mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-24 11:05:02 +08:00
Compare commits
245 Commits
Bug_9545
...
add_libblo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08dbacb62a | ||
|
|
71ea7517a7 | ||
|
|
306aabe4ea | ||
|
|
21b15495da | ||
|
|
96c2a4885a | ||
|
|
6e992b3a8b | ||
|
|
4d17441d44 | ||
|
|
41f83bb782 | ||
|
|
80fbdf2afe | ||
|
|
a0477ff19d | ||
|
|
73e6a19070 | ||
|
|
1811f4e42f | ||
|
|
177d4b43b2 | ||
|
|
c86a387a17 | ||
|
|
c8c1bb2a47 | ||
|
|
45f4468736 | ||
|
|
43fe6e522b | ||
|
|
b731667227 | ||
|
|
302a93121a | ||
|
|
212872b353 | ||
|
|
1d894d390b | ||
|
|
9b3611b287 | ||
|
|
de8c4dbc02 | ||
|
|
e8c3370f35 | ||
|
|
c37809e629 | ||
|
|
376b69eef1 | ||
|
|
92cde1ab5f | ||
|
|
f722c70859 | ||
|
|
ed1194be9d | ||
|
|
ef0c49d853 | ||
|
|
44ad141311 | ||
|
|
28e8fda73b | ||
|
|
44c6d5e7e6 | ||
|
|
6a8734ad4f | ||
|
|
91cd49c655 | ||
|
|
cb7256eba9 | ||
|
|
82fe2012eb | ||
|
|
26d9c43c7a | ||
|
|
a88061f8bf | ||
|
|
a92372c236 | ||
|
|
f4a33e75bd | ||
|
|
7c8b92e588 | ||
|
|
cd29e81357 | ||
|
|
da85372764 | ||
|
|
5b7a4d13ca | ||
|
|
86a553c697 | ||
|
|
769d814a6a | ||
|
|
51b076831a | ||
|
|
316a861269 | ||
|
|
d88eb8054b | ||
|
|
7d3387b095 | ||
|
|
f3059ca516 | ||
|
|
ae94f3390f | ||
|
|
5b3ad47604 | ||
|
|
e5bda20934 | ||
|
|
a6bde81c24 | ||
|
|
d1f74be5d5 | ||
|
|
8f3a5ca899 | ||
|
|
e5826116c1 | ||
|
|
a3bbe22c4d | ||
|
|
d850fa30bc | ||
|
|
ae9aa435db | ||
|
|
5ab73e5ff8 | ||
|
|
663afa1332 | ||
|
|
d343d53c36 | ||
|
|
c22193831e | ||
|
|
ac99059cd1 | ||
|
|
ecf1e6780f | ||
|
|
c3cdc2e859 | ||
|
|
b5e675774e | ||
|
|
5f116f84a2 | ||
|
|
e16f723dd0 | ||
|
|
c392ca42b9 | ||
|
|
3b5f77d70d | ||
|
|
5a44065b48 | ||
|
|
3c030ea40d | ||
|
|
00d9c04d22 | ||
|
|
7502a9418d | ||
|
|
ecbf78e517 | ||
|
|
024e9d6291 | ||
|
|
d7f607aaa4 | ||
|
|
bd5b448d38 | ||
|
|
10ee5827b9 | ||
|
|
bc0e86f2de | ||
|
|
6584bcb6d5 | ||
|
|
adc3dee346 | ||
|
|
8f3027c10a | ||
|
|
7f542aef0c | ||
|
|
bb213672f7 | ||
|
|
c0bdd69f42 | ||
|
|
05d96f2adf | ||
|
|
702f18b133 | ||
|
|
ffb2ca218f | ||
|
|
cdcc69a881 | ||
|
|
cdcafdb724 | ||
|
|
ec7175267e | ||
|
|
64d58681ea | ||
|
|
7355dcb205 | ||
|
|
82afbb191c | ||
|
|
62d586fc60 | ||
|
|
227a65b4c3 | ||
|
|
9e28ed1733 | ||
|
|
95471502d7 | ||
|
|
b00207e894 | ||
|
|
e508592575 | ||
|
|
d911030e19 | ||
|
|
b69a074909 | ||
|
|
5639e84185 | ||
|
|
406de53d91 | ||
|
|
6c6abcd25a | ||
|
|
32ea5ee333 | ||
|
|
4f8e7d9899 | ||
|
|
331441e450 | ||
|
|
1ab88ddc70 | ||
|
|
57733d7f69 | ||
|
|
f99105089a | ||
|
|
649d57c9d3 | ||
|
|
2e61d61460 | ||
|
|
f92d060e06 | ||
|
|
242948948b | ||
|
|
ddd2f3a7da | ||
|
|
aa7ac703b4 | ||
|
|
f91fdd322e | ||
|
|
e39818e9d1 | ||
|
|
e62f24cc8e | ||
|
|
dc20f7f5f0 | ||
|
|
f6fa3f1a0b | ||
|
|
60ae096737 | ||
|
|
fc0ad5ba69 | ||
|
|
8ae1aa6d8c | ||
|
|
0e774b253c | ||
|
|
a853005c4d | ||
|
|
19b0491590 | ||
|
|
dd153fb261 | ||
|
|
87ef9d3f67 | ||
|
|
fb24ea7fef | ||
|
|
fd5b6a249b | ||
|
|
287db84d6d | ||
|
|
6c59af0c91 | ||
|
|
8072d96785 | ||
|
|
7a552e7faf | ||
|
|
21bef13eff | ||
|
|
379d09248d | ||
|
|
31e356de22 | ||
|
|
58afb75fd5 | ||
|
|
f6cf333457 | ||
|
|
5e71c0b886 | ||
|
|
7fb146dea4 | ||
|
|
669c87149f | ||
|
|
9c2a82ea90 | ||
|
|
1e74f24e1c | ||
|
|
e82b011f20 | ||
|
|
09211031ac | ||
|
|
7a877b0c45 | ||
|
|
814e17842f | ||
|
|
5340619a96 | ||
|
|
9e65220253 | ||
|
|
3cd58f18cc | ||
|
|
36a51d0a77 | ||
|
|
52ae39fa32 | ||
|
|
139c5a7d6e | ||
|
|
28fa1ed6f9 | ||
|
|
116b9c4e70 | ||
|
|
e728729917 | ||
|
|
ed1c6c4cbb | ||
|
|
84f10fa947 | ||
|
|
6c2439841d | ||
|
|
428071241f | ||
|
|
8c651abc6d | ||
|
|
5a1a0af706 | ||
|
|
a79b121895 | ||
|
|
f859973f32 | ||
|
|
a9706e0d73 | ||
|
|
9953e9ee9b | ||
|
|
0b680a8f67 | ||
|
|
ef3e1681f9 | ||
|
|
e28995fa4e | ||
|
|
aee1acab41 | ||
|
|
0c7aa209b5 | ||
|
|
827d2768d6 | ||
|
|
60e4467f88 | ||
|
|
81950e5334 | ||
|
|
d8c7ebb2d6 | ||
|
|
5de90c7a9c | ||
|
|
5d7e5772a8 | ||
|
|
0f886bbdf1 | ||
|
|
2275c00b9f | ||
|
|
00c6f60f2e | ||
|
|
6fd65dddc8 | ||
|
|
4c7577bf1c | ||
|
|
d162e82d20 | ||
|
|
49f95c3d05 | ||
|
|
f361dbd5e7 | ||
|
|
bce4779702 | ||
|
|
a715e0a659 | ||
|
|
f288578904 | ||
|
|
1231fc226c | ||
|
|
1d189552b2 | ||
|
|
ce4d398492 | ||
|
|
b553bc34bf | ||
|
|
ddb3e69af8 | ||
|
|
fc6a687322 | ||
|
|
d7c553457c | ||
|
|
2a82271322 | ||
|
|
a2b454ccb6 | ||
|
|
cb17e5b375 | ||
|
|
c54cb80862 | ||
|
|
bf1d366ce7 | ||
|
|
346319892c | ||
|
|
060a1ccfbb | ||
|
|
74a8169050 | ||
|
|
15bb04abd1 | ||
|
|
51b2ffd607 | ||
|
|
091c4b81f9 | ||
|
|
c68554a42c | ||
|
|
10de78cd1a | ||
|
|
6bd995e445 | ||
|
|
087e0e3750 | ||
|
|
c3f5c269aa | ||
|
|
4ef1ac4703 | ||
|
|
b9c58a99a5 | ||
|
|
4bec432070 | ||
|
|
e2556a0f3d | ||
|
|
f265b9fe7b | ||
|
|
c2bf977fb6 | ||
|
|
44030e710a | ||
|
|
e0028e8079 | ||
|
|
9c14d21609 | ||
|
|
d690e1a7a5 | ||
|
|
bfacccba18 | ||
|
|
8b93d6ce3a | ||
|
|
69d12b567d | ||
|
|
4fbede4cb2 | ||
|
|
e758208a17 | ||
|
|
a5f04ddb5f | ||
|
|
48913ed4bf | ||
|
|
a8e8d4b109 | ||
|
|
3a968d1914 | ||
|
|
58f4ad8e5a | ||
|
|
549d681fab | ||
|
|
5313770972 | ||
|
|
9046c71d00 | ||
|
|
87a71c7389 | ||
|
|
834bab34ab | ||
|
|
a04593f02d |
@@ -18,6 +18,10 @@ config BBF_TR143
|
||||
bool "Enable TR-143 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBF_TR471
|
||||
bool "Enable TR-471 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBFDM_ENABLE_JSON_PLUGIN
|
||||
bool "Enable json plugin to extend datamodel"
|
||||
default y
|
||||
|
||||
18
bbf/Makefile
18
bbf/Makefile
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=6.8.16
|
||||
PKG_VERSION:=6.8.49
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_VERSION:=0ef6169d86333b8727ed34c63f379b08254340e3
|
||||
PKG_SOURCE_VERSION:=87ae46df8b4e221b8894fd861d2eb785ae1f3bf3
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -34,7 +34,8 @@ define Package/libbbfdm/default
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Library for broadband forum data model support
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl +libbbf_api
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl +libbbf_api \
|
||||
+BBF_TR471:obudpst
|
||||
endef
|
||||
|
||||
define Package/libbbfdm
|
||||
@@ -110,6 +111,11 @@ CMAKE_OPTIONS += \
|
||||
-DBBF_TR143=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR471),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR471=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_EXTENSION=ON
|
||||
@@ -155,13 +161,11 @@ define Package/libbbfdm/default/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
|
||||
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||
ifeq ($(CONFIG_PACKAGE_mosquitto-ssl),y)
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-mosquitto-config $(1)/etc/uci-defaults/
|
||||
endif
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default/prerm
|
||||
|
||||
@@ -15,15 +15,13 @@ if [ ! -f "/etc/config/userinterface" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
function exec_cmd()
|
||||
{
|
||||
if ! $@; then
|
||||
log "Failed to run [$@]"
|
||||
exec_cmd() {
|
||||
if ! "$@"; then
|
||||
log "Failed to run [$*]"
|
||||
fi
|
||||
}
|
||||
|
||||
function configure_firewall_rule()
|
||||
{
|
||||
configure_firewall_rule() {
|
||||
local enable port protocol gui_port
|
||||
local zone interface
|
||||
|
||||
@@ -32,25 +30,24 @@ function configure_firewall_rule()
|
||||
config_get port remote_access port
|
||||
config_get interface remote_access interface
|
||||
|
||||
if [ "${enable}" -eq "0" -o -z "${port}" -o -z "${interface}" ]; then
|
||||
if [ "${enable}" -eq "0" ] || [ -z "${port}" ] || [ -z "${interface}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_input"
|
||||
iptables -w 1 -t filter -nL ${zone} 2>/dev/null 1>&2
|
||||
iptables -w 1 -t filter -nL "${zone}" 2>/dev/null 1>&2
|
||||
if [ "$?" -eq 0 ]; then
|
||||
iptables -w 1 -I ${zone} -p tcp -m multiport --dports ${port} -m conntrack --ctstate NEW,ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
|
||||
iptables -w 1 -I "${zone}" -p tcp -m multiport --dports "${port}" -m conntrack --ctstate NEW,ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_output"
|
||||
iptables -w 1 -t filter -nL ${zone} 2>/dev/null 1>&2
|
||||
iptables -w 1 -t filter -nL "${zone}" 2>/dev/null 1>&2
|
||||
if [ "$?" -eq 0 ]; then
|
||||
iptables -w 1 -I ${zone} -p tcp -m multiport --dports ${port} -m conntrack --ctstate ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
|
||||
iptables -w 1 -I "${zone}" -p tcp -m multiport --dports "${port}" -m conntrack --ctstate ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
|
||||
fi
|
||||
}
|
||||
|
||||
function delete_firewall_rule()
|
||||
{
|
||||
delete_firewall_rule() {
|
||||
local zone interface
|
||||
local CMD
|
||||
|
||||
@@ -63,20 +60,20 @@ function delete_firewall_rule()
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_input"
|
||||
CMD="iptables -w 1 -t filter -L ${zone} --line-numbers"
|
||||
CMD="iptables -w 1 -t filter -nL ${zone} --line-numbers"
|
||||
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
|
||||
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
|
||||
if [ -n "${rule_num}" ]; then
|
||||
exec_cmd iptables -w 1 -t filter -D ${zone} ${rule_num};
|
||||
exec_cmd iptables -w 1 -t filter -D "${zone}" "${rule_num}";
|
||||
fi
|
||||
done
|
||||
|
||||
zone="zone_${interface}_output"
|
||||
CMD="iptables -w 1 -t filter -L ${zone} --line-numbers"
|
||||
CMD="iptables -w 1 -t filter -nL ${zone} --line-numbers"
|
||||
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
|
||||
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
|
||||
if [ -n "${rule_num}" ]; then
|
||||
exec_cmd iptables -w 1 -t filter -D ${zone} ${rule_num};
|
||||
exec_cmd iptables -w 1 -t filter -D "${zone}" "${rule_num}";
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
config_mosquitto_owrt() {
|
||||
sec=$(uci -q get mosquitto.owrt)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto owrt)
|
||||
uci -q rename mosquitto."${sec}"="owrt"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.owrt.use_uci="1"
|
||||
uci -q set mosquitto.owrt.write_pid="1"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
config_mosquitto_general() {
|
||||
sec=$(uci -q get mosquitto.mosquitto)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto mosquitto)
|
||||
uci -q rename mosquitto."${sec}"="mosquitto"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.mosquitto.log_dest="syslog"
|
||||
uci -q set mosquitto.mosquitto.log_facility="5"
|
||||
uci -q set mosquitto.mosquitto.log_timestamp="1"
|
||||
uci -q set mosquitto.mosquitto.log_types="error warning notice"
|
||||
uci -q set mosquitto.mosquitto.per_listener_settings="1"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
config_mosquitto_persistence() {
|
||||
sec=$(uci -q get mosquitto.persistence)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto persistence)
|
||||
uci -q rename mosquitto."${sec}"="persistence"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.persistence.persistence="0"
|
||||
uci -q set mosquitto.persistence.location="/var/run"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
if [ -f "/etc/config/mosquitto" ]; then
|
||||
config_mosquitto_owrt
|
||||
config_mosquitto_general
|
||||
config_mosquitto_persistence
|
||||
fi
|
||||
1
bbf/files/lib/upgrade/keep.d/bbf
Normal file
1
bbf/files/lib/upgrade/keep.d/bbf
Normal file
@@ -0,0 +1 @@
|
||||
/etc/bbfdm/sysctl.conf
|
||||
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulkdata
|
||||
PKG_VERSION:=2.0.9
|
||||
PKG_VERSION:=2.0.10
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
|
||||
@@ -16,8 +16,8 @@ get_next_count()
|
||||
fi
|
||||
|
||||
while [ "${found}" -ne 1 ]; do
|
||||
uci -q get ${config}.${default_name}_${count} >/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
uci -q get "${config}"."${default_name}"_${count} >/dev/null
|
||||
if [ "$?" -eq 0 ]; then
|
||||
count=$((count + 1))
|
||||
else
|
||||
found=1;
|
||||
@@ -39,8 +39,8 @@ translate_profile_id_to_profile_name() {
|
||||
|
||||
[ "${curr_profile_id}" != "${profile_id}" ] && return
|
||||
|
||||
uci -q set bulkdata.${section}.profile_name="${profile_name}"
|
||||
uci -q set bulkdata.${section}.profile_id=""
|
||||
uci -q set bulkdata."${section}".profile_name="${profile_name}"
|
||||
uci -q set bulkdata."${section}".profile_id=""
|
||||
}
|
||||
|
||||
update_profile_sections() {
|
||||
@@ -54,7 +54,7 @@ update_profile_sections() {
|
||||
|
||||
case "${section}" in
|
||||
"cfg"*)
|
||||
profile_name="$(get_next_count bulkdata ${default} ${PROFILE_COUNT})"
|
||||
profile_name="$(get_next_count bulkdata "${default}" ${PROFILE_COUNT})"
|
||||
uci_rename bulkdata "${section}" "${profile_name}"
|
||||
;;
|
||||
esac
|
||||
@@ -62,7 +62,7 @@ update_profile_sections() {
|
||||
|
||||
[ -n "$profile_name" ] && section="${profile_name}"
|
||||
|
||||
uci -q set bulkdata.${section}.profile_id=""
|
||||
uci -q set bulkdata."${section}".profile_id=""
|
||||
|
||||
config_foreach translate_profile_id_to_profile_name profile_parameter "${profile_id}" "${profile_name}"
|
||||
config_foreach translate_profile_id_to_profile_name profile_http_request_uri_parameter "${profile_id}" "${profile_name}"
|
||||
|
||||
@@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.5.6
|
||||
PKG_VERSION:=3.5.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=81450033d98fcdb68911e2148f48d190492090a6
|
||||
PKG_SOURCE_VERSION:=83f89a83cf860bbcf2b7f2e030215db315a5bbbf
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# libeasy configuration
|
||||
|
||||
config LIBWIFI_USE_CTRL_IFACE
|
||||
bool "Use UNIX sockets"
|
||||
default n
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=7.2.3
|
||||
PKG_VERSION:=7.2.26
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=c277f89b0791664b7d417a4de34a156fc0aa8ee0
|
||||
PKG_SOURCE_VERSION:=350793b45873480d8981dac540c4145705a7b7ba
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
@@ -43,10 +43,6 @@ ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_MAC80211
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_x86),y)
|
||||
TARGET_PLATFORM=TEST
|
||||
TARGET_WIFI_TYPE=TEST
|
||||
@@ -57,12 +53,16 @@ else ifeq ($(CONFIG_TARGET_iopsys_armvirt),y)
|
||||
TARGET_CFLAGS +=-DIOPSYS_TEST
|
||||
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_PLATFORM=ECONET
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_WIFI_TYPE=MEDIATEK MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_ECONET
|
||||
else ifeq ($(CONFIG_TARGET_ipq95xx),y)
|
||||
TARGET_PLATFORM=IPQ95XX
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_CFLAGS +=-DIPQ95XX
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_mediatek),y)
|
||||
TARGET_PLATFORM=LINUX
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_LINUX
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET, use default MAC80211)
|
||||
TARGET_PLATFORM=MAC80211
|
||||
@@ -70,18 +70,29 @@ else
|
||||
TARGET_CFLAGS +=-DIOPSYS_MAC80211
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
export TARGET_WIFI_TYPE
|
||||
|
||||
subdirs := \
|
||||
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
|
||||
$(if $(CONFIG_PACKAGE_libwifiutils),libwifi) \
|
||||
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
|
||||
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
|
||||
$(if $(CONFIG_PACKAGE_libethernet),libethernet) \
|
||||
$(if $(CONFIG_PACKAGE_libqos),libqos)
|
||||
|
||||
EASY_SOC_LIBS := \
|
||||
ifneq ($(CONFIG_PACKAGE_libwifi),)
|
||||
TARGET_CFLAGS +=-DHAS_WIFI
|
||||
endif
|
||||
|
||||
esl-pkgs := \
|
||||
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
|
||||
$(if $(CONFIG_PACKAGE_libwifiutils),libwifiutils) \
|
||||
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
|
||||
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
|
||||
$(if $(CONFIG_PACKAGE_libethernet),libethernet) \
|
||||
$(if $(CONFIG_PACKAGE_libqos),libqos)
|
||||
|
||||
esl-pkgs-all := \
|
||||
libeasy \
|
||||
libwifiutils \
|
||||
libwifi \
|
||||
libdsl \
|
||||
libethernet \
|
||||
@@ -131,15 +142,15 @@ define Build/Compile
|
||||
$(Build/Compile/rebuild)
|
||||
touch $(PKG_BUILD_DIR)/.config_$(CONFIG_TARGET_PROFILE)
|
||||
$(call Build/Compile/Default)
|
||||
$(foreach dir,$(subdirs),$(call Build/Compile/$(dir)))
|
||||
$(foreach dir,$(esl-pkgs),$(call Build/Compile/$(dir)))
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(foreach dir,$(subdirs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
||||
$(foreach dir,$(esl-pkgs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
||||
endef
|
||||
|
||||
define Package/easy-soc-libs/install
|
||||
:
|
||||
endef
|
||||
|
||||
$(eval $(foreach e,$(EASY_SOC_LIBS),$(call BuildPackage,$(e))))
|
||||
$(eval $(foreach e,$(esl-pkgs-all),$(call BuildPackage,$(e))))
|
||||
|
||||
@@ -6,10 +6,6 @@ define Package/libeasy
|
||||
DEPENDS+=+libnl +libnl-route
|
||||
endef
|
||||
|
||||
define Package/libeasy/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libeasy
|
||||
$(INSTALL_DIR) $(1)/usr/include/easy
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
define Package/libethernet
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= Ethernet library (libethernet)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_ramips:swconfig +TARGET_airoha:ecnt_api
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_airoha:ecnt_api
|
||||
endef
|
||||
|
||||
define Package/libethernet/config
|
||||
|
||||
@@ -1,32 +1,53 @@
|
||||
|
||||
define Package/libwifi
|
||||
define Package/libwifiutils
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= WiFi library (libwifi)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_brcmbca:bcmkernel
|
||||
TITLE:= WiFi utility library (libwifiutils.so)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy
|
||||
endef
|
||||
|
||||
define Package/libwifi/config
|
||||
if PACKAGE_libdsl
|
||||
config LIBWIFI_DEBUG
|
||||
depends on PACKAGE_libwifi
|
||||
bool "Enable wifi debugging"
|
||||
default n
|
||||
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libwifi
|
||||
define Build/InstallDev/libwifiutils
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifidefs.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifiutils.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifiutils*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libwifiutils/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifiutils*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/libwifi
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= WiFi library (libwifi)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +libwifiutils +TARGET_brcmbca:bcmkernel
|
||||
endef
|
||||
|
||||
define Package/libwifi/config
|
||||
if PACKAGE_libwifi
|
||||
config LIBWIFI_DEBUG
|
||||
depends on PACKAGE_libwifi
|
||||
bool "Enable debugging in libwifi"
|
||||
default n
|
||||
|
||||
config LIBWIFI_USE_CTRL_IFACE
|
||||
bool "Create UNIX sockets to interface with hostapd/wpa_supplicant"
|
||||
default n
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
define Build/InstallDev/libwifi
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifiops.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifi.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi-7*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libwifi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi-7*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ PKG_BUILD_PARALLEL:=1
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
export CONFIG_BRCM_SDK_VER_504040
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -23,7 +23,7 @@ define Package/ethmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Ethernet status and configration utility
|
||||
DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx):libethernet +libuci +libubox +ubus +libpthread +libnl-genl
|
||||
DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx||TARGET_iopsys_mediatek):libethernet +libuci +libubox +ubus +libpthread +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/ethmngr/description
|
||||
@@ -37,7 +37,7 @@ TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx),)
|
||||
ifeq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_iopsys_mediatek),)
|
||||
define Build/Compile
|
||||
endef
|
||||
endif
|
||||
@@ -51,7 +51,7 @@ else ifneq ($(CONFIG_TARGET_airoha),)
|
||||
else
|
||||
$(CP) ./files/linux/* $(1)/
|
||||
endif
|
||||
ifneq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx),)
|
||||
ifneq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_iopsys_mediatek),)
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethmngr $(1)/usr/sbin/
|
||||
endif
|
||||
|
||||
@@ -24,7 +24,7 @@ get_max_port_speed() {
|
||||
# arg1: port name, ex: eth0
|
||||
get_port_number() {
|
||||
[ -z "$1" ] && return
|
||||
local ports="0 1 2 3 4 5 6 7"
|
||||
local ports="0 1 2 3 4 5 6 7 8"
|
||||
local units="0 1"
|
||||
local port="$1"
|
||||
local ifname
|
||||
|
||||
@@ -220,7 +220,6 @@ static int canyon_led_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(leds->clock_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire clock GPIO %ld\n",
|
||||
PTR_ERR(leds->clock_gpio));
|
||||
leds->clock_gpio = NULL;
|
||||
return PTR_ERR(leds->clock_gpio);
|
||||
}
|
||||
|
||||
@@ -228,7 +227,6 @@ static int canyon_led_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(leds->clock_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire clock GPIO %ld\n",
|
||||
PTR_ERR(leds->clock_gpio));
|
||||
leds->clock_gpio = NULL;
|
||||
return PTR_ERR(leds->clock_gpio);
|
||||
} else {
|
||||
printk(KERN_INFO "Got clock gpio\n");
|
||||
@@ -246,7 +244,6 @@ static int canyon_led_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(leds->data_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire data GPIO %ld\n",
|
||||
PTR_ERR(leds->data_gpio));
|
||||
leds->data_gpio = NULL;
|
||||
return PTR_ERR(leds->data_gpio);
|
||||
}
|
||||
|
||||
@@ -254,7 +251,6 @@ static int canyon_led_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(leds->data_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire data GPIO %ld\n",
|
||||
PTR_ERR(leds->data_gpio));
|
||||
leds->data_gpio = NULL;
|
||||
return PTR_ERR(leds->data_gpio);
|
||||
} else {
|
||||
printk(KERN_INFO "Got data gpio\n");
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.1.5
|
||||
PKG_VERSION:=9.1.19
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
PKG_SOURCE_VERSION:=79284d1f4e16cf6077a7394f0c04a894b83a8a41
|
||||
PKG_SOURCE_VERSION:=9d8389cda16f410826920bb27fd8af4d28c79de9
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -29,7 +29,7 @@ define Package/icwmp/default
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=TR069 CWMP client
|
||||
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml +libuuid
|
||||
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml +libuuid +libbbf_api
|
||||
endef
|
||||
|
||||
define Package/icwmp-openssl
|
||||
@@ -84,6 +84,8 @@ define Package/icwmp/default/install
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libcwmpdm.so $(1)/usr/lib/bbfdm/libcwmpdm.so
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
|
||||
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
|
||||
$(INSTALL_BIN) ./files/etc/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||
|
||||
@@ -38,6 +38,7 @@ config cpe 'cpe'
|
||||
option periodic_notify_enable '1'
|
||||
option periodic_notify_interval '10'
|
||||
option incoming_rule 'Port_Only'
|
||||
option active_notif_throttle '0'
|
||||
|
||||
config lwn 'lwn'
|
||||
option enable '1'
|
||||
|
||||
@@ -20,13 +20,13 @@ if [ -z "${zone_name}" ]; then
|
||||
exit 0
|
||||
elif [ "$zone_name" = "icwmp" ]; then
|
||||
iptables -nL zone_icwmp_input 2> /dev/null
|
||||
if [ $? != 0 ]; then
|
||||
if [ "$?" != 0 ]; then
|
||||
iptables -w 1 -N zone_icwmp_input
|
||||
iptables -w 1 -t filter -A INPUT -j zone_icwmp_input
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport $port -j REJECT
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport "${port}" -j REJECT
|
||||
else
|
||||
iptables -w 1 -F zone_icwmp_input
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport $port -j REJECT
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport "${port}" -j REJECT
|
||||
fi
|
||||
else
|
||||
iptables -w 1 -F zone_icwmp_input 2> /dev/null
|
||||
@@ -64,13 +64,13 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ${cmd}|grep -q "\-\-dport \|\-s "
|
||||
echo "${cmd}"|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -eq 0 ]; then
|
||||
cmd="${cmd} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
${cmd}
|
||||
fi
|
||||
|
||||
echo ${cmd6}|grep -q "\-\-dport \|\-s "
|
||||
echo "${cmd6}"|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -eq 0 ]; then
|
||||
cmd6="${cmd6} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
${cmd6}
|
||||
|
||||
@@ -16,7 +16,7 @@ handle_icwmp_update() {
|
||||
|
||||
ret=$(ubus call service list '{"name":"icwmpd"}' | jsonfilter -qe '@.icwmpd.instances.icwmp.running')
|
||||
|
||||
if [ "$ret" == "true" ]; then
|
||||
if [ "$ret" = "true" ]; then
|
||||
# read status from var/state/cwmp
|
||||
status=$(uci -q -c /var/state get cwmp.sess_status.current_status)
|
||||
if [ "$status" != "running" ]; then
|
||||
@@ -29,4 +29,4 @@ handle_icwmp_update() {
|
||||
fi
|
||||
}
|
||||
|
||||
handle_icwmp_update $@
|
||||
handle_icwmp_update "$@"
|
||||
|
||||
@@ -23,22 +23,22 @@ regenerate_ssl_link()
|
||||
[ ! -d "${cert_dir}" ] && return 0;
|
||||
|
||||
### Generate all ssl link for pem certicates ###
|
||||
all_file=$(ls $cert_dir/*.pem 2>/dev/null)
|
||||
all_file=$(ls "${cert_dir}"/*.pem 2>/dev/null)
|
||||
if [ -n "${all_file}" ]; then
|
||||
for cfile in $all_file; do
|
||||
rehash="$(openssl x509 -hash -noout -in $cfile)"
|
||||
[ -f ${cert_dir}/${rehash}.0 ] || \
|
||||
ln -s $cfile $cert_dir/${rehash}.0
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
[ -f "${cert_dir}"/"${rehash}".0 ] || \
|
||||
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
|
||||
done
|
||||
fi
|
||||
|
||||
### Generate all ssl link for crt certicates ###
|
||||
all_file=$(ls $cert_dir/*.crt 2>/dev/null)
|
||||
all_file=$(ls "${cert_dir}"/*.crt 2>/dev/null)
|
||||
if [ -n "${all_file}" ]; then
|
||||
for cfile in $all_file; do
|
||||
rehash="$(openssl x509 -hash -noout -in $cfile)"
|
||||
[ -f ${cert_dir}/${rehash}.0 ] || \
|
||||
ln -s $cfile $cert_dir/${rehash}.0
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
[ -f "${cert_dir}"/"${rehash}".0 ] || \
|
||||
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
|
||||
done
|
||||
fi
|
||||
}
|
||||
@@ -47,8 +47,8 @@ enable_dhcp_option43() {
|
||||
local wan="${1}"
|
||||
|
||||
### Ask for DHCP Option 43 only if CWMP is enabled ###
|
||||
local reqopts="$(uci -q get network.$wan.reqopts)"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
local reqopts="$(uci -q get network."${wan}".reqopts)"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
local newreqopts=""
|
||||
local option43_present=0
|
||||
|
||||
@@ -64,8 +64,8 @@ enable_dhcp_option43() {
|
||||
fi
|
||||
|
||||
newreqopts="$reqopts 43"
|
||||
if [ "${proto}" == "dhcp" ]; then
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
fi
|
||||
@@ -122,12 +122,12 @@ configure_send_op125() {
|
||||
serial_len=$(echo -n "${serial}" | wc -m)
|
||||
class_len=$(echo -n "${class}" | wc -m)
|
||||
|
||||
if [ ${oui_len} -eq 0 ] || [ ${serial_len} -eq 0 ]; then
|
||||
if [ "${oui_len}" -eq 0 ] || [ "${serial_len}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
opt125_len=$((oui_len + serial_len + class_len))
|
||||
if [ ${class_len} -gt 0 ]; then
|
||||
if [ "${class_len}" -gt 0 ]; then
|
||||
opt125_len=$((opt125_len + 6))
|
||||
else
|
||||
opt125_len=$((opt125_len + 4))
|
||||
@@ -159,7 +159,7 @@ configure_send_op125() {
|
||||
opt125="${opt125}:05:${hex_serial_len}${hex_serial}"
|
||||
fi
|
||||
|
||||
if [ ${class_len} -gt 0 ]; then
|
||||
if [ "${class_len}" -gt 0 ]; then
|
||||
hex_class=$(convert_to_hex "${class}")
|
||||
if [ -z "${hex_class}" ]; then
|
||||
return 0
|
||||
@@ -176,9 +176,9 @@ configure_send_op125() {
|
||||
|
||||
if [ "${uci}" = "network" ]; then
|
||||
new_send_opt="$sendopt $opt125"
|
||||
uci -q set network.$intf.sendopts="$new_send_opt"
|
||||
uci -q set network."${intf}".sendopts="$new_send_opt"
|
||||
else
|
||||
uci -q add_list dhcp.$intf.dhcp_option="$opt125"
|
||||
uci -q add_list dhcp."${intf}".dhcp_option="$opt125"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -187,9 +187,9 @@ enable_dnsmasq_option125() {
|
||||
local send125_present=0
|
||||
local opt125="125,"
|
||||
|
||||
local proto="$(uci -q get dhcp.$lan.dhcpv4)"
|
||||
local proto="$(uci -q get dhcp."${lan}".dhcpv4)"
|
||||
if [ "${proto}" = "server" ]; then
|
||||
opt_list="$(uci -q get dhcp.$lan.dhcp_option)"
|
||||
opt_list="$(uci -q get dhcp."${lan}".dhcp_option)"
|
||||
|
||||
for sopt in $opt_list; do
|
||||
if [[ "$sopt" == "$opt125"* ]]; then
|
||||
@@ -205,13 +205,27 @@ enable_dnsmasq_option125() {
|
||||
fi
|
||||
}
|
||||
|
||||
enable_disable_dhcp_option125() {
|
||||
set_vendor_id() {
|
||||
local wan="${1}"
|
||||
local action="${2}"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
|
||||
local reqopts="$(uci -q get network.$wan.reqopts)"
|
||||
local sendopts="$(uci -q get network.$wan.sendopts)"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
vendorid="$(uci -q get network."${wan}".vendorid)"
|
||||
if [ -z "${vendorid}" ]; then
|
||||
uci -q set network."${wan}".vendorid="dslforum.org"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
elif [[ $vendorid != *"dslforum.org"* ]]; then
|
||||
uci -q set network."${wan}".vendorid="${vendorid},dslforum.org"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
enable_dhcp_option125() {
|
||||
local wan="${1}"
|
||||
local reqopts="$(uci -q get network."${wan}".reqopts)"
|
||||
local sendopts="$(uci -q get network."${wan}".sendopts)"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
local newreqopts=""
|
||||
local newsendopts=""
|
||||
local req125_present=0
|
||||
@@ -233,35 +247,16 @@ enable_disable_dhcp_option125() {
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${proto}" == "dhcp" ]; then
|
||||
if [ "${action}" == "enable" ]; then
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
|
||||
if [ ${send125_present} -eq 0 ]; then
|
||||
configure_send_op125 "${sendopts}" "${wan}" "network"
|
||||
network_uci_update=1
|
||||
fi
|
||||
else
|
||||
if [ ${req125_present} -eq 1 ]; then
|
||||
newreqopts=$(echo ${reqopts/125/})
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
|
||||
if [ ${send125_present} -eq 1 ]; then
|
||||
for sopt in $sendopts; do
|
||||
if [[ "$sopt" == "$opt125"* ]]; then
|
||||
newsendopts=$(echo ${sendopts/"${sopt}"/})
|
||||
uci -q set network.$wan.sendopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ ${send125_present} -eq 0 ]; then
|
||||
configure_send_op125 "${sendopts}" "${wan}" "network"
|
||||
network_uci_update=1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -288,13 +283,6 @@ wait_for_resolvfile() {
|
||||
copy_cwmp_etc_files_to_varstate() {
|
||||
mkdir -p /var/run/icwmpd
|
||||
|
||||
if [ -f /etc/icwmpd/cwmp ]; then
|
||||
uci -q -c /etc/icwmpd delete cwmp.acs
|
||||
uci -q -c /etc/icwmpd delete cwmp.gatewayinfo
|
||||
uci -q -c /etc/icwmpd commit cwmp
|
||||
cat /etc/icwmpd/cwmp >> /var/state/cwmp
|
||||
fi
|
||||
|
||||
if [ -f /etc/icwmpd/icwmpd_backup_session.xml ]; then
|
||||
cp -f /etc/icwmpd/icwmpd_backup_session.xml /var/run/icwmpd/ 2>/dev/null
|
||||
fi
|
||||
@@ -313,12 +301,6 @@ copy_cwmp_varstate_files_to_etc() {
|
||||
cp -f /var/run/icwmpd/dm_enabled_notify /etc/icwmpd/ 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -f /var/state/cwmp ]; then
|
||||
uci -q -c /var/state delete cwmp.sess_status
|
||||
uci -q -c /var/state commit cwmp
|
||||
cp -f /var/state/cwmp /etc/icwmpd/
|
||||
fi
|
||||
|
||||
# move the successful custom notify import marker to persistent storage
|
||||
if [ -f /var/run/icwmpd/icwmpd_notify_import_marker ]; then
|
||||
cp -f /var/run/icwmpd/icwmpd_notify_import_marker /etc/icwmpd/
|
||||
@@ -395,25 +377,30 @@ validate_defaults() {
|
||||
}
|
||||
|
||||
boot() {
|
||||
local enable_cwmp="0"
|
||||
local dhcp_discovery="0"
|
||||
|
||||
config_load cwmp
|
||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
config_get_bool enable_cwmp cpe enable 1
|
||||
if [ "$enable_cwmp" = "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
config_get wan_interface cpe default_wan_interface "wan"
|
||||
if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then
|
||||
|
||||
if [ "${dhcp_discovery}" = "enable" ] || [ "${dhcp_discovery}" = "1" ]; then
|
||||
# Set dhcp option 43 if not already configured
|
||||
enable_dhcp_option43 "${wan_interface}"
|
||||
# Set dhcp option 60
|
||||
set_vendor_id "${wan_interface}"
|
||||
fi
|
||||
|
||||
config_get lan_interface cpe default_lan_interface ""
|
||||
if [ -n "${lan_interface}" ]; then
|
||||
# Set dhcp_option 125 if not already configured
|
||||
enable_disable_dhcp_option125 "${wan_interface}" "enable"
|
||||
enable_dhcp_option125 "${wan_interface}"
|
||||
enable_dnsmasq_option125 "${lan_interface}"
|
||||
else
|
||||
# Remove dhcp option 125 if exists
|
||||
enable_disable_dhcp_option125 "${wan_interface}" "disable"
|
||||
fi
|
||||
|
||||
config_get ssl_capath acs ssl_capath
|
||||
@@ -422,8 +409,10 @@ boot() {
|
||||
regenerate_ssl_link "${ssl_capath}"
|
||||
fi
|
||||
|
||||
# Copy backup data so that if it restart latter on it gets the info
|
||||
# Copy backup data so that if it restart latter on, it gets the info
|
||||
copy_cwmp_etc_files_to_varstate
|
||||
mkdir -p /var/run/icwmpd/
|
||||
touch /var/run/icwmpd/cwmp
|
||||
|
||||
start
|
||||
}
|
||||
@@ -458,11 +447,6 @@ start_service() {
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_stopped()
|
||||
{
|
||||
copy_cwmp_varstate_files_to_etc
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
copy_cwmp_varstate_files_to_etc
|
||||
@@ -488,7 +472,7 @@ reload_service() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
status="$(echo $tr069_status | jsonfilter -qe '@.cwmp.status')"
|
||||
status="$(echo "${tr069_status}" | jsonfilter -qe '@.cwmp.status')"
|
||||
ret="$?"
|
||||
if [ "$status" = "up" ]; then
|
||||
ubus -t 1 call tr069 command '{"command":"reload"}'
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=7.0.2
|
||||
PKG_VERSION:=8.0.12
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=47c04c502edf441fef9f14307be5f07541614049
|
||||
PKG_SOURCE_VERSION:=b265053762a3d6c901872f29fa3e70b8666daf46
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -57,6 +57,7 @@ CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/"
|
||||
# EasySoC HAL #
|
||||
CONFIG_PACKAGE_inbd=y
|
||||
CONFIG_PACKAGE_qosmngr=y
|
||||
CONFIG_PACKAGE_libwifiutils=y
|
||||
CONFIG_PACKAGE_wifimngr=y
|
||||
|
||||
# Multi-AP #
|
||||
@@ -130,7 +131,7 @@ CONFIG_PACKAGE_atftp=m
|
||||
CONFIG_PACKAGE_atftpd=m
|
||||
CONFIG_PACKAGE_ddns-scripts=y
|
||||
CONFIG_PACKAGE_dnsmasq=y
|
||||
CONFIG_PACKAGE_miniupnpd-iptables=y
|
||||
CONFIG_PACKAGE_ssdpd=y
|
||||
CONFIG_PACKAGE_mosquitto-client-ssl=y
|
||||
CONFIG_PACKAGE_mosquitto-ssl=y
|
||||
CONFIG_PACKAGE_nginx=y
|
||||
|
||||
@@ -14,7 +14,6 @@ function genconfig {
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||
ramips_feed="target/linux/feeds/iopsys-ramips"
|
||||
airoha_feed="target/linux/feeds/airoha"
|
||||
x86_feed="target/linux/feeds/iopsys-x86"
|
||||
armvirt_feed="target/linux/feeds/iopsys-armvirt"
|
||||
@@ -111,8 +110,6 @@ function genconfig {
|
||||
|
||||
[ -e $brcmbca_feed/genconfig ] &&
|
||||
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||
[ -e $ramips_feed/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips_feed; ./genconfig)
|
||||
[ -e $airoha_feed/genconfig ] &&
|
||||
airoha=$(cd $airoha_feed; ./genconfig)
|
||||
[ -e $x86_feed/genconfig ] &&
|
||||
@@ -125,7 +122,7 @@ function genconfig {
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
for list in brcmbca airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -142,14 +139,6 @@ function genconfig {
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_ramips"
|
||||
target_config_path="$ramips_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
@@ -276,11 +265,22 @@ function genconfig {
|
||||
setup_dirs()
|
||||
{
|
||||
git remote -v | grep -q http || {
|
||||
CUSTBRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
if git ls-remote $CUSTREPO -q 2>/dev/null; then
|
||||
if [ ! -d "$CUSTPATH" ]; then
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
echo "Cloning $CUSTBRANCH branch of $CUSTREPO"
|
||||
git clone -b "$CUSTBRANCH" "$CUSTREPO" "$CUSTPATH" 2>/dev/null || {
|
||||
DEFBRANCH="$(git remote show $CUSTREPO | grep 'HEAD branch' | cut -d' ' -f5)"
|
||||
echo "$CUSTBRANCH branch is not found, cloning $DEFBRANCH branch of $CUSTREPO"
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
}
|
||||
elif [ $IMPORT -eq 1 ]; then
|
||||
cd $CUSTPATH
|
||||
echo "Checking out $CUSTBRANCH branch in $CUSTPATH"
|
||||
git checkout "$CUSTBRANCH" 2>/dev/null || {
|
||||
DEFBRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | cut -d '/' -f4)"
|
||||
echo "Checking out $CUSTBRANCH branch has failed, using $DEFBRANCH branch in $CUSTPATH"
|
||||
}
|
||||
v "git pull"
|
||||
git pull
|
||||
cd - >/dev/null #go back
|
||||
@@ -340,9 +340,9 @@ function genconfig {
|
||||
echo "" >> .config
|
||||
fi
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
iopsys_ramips | airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
||||
|
||||
@@ -13,7 +13,6 @@ function genconfig_min {
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||
ramips_feed="target/linux/feeds/iopsys-ramips"
|
||||
airoha_feed="target/linux/feeds/airoha"
|
||||
x86_feed="target/linux/feeds/iopsys-x86"
|
||||
armvirt_feed="target/linux/feeds/iopsys-armvirt"
|
||||
@@ -110,8 +109,6 @@ function genconfig_min {
|
||||
|
||||
[ -e $brcmbca_feed/genconfig ] &&
|
||||
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||
[ -e $ramips_feed/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips_feed; ./genconfig)
|
||||
[ -e $airoha_feed/genconfig ] &&
|
||||
airoha=$(cd $airoha_feed; ./genconfig)
|
||||
[ -e $x86_feed/genconfig ] &&
|
||||
@@ -124,7 +121,7 @@ function genconfig_min {
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
for list in brcmbca airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -141,14 +138,6 @@ function genconfig_min {
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_ramips"
|
||||
target_config_path="$ramips_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
@@ -192,12 +181,6 @@ function genconfig_min {
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
DEVELOPER=1
|
||||
|
||||
bcmAllowed=0
|
||||
endptAllowed=0
|
||||
|
||||
git ls-remote git@dev.iopsys.eu:broadcom/bcmcreator.git -q 2>/dev/null && bcmAllowed=1
|
||||
git ls-remote git@dev.iopsys.eu:iopsys/endptmngr.git -q 2>/dev/null && endptAllowed=1
|
||||
}
|
||||
|
||||
v() {
|
||||
@@ -333,7 +316,7 @@ function genconfig_min {
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
iopsys_ramips | airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
||||
|
||||
52
libpicoevent-bcm/Makefile
Normal file
52
libpicoevent-bcm/Makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=0.3
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libpicoevent.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=f446f186102539cceedaa15a95a33547ac3c1fd7
|
||||
PKG_NAME:=libpicoevent-bcm
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libpicoevent-bcm
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Libpicoevent-bcm
|
||||
URL:=
|
||||
DEPENDS:= +TARGET_brcmbca:bcmkernel
|
||||
include $(TOPDIR)/feeds/broadcom/bcmkernel/bcm-toolchain.mk
|
||||
TARGET_CFLAGS := -Os -pipe -mfpu=vfpv3-d16 -mfloat-abi=softfp -DCONFIG_TARGET_brcmbca -g3 -fno-caller-saves -fno-plt -Wno-error=unused-but-set-variable -Wno-error=unused-result \
|
||||
-mfloat-abi=soft -fmacro-prefix-map=$(BUILD_DIR)libpicoevent-bcm-0.3=libpicoevent-bcm-0.3 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 \
|
||||
-Wl,-z,now -Wl,-z,relro -Wl,--build-i
|
||||
endef
|
||||
|
||||
define Package/libpicoevent-bcm/description
|
||||
Minimal event library
|
||||
endef
|
||||
|
||||
define Package/libpicoevent-bcm/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/lib
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/lib/broadcom
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx
|
||||
$(CP) $(PKG_BUILD_DIR)/libpicoevent.h $(STAGING_DIR)/usr/include/bcm963xx
|
||||
mkdir -p $(1)/usr/lib/broadcom
|
||||
$(CP) $(PKG_BUILD_DIR)/libpicoevent.so $(STAGING_DIR)/usr/lib/broadcom
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libpicoevent.so $(1)/usr/lib/broadcom
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libpicoevent-bcm))
|
||||
58
libvoice-airoha/Makefile
Normal file
58
libvoice-airoha/Makefile
Normal file
@@ -0,0 +1,58 @@
|
||||
#
|
||||
# Copyright (C) 2022 IOPSYS Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-airoha
|
||||
PKG_VERSION:=0.1
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
LOCAL_SRC_DIR:=~/git/voip/$(PKG_NAME)
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=2a6ef141747ad0f7b32a536b5b5bd174834a7af5
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
# All config variable that are passed to the make invocation, directly or
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS libvoice for Airoha platform
|
||||
URL:=
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Libvoice is a library that provides a uniform set of APIs and data types with hardware abstract layer for DSP/SLIC from different vendors
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -av --exclude=.* $(LOCAL_SRC_DIR)/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
# Although there is nothing needs to be installed, but the install section must NOT be empty. Otherwise the package will be skipped as below.
|
||||
# WARNING: skipping libvoice-airoha -- package has no install section
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -16,7 +16,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=d066c9d5c14757ab38e9ecb265ba24f5b33cdbce
|
||||
PKG_SOURCE_VERSION:=401a392a72e2933f527eb92466faaf2907c38730
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -27,7 +27,6 @@ PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||
|
||||
export CONFIG_BRCM_SDK_VER_504040
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -16,7 +16,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=45e7d35f97f258f5e13c3afa0542db724bf59828
|
||||
PKG_SOURCE_VERSION:=8a67b666e57836600457167ccadfba8c46461e5c
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -25,17 +25,17 @@ endif
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
export D2_VTSP_PLATFORM := $(shell echo $(CONFIG_D2_VTSP_PLATFORM))
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS libvoice for D2 which is software DSP
|
||||
URL:=
|
||||
DEPENDS:=
|
||||
DEPENDS:=+d2-voice
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
|
||||
@@ -33,5 +33,17 @@ config AGENT_EASYMESH_VENDOR_EXT_OUI
|
||||
enabled through AGENT_EASYMESH_VENDOR_EXT. Please provide the Vendor's OUI
|
||||
through which such features would be exposed.
|
||||
|
||||
config AGENT_UNAUTHORIZED_STA_IN_ASSOCLIST
|
||||
bool "Create STA entry before authorization is completed"
|
||||
|
||||
config AGENT_CHANSWITCH_SKIP_DFS_UNAVAILABLE
|
||||
bool "Skip DFS unavailable channels when channel switch"
|
||||
|
||||
config AGENT_LOCAL_ACS_SERVICE
|
||||
bool "Enable loacal ACS daemon usage"
|
||||
|
||||
config AGENT_STRICT_OPER_CHANNEL_REPORT
|
||||
bool "Report operation channel strictly, skip some unsolicited reports"
|
||||
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=4.1.0.0
|
||||
PKG_VERSION:=4.2.0.7
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=035a398ae9e23612816cba8eeb8477997135a840
|
||||
PKG_SOURCE_VERSION:=142314d9a555ce30399d99ae1a44fbf8be8bb247
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -78,6 +78,21 @@ TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT_OUI=\\\"$(CONFIG_AGENT_EASYMESH_VENDOR_EX
|
||||
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AGENT_UNAUTHORIZED_STA_IN_ASSOCLIST),y)
|
||||
TARGET_CFLAGS += -DUNAUTHORIZED_STA_IN_ASSOCLIST
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AGENT_CHANSWITCH_SKIP_DFS_UNAVAILABLE),y)
|
||||
TARGET_CFLAGS += -DCHANSWITCH_SKIP_DFS_UNAVAILABLE
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AGENT_LOCAL_ACS_SERVICE),y)
|
||||
TARGET_CFLAGS += -DLOCAL_ACS_SERVICE
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AGENT_STRICT_OPER_CHANNEL_REPORT),y)
|
||||
TARGET_CFLAGS += -DSTRICT_OPER_CHANNEL_REPORT
|
||||
endif
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ validate_agent_section() {
|
||||
uci_validate_section mapagent agent "agent" \
|
||||
'enabled:bool:true' \
|
||||
'debug:range(0,16)' \
|
||||
'profile:range(1,2):2' \
|
||||
'profile:range(1,4):2' \
|
||||
'brcm_setup:bool:false' \
|
||||
'controller_macaddr:macaddr' \
|
||||
'al_bridge:string' \
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=4.1.0.0
|
||||
PKG_VERSION:=4.2.0.3
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=473c4a547c34af0f3b09cb7a110e5cff90abc191
|
||||
PKG_SOURCE_VERSION:=a88dea065f40c81d3356d850fe447a9deeb972e4
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
@@ -26,7 +26,7 @@ define Package/map-controller
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=WiFi Multi-AP Controller (EasyMesh R2)
|
||||
DEPENDS:=+libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 +map-plugin
|
||||
DEPENDS:=+libuci +libubox +ubus +libeasy +libwifiutils +libieee1905 +ieee1905 +map-plugin
|
||||
endef
|
||||
|
||||
define Package/map-controller/description
|
||||
|
||||
@@ -45,7 +45,13 @@ validate_sta_steering_section() {
|
||||
'use_bcn_metrics:bool:false' \
|
||||
'use_usta_metrics:bool:false' \
|
||||
'bandsteer:bool:false' \
|
||||
'diffsnr:range(0,100)'
|
||||
'diffsnr:range(0,100)' \
|
||||
'rcpi_threshold_2g:range(0,220)' \
|
||||
'rcpi_threshold_5g:range(0,220)' \
|
||||
'rcpi_threshold_6g:range(0,220)' \
|
||||
'report_rcpi_threshold_2g:range(0,220)' \
|
||||
'report_rcpi_threshold_5g:range(0,220)' \
|
||||
'report_rcpi_threshold_6g:range(0,220)'
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "mapcontroller" "Validation of sta_steering section failed"
|
||||
@@ -193,7 +199,7 @@ reload_service() {
|
||||
return
|
||||
fi
|
||||
|
||||
pidof "mapcontroller" > /dev/null
|
||||
pidof "/usr/sbin/mapcontroller" > /dev/null
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
start
|
||||
return
|
||||
|
||||
@@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=map-topology
|
||||
PKG_VERSION:=2.5.1.14
|
||||
PKG_VERSION:=2.5.1.18
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_VERSION:=bacbffccabdc1a388a135daad58db4ca60676b05
|
||||
PKG_SOURCE_VERSION:=4320fa30e73b916ae6e4ff489294640e61feeb34
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/map-topology.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -4,3 +4,4 @@ config topology 'topology'
|
||||
option depth '8'
|
||||
option interval '60'
|
||||
option maxlog '32'
|
||||
option profile '2'
|
||||
|
||||
@@ -71,6 +71,10 @@ start_service() {
|
||||
config_load "hosts"
|
||||
validate_hosts_config || return 1;
|
||||
|
||||
if [ -f "/proc/sys/net/netfilter/nf_conntrack_timestamp" ]; then
|
||||
echo 1 >/proc/sys/net/netfilter/nf_conntrack_timestamp
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "/usr/sbin/topologyd"
|
||||
procd_set_param respawn
|
||||
|
||||
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=mcastmngr
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_VERSION:=1.1.0
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@@ -16,8 +16,9 @@ PKG_LICENSE_FILES:=LICENSE
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mcastmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=multicast packets manager daemon
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Multicast Proxy/Snooping Manager
|
||||
DEPENDS:=+!TARGET_brcmbca:mcproxy
|
||||
endef
|
||||
|
||||
define Package/mcastmngr/description
|
||||
@@ -32,7 +33,12 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/mcastmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(CP) ./files/common/* $(1)/
|
||||
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||
$(CP) ./files/broadcom/* $(1)/
|
||||
else
|
||||
$(CP) ./files/linux/* $(1)/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mcastmngr))
|
||||
|
||||
254
mcastmngr/files/broadcom/lib/mcast/broadcom.sh
Executable file
254
mcastmngr/files/broadcom/lib/mcast/broadcom.sh
Executable file
@@ -0,0 +1,254 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/mcast/common.sh
|
||||
|
||||
include /lib/network
|
||||
|
||||
|
||||
CONFFILE=/var/mcpd.conf
|
||||
PROG_EXE=/usr/sbin/mcpd
|
||||
|
||||
proxdevs=""
|
||||
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
|
||||
config_snooping_common_params() {
|
||||
local protocol="$1"
|
||||
echo "${protocol}-default-version $2" >> $CONFFILE
|
||||
echo "${protocol}-robustness-value $3" >> $CONFFILE
|
||||
echo "${protocol}-max-groups $max_groups" >> $CONFFILE
|
||||
echo "${protocol}-max-sources $max_msf" >> $CONFFILE
|
||||
echo "${protocol}-max-members $max_members" >> $CONFFILE
|
||||
echo "${protocol}-snooping-enable $4" >> $CONFFILE
|
||||
}
|
||||
|
||||
config_mcast_querier_params() {
|
||||
local protocol="$1"
|
||||
local query_interval=$2
|
||||
local q_resp_interval=$3
|
||||
local last_mem_q_int=$4
|
||||
|
||||
echo "${protocol}-query-interval $query_interval" >> $CONFFILE
|
||||
echo "${protocol}-query-response-interval $q_resp_interval" >> $CONFFILE
|
||||
echo "${protocol}-last-member-query-interval $last_mem_q_int" >> $CONFFILE
|
||||
}
|
||||
|
||||
config_snooping_upstream_interface() {
|
||||
local snooping_upstream_intf=""
|
||||
|
||||
json_load "$(devstatus $1)"
|
||||
logger -t "mcastconf" "$(devstatus $1)"
|
||||
itr=1
|
||||
json_select bridge-members
|
||||
|
||||
# loop over the bridge and find the device on wan port
|
||||
while json_get_var dev $itr; do
|
||||
case "$dev" in
|
||||
*.*)
|
||||
port="$(echo "$dev" | cut -d'.' -f 1)"
|
||||
if [ $port == $ethwan ]; then
|
||||
ifconfig $dev | grep RUNNING >/dev/null && $snooping_upstream_intf="$dev" && break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
itr=$(($itr + 1))
|
||||
done
|
||||
json_select ..
|
||||
|
||||
# if none of the bridge members are on wan port, set the wan port itself
|
||||
if [ -n "$snooping_upstream_intf" ]; then
|
||||
echo "upstream-interface $snooping_upstream_intf" >>$CONFFILE
|
||||
else
|
||||
echo "upstream-interface $ethwan" >>$CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
config_snooping_on_bridge() {
|
||||
local protocol="$1"
|
||||
local bcm_mcast_p=1
|
||||
echo "${protocol}-snooping-interfaces $2" >> $CONFFILE
|
||||
|
||||
[ "$protocol" == "mld" ] && bcm_mcast_p=2
|
||||
|
||||
for snpif in $2; do
|
||||
case "$snpif" in
|
||||
br-*)
|
||||
# set snooping mode on the bridge
|
||||
bcmmcastctl mode -i $snpif -p $bcm_mcast_p -m $3
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
config_mcast_proxy_interface() {
|
||||
local itr
|
||||
local p1="$1"
|
||||
local p_enable
|
||||
|
||||
if [ "$p1" == "igmp" ]; then
|
||||
p_enable=$igmp_p_enable
|
||||
else
|
||||
p_enable=$mld_p_enable
|
||||
fi
|
||||
|
||||
for proxif in $2; do
|
||||
case "$proxif" in
|
||||
br-*)
|
||||
proxdevs="$proxdevs $proxif"
|
||||
echo "upstream-interface $proxif" >>$CONFFILE
|
||||
;;
|
||||
*)
|
||||
ifconfig $proxif | grep RUNNING >/dev/null && proxdevs="$proxdevs $proxif"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $p_enable -eq 1 ]; then
|
||||
echo "${p1}-proxy-interfaces $proxdevs" >> $CONFFILE
|
||||
fi
|
||||
|
||||
# if proxdevs is empty set the wan port as mcast-interface
|
||||
if [ -n "$proxdevs" ]; then
|
||||
echo "${p1}-mcast-interfaces $proxdevs" >> $CONFFILE
|
||||
else
|
||||
echo "${p1}-mcast-interfaces $ethwan" >> $CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
configure_mcpd_snooping() {
|
||||
local protocol="$1"
|
||||
local exceptions
|
||||
local filter_ip=""
|
||||
local fast_leave=0
|
||||
|
||||
# Configure snooping related params
|
||||
if [ "$protocol" == "igmp" ]; then
|
||||
config_snooping_common_params $protocol $igmp_s_version $igmp_s_robustness $igmp_s_mode
|
||||
config_mcast_querier_params $protocol $igmp_s_query_interval $igmp_s_q_resp_interval $igmp_s_last_mem_q_int
|
||||
config_snooping_upstream_interface "$igmp_s_iface"
|
||||
config_snooping_on_bridge $protocol $igmp_s_iface $igmp_s_mode
|
||||
exceptions=$igmp_s_exceptions
|
||||
fast_leave=$igmp_s_fast_leave
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
config_snooping_common_params $protocol $mld_s_version $mld_s_robustness $mld_s_mode
|
||||
config_mcast_querier_params $protocol $mld_s_query_interval $mld_s_q_resp_interval $mld_s_last_mem_q_int
|
||||
config_snooping_upstream_interface "$mld_s_iface"
|
||||
config_snooping_on_bridge $protocol $mld_s_iface $mld_s_mode
|
||||
exceptions=$mld_s_exceptions
|
||||
fast_leave=$mld_s_fast_leave
|
||||
fi
|
||||
|
||||
echo "${protocol}-proxy-enable 0" >> $CONFFILE
|
||||
echo "${protocol}-fast-leave $fast_leave" >> $CONFFILE
|
||||
|
||||
if [ -n "$exceptions" ]; then
|
||||
IFS=" "
|
||||
for excp in $exceptions; do
|
||||
case $excp in
|
||||
*/*)
|
||||
tmp="$(ipcalc.sh $excp | grep IP | awk '{print substr($0,4)}')"
|
||||
tmp1="$(ipcalc.sh $excp | grep NETMASK | awk '{print substr($0,9)}')"
|
||||
filter_ip="$filter_ip $tmp/$tmp1"
|
||||
;;
|
||||
*)
|
||||
filter_ip="$filter_ip $excp"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "${protocol}-mcast-snoop-exceptions $filter_ip" >> $CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
configure_mcpd_proxy() {
|
||||
local protocol="$1"
|
||||
local fast_leave=0
|
||||
local exceptions=""
|
||||
|
||||
# Configure snooping related params
|
||||
if [ "$protocol" == "igmp" ]; then
|
||||
config_snooping_common_params $protocol $igmp_p_version $igmp_p_robustness $igmp_p_mode
|
||||
config_mcast_querier_params $protocol $igmp_query_interval $igmp_q_resp_interval $igmp_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol "$igmp_p_up_interfaces"
|
||||
config_snooping_on_bridge $protocol $igmp_p_down_interfaces $igmp_p_mode
|
||||
fast_leave=$igmp_fast_leave
|
||||
exceptions=$igmp_p_exceptions
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
config_snooping_common_params $protocol $mld_p_version $mld_p_robustness $mld_p_mode
|
||||
config_mcast_querier_params $protocol $mld_query_interval $mld_q_resp_interval $mld_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol "$mld_p_up_interfaces"
|
||||
config_snooping_on_bridge $protocol $mld_p_down_interfaces $mld_p_mode
|
||||
fast_leave=$mld_fast_leave
|
||||
exceptions=$mld_p_exceptions
|
||||
fi
|
||||
|
||||
# This function will only be hit in case proxy is enabled, so hard coding
|
||||
# proxy enable should not be a problem
|
||||
echo "${protocol}-proxy-enable 1" >> $CONFFILE
|
||||
echo "${protocol}-fast-leave $fast_leave" >> $CONFFILE
|
||||
|
||||
if [ -n "$exceptions" ]; then
|
||||
IFS=" "
|
||||
for excp in $exceptions; do
|
||||
case $excp in
|
||||
*/*)
|
||||
tmp="$(ipcalc.sh $excp | grep IP | awk '{print substr($0,4)}')"
|
||||
tmp1="$(ipcalc.sh $excp | grep NETMASK | awk '{print substr($0,9)}')"
|
||||
filter_ip="$filter_ip $tmp/$tmp1"
|
||||
;;
|
||||
*)
|
||||
filter_ip="$filter_ip $excp"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "${protocol}-mcast-snoop-exceptions $filter_ip" >> $CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
disable_snooping() {
|
||||
local bcm_mcast_p=$1
|
||||
|
||||
for br in $(brctl show | grep 'br-' | awk '{print$1}' | tr '\n' ' '); do
|
||||
bcmmcastctl mode -i $br -p $bcm_mcast_p -m 0 # disable snooping on all bridges
|
||||
done
|
||||
}
|
||||
|
||||
configure_mcpd() {
|
||||
disable_snooping 1
|
||||
disable_snooping 2
|
||||
|
||||
# BCM's mcpd does not allow configuration of proxy and L2 snooping simultaneously, hence
|
||||
# here, if proxy is to be configured then the configuration params of snooping are ignored.
|
||||
if [ "$igmp_p_enable" == "1" ]; then
|
||||
configure_mcpd_proxy igmp
|
||||
elif [ "$igmp_s_enable" == "1" ]; then
|
||||
configure_mcpd_snooping igmp
|
||||
fi
|
||||
|
||||
proxdevs=""
|
||||
if [ "$mld_p_enable" == "1" ]; then
|
||||
configure_mcpd_proxy mld
|
||||
elif [ "$mld_s_enable" == "1" ]; then
|
||||
configure_mcpd_snooping mld
|
||||
fi
|
||||
}
|
||||
|
||||
setup_mcast_mode() {
|
||||
# set the mode at chip to allow both tagged and untagged multicast forwarding
|
||||
bs /b/c iptv lookup_method=group_ip_src_ip
|
||||
}
|
||||
|
||||
configure_mcast() {
|
||||
rm -f $CONFFILE
|
||||
touch $CONFFILE
|
||||
|
||||
# mcpd internally writes max_groups and max_msf, no need to modify
|
||||
# here directly
|
||||
config_global_params
|
||||
|
||||
read_mcast_snooping_params
|
||||
read_mcast_proxy_params
|
||||
|
||||
configure_mcpd
|
||||
}
|
||||
@@ -14,15 +14,36 @@ service_triggers() {
|
||||
procd_add_reload_trigger network $NAME
|
||||
}
|
||||
|
||||
start_mcast_service() {
|
||||
local param=$@
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command "${PROG_EXE}"
|
||||
if [ -n "${param}" ]; then
|
||||
procd_append_param command ${param}
|
||||
fi
|
||||
procd_set_param respawn
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
if [ -f "/etc/config/mcast" ]; then
|
||||
configure_mcast
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG_EXE"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
if [ -z "${PROG_PARAMS}" ]; then
|
||||
start_mcast_service
|
||||
return
|
||||
fi
|
||||
|
||||
local prev_IFS="${IFS}"
|
||||
IFS=${PROG_PARAMS_SEPARATOR}
|
||||
for param in ${PROG_PARAMS}; do
|
||||
IFS="${prev_IFS}"
|
||||
start_mcast_service ${param}
|
||||
done
|
||||
}
|
||||
|
||||
boot() {
|
||||
@@ -31,11 +52,10 @@ boot() {
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
service_stop $PROG_EXE
|
||||
service_stop "${PROG_EXE}"
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
117
mcastmngr/files/common/etc/uci-defaults/61-mcast_config_generate
Normal file
117
mcastmngr/files/common/etc/uci-defaults/61-mcast_config_generate
Normal file
@@ -0,0 +1,117 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
generate_igmp_global_params(){
|
||||
uci add mcast igmp
|
||||
uci rename mcast.@igmp[-1]="igmp"
|
||||
uci set mcast.@igmp[-1].max_membership="20"
|
||||
uci set mcast.@igmp[-1].max_msf="10"
|
||||
uci set mcast.@igmp[-1].qrv="2"
|
||||
uci set mcast.@igmp[-1].force_version="0"
|
||||
|
||||
uci add mcast mld
|
||||
uci rename mcast.@mld[-1]="mld"
|
||||
uci set mcast.@mld[-1].mldv1_unsolicited_report_interval="10"
|
||||
uci set mcast.@mld[-1].mldv2_unsolicited_report_interval="1"
|
||||
uci set mcast.@mld[-1].qrv="2"
|
||||
uci set mcast.@mld[-1].force_version="0"
|
||||
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
generate_mld_proxy_config(){
|
||||
local u_itf="$1"
|
||||
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="mc_proxy_MLD"
|
||||
uci set mcast.@proxy[-1].enable="1"
|
||||
uci set mcast.@proxy[-1].proto="mld"
|
||||
uci set mcast.@proxy[-1].version="2"
|
||||
uci set mcast.@proxy[-1].robustness="2"
|
||||
uci set mcast.@proxy[-1].query_interval="125"
|
||||
uci set mcast.@proxy[-1].query_response_interval="100"
|
||||
uci set mcast.@proxy[-1].last_member_query_interval="10"
|
||||
uci set mcast.@proxy[-1].fast_leave="1"
|
||||
uci set mcast.@proxy[-1].snooping_mode="2"
|
||||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $u_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
generate_igmp_proxy_config(){
|
||||
local u_itf="$1"
|
||||
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="igmp_proxy_1"
|
||||
uci set mcast.@proxy[-1].enable="1"
|
||||
uci set mcast.@proxy[-1].proto="igmp"
|
||||
uci set mcast.@proxy[-1].version="2"
|
||||
uci set mcast.@proxy[-1].robustness="2"
|
||||
uci set mcast.@proxy[-1].query_interval="125"
|
||||
uci set mcast.@proxy[-1].query_response_interval="100"
|
||||
uci set mcast.@proxy[-1].last_member_query_interval="10"
|
||||
uci set mcast.@proxy[-1].fast_leave="1"
|
||||
uci set mcast.@proxy[-1].snooping_mode="2"
|
||||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $u_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
|
||||
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
|
||||
}
|
||||
|
||||
generate_mcast_config(){
|
||||
|
||||
up_itf="$(uci -q get network.wan.device)"
|
||||
|
||||
generate_igmp_proxy_config "$up_itf"
|
||||
generate_mld_proxy_config "$up_itf"
|
||||
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
interfaces_ok(){
|
||||
local section_name=$1
|
||||
|
||||
local up_interf=$(uci -q get ${section_name}.upstream_interface)
|
||||
[ -z "$up_interf" ] && return 1
|
||||
|
||||
local down_interf=$(uci -q get ${section_name}.downstream_interface)
|
||||
[ -z "$down_interf" ] && return 1
|
||||
|
||||
# check if upstream untagged
|
||||
IFS=" "
|
||||
for itf in $up_interf; do
|
||||
# check if there exist a device section for this upstream interface, if yes the
|
||||
# do nothing, if no then split the it at . and use the native interface as
|
||||
# upstream interface
|
||||
dev_section=$(ubus call uci get '{"config":"network", "type":"device", "match":{"name":"'"$itf"'"}}' | jsonfilter -e @.values | jq keys[])
|
||||
|
||||
# mcast config is outdated, simply generate as per new logic
|
||||
[ -z "$dev_section" ] && return 1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ -s "/etc/config/mcast" ]; then
|
||||
if uci -q get mcast.@proxy[0] >/dev/null; then
|
||||
interfaces_ok "mcast.@proxy[0]" && exit
|
||||
elif uci -q get mcast.@snooping[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f /etc/config/mcast
|
||||
touch /etc/config/mcast
|
||||
|
||||
generate_igmp_global_params
|
||||
|
||||
generate_mcast_config
|
||||
182
mcastmngr/files/common/lib/mcast/common.sh
Executable file
182
mcastmngr/files/common/lib/mcast/common.sh
Executable file
@@ -0,0 +1,182 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
include /lib/network
|
||||
|
||||
|
||||
# Parameters available in snooping configuration
|
||||
igmp_s_enable=0
|
||||
igmp_s_version=2
|
||||
igmp_s_query_interval=125
|
||||
igmp_s_q_resp_interval=100
|
||||
igmp_s_last_mem_q_int=10
|
||||
igmp_s_fast_leave=1
|
||||
igmp_s_robustness=2
|
||||
igmp_s_mode=0
|
||||
igmp_s_iface=""
|
||||
igmp_s_exceptions=""
|
||||
|
||||
mld_s_enable=0
|
||||
mld_s_version=2
|
||||
mld_s_robustness=2
|
||||
mld_s_mode=0
|
||||
mld_s_iface=""
|
||||
mld_s_exceptions=""
|
||||
|
||||
# Global params
|
||||
max_groups=25
|
||||
max_msf=10
|
||||
max_members=25
|
||||
mldv1_unsolicited_report_interval=10
|
||||
mldv2_unsolicited_report_interval=1
|
||||
|
||||
# Parameters available in proxy configuration
|
||||
igmp_p_enable=0
|
||||
igmp_p_version=2
|
||||
igmp_query_interval=125
|
||||
igmp_q_resp_interval=100
|
||||
igmp_last_mem_q_int=10
|
||||
igmp_fast_leave=1
|
||||
igmp_p_robustness=2
|
||||
igmp_p_mode=0
|
||||
igmp_p_up_interfaces=""
|
||||
igmp_p_down_interfaces=""
|
||||
igmp_p_exceptions=""
|
||||
|
||||
mld_p_enable=0
|
||||
mld_p_version=1
|
||||
mld_query_interval=125
|
||||
mld_q_resp_interval=100
|
||||
mld_last_mem_q_int=10
|
||||
mld_fast_leave=1
|
||||
mld_p_robustness=2
|
||||
mld_p_mode=0
|
||||
mld_p_up_interfaces=""
|
||||
mld_p_down_interfaces=""
|
||||
mld_p_exceptions=""
|
||||
|
||||
read_snooping() {
|
||||
local config="$1"
|
||||
local sec_enable
|
||||
local proto
|
||||
|
||||
config_get sec_enable "$config" enable 0
|
||||
config_get proto "$config" proto
|
||||
|
||||
if [ "$sec_enable" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$proto" == "igmp" ]; then
|
||||
igmp_s_enable=$sec_enable
|
||||
config_get igmp_s_version "$config" version 2
|
||||
config_get igmp_s_query_interval "$config" query_interval 125
|
||||
config_get igmp_s_q_resp_interval "$config" query_response_interval 100
|
||||
config_get igmp_s_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get igmp_s_fast_leave "$config" fast_leave 1
|
||||
config_get igmp_s_robustness "$config" robustness 2
|
||||
config_get igmp_s_mode "$config" snooping_mode 0
|
||||
config_get igmp_s_iface "$config" interface
|
||||
config_get igmp_s_exceptions "$config" filter
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$proto" == "mld" ]; then
|
||||
mld_s_enable=$sec_enable
|
||||
config_get mld_s_version "$config" version 2
|
||||
config_get mld_s_query_interval "$config" query_interval 125
|
||||
config_get mld_s_q_resp_interval "$config" query_response_interval 100
|
||||
config_get mld_s_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get mld_s_fast_leave "$config" fast_leave 1
|
||||
config_get mld_s_robustness "$config" robustness 2
|
||||
config_get mld_s_mode "$config" snooping_mode 0
|
||||
config_get mld_s_iface "$config" interface
|
||||
config_get mld_s_exceptions "$config" filter
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
read_proxy() {
|
||||
local config="$1"
|
||||
local sec_enable
|
||||
local proto
|
||||
|
||||
config_get sec_enable "$config" enable 0
|
||||
config_get proto "$config" proto
|
||||
|
||||
if [ "$sec_enable" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$proto" == "igmp" ]; then
|
||||
igmp_p_enable=$sec_enable
|
||||
config_get igmp_p_version "$config" version 2
|
||||
config_get igmp_query_interval "$config" query_interval 125
|
||||
config_get igmp_q_resp_interval "$config" query_response_interval 100
|
||||
config_get igmp_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get igmp_fast_leave "$config" fast_leave 1
|
||||
config_get igmp_p_robustness "$config" robustness 2
|
||||
config_get igmp_p_mode "$config" snooping_mode 0
|
||||
config_get igmp_p_up_interfaces "$config" upstream_interface
|
||||
config_get igmp_p_down_interfaces "$config" downstream_interface
|
||||
config_get igmp_p_exceptions "$config" filter
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$proto" == "mld" ]; then
|
||||
mld_p_enable=$sec_enable
|
||||
config_get mld_p_version "$config" version 2
|
||||
config_get mld_query_interval "$config" query_interval 125
|
||||
config_get mld_q_resp_interval "$config" query_response_interval 100
|
||||
config_get mld_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get mld_fast_leave "$config" fast_leave 1
|
||||
config_get mld_p_robustness "$config" robustness 2
|
||||
config_get mld_p_mode "$config" snooping_mode 0
|
||||
config_get mld_p_up_interfaces "$config" upstream_interface
|
||||
config_get mld_p_down_interfaces "$config" downstream_interface
|
||||
config_get mld_p_exceptions "$config" filter
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
read_mcast_snooping_params() {
|
||||
config_load mcast
|
||||
config_foreach read_snooping snooping
|
||||
}
|
||||
|
||||
read_mcast_proxy_params() {
|
||||
config_load mcast
|
||||
config_foreach read_proxy proxy
|
||||
}
|
||||
|
||||
config_global_params() {
|
||||
local igmp_qrv
|
||||
local igmp_force_version
|
||||
local mld_qrv
|
||||
local mld_force_version
|
||||
|
||||
config_load mcast
|
||||
config_get max_msf igmp max_msf 10
|
||||
config_get max_groups igmp max_membership 25
|
||||
config_get igmp_qrv igmp qrv 2
|
||||
config_get igmp_force_version igmp force_version 0
|
||||
|
||||
config_get mld_qrv mld qrv 2
|
||||
config_get mldv1_unsolicited_report_interval mld mldv1_unsolicited_report_interval 10
|
||||
config_get mldv2_unsolicited_report_interval mld mldv2_unsolicited_report_interval 1
|
||||
config_get mld_force_version mld force_version 0
|
||||
|
||||
if [ "$1" == "set_max_groups_and_sources" ]; then
|
||||
echo $max_groups > /proc/sys/net/ipv4/igmp_max_memberships
|
||||
echo $max_msf > /proc/sys/net/ipv4/igmp_max_msf
|
||||
echo $max_msf > /proc/sys/net/ipv6/mld_max_msf
|
||||
fi
|
||||
echo $igmp_qrv > /proc/sys/net/ipv4/igmp_qrv
|
||||
echo $igmp_force_version > /proc/sys/net/ipv4/conf/all/force_igmp_version
|
||||
|
||||
echo $mld_qrv > /proc/sys/net/ipv6/mld_qrv
|
||||
echo $mld_force_version > /proc/sys/net/ipv6/conf/all/force_mld_version
|
||||
echo $mldv1_unsolicited_report_interval > /proc/sys/net/ipv6/conf/all/mldv1_unsolicited_report_interval
|
||||
echo $mldv2_unsolicited_report_interval > /proc/sys/net/ipv6/conf/all/mldv2_unsolicited_report_interval
|
||||
}
|
||||
142
mcastmngr/files/common/usr/libexec/rpcd/mcast
Executable file
142
mcastmngr/files/common/usr/libexec/rpcd/mcast
Executable file
@@ -0,0 +1,142 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
read_mcast_stats() {
|
||||
cat /proc/net/igmp_snooping > /tmp/igmp_stats
|
||||
local mcast_addrs=""
|
||||
local ifaces=""
|
||||
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
found_iface=0
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ -z "$ifaces" ]; then
|
||||
ifaces="$snoop_iface"
|
||||
continue
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for ifx in $ifaces; do
|
||||
if [ $ifx == $snoop_iface ]; then
|
||||
found_iface=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $found_iface -eq 0 ]; then
|
||||
ifaces="$ifaces $snoop_iface"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
found_ip=0
|
||||
grp_ip="$(echo $line | awk -F ' ' '{ print $10 }')"
|
||||
if [ -z "$mcast_addrs" ]; then
|
||||
mcast_addrs="$grp_ip"
|
||||
continue
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for ip_addr in $mcast_addrs; do
|
||||
if [ $ip_addr == $grp_ip ]; then
|
||||
found_ip=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $found_ip -eq 0 ]; then
|
||||
mcast_addrs="$mcast_addrs $grp_ip"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
|
||||
json_init
|
||||
json_add_array "snooping"
|
||||
json_add_object ""
|
||||
IFS=" "
|
||||
for intf in $ifaces; do
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
IFS=" "
|
||||
for gip_addr in $mcast_addrs; do
|
||||
grp_obj_added=0
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
grp_ip="$(echo $line | awk -F ' ' '{ print $10 }')"
|
||||
if [ "$grp_ip" != "$gip_addr" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ $grp_obj_added -eq 0 ]; then
|
||||
json_add_object ""
|
||||
gip="$(ipcalc.sh $gip_addr | grep IP | awk '{print substr($0,4)}')"
|
||||
json_add_string "groupaddr" "$gip"
|
||||
json_add_array "clients"
|
||||
grp_obj_added=1
|
||||
fi
|
||||
|
||||
json_add_object ""
|
||||
host_ip="$(echo $line | awk -F ' ' '{ print $14 }')"
|
||||
h_ip="$(ipcalc.sh $host_ip | grep IP | awk '{print substr($0,4)}')"
|
||||
json_add_string "ipaddr" "$h_ip"
|
||||
src_port="$(echo $line | awk -F ' ' '{ print $2 }')"
|
||||
json_add_string "device" "$src_port"
|
||||
timeout="$(echo $line | awk -F ' ' '{ print $15 }')"
|
||||
json_add_int "timeout" "$timeout"
|
||||
json_close_object #close the associated device object
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
done # close the loop for group addresses
|
||||
json_close_array #close the groups array
|
||||
done # close the loop for interfaces
|
||||
json_close_object # close the snooping object
|
||||
json_close_array # close the snooping array
|
||||
json_dump
|
||||
|
||||
rm -f /tmp/igmp_stats
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "stats":{} }'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
stats)
|
||||
read_mcast_stats
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
generate_igmp_global_params(){
|
||||
uci add mcast igmp
|
||||
uci rename mcast.@igmp[-1]="igmp"
|
||||
uci set mcast.@igmp[-1].max_membership="20"
|
||||
uci set mcast.@igmp[-1].max_msf="10"
|
||||
uci set mcast.@igmp[-1].qrv="2"
|
||||
uci set mcast.@igmp[-1].force_version="0"
|
||||
|
||||
uci add mcast mld
|
||||
uci rename mcast.@mld[-1]="mld"
|
||||
uci set mcast.@mld[-1].mldv1_unsolicited_report_interval="10"
|
||||
uci set mcast.@mld[-1].mldv2_unsolicited_report_interval="1"
|
||||
uci set mcast.@mld[-1].qrv="2"
|
||||
uci set mcast.@mld[-1].force_version="0"
|
||||
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
generate_mcast_config(){
|
||||
|
||||
up_itf="$(uci -q get network.wan.device)"
|
||||
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="igmp_proxy_1"
|
||||
uci set mcast.@proxy[-1].enable="1"
|
||||
uci set mcast.@proxy[-1].proto="igmp"
|
||||
uci set mcast.@proxy[-1].version="2"
|
||||
uci set mcast.@proxy[-1].robustness="2"
|
||||
uci set mcast.@proxy[-1].query_interval="125"
|
||||
uci set mcast.@proxy[-1].query_response_interval="100"
|
||||
uci set mcast.@proxy[-1].last_member_query_interval="10"
|
||||
uci set mcast.@proxy[-1].fast_leave="1"
|
||||
uci set mcast.@proxy[-1].snooping_mode="2"
|
||||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $up_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
|
||||
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
if [ -s "/etc/config/mcast" ]; then
|
||||
if uci -q get mcast.@proxy[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
elif uci -q get mcast.@snooping[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
else
|
||||
rm -f /etc/config/mcast
|
||||
fi
|
||||
fi
|
||||
touch /etc/config/mcast
|
||||
|
||||
generate_igmp_global_params
|
||||
|
||||
generate_mcast_config
|
||||
@@ -1,547 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
include /lib/network
|
||||
|
||||
CONFFILE=/var/mcpd.conf
|
||||
PROG_EXE=/usr/sbin/mcpd
|
||||
|
||||
# Parameters available in snooping configuration
|
||||
igmp_s_enable=0
|
||||
igmp_s_version=2
|
||||
igmp_s_query_interval=125
|
||||
igmp_s_q_resp_interval=100
|
||||
igmp_s_last_mem_q_int=10
|
||||
igmp_s_fast_leave=1
|
||||
igmp_s_robustness=2
|
||||
igmp_s_mode=0
|
||||
igmp_s_iface=""
|
||||
igmp_s_exceptions=""
|
||||
|
||||
mld_s_enable=0
|
||||
mld_s_version=2
|
||||
mld_s_robustness=2
|
||||
mld_s_mode=0
|
||||
mld_s_iface=""
|
||||
mld_s_exceptions=""
|
||||
|
||||
# Global params
|
||||
max_groups=25
|
||||
max_msf=10
|
||||
max_members=25
|
||||
mldv1_unsolicited_report_interval=10
|
||||
mldv2_unsolicited_report_interval=1
|
||||
|
||||
# Parameters available in proxy configuration
|
||||
igmp_p_enable=0
|
||||
igmp_p_version=2
|
||||
igmp_query_interval=125
|
||||
igmp_q_resp_interval=100
|
||||
igmp_last_mem_q_int=10
|
||||
igmp_fast_leave=1
|
||||
igmp_p_robustness=2
|
||||
igmp_p_mode=0
|
||||
igmp_p_up_interfaces=""
|
||||
igmp_p_down_interfaces=""
|
||||
igmp_p_exceptions=""
|
||||
|
||||
mld_p_enable=0
|
||||
mld_p_version=1
|
||||
mld_query_interval=125
|
||||
mld_q_resp_interval=100
|
||||
mld_last_mem_q_int=10
|
||||
mld_fast_leave=1
|
||||
mld_p_robustness=2
|
||||
mld_p_mode=0
|
||||
mld_p_up_interfaces=""
|
||||
mld_p_down_interfaces=""
|
||||
mld_p_exceptions=""
|
||||
|
||||
proxdevs=""
|
||||
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
read_snooping() {
|
||||
local config="$1"
|
||||
local sec_enable
|
||||
local proto
|
||||
|
||||
config_get sec_enable "$config" enable 0
|
||||
config_get proto "$config" proto
|
||||
|
||||
if [ "$sec_enable" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$proto" == "igmp" ]; then
|
||||
igmp_s_enable=$sec_enable
|
||||
config_get igmp_s_version "$config" version 2
|
||||
config_get igmp_s_query_interval "$config" query_interval 125
|
||||
config_get igmp_s_q_resp_interval "$config" query_response_interval 100
|
||||
config_get igmp_s_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get igmp_s_fast_leave "$config" fast_leave 1
|
||||
config_get igmp_s_robustness "$config" robustness 2
|
||||
config_get igmp_s_mode "$config" snooping_mode 0
|
||||
config_get igmp_s_iface "$config" interface
|
||||
config_get igmp_s_exceptions "$config" filter
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$proto" == "mld" ]; then
|
||||
mld_s_enable=$sec_enable
|
||||
config_get mld_s_version "$config" version 2
|
||||
config_get mld_s_query_interval "$config" query_interval 125
|
||||
config_get mld_s_q_resp_interval "$config" query_response_interval 100
|
||||
config_get mld_s_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get mld_s_fast_leave "$config" fast_leave 1
|
||||
config_get mld_s_robustness "$config" robustness 2
|
||||
config_get mld_s_mode "$config" snooping_mode 0
|
||||
config_get mld_s_iface "$config" interface
|
||||
config_get mld_s_exceptions "$config" filter
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
read_proxy() {
|
||||
local config="$1"
|
||||
local sec_enable
|
||||
local proto
|
||||
|
||||
config_get sec_enable "$config" enable 0
|
||||
config_get proto "$config" proto
|
||||
|
||||
if [ "$sec_enable" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$proto" == "igmp" ]; then
|
||||
igmp_p_enable=$sec_enable
|
||||
config_get igmp_p_version "$config" version 2
|
||||
config_get igmp_query_interval "$config" query_interval 125
|
||||
config_get igmp_q_resp_interval "$config" query_response_interval 100
|
||||
config_get igmp_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get igmp_fast_leave "$config" fast_leave 1
|
||||
config_get igmp_p_robustness "$config" robustness 2
|
||||
config_get igmp_p_mode "$config" snooping_mode 0
|
||||
config_get igmp_p_up_interfaces "$config" upstream_interface
|
||||
config_get igmp_p_down_interfaces "$config" downstream_interface
|
||||
config_get igmp_p_exceptions "$config" filter
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$proto" == "mld" ]; then
|
||||
mld_p_enable=$sec_enable
|
||||
config_get mld_p_version "$config" version 2
|
||||
config_get mld_query_interval "$config" query_interval 125
|
||||
config_get mld_q_resp_interval "$config" query_response_interval 100
|
||||
config_get mld_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get mld_fast_leave "$config" fast_leave 1
|
||||
config_get mld_p_robustness "$config" robustness 2
|
||||
config_get mld_p_mode "$config" snooping_mode 0
|
||||
config_get mld_p_up_interfaces "$config" upstream_interface
|
||||
config_get mld_p_down_interfaces "$config" downstream_interface
|
||||
config_get mld_p_exceptions "$config" filter
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
config_snooping_common_params() {
|
||||
local protocol="$1"
|
||||
echo "${protocol}-default-version $2" >> $CONFFILE
|
||||
echo "${protocol}-robustness-value $3" >> $CONFFILE
|
||||
echo "${protocol}-max-groups $max_groups" >> $CONFFILE
|
||||
echo "${protocol}-max-sources $max_msf" >> $CONFFILE
|
||||
echo "${protocol}-max-members $max_members" >> $CONFFILE
|
||||
echo "${protocol}-snooping-enable $4" >> $CONFFILE
|
||||
}
|
||||
|
||||
config_mcast_querier_params() {
|
||||
local protocol="$1"
|
||||
local query_interval=$2
|
||||
local q_resp_interval=$3
|
||||
local last_mem_q_int=$4
|
||||
|
||||
echo "${protocol}-query-interval $query_interval" >> $CONFFILE
|
||||
echo "${protocol}-query-response-interval $q_resp_interval" >> $CONFFILE
|
||||
echo "${protocol}-last-member-query-interval $last_mem_q_int" >> $CONFFILE
|
||||
}
|
||||
|
||||
config_snooping_upstream_interface() {
|
||||
local snooping_upstream_intf=""
|
||||
|
||||
json_load "$(devstatus $1)"
|
||||
logger -t "mcastconf" "$(devstatus $1)"
|
||||
itr=1
|
||||
json_select bridge-members
|
||||
|
||||
# loop over the bridge and find the device on wan port
|
||||
while json_get_var dev $itr; do
|
||||
case "$dev" in
|
||||
*.*)
|
||||
port="$(echo "$dev" | cut -d'.' -f 1)"
|
||||
if [ $port == $ethwan ]; then
|
||||
ifconfig $dev | grep RUNNING >/dev/null && $snooping_upstream_intf="$dev" && break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
itr=$(($itr + 1))
|
||||
done
|
||||
json_select ..
|
||||
|
||||
# if none of the bridge members are on wan port, set the wan port itself
|
||||
if [ -n "$snooping_upstream_intf" ]; then
|
||||
echo "upstream-interface $snooping_upstream_intf" >>$CONFFILE
|
||||
else
|
||||
echo "upstream-interface $ethwan" >>$CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
config_snooping_on_bridge() {
|
||||
local protocol="$1"
|
||||
local bcm_mcast_p=1
|
||||
echo "${protocol}-snooping-interfaces $2" >> $CONFFILE
|
||||
|
||||
[ "$protocol" == "mld" ] && bcm_mcast_p=2
|
||||
|
||||
for snpif in $2; do
|
||||
case "$snpif" in
|
||||
br-*)
|
||||
# set snooping mode on the bridge
|
||||
bcmmcastctl mode -i $snpif -p $bcm_mcast_p -m $3
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
config_mcast_proxy_interface() {
|
||||
local itr
|
||||
local p1="$1"
|
||||
local p_enable
|
||||
|
||||
if [ "$p1" == "igmp" ]; then
|
||||
p_enable=$igmp_p_enable
|
||||
else
|
||||
p_enable=$mld_p_enable
|
||||
fi
|
||||
|
||||
for proxif in $2; do
|
||||
case "$proxif" in
|
||||
br-*)
|
||||
proxdevs="$proxdevs $proxif"
|
||||
echo "upstream-interface $proxif" >>$CONFFILE
|
||||
;;
|
||||
*)
|
||||
ifconfig $proxif | grep RUNNING >/dev/null && proxdevs="$proxdevs $proxif"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $p_enable -eq 1 ]; then
|
||||
echo "${p1}-proxy-interfaces $proxdevs" >> $CONFFILE
|
||||
fi
|
||||
|
||||
# if proxdevs is empty set the wan port as mcast-interface
|
||||
if [ -n "$proxdevs" ]; then
|
||||
echo "${p1}-mcast-interfaces $proxdevs" >> $CONFFILE
|
||||
else
|
||||
echo "${p1}-mcast-interfaces $ethwan" >> $CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
configure_mcpd_snooping() {
|
||||
local protocol="$1"
|
||||
local exceptions
|
||||
local filter_ip=""
|
||||
local fast_leave=0
|
||||
|
||||
# Configure snooping related params
|
||||
if [ "$protocol" == "igmp" ]; then
|
||||
config_snooping_common_params $protocol $igmp_s_version $igmp_s_robustness $igmp_s_mode
|
||||
config_mcast_querier_params $protocol $igmp_s_query_interval $igmp_s_q_resp_interval $igmp_s_last_mem_q_int
|
||||
config_snooping_upstream_interface "$igmp_s_iface"
|
||||
config_snooping_on_bridge $protocol $igmp_s_iface $igmp_s_mode
|
||||
exceptions=$igmp_s_exceptions
|
||||
fast_leave=$igmp_s_fast_leave
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
config_snooping_common_params $protocol $mld_s_version $mld_s_robustness $mld_s_mode
|
||||
config_mcast_querier_params $protocol $mld_s_query_interval $mld_s_q_resp_interval $mld_s_last_mem_q_int
|
||||
config_snooping_upstream_interface "$mld_s_iface"
|
||||
config_snooping_on_bridge $protocol $mld_s_iface $mld_s_mode
|
||||
exceptions=$mld_s_exceptions
|
||||
fast_leave=$mld_s_fast_leave
|
||||
fi
|
||||
|
||||
echo "${protocol}-proxy-enable 0" >> $CONFFILE
|
||||
echo "${protocol}-fast-leave $fast_leave" >> $CONFFILE
|
||||
|
||||
if [ -n "$exceptions" ]; then
|
||||
IFS=" "
|
||||
for excp in $exceptions; do
|
||||
case $excp in
|
||||
*/*)
|
||||
tmp="$(ipcalc.sh $excp | grep IP | awk '{print substr($0,4)}')"
|
||||
tmp1="$(ipcalc.sh $excp | grep NETMASK | awk '{print substr($0,9)}')"
|
||||
filter_ip="$filter_ip $tmp/$tmp1"
|
||||
;;
|
||||
*)
|
||||
filter_ip="$filter_ip $excp"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "${protocol}-mcast-snoop-exceptions $filter_ip" >> $CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
configure_mcpd_proxy() {
|
||||
local protocol="$1"
|
||||
local fast_leave=0
|
||||
local exceptions=""
|
||||
|
||||
# Configure snooping related params
|
||||
if [ "$protocol" == "igmp" ]; then
|
||||
config_snooping_common_params $protocol $igmp_p_version $igmp_p_robustness $igmp_p_mode
|
||||
config_mcast_querier_params $protocol $igmp_query_interval $igmp_q_resp_interval $igmp_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol "$igmp_p_up_interfaces"
|
||||
config_snooping_on_bridge $protocol $igmp_p_down_interfaces $igmp_p_mode
|
||||
fast_leave=$igmp_fast_leave
|
||||
exceptions=$igmp_p_exceptions
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
config_snooping_common_params $protocol $mld_p_version $mld_p_robustness $mld_p_mode
|
||||
config_mcast_querier_params $protocol $mld_query_interval $mld_q_resp_interval $mld_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol "$mld_p_up_interfaces"
|
||||
config_snooping_on_bridge $protocol $mld_p_down_interfaces $mld_p_mode
|
||||
fast_leave=$mld_fast_leave
|
||||
exceptions=$mld_p_exceptions
|
||||
fi
|
||||
|
||||
# This function will only be hit in case proxy is enabled, so hard coding
|
||||
# proxy enable should not be a problem
|
||||
echo "${protocol}-proxy-enable 1" >> $CONFFILE
|
||||
echo "${protocol}-fast-leave $fast_leave" >> $CONFFILE
|
||||
|
||||
if [ -n "$exceptions" ]; then
|
||||
IFS=" "
|
||||
for excp in $exceptions; do
|
||||
case $excp in
|
||||
*/*)
|
||||
tmp="$(ipcalc.sh $excp | grep IP | awk '{print substr($0,4)}')"
|
||||
tmp1="$(ipcalc.sh $excp | grep NETMASK | awk '{print substr($0,9)}')"
|
||||
filter_ip="$filter_ip $tmp/$tmp1"
|
||||
;;
|
||||
*)
|
||||
filter_ip="$filter_ip $excp"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "${protocol}-mcast-snoop-exceptions $filter_ip" >> $CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
disable_snooping() {
|
||||
local bcm_mcast_p=$1
|
||||
|
||||
for br in $(brctl show | grep 'br-' | awk '{print$1}' | tr '\n' ' '); do
|
||||
bcmmcastctl mode -i $br -p $bcm_mcast_p -m 0 # disable snooping on all bridges
|
||||
done
|
||||
}
|
||||
|
||||
configure_mcpd() {
|
||||
disable_snooping 1
|
||||
disable_snooping 2
|
||||
|
||||
# BCM's mcpd does not allow configuration of proxy and L2 snooping simultaneously, hence
|
||||
# here, if proxy is to be configured then the configuration params of snooping are ignored.
|
||||
if [ "$igmp_p_enable" == "1" ]; then
|
||||
configure_mcpd_proxy igmp
|
||||
elif [ "$igmp_s_enable" == "1" ]; then
|
||||
configure_mcpd_snooping igmp
|
||||
fi
|
||||
|
||||
proxdevs=""
|
||||
if [ "$mld_p_enable" == "1" ]; then
|
||||
configure_mcpd_proxy mld
|
||||
elif [ "$mld_s_enable" == "1" ]; then
|
||||
configure_mcpd_snooping mld
|
||||
fi
|
||||
}
|
||||
|
||||
read_mcast_snooping_params() {
|
||||
config_load mcast
|
||||
config_foreach read_snooping snooping
|
||||
}
|
||||
|
||||
read_mcast_proxy_params() {
|
||||
config_load mcast
|
||||
config_foreach read_proxy proxy
|
||||
}
|
||||
|
||||
config_global_params() {
|
||||
local igmp_qrv
|
||||
local igmp_force_version
|
||||
local mld_qrv
|
||||
local mld_force_version
|
||||
|
||||
config_load mcast
|
||||
config_get max_msf igmp max_msf 10
|
||||
config_get max_groups igmp max_membership 25
|
||||
config_get igmp_qrv igmp qrv 2
|
||||
config_get igmp_force_version igmp force_version 0
|
||||
|
||||
config_get mld_qrv mld qrv 2
|
||||
config_get mldv1_unsolicited_report_interval mld mldv1_unsolicited_report_interval 10
|
||||
config_get mldv2_unsolicited_report_interval mld mldv2_unsolicited_report_interval 1
|
||||
config_get mld_force_version mld force_version 0
|
||||
|
||||
# mcpd internally writes max_groups and max_msf, no need to modify
|
||||
# here directly
|
||||
echo $igmp_qrv > /proc/sys/net/ipv4/igmp_qrv
|
||||
echo $igmp_force_version > /proc/sys/net/ipv4/conf/all/force_igmp_version
|
||||
|
||||
echo $mld_qrv > /proc/sys/net/ipv6/mld_qrv
|
||||
echo $mld_force_version > /proc/sys/net/ipv6/conf/all/force_mld_version
|
||||
echo $mldv1_unsolicited_report_interval > /proc/sys/net/ipv6/conf/all/mldv1_unsolicited_report_interval
|
||||
echo $mldv2_unsolicited_report_interval > /proc/sys/net/ipv6/conf/all/mldv2_unsolicited_report_interval
|
||||
}
|
||||
|
||||
setup_mcast_mode() {
|
||||
# set the mode at chip to allow both tagged and untagged multicast forwarding
|
||||
bs /b/c iptv lookup_method=group_ip_src_ip
|
||||
}
|
||||
|
||||
configure_mcast() {
|
||||
rm -f $CONFFILE
|
||||
touch $CONFFILE
|
||||
|
||||
config_global_params
|
||||
|
||||
read_mcast_snooping_params
|
||||
read_mcast_proxy_params
|
||||
|
||||
configure_mcpd
|
||||
}
|
||||
|
||||
read_mcast_stats() {
|
||||
cat /proc/net/igmp_snooping > /tmp/igmp_stats
|
||||
local mcast_addrs=""
|
||||
local ifaces=""
|
||||
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
found_iface=0
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ -z "$ifaces" ]; then
|
||||
ifaces="$snoop_iface"
|
||||
continue
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for ifx in $ifaces; do
|
||||
if [ $ifx == $snoop_iface ]; then
|
||||
found_iface=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $found_iface -eq 0 ]; then
|
||||
ifaces="$ifaces $snoop_iface"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
found_ip=0
|
||||
grp_ip="$(echo $line | awk -F ' ' '{ print $10 }')"
|
||||
if [ -z "$mcast_addrs" ]; then
|
||||
mcast_addrs="$grp_ip"
|
||||
continue
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for ip_addr in $mcast_addrs; do
|
||||
if [ $ip_addr == $grp_ip ]; then
|
||||
found_ip=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $found_ip -eq 0 ]; then
|
||||
mcast_addrs="$mcast_addrs $grp_ip"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
|
||||
json_init
|
||||
json_add_array "snooping"
|
||||
json_add_object ""
|
||||
IFS=" "
|
||||
for intf in $ifaces; do
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
IFS=" "
|
||||
for gip_addr in $mcast_addrs; do
|
||||
grp_obj_added=0
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
grp_ip="$(echo $line | awk -F ' ' '{ print $10 }')"
|
||||
if [ "$grp_ip" != "$gip_addr" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ $grp_obj_added -eq 0 ]; then
|
||||
json_add_object ""
|
||||
gip="$(ipcalc.sh $gip_addr | grep IP | awk '{print substr($0,4)}')"
|
||||
json_add_string "groupaddr" "$gip"
|
||||
json_add_array "clients"
|
||||
grp_obj_added=1
|
||||
fi
|
||||
|
||||
json_add_object ""
|
||||
host_ip="$(echo $line | awk -F ' ' '{ print $14 }')"
|
||||
h_ip="$(ipcalc.sh $host_ip | grep IP | awk '{print substr($0,4)}')"
|
||||
json_add_string "ipaddr" "$h_ip"
|
||||
src_port="$(echo $line | awk -F ' ' '{ print $2 }')"
|
||||
json_add_string "device" "$src_port"
|
||||
timeout="$(echo $line | awk -F ' ' '{ print $15 }')"
|
||||
json_add_int "timeout" "$timeout"
|
||||
json_close_object #close the associated device object
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
done # close the loop for group addresses
|
||||
json_close_array #close the groups array
|
||||
done # close the loop for interfaces
|
||||
json_close_object # close the snooping object
|
||||
json_close_array # close the snooping array
|
||||
json_dump
|
||||
|
||||
rm -f /tmp/igmp_stats
|
||||
}
|
||||
2
mcastmngr/files/linux/etc/firewall.mcast
Normal file
2
mcastmngr/files/linux/etc/firewall.mcast
Normal file
@@ -0,0 +1,2 @@
|
||||
# Forward multicast packets from wan to lan
|
||||
iptables -t filter -A zone_wan_forward -p udp -d 224.0.0.0/240.0.0.0 -m comment --comment "!fw3: Allow-Multicast-UDP" -j zone_lan_dest_ACCEPT
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
# Add firewall include instance
|
||||
uci -q batch <<-EOT
|
||||
delete firewall.mcast
|
||||
set firewall.mcast=include
|
||||
set firewall.mcast.path=/etc/firewall.mcast
|
||||
set firewall.mcast.reload=1
|
||||
commit firewall
|
||||
EOT
|
||||
149
mcastmngr/files/linux/lib/mcast/linux.sh
Executable file
149
mcastmngr/files/linux/lib/mcast/linux.sh
Executable file
@@ -0,0 +1,149 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/mcast/common.sh
|
||||
|
||||
include /lib/network
|
||||
|
||||
CONFFILE=
|
||||
PROG_EXE=/usr/sbin/mcproxy
|
||||
PROG_PARAMS=
|
||||
PROG_PARAMS_SEPARATOR=:
|
||||
|
||||
setup_mcast_mode() {
|
||||
unused(){ :;}
|
||||
}
|
||||
|
||||
config_mcproxy_interfaces() {
|
||||
local upstreams="$1"
|
||||
local downstreams="$2"
|
||||
local exceptions="$3"
|
||||
|
||||
local str_up=""
|
||||
if [ -n "$upstreams" ]; then
|
||||
for upstream in $upstreams; do
|
||||
str_up="$str_up \"$upstream\""
|
||||
done
|
||||
fi
|
||||
|
||||
local str_down=""
|
||||
if [ -n "$downstreams" ]; then
|
||||
for downstream in $downstreams; do
|
||||
str_down="$str_down \"$downstream\""
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ! -z $downstream ]; then
|
||||
echo -e "pinstance main:$str_up ==>$str_down;\n" >> $CONFFILE
|
||||
fi
|
||||
|
||||
|
||||
if [ -z "$exceptions" ] || [ -z "$upstreams" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
for upstream in $upstreams; do
|
||||
local filter=""
|
||||
for excp in $exceptions; do
|
||||
case $excp in
|
||||
*/*)
|
||||
ip_start="$(ipcalc.sh $excp | grep IP | awk '{print substr($0,4)}')"
|
||||
ip_end="$(ipcalc.sh $excp | grep BROADCAST | awk '{print substr($0,11)}')"
|
||||
filter="$filter ($ip_start - $ip_end | *)"
|
||||
;;
|
||||
*)
|
||||
filter="$filter ($excp | *)"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "pinstance main upstream \"$upstream\" in blacklist table{$filter };" >> $CONFFILE
|
||||
echo "pinstance main upstream \"$upstream\" out blacklist table{$filter };" >> $CONFFILE
|
||||
done
|
||||
}
|
||||
|
||||
config_mcproxy_instance() {
|
||||
local protocol="$1"
|
||||
local version="$2"
|
||||
|
||||
local robustness=
|
||||
local query_interval=
|
||||
local q_resp_interval=
|
||||
local last_mem_q_int=
|
||||
local fast_leave=0
|
||||
local exceptions=
|
||||
local upstreams=
|
||||
local downstreams=
|
||||
|
||||
CONFFILE=/var/etc/mcproxy_"$protocol".conf
|
||||
rm -f $CONFFILE
|
||||
touch $CONFFILE
|
||||
|
||||
if [ "$protocol" == "igmp" ]; then
|
||||
case "$version" in
|
||||
[1-3])
|
||||
echo -e "protocol IGMPv${version};\n" >> $CONFFILE
|
||||
;;
|
||||
*)
|
||||
echo -e "protocol IGMPv2;\n" >> $CONFFILE
|
||||
;;
|
||||
esac
|
||||
|
||||
robustness=$igmp_p_robustness
|
||||
query_interval=$igmp_query_interval
|
||||
q_resp_interval=$igmp_q_resp_interval
|
||||
last_mem_q_int=$igmp_last_mem_q_int
|
||||
fast_leave=$igmp_fast_leave
|
||||
exceptions=$igmp_p_exceptions
|
||||
|
||||
upstreams=$igmp_p_up_interfaces
|
||||
downstreams=$igmp_p_down_interfaces
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
case "$version" in
|
||||
[1-2])
|
||||
echo -e "protocol MLDv${version};\n" >> $CONFFILE
|
||||
;;
|
||||
*)
|
||||
echo -e "protocol MLDv2;\n" >> $CONFFILE
|
||||
;;
|
||||
esac
|
||||
|
||||
robustness=$mld_p_robustness
|
||||
query_interval=$mld_query_interval
|
||||
q_resp_interval=$mld_q_resp_interval
|
||||
last_mem_q_int=$mld_last_mem_q_int
|
||||
fast_leave=$mld_fast_leave
|
||||
exceptions=$mld_p_exceptions
|
||||
|
||||
upstreams=$mld_p_up_interfaces
|
||||
downstreams=$mld_p_down_interfaces
|
||||
fi
|
||||
|
||||
[ -n "$robustness" ] && echo -e "rv $robustness;" >> $CONFFILE
|
||||
[ -n "$query_interval" ] && echo -e "qi $query_interval;" >> $CONFFILE
|
||||
[ -n "$q_resp_interval" ] && echo -e "qri $q_resp_interval;" >> $CONFFILE
|
||||
[ -n "$last_mem_q_int" ] && echo -e "lmqi $last_mem_q_int;" >> $CONFFILE
|
||||
[ -n "$fast_leave" ] && echo -e "fastleave $fast_leave;\n" >> $CONFFILE
|
||||
|
||||
[ -n "$upstreams" ] && [ -n "$downstreams" ] &&
|
||||
config_mcproxy_interfaces "$upstreams" "$downstreams" "$exceptions"
|
||||
|
||||
PROG_PARAMS="${PROG_PARAMS} -f ${CONFFILE}${PROG_PARAMS_SEPARATOR}"
|
||||
}
|
||||
|
||||
config_mcproxy() {
|
||||
if [ "$igmp_p_enable" == "1" ]; then
|
||||
config_mcproxy_instance igmp "$igmp_p_version"
|
||||
fi
|
||||
|
||||
if [ "$mld_p_enable" == "1" ]; then
|
||||
config_mcproxy_instance mld "$mld_p_version"
|
||||
fi
|
||||
}
|
||||
|
||||
configure_mcast() {
|
||||
config_global_params "set_max_groups_and_sources"
|
||||
|
||||
read_mcast_snooping_params
|
||||
read_mcast_proxy_params
|
||||
|
||||
config_mcproxy
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions.sh
|
||||
include /lib/mcast
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "stats":{} }'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
stats)
|
||||
read_mcast_stats
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
@@ -6,19 +6,22 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obudpst
|
||||
PKG_VERSION:=7.2.1
|
||||
PKG_SOURCE_VERSION:=9c448095c9773bd7e5cea143af07817ad9f3c6ba
|
||||
PKG_VERSION:=7.5.1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/BroadbandForum/obudpst.git
|
||||
PKG_SOURCE_VERSION:=a8faf1925ea9189467e7f8d3b9d93c67c8b927bd
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
CMAKE_OPTIONS += -DDISABLE_INT_TIMER=ON
|
||||
|
||||
define Package/obudpst
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS+=+libopenssl
|
||||
@@ -39,4 +42,10 @@ define Package/obudpst/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/udpst $(1)/usr/sbin/udpst
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/obudpst
|
||||
$(CP) $(HOST_BUILD_DIR)/udpst $(STAGING_DIR_HOST)/obudpst/
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call BuildPackage,obudpst))
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=6.0.0.14
|
||||
PKG_VERSION:=7.0.0.9
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/obuspa.git
|
||||
PKG_SOURCE_VERSION:=3df3346238a9eef2168fddadcef01ebe311053e4
|
||||
PKG_SOURCE_VERSION:=0a2a3481dddea672a2b12d1fcaa689d7fa761fe3
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -110,7 +110,7 @@ define Package/obuspa/install
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/USPAgent.json $(1)/etc/bbfdm/json/USPAgent.json
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/TransferComplete.json $(1)/etc/bbfdm/json/TransferComplete.json
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/50-add-mqtt-usp-test $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/05-obuspa-mqtt-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,obuspa))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
config obuspa 'global'
|
||||
option enabled '1'
|
||||
option debug '1'
|
||||
option debug '0'
|
||||
option log_level '1'
|
||||
option prototrace '0'
|
||||
option db_file '/etc/obuspa/usp.db'
|
||||
|
||||
@@ -970,7 +970,7 @@ delete_sql_db_entry_with_pattern()
|
||||
return 0;
|
||||
fi
|
||||
|
||||
params="$(grep ${pattern} ${DB_DUMP}|awk '{print $1}')"
|
||||
params="$(grep "${pattern}" ${DB_DUMP}|awk '{print $1}')"
|
||||
for p in ${params}; do
|
||||
db_del_sql "${p}"
|
||||
done
|
||||
@@ -981,7 +981,7 @@ check_n_delete_db()
|
||||
local sec t r path
|
||||
|
||||
sec="${1}"
|
||||
if uci -q get obuspa.${sec} >/dev/null 2>&1; then
|
||||
if uci -q get obuspa."${sec}" >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -1032,7 +1032,7 @@ db_init()
|
||||
fi
|
||||
|
||||
# remove entries from db if deleted from uci
|
||||
if [ -f "${DB_DUMP}" ] && [ "${reason}" == "update" ] && [ -f "/tmp/obuspa/obuspa" ]; then
|
||||
if [ -f "${DB_DUMP}" ] && [ "${reason}" = "update" ] && [ -f "/tmp/obuspa/obuspa" ]; then
|
||||
reverse_update_db_with_uci
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"dmcaching_exclude": [
|
||||
"Device.InterfaceStack.",
|
||||
"Device.Hosts.Host.",
|
||||
"Device.IEEE1905.",
|
||||
"Device.WiFi.DataElements."
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
fix_stomp_section() {
|
||||
local encryption
|
||||
|
||||
config_get_bool encryption $1 encryption ""
|
||||
config_get_bool encryption "${1}" encryption ""
|
||||
if [ -n "${encryption}" ]; then
|
||||
uci_set obuspa $1 encryption ""
|
||||
uci_set obuspa $1 EnableEncryption "$encryption"
|
||||
uci_set obuspa "${1}" encryption ""
|
||||
uci_set obuspa "${1}" EnableEncryption "$encryption"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
22
obuspa/files/etc/uci-defaults/05-obuspa-mqtt-config
Executable file
22
obuspa/files/etc/uci-defaults/05-obuspa-mqtt-config
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
if [ ! -f "/etc/config/mosquitto" ]; then
|
||||
echo "Local mosquitto broker not available"
|
||||
return 0
|
||||
fi
|
||||
|
||||
add_obuspa_config()
|
||||
{
|
||||
if ! uci_get mosquitto obuspa >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener obuspa
|
||||
uci_set mosquitto obuspa enabled 1
|
||||
uci_set mosquitto obuspa port '1883'
|
||||
uci_set mosquitto obuspa no_remote_access '1'
|
||||
uci_set mosquitto obuspa allow_anonymous '1'
|
||||
fi
|
||||
}
|
||||
|
||||
uci_load mosquitto
|
||||
add_obuspa_config
|
||||
@@ -1,14 +0,0 @@
|
||||
add_usp_test()
|
||||
{
|
||||
if ! uci_get mosquitto usptest >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener usptest
|
||||
uci_set mosquitto usptest enabled 1
|
||||
uci_set mosquitto usptest port '9001'
|
||||
uci_set mosquitto usptest protocol 'websockets'
|
||||
uci_set mosquitto usptest require_certificates '0'
|
||||
uci_set mosquitto usptest auth_plugin '/usr/lib/mosquitto_auth_shadow.so'
|
||||
fi
|
||||
}
|
||||
|
||||
uci_load mosquitto
|
||||
add_usp_test
|
||||
@@ -1,140 +0,0 @@
|
||||
diff --git a/src/core/device.h b/src/core/device.h
|
||||
index adf8fa6..072f953 100644
|
||||
--- a/src/core/device.h
|
||||
+++ b/src/core/device.h
|
||||
@@ -111,6 +111,7 @@ typedef struct
|
||||
// Following member variables only set if USP message was received over MQTT
|
||||
int mqtt_instance;
|
||||
char *mqtt_topic; // only set if reply_to was specified in the received MQTT packet
|
||||
+ char *mqtt_topic_recv;
|
||||
|
||||
|
||||
// Following member variables only set if USP message was received over CoAP
|
||||
@@ -252,7 +253,7 @@ void DEVICE_MTP_NotifyMqttConnDeleted(int mqtt_instance);
|
||||
int DEVICE_MTP_ValidateMqttReference(dm_req_t *req, char *value);
|
||||
void DEVICE_CONTROLLER_SetRolesFromMqtt(int mqtt_instance, ctrust_role_t role);
|
||||
char *DEVICE_CONTROLLER_GetControllerTopic(int mqtt_instance);
|
||||
-
|
||||
+int validate_controller_topic_by_endpointid(char *endpointid, mtp_protocol_t proto, char *recv_topic);
|
||||
//------------------------------------------------------------------------------
|
||||
// Tables used to convert to/from an enumeration to/from a string
|
||||
extern const enum_entry_t mtp_protocols[kMtpProtocol_Max];
|
||||
diff --git a/src/core/device_controller.c b/src/core/device_controller.c
|
||||
index 62c803f..103388d 100755
|
||||
--- a/src/core/device_controller.c
|
||||
+++ b/src/core/device_controller.c
|
||||
@@ -239,6 +239,41 @@ int Async_E2ESessionReset(dm_req_t *req, kv_vector_t *input_args, int request);
|
||||
extern const enum_entry_t e2e_session_modes[kE2EMode_Max];
|
||||
#endif
|
||||
|
||||
+
|
||||
+int validate_controller_topic_by_endpointid(char *endpointid, mtp_protocol_t proto, char *recv_topic)
|
||||
+{
|
||||
+ controller_t *cont = FindEnabledControllerByEndpointId(endpointid);
|
||||
+ if (cont == NULL)
|
||||
+ {
|
||||
+ USP_LOG_Error("not able to find the controller from endpointid [%s]", endpointid);
|
||||
+ return USP_ERR_PERMISSION_DENIED;
|
||||
+ }
|
||||
+#ifdef ENABLE_MQTT
|
||||
+ if (proto == kMtpProtocol_MQTT)
|
||||
+ {
|
||||
+ controller_mtp_t *mtp = FindFirstEnabledMtp(cont, proto);
|
||||
+
|
||||
+ if (mtp == NULL) {
|
||||
+ USP_LOG_Error("Not able to find mtp[%d] for endpointid [%s]", proto, endpointid);
|
||||
+ return USP_ERR_REQUEST_DENIED;
|
||||
+ }
|
||||
+
|
||||
+ if (mtp->protocol != proto) {
|
||||
+ USP_LOG_Error("No matching mtp[%d] for endpointid [%s]", proto, endpointid);
|
||||
+ return USP_ERR_REQUEST_DENIED;
|
||||
+ }
|
||||
+
|
||||
+ char *response_topic = DEVICE_MTP_GetAgentMqttResponseTopic(mtp->mqtt_connection_instance);
|
||||
+ if (response_topic && strcmp(response_topic, recv_topic) != 0 ) {
|
||||
+ USP_LOG_Error("Controller response topic[%s] and recv topic[%s] mismatch, probably a spoof message", response_topic, recv_topic);
|
||||
+ return USP_ERR_PERMISSION_DENIED;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ return USP_ERR_OK;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** DEVICE_CONTROLLER_Init
|
||||
diff --git a/src/core/dm_exec.c b/src/core/dm_exec.c
|
||||
index c0b95d8..6eb51e2 100755
|
||||
--- a/src/core/dm_exec.c
|
||||
+++ b/src/core/dm_exec.c
|
||||
@@ -624,6 +624,7 @@ void DM_EXEC_PostUspRecord(unsigned char *pbuf, int pbuf_len, ctrust_role_t role
|
||||
pur->mtp_reply_to.coap_encryption = mrt->coap_encryption;
|
||||
pur->mtp_reply_to.coap_reset_session_hint = mrt->coap_reset_session_hint;
|
||||
pur->mtp_reply_to.mqtt_topic = USP_STRDUP(mrt->mqtt_topic);
|
||||
+ pur->mtp_reply_to.mqtt_topic_recv = USP_STRDUP(mrt->mqtt_topic_recv);
|
||||
pur->mtp_reply_to.mqtt_instance = mrt->mqtt_instance;
|
||||
pur->mtp_reply_to.wsclient_cont_instance = mrt->wsclient_cont_instance;
|
||||
pur->mtp_reply_to.wsclient_mtp_instance = mrt->wsclient_mtp_instance;
|
||||
@@ -1144,6 +1145,7 @@ void ProcessMessageQueueSocketActivity(socket_set_t *set)
|
||||
USP_SAFE_FREE(mrt->coap_resource);
|
||||
USP_SAFE_FREE(mrt->mqtt_topic);
|
||||
USP_SAFE_FREE(mrt->cont_endpoint_id);
|
||||
+ USP_SAFE_FREE(mrt->mqtt_topic_recv);
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_STOMP
|
||||
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
|
||||
index 7dba9f4..3ee9c97 100644
|
||||
--- a/src/core/mqtt.c
|
||||
+++ b/src/core/mqtt.c
|
||||
@@ -3141,6 +3141,7 @@ void ReceiveMqttMessage(mqtt_client_t *client, const struct mosquitto_message *m
|
||||
mrt.mqtt_topic = response_topic;
|
||||
}
|
||||
|
||||
+ mrt.mqtt_topic_recv = message->topic;
|
||||
// Message may not be valid USP
|
||||
DM_EXEC_PostUspRecord(message->payload, message->payloadlen, client->role, &mrt);
|
||||
}
|
||||
diff --git a/src/core/msg_handler.c b/src/core/msg_handler.c
|
||||
index ce67626..4af9ade 100644
|
||||
--- a/src/core/msg_handler.c
|
||||
+++ b/src/core/msg_handler.c
|
||||
@@ -118,7 +118,7 @@ static enum_entry_t mtp_content_types[] = {
|
||||
//------------------------------------------------------------------------------
|
||||
// Forward declarations. Note these are not static, because we need them in the symbol table for USP_LOG_Callstack() to show them
|
||||
int HandleUspMessage(Usp__Msg *usp, char *controller_endpoint, mtp_reply_to_t *mrt);
|
||||
-int ValidateUspRecord(UspRecord__Record *rec);
|
||||
+int ValidateUspRecord(UspRecord__Record *rec, mtp_reply_to_t *mrt);
|
||||
char *MtpSendItemToString(mtp_send_item_t *msi);
|
||||
void CacheControllerRoleForCurMsg(char *endpoint_id, ctrust_role_t role, mtp_protocol_t protocol);
|
||||
int QueueUspNoSessionRecord(usp_send_item_t *usi, char *endpoint_id, char *usp_msg_id, mtp_reply_to_t *mrt, time_t expiry_time);
|
||||
@@ -172,7 +172,7 @@ int MSG_HANDLER_HandleBinaryRecord(unsigned char *pbuf, int pbuf_len, ctrust_rol
|
||||
#endif
|
||||
|
||||
// Exit if USP record failed validation
|
||||
- err = ValidateUspRecord(rec);
|
||||
+ err = ValidateUspRecord(rec, mrt);
|
||||
if (err != USP_ERR_OK)
|
||||
{
|
||||
goto exit;
|
||||
@@ -725,7 +725,7 @@ exit:
|
||||
** \return USP_ERR_OK if record is valid
|
||||
**
|
||||
**************************************************************************/
|
||||
-int ValidateUspRecord(UspRecord__Record *rec)
|
||||
+int ValidateUspRecord(UspRecord__Record *rec, mtp_reply_to_t *mrt)
|
||||
{
|
||||
char *endpoint_id;
|
||||
|
||||
@@ -806,6 +806,9 @@ int ValidateUspRecord(UspRecord__Record *rec)
|
||||
return USP_ERR_REQUEST_DENIED;
|
||||
}
|
||||
|
||||
+#if OBUSPA_CONTROLLER_MTP_VERIFY
|
||||
+ return validate_controller_topic_by_endpointid(rec->from_id, mrt->protocol, mrt->mqtt_topic_recv);
|
||||
+#endif
|
||||
// If the code gets here, then the USP record passed validation, and the encapsulated USP message may be processed
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
void DM_PRIV_RequestInit(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst);
|
||||
--- a/src/core/msg_handler.c
|
||||
+++ b/src/core/msg_handler.c
|
||||
@@ -839,6 +839,20 @@ char *MtpSendItemToString(mtp_send_item_
|
||||
@@ -893,6 +893,20 @@ char *MtpSendItemToString(mtp_send_item_
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
|
||||
20
obuspa/patches/0004-suppress-notification-logs.patch
Normal file
20
obuspa/patches/0004-suppress-notification-logs.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
--- a/src/core/data_model.c
|
||||
+++ b/src/core/data_model.c
|
||||
@@ -1239,7 +1239,7 @@ int DATA_MODEL_NotifyInstanceAdded(char
|
||||
// Exit if instance already exists - nothing to do
|
||||
if (exists)
|
||||
{
|
||||
- USP_ERR_SetMessage("%s: Object (%s) already exists in the data model", __FUNCTION__, path);
|
||||
+ // USP_ERR_SetMessage("%s: Object (%s) already exists in the data model", __FUNCTION__, path);
|
||||
return USP_ERR_CREATION_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,7 @@ int DATA_MODEL_NotifyInstanceDeleted(cha
|
||||
// Exit if instance does not exist - nothing to do
|
||||
if (exists == false)
|
||||
{
|
||||
- USP_ERR_SetMessage("%s: Object (%s) does not exist in the data model", __FUNCTION__, path);
|
||||
+ // USP_ERR_SetMessage("%s: Object (%s) does not exist in the data model", __FUNCTION__, path);
|
||||
return USP_ERR_OBJECT_DOES_NOT_EXIST;
|
||||
}
|
||||
|
||||
22
obuspa/patches/0005-optimise_ubus_calls_cli.patch
Normal file
22
obuspa/patches/0005-optimise_ubus_calls_cli.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
diff --git a/src/core/data_model.c b/src/core/data_model.c
|
||||
index 2cf4b6c..b92cf59 100644
|
||||
--- a/src/core/data_model.c
|
||||
+++ b/src/core/data_model.c
|
||||
@@ -136,6 +136,7 @@ void DumpDataModelNodeMap(void);
|
||||
int GetVendorParam(dm_node_t *node, char *path, dm_instances_t *inst, char *buf, int len, dm_req_t *req);
|
||||
int SetVendorParam(dm_node_t *node, char *path, dm_instances_t *inst, char *value, dm_req_t *req);
|
||||
|
||||
+extern bool is_running_cli_local_command;
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** DATA_MODEL_Init
|
||||
@@ -223,7 +224,9 @@ int DATA_MODEL_Init(void)
|
||||
}
|
||||
|
||||
// Set the default values of OUI, Serial Number and (LocalAgent) EndpointID, and cache EndpointID
|
||||
+ if (is_running_cli_local_command == false) {
|
||||
err = DEVICE_LOCAL_AGENT_SetDefaults();
|
||||
+ }
|
||||
if (err != USP_ERR_OK)
|
||||
{
|
||||
return err;
|
||||
372
obuspa/patches/0006-bdc_json_obj_hierarchy.patch
Normal file
372
obuspa/patches/0006-bdc_json_obj_hierarchy.patch
Normal file
@@ -0,0 +1,372 @@
|
||||
diff --git a/src/core/bdc_exec.c b/src/core/bdc_exec.c
|
||||
index 6b5c11d..3670361 100644
|
||||
--- a/src/core/bdc_exec.c
|
||||
+++ b/src/core/bdc_exec.c
|
||||
@@ -548,9 +548,14 @@ int StartSendingReport(bdc_connection_t *bc)
|
||||
// Set the list of headers
|
||||
bc->headers = NULL;
|
||||
bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
|
||||
- bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
|
||||
+ if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER)
|
||||
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ObjectHierarchy");
|
||||
+ else
|
||||
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
|
||||
+
|
||||
if (bc->flags & BDC_FLAG_GZIP)
|
||||
{
|
||||
+ curl_easy_setopt(curl_ctx, CURLOPT_ACCEPT_ENCODING, "gzip");
|
||||
bc->headers = curl_slist_append(bc->headers, "Content-Encoding: gzip");
|
||||
}
|
||||
|
||||
diff --git a/src/core/bdc_exec.h b/src/core/bdc_exec.h
|
||||
index c58c6d5..ff37a2d 100644
|
||||
--- a/src/core/bdc_exec.h
|
||||
+++ b/src/core/bdc_exec.h
|
||||
@@ -53,6 +53,6 @@ void BDC_EXEC_ScheduleExit(void);
|
||||
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
|
||||
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
|
||||
#define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post.
|
||||
-
|
||||
+#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be ObjectHierarchy otherwise NameValuePair
|
||||
|
||||
#endif
|
||||
diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c
|
||||
index 5b1aff2..a7d1b3e 100755
|
||||
--- a/src/core/device_bulkdata.c
|
||||
+++ b/src/core/device_bulkdata.c
|
||||
@@ -68,7 +68,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions for formats that we support
|
||||
#define BULKDATA_ENCODING_TYPE "JSON"
|
||||
-#define BULKDATA_JSON_REPORT_FORMAT "NameValuePair"
|
||||
+#define BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE "NameValuePair"
|
||||
+#define BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER "ObjectHierarchy"
|
||||
|
||||
|
||||
// Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
@@ -159,6 +160,7 @@ typedef struct
|
||||
char compression[9];
|
||||
char method[9];
|
||||
bool use_date_header;
|
||||
+ char report_format[20];
|
||||
} profile_ctrl_params_t;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -233,7 +235,7 @@ bulkdata_profile_t *bulkdata_find_free_profile(void);
|
||||
bulkdata_profile_t *bulkdata_find_profile(int profile_id);
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
|
||||
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
|
||||
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp);
|
||||
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
|
||||
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
|
||||
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
|
||||
int bulkdata_start_profile(bulkdata_profile_t *bp);
|
||||
@@ -307,7 +309,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Parameter.{i}.Reference", "", Validate_BulkDataReference, NULL, DM_STRING);
|
||||
|
||||
// Device.BulkData.Profile.{i}.JSONEncoding
|
||||
- err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT, Validate_BulkDataReportFormat, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
|
||||
|
||||
// Device.BulkData.Profile.{i}.HTTP
|
||||
@@ -661,9 +663,11 @@ int Validate_BulkDataReference(dm_req_t *req, char *value)
|
||||
int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
- if (strcmp(value, BULKDATA_JSON_REPORT_FORMAT) != 0)
|
||||
+ if (strcmp(value, BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE) != 0 &&
|
||||
+ strcmp(value, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) != 0)
|
||||
{
|
||||
- USP_ERR_SetMessage("%s: Only JSON Report Format supported is '%s'", __FUNCTION__, BULKDATA_JSON_REPORT_FORMAT);
|
||||
+ USP_ERR_SetMessage("%s: Only JSON Report Format supported are '%s', '%s'", __FUNCTION__,
|
||||
+ BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER);
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -1974,6 +1978,14 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
|
||||
return err;
|
||||
}
|
||||
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_format, sizeof(ctrl_params->report_format), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
@@ -2249,7 +2261,7 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
- json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp);
|
||||
+ json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
|
||||
if (json_report == NULL)
|
||||
{
|
||||
USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
@@ -2299,7 +2311,8 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
kv_pair_t kv;
|
||||
report_t *cur_report;
|
||||
char *json_report;
|
||||
- char report_timestamp[33];
|
||||
+ char report_timestamp[33] = {0};
|
||||
+ char report_format[20] = {0};
|
||||
|
||||
// Exit if the MTP has not been connected to successfully after bootup
|
||||
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
|
||||
@@ -2316,6 +2329,14 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
// When sending via USP events, only one report is ever sent in each USP event
|
||||
// So ensure all retained reports are removed. NOTE: Clearing the reports here is only necessary when switching protocol from HTTP to USP event, and where HTTP had some unsent reports
|
||||
bulkdata_clear_retained_reports(bp);
|
||||
@@ -2333,7 +2354,7 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
bp->num_retained_reports = 1;
|
||||
|
||||
// Exit if unable to generate the report
|
||||
- json_report = bulkdata_generate_json_report(bp, report_timestamp);
|
||||
+ json_report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
|
||||
if (json_report == NULL)
|
||||
{
|
||||
USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
@@ -2545,21 +2566,7 @@ int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *ou
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
-/*********************************************************************//**
|
||||
-**
|
||||
-** bulkdata_generate_json_report
|
||||
-**
|
||||
-** Generates a JSON name-value pair format report
|
||||
-** NOTE: The report contains all retained failed reports, as well as the current report
|
||||
-** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
|
||||
-**
|
||||
-** \param bp - pointer to bulk data profile containing all reports (current and retained)
|
||||
-** \param report_timestamp - value of Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
-**
|
||||
-** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||
-**
|
||||
-**************************************************************************/
|
||||
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp)
|
||||
+static char *create_json_name_value_pair_report(bulkdata_profile_t *bp, char *report_timestamp)
|
||||
{
|
||||
JsonNode *top; // top of report
|
||||
JsonNode *array; // array of reports (retained + current)
|
||||
@@ -2574,7 +2581,6 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
long long value_as_ll;
|
||||
unsigned long long value_as_ull;
|
||||
bool value_as_bool;
|
||||
- char *result;
|
||||
int i, j;
|
||||
char buf[32];
|
||||
kv_pair_t *kv;
|
||||
@@ -2597,7 +2603,7 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
}
|
||||
else if (strcmp(report_timestamp, "ISO-8601")==0)
|
||||
{
|
||||
- result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
if (result != NULL)
|
||||
{
|
||||
json_append_member(element, "CollectionTime", json_mkstring(buf));
|
||||
@@ -2656,11 +2662,174 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
json_append_member(top, "Report", array);
|
||||
|
||||
// Serialize the JSON tree
|
||||
- result = json_stringify(top, " ");
|
||||
+ char *output = json_stringify(top, " ");
|
||||
+
|
||||
+ // Clean up the JSON tree
|
||||
+ json_delete(top); // Other JsonNodes which are children of this top level tree will be deleted
|
||||
+
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
+static char *create_json_obj_hier_report(bulkdata_profile_t *bp, char *report_timestamp)
|
||||
+{
|
||||
+ JsonNode *top; // top of report
|
||||
+ JsonNode *array; // array of reports (retained + current)
|
||||
+ JsonNode *element; // element of json array, containing an individual report
|
||||
+ JsonNode *temp;
|
||||
+ char *param_path;
|
||||
+ char *param_type_value;
|
||||
+ char param_type;
|
||||
+ char *param_value;
|
||||
+ kv_vector_t *report_map;
|
||||
+ report_t *report;
|
||||
+ double value_as_number;
|
||||
+ long long value_as_ll;
|
||||
+ unsigned long long value_as_ull;
|
||||
+ bool value_as_bool;
|
||||
+ int i, j;
|
||||
+ char buf[32];
|
||||
+ kv_pair_t *kv;
|
||||
+ int err;
|
||||
+
|
||||
+ top = json_mkobject();
|
||||
+ array = json_mkarray();
|
||||
+
|
||||
+ // Iterate over all reports adding them to the JSON array
|
||||
+ for (i=0; i < bp->num_retained_reports; i++)
|
||||
+ {
|
||||
+ report = &bp->reports[i];
|
||||
+ report_map = &report->report_map;
|
||||
+
|
||||
+ // Add Collection time to each json report element (only if specified and not 'None')
|
||||
+ element = json_mkobject();
|
||||
+ if (strcmp(report_timestamp, "Unix-Epoch")==0)
|
||||
+ {
|
||||
+ json_append_member(element, "CollectionTime", json_mknumber(report->collection_time));
|
||||
+ }
|
||||
+ else if (strcmp(report_timestamp, "ISO-8601")==0)
|
||||
+ {
|
||||
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
+ if (result != NULL)
|
||||
+ {
|
||||
+ json_append_member(element, "CollectionTime", json_mkstring(buf));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ temp = element;
|
||||
+ // Iterate over each parameter, adding it to the json element. Take account of the parameter's type
|
||||
+ for (j=0; j < report_map->num_entries; j++)
|
||||
+ {
|
||||
+ char buff[2056] = {0};
|
||||
+ char *pch = NULL, *pchr = NULL, *argv[128] = {0};
|
||||
+ int n = 0;
|
||||
+
|
||||
+ kv = &report_map->vector[j];
|
||||
+ param_path = kv->key;
|
||||
+ param_type_value = kv->value;
|
||||
+ param_type = param_type_value[0]; // First character denotes the type of the parameter
|
||||
+ param_value = ¶m_type_value[1]; // Subsequent characters contain the parameter's value
|
||||
+
|
||||
+ strncpy(buff, param_path, sizeof(buff));
|
||||
+ for (pch = strtok_r(buff, ".", &pchr); pch != NULL; pch = strtok_r(NULL, ".", &pchr)) {
|
||||
+ int idx;
|
||||
+ JsonNode *obj = element;
|
||||
+ argv[n] = pch;
|
||||
+
|
||||
+ for (idx = 0; idx <= n; idx++) {
|
||||
+ if (obj == NULL)
|
||||
+ break;
|
||||
+ obj = json_find_member(obj, argv[idx]);
|
||||
+ }
|
||||
+
|
||||
+ if (obj)
|
||||
+ temp = obj;
|
||||
+ else {
|
||||
+ if (pchr != NULL && *pchr != '\0') {
|
||||
+ // It is a DMOBJ
|
||||
+ JsonNode *new = json_mkobject();
|
||||
+ json_append_member(temp, pch, new);
|
||||
+ temp = new;
|
||||
+ } else {
|
||||
+ // It is a DMPARAM
|
||||
+ switch (param_type)
|
||||
+ {
|
||||
+ case 'S':
|
||||
+ json_append_member(temp, pch, json_mkstring(param_value) );
|
||||
+ break;
|
||||
+
|
||||
+ case 'U':
|
||||
+ value_as_ull = strtoull(param_value, NULL, 10);
|
||||
+ json_append_member(temp, pch, json_mkulonglong(value_as_ull) );
|
||||
+ break;
|
||||
+
|
||||
+ case 'L':
|
||||
+ value_as_ll = strtoll(param_value, NULL, 10);
|
||||
+ json_append_member(temp, pch, json_mklonglong(value_as_ll) );
|
||||
+ break;
|
||||
+
|
||||
+ case 'N':
|
||||
+ value_as_number = atof(param_value);
|
||||
+ json_append_member(temp, pch, json_mknumber(value_as_number) );
|
||||
+ break;
|
||||
+
|
||||
+ case 'B':
|
||||
+ err = TEXT_UTILS_StringToBool(param_value, &value_as_bool);
|
||||
+ if (err == USP_ERR_OK)
|
||||
+ {
|
||||
+ json_append_member(temp, pch, json_mkbool(value_as_bool) );
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ USP_ERR_SetMessage("%s: Invalid JSON parameter type ('%c') in report map for %s", __FUNCTION__, param_type_value[0], param_path);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ n++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Add the json element to the json array
|
||||
+ json_append_element(array, element);
|
||||
+ }
|
||||
+
|
||||
+ // Finally add the array to the report top level
|
||||
+ json_append_member(top, "Report", array);
|
||||
+
|
||||
+ // Serialize the JSON tree
|
||||
+ char *output = json_stringify(top, " ");
|
||||
|
||||
// Clean up the JSON tree
|
||||
json_delete(top); // Other JsonNodes which are children of this top level tree will be deleted
|
||||
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** bulkdata_generate_json_report
|
||||
+**
|
||||
+** Generates a JSON name-value pair or object-hierarchy format report
|
||||
+** NOTE: The report contains all retained failed reports, as well as the current report
|
||||
+** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
|
||||
+**
|
||||
+** \param bp - pointer to bulk data profile containing all reports (current and retained)
|
||||
+** \param report_timestamp - value of Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
+**
|
||||
+** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format)
|
||||
+{
|
||||
+ char *result = NULL;
|
||||
+
|
||||
+ if (strcmp(report_format, BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE) == 0) {
|
||||
+ result = create_json_name_value_pair_report(bp, report_timestamp);
|
||||
+ } else if (strcmp(report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0) {
|
||||
+ result = create_json_obj_hier_report(bp, report_timestamp);
|
||||
+ }
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2817,6 +2986,11 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
|
||||
flags |= BDC_FLAG_DATE_HEADER;
|
||||
}
|
||||
|
||||
+ if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0)
|
||||
+ {
|
||||
+ flags |= BDC_FLAG_HEADER_OBJ_HIER;
|
||||
+ }
|
||||
+
|
||||
// Exit if failed to post a message to BDC thread
|
||||
// NOTE: Ownership of full_url, query_string, report, username and password passes to BDC_EXEC
|
||||
err = BDC_EXEC_PostReportToSend(bp->profile_id, full_url, query_string, username, password, report, report_len, flags);
|
||||
673
obuspa/patches/0007-bdc_csv_format.patch
Normal file
673
obuspa/patches/0007-bdc_csv_format.patch
Normal file
@@ -0,0 +1,673 @@
|
||||
diff --git a/src/core/bdc_exec.c b/src/core/bdc_exec.c
|
||||
index 3670361..6a6325d 100644
|
||||
--- a/src/core/bdc_exec.c
|
||||
+++ b/src/core/bdc_exec.c
|
||||
@@ -547,11 +547,19 @@ int StartSendingReport(bdc_connection_t *bc)
|
||||
|
||||
// Set the list of headers
|
||||
bc->headers = NULL;
|
||||
- bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
|
||||
- if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER)
|
||||
+ if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER) {
|
||||
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
|
||||
bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ObjectHierarchy");
|
||||
- else
|
||||
+ } else if (bc->flags & BDC_FLAG_HEADER_NAME_VAL) {
|
||||
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
|
||||
bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
|
||||
+ } else if (bc->flags & BDC_FLAG_HEADER_PER_COL) {
|
||||
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: text/csv; charset=UTF-8");
|
||||
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ParameterPerColumn");
|
||||
+ } else {
|
||||
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: text/csv; charset=UTF-8");
|
||||
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ParameterPerRow");
|
||||
+ }
|
||||
|
||||
if (bc->flags & BDC_FLAG_GZIP)
|
||||
{
|
||||
diff --git a/src/core/bdc_exec.h b/src/core/bdc_exec.h
|
||||
index ff37a2d..ee29c85 100644
|
||||
--- a/src/core/bdc_exec.h
|
||||
+++ b/src/core/bdc_exec.h
|
||||
@@ -53,6 +53,9 @@ void BDC_EXEC_ScheduleExit(void);
|
||||
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
|
||||
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
|
||||
#define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post.
|
||||
-#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be ObjectHierarchy otherwise NameValuePair
|
||||
+#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be json ObjectHierarchy
|
||||
+#define BDC_FLAG_HEADER_NAME_VAL 0x00000010 // If set, report format in header would be json NameValuePair
|
||||
+#define BDC_FLAG_HEADER_PER_ROW 0x00000020 // If set, report format in header would be csv ParameterPerRow
|
||||
+#define BDC_FLAG_HEADER_PER_COL 0x00000040 // If set, report format in header would be csv ParameterPerColumn
|
||||
|
||||
#endif
|
||||
diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c
|
||||
index a7d1b3e..fab9731 100755
|
||||
--- a/src/core/device_bulkdata.c
|
||||
+++ b/src/core/device_bulkdata.c
|
||||
@@ -67,9 +67,12 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions for formats that we support
|
||||
-#define BULKDATA_ENCODING_TYPE "JSON"
|
||||
+#define BULKDATA_ENCODING_TYPE_JSON "JSON"
|
||||
+#define BULKDATA_ENCODING_TYPE_CSV "CSV"
|
||||
#define BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE "NameValuePair"
|
||||
#define BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER "ObjectHierarchy"
|
||||
+#define BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN "ParameterPerColumn"
|
||||
+#define BULKDATA_CSV_REPORT_FORMAT_PER_ROW "ParameterPerRow"
|
||||
|
||||
|
||||
// Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
@@ -153,6 +156,7 @@ static char *profile_push_event_args[] =
|
||||
typedef struct
|
||||
{
|
||||
int num_retained_failed_reports;
|
||||
+ char encoding_type[10];
|
||||
char report_timestamp[33];
|
||||
char url[1025];
|
||||
char username[257];
|
||||
@@ -161,6 +165,11 @@ typedef struct
|
||||
char method[9];
|
||||
bool use_date_header;
|
||||
char report_format[20];
|
||||
+ char field_separator[10];
|
||||
+ char row_separator[10];
|
||||
+ char escape_char[10];
|
||||
+ char csv_format[20];
|
||||
+ char row_timestamp[33];
|
||||
} profile_ctrl_params_t;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -208,6 +217,7 @@ int Validate_BulkDataEncodingType(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReportingInterval(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReference(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReportFormat(dm_req_t *req, char *value);
|
||||
+int Validate_BulkDataCSVReportFormat(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReportTimestamp(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataCompression(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
|
||||
@@ -236,6 +246,8 @@ bulkdata_profile_t *bulkdata_find_profile(int profile_id);
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
|
||||
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
|
||||
char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
|
||||
+char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator, char *row_separator,
|
||||
+ char *escape_char, char *csv_format, char *row_timestamp);
|
||||
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
|
||||
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
|
||||
int bulkdata_start_profile(bulkdata_profile_t *bp);
|
||||
@@ -250,6 +262,7 @@ char *bulkdata_platform_calc_uri_query_string(kv_vector_t *escaped_map);
|
||||
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
|
||||
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv);
|
||||
void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map);
|
||||
+void append_string_to_target(char *str, char **output);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
@@ -282,7 +295,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT);
|
||||
err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols));
|
||||
- err |= USP_REGISTER_Param_Constant("Device.BulkData.EncodingTypes", BULKDATA_ENCODING_TYPE, DM_STRING);
|
||||
+ err |= USP_REGISTER_Param_Constant("Device.BulkData.EncodingTypes", "CSV,JSON", DM_STRING);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT);
|
||||
@@ -297,7 +310,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING);
|
||||
- err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE, Validate_BulkDataEncodingType, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE_JSON, Validate_BulkDataEncodingType, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME);
|
||||
|
||||
@@ -312,6 +325,13 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
|
||||
|
||||
+ // Device.BulkData.Profile.{i}.CSVEncoding
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.FieldSeparator", ",", NULL, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.RowSeparator", " ", NULL, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.EscapeCharacter", """, NULL, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat", BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN, Validate_BulkDataCSVReportFormat, NULL, DM_STRING);
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.RowTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
|
||||
+
|
||||
// Device.BulkData.Profile.{i}.HTTP
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
|
||||
@@ -591,9 +611,10 @@ int Validate_BulkDataProtocol(dm_req_t *req, char *value)
|
||||
int Validate_BulkDataEncodingType(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
- if (strcmp(value, BULKDATA_ENCODING_TYPE) != 0)
|
||||
+ if (strcmp(value, BULKDATA_ENCODING_TYPE_JSON) != 0 && strcmp(value, BULKDATA_ENCODING_TYPE_CSV) != 0)
|
||||
{
|
||||
- USP_ERR_SetMessage("%s: Only EncodingType supported is '%s'", __FUNCTION__, BULKDATA_ENCODING_TYPE);
|
||||
+ USP_ERR_SetMessage("%s: Only EncodingType supported are '%s,%s'", __FUNCTION__,
|
||||
+ BULKDATA_ENCODING_TYPE_JSON, BULKDATA_ENCODING_TYPE_CSV);
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -674,6 +695,32 @@ int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** Validate_BulkDataCSVReportFormat
|
||||
+**
|
||||
+** Validates Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat
|
||||
+**
|
||||
+** \param req - pointer to structure identifying the parameter
|
||||
+** \param value - value that the controller would like to set the parameter to
|
||||
+**
|
||||
+** \return USP_ERR_OK if successful
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+int Validate_BulkDataCSVReportFormat(dm_req_t *req, char *value)
|
||||
+{
|
||||
+ // Exit if trying to set a value outside of the range we accept
|
||||
+ if (strcmp(value, BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN) != 0 &&
|
||||
+ strcmp(value, BULKDATA_CSV_REPORT_FORMAT_PER_ROW) != 0)
|
||||
+ {
|
||||
+ USP_ERR_SetMessage("%s: Only JSON Report Format supported are '%s', '%s'", __FUNCTION__,
|
||||
+ BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN, BULKDATA_CSV_REPORT_FORMAT_PER_ROW);
|
||||
+ return USP_ERR_INVALID_VALUE;
|
||||
+ }
|
||||
+
|
||||
+ return USP_ERR_OK;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** Validate_BulkDataReportTimestamp
|
||||
@@ -1970,6 +2017,14 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
|
||||
return err;
|
||||
}
|
||||
|
||||
+ // Exit if unable to get EncodingType
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.EncodingType", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->encoding_type, sizeof(ctrl_params->encoding_type), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
// Exit if unable to get ReportTimestamp
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
|
||||
@@ -1986,6 +2041,46 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
|
||||
return err;
|
||||
}
|
||||
|
||||
+ // Exit if unable to get FieldSeparator
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.FieldSeparator", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->field_separator, sizeof(ctrl_params->field_separator), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get RowSeparator
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowSeparator", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->row_separator, sizeof(ctrl_params->row_separator), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get EscapeCharacter
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.EscapeCharacter", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->escape_char, sizeof(ctrl_params->escape_char), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->csv_format, sizeof(ctrl_params->csv_format), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get RowTimestamp
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowTimestamp", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->row_timestamp, sizeof(ctrl_params->row_timestamp), 0);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
@@ -2222,7 +2317,7 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
{
|
||||
int err;
|
||||
report_t *cur_report;
|
||||
- char *json_report;
|
||||
+ char *report;
|
||||
profile_ctrl_params_t ctrl;
|
||||
unsigned char *compressed_report;
|
||||
int compressed_len;
|
||||
@@ -2261,10 +2356,23 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
- json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
|
||||
- if (json_report == NULL)
|
||||
- {
|
||||
- USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
+ if (strcmp(ctrl.encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||
+ report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
|
||||
+ if (report == NULL)
|
||||
+ {
|
||||
+ USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
+ return;
|
||||
+ }
|
||||
+ } else if (strcmp(ctrl.encoding_type, BULKDATA_ENCODING_TYPE_CSV) == 0) {
|
||||
+ report = bulkdata_generate_csv_report(bp, ctrl.field_separator, ctrl.row_separator, ctrl.escape_char,
|
||||
+ ctrl.csv_format, ctrl.row_timestamp);
|
||||
+ if (report == NULL)
|
||||
+ {
|
||||
+ USP_ERR_SetMessage("%s: bulkdata_generate_csv_report failed", __FUNCTION__);
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
+ USP_ERR_SetMessage("%s: bulkdata invalid report encoding type %s", __FUNCTION__, ctrl.encoding_type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2273,14 +2381,14 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
|
||||
if (enable_protocol_trace)
|
||||
{
|
||||
- USP_LOG_String(kLogLevel_Info, kLogType_Protocol, json_report);
|
||||
+ USP_LOG_String(kLogLevel_Info, kLogType_Protocol, report);
|
||||
}
|
||||
|
||||
// Compress the report, if enabled
|
||||
- compressed_report = bulkdata_compress_report(&ctrl, json_report, strlen(json_report), &compressed_len);
|
||||
- if (compressed_report != (unsigned char *)json_report)
|
||||
+ compressed_report = bulkdata_compress_report(&ctrl, report, strlen(report), &compressed_len);
|
||||
+ if (compressed_report != (unsigned char *)report)
|
||||
{
|
||||
- free(json_report);
|
||||
+ free(report);
|
||||
}
|
||||
// NOTE: From this point on, only the compressed_report exists
|
||||
|
||||
@@ -2310,9 +2418,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
kv_vector_t event_args;
|
||||
kv_pair_t kv;
|
||||
report_t *cur_report;
|
||||
- char *json_report;
|
||||
+ char *report;
|
||||
+ char encoding_type[10] = {0};
|
||||
char report_timestamp[33] = {0};
|
||||
char report_format[20] = {0};
|
||||
+ char field_separator[10];
|
||||
+ char row_separator[10];
|
||||
+ char escape_char[10];
|
||||
+ char csv_format[20];
|
||||
+ char row_timestamp[33];
|
||||
|
||||
// Exit if the MTP has not been connected to successfully after bootup
|
||||
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
|
||||
@@ -2321,20 +2435,62 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
- // Exit if unable to get ReportTimestamp
|
||||
- USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
- err = DATA_MODEL_GetParameterValue(path, report_timestamp, sizeof(report_timestamp), 0);
|
||||
- if (err != USP_ERR_OK)
|
||||
- {
|
||||
+ // Exit if unable to get EncodingType
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.EncodingType", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, encoding_type, sizeof(encoding_type), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
- // Exit if unable to get ReportFormat
|
||||
- USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
|
||||
- err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
|
||||
- if (err != USP_ERR_OK)
|
||||
- {
|
||||
- return;
|
||||
+ if (strcmp(encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||
+ // Exit if unable to get ReportTimestamp
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, report_timestamp, sizeof(report_timestamp), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
+ // Exit if unable to get FieldSeparator
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.FieldSeparator", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, field_separator, sizeof(field_separator), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get RowSeparator
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowSeparator", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, row_separator, sizeof(row_separator), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get EscapeCharacter
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.EscapeCharacter", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, escape_char, sizeof(escape_char), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get ReportFormat
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.ReportFormat", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, csv_format, sizeof(csv_format), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Exit if unable to get RowTimestamp
|
||||
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowTimestamp", bp->profile_id);
|
||||
+ err = DATA_MODEL_GetParameterValue(path, row_timestamp, sizeof(row_timestamp), 0);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
// When sending via USP events, only one report is ever sent in each USP event
|
||||
@@ -2354,10 +2510,16 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
bp->num_retained_reports = 1;
|
||||
|
||||
// Exit if unable to generate the report
|
||||
- json_report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
|
||||
- if (json_report == NULL)
|
||||
+ if (strcmp(encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||
+ report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
|
||||
+ } else {
|
||||
+ report = bulkdata_generate_csv_report(bp, field_separator, row_separator, escape_char,
|
||||
+ csv_format, row_timestamp);
|
||||
+ }
|
||||
+
|
||||
+ if (report == NULL)
|
||||
{
|
||||
- USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||
+ USP_ERR_SetMessage("%s: bulkdata failed to generate report", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2365,15 +2527,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
|
||||
// Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add()
|
||||
kv.key = "Data";
|
||||
- kv.value = json_report;
|
||||
+ kv.value = report;
|
||||
event_args.vector = &kv;
|
||||
event_args.num_entries = 1;
|
||||
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.Push!", bp->profile_id);
|
||||
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args);
|
||||
|
||||
- // Free the report. No need to free the event_args as json_report is the only thing dynamically allocated in it
|
||||
- free(json_report); // The report is not allocated via USP_MALLOC
|
||||
+ // Free the report. No need to free the event_args as report is the only thing dynamically allocated in it
|
||||
+ free(report); // The report is not allocated via USP_MALLOC
|
||||
|
||||
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them
|
||||
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
|
||||
@@ -2833,6 +2995,219 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
return result;
|
||||
}
|
||||
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** append_string_to_target
|
||||
+**
|
||||
+** concatenates the src string with target string in newly allocated memory
|
||||
+** and assign back the new pointer.
|
||||
+**
|
||||
+** \param str - pointer to the src string
|
||||
+** \param output - address of the pointer that points to the target string
|
||||
+**
|
||||
+** \return None
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+void append_string_to_target(char *str, char **output)
|
||||
+{
|
||||
+ char *tmp = NULL;
|
||||
+
|
||||
+ if (str == NULL || strlen(str) == 0)
|
||||
+ return;
|
||||
+
|
||||
+ if (*output == NULL || strlen(*output) == 0) {
|
||||
+ *output = USP_STRDUP(str);
|
||||
+ return;
|
||||
+ } else {
|
||||
+ tmp = USP_STRDUP(*output);
|
||||
+ free(*output);
|
||||
+ }
|
||||
+
|
||||
+ assert(tmp != NULL);
|
||||
+ asprintf(output, "%s%s", tmp, str);
|
||||
+ free(tmp);
|
||||
+}
|
||||
+
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** bulkdata_generate_csv_report
|
||||
+**
|
||||
+** Generates a CSV ParameterPerRow or ParameterPerColumn format report
|
||||
+** NOTE: The report contains all retained failed reports, as well as the current report
|
||||
+** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
|
||||
+**
|
||||
+** \param bp - pointer to bulk data profile containing all reports (current and retained)
|
||||
+** \param field_separator - value of Device.Bulkdata.Profile.{i}.CSVEncoding.FieldSeparator
|
||||
+** \param row_separator - value of Device.Bulkdata.Profile.{i}.CSVEncoding.RowSeparator
|
||||
+** \param escape_char - value of Device.Bulkdata.Profile.{i}.CSVEncoding.EscapeCharacter
|
||||
+** \param csv_format - value of Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat
|
||||
+** \param row_timestamp - value of Device.Bulkdata.Profile.{i}.CSVEncoding.RowTimestamp
|
||||
+**
|
||||
+** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator, char *row_separator,
|
||||
+ char *escape_char, char *csv_format, char *row_timestamp)
|
||||
+{
|
||||
+ char *param_path;
|
||||
+ char *param_type_value;
|
||||
+ char param_type;
|
||||
+ char *param_value;
|
||||
+ kv_vector_t *report_map;
|
||||
+ report_t *report;
|
||||
+ int i, j;
|
||||
+ bool value_as_bool;
|
||||
+ char buf[32];
|
||||
+ kv_pair_t *kv;
|
||||
+ int err;
|
||||
+ char *output = NULL, *str = NULL, *str1 = NULL, *str2 = NULL, rowseparator = '\0', separator = '\0';
|
||||
+
|
||||
+ if (strcmp(row_separator, " ") == 0)
|
||||
+ rowseparator = '\n';
|
||||
+ else if (strcmp(row_separator, " ") == 0)
|
||||
+ rowseparator = '\r';
|
||||
+
|
||||
+ if (field_separator)
|
||||
+ separator = field_separator[0];
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
|
||||
+ if (strcmp(row_timestamp, "None") == 0)
|
||||
+ asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
|
||||
+ else
|
||||
+ asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &output);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+ }
|
||||
+
|
||||
+ for (i=0; i < bp->num_retained_reports; i++)
|
||||
+ {
|
||||
+ char *timestamp = NULL;
|
||||
+ report = &bp->reports[i];
|
||||
+ report_map = &report->report_map;
|
||||
+
|
||||
+ // Add Collection time to each csv report element (only if specified and not 'None')
|
||||
+ if (strcmp(row_timestamp, "Unix-Epoch")==0)
|
||||
+ {
|
||||
+ asprintf(×tamp, "%lld", (long long int)report->collection_time);
|
||||
+ }
|
||||
+ else if (strcmp(row_timestamp, "ISO-8601")==0)
|
||||
+ {
|
||||
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
+ if (result != NULL)
|
||||
+ {
|
||||
+ asprintf(×tamp, "%s", buf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerColumn") == 0 && timestamp) {
|
||||
+ append_string_to_target("ReportTimestamp", &str1);
|
||||
+ append_string_to_target(timestamp, &str2);
|
||||
+ }
|
||||
+
|
||||
+ // Iterate over each parameter, adding it to the json element. Take account of the parameter's type
|
||||
+ for (j=0; j < report_map->num_entries; j++)
|
||||
+ {
|
||||
+ kv = &report_map->vector[j];
|
||||
+ param_path = kv->key;
|
||||
+ param_type_value = kv->value;
|
||||
+ param_type = param_type_value[0]; // First character denotes the type of the parameter
|
||||
+ param_value = ¶m_type_value[1]; // Subsequent characters contain the parameter's valu
|
||||
+ char *type = NULL;
|
||||
+ switch (param_type)
|
||||
+ {
|
||||
+ case 'S':
|
||||
+ type = "string";
|
||||
+ break;
|
||||
+
|
||||
+ case 'U':
|
||||
+ type = "unsignedInt";
|
||||
+ break;
|
||||
+
|
||||
+ case 'L':
|
||||
+ type = "long";
|
||||
+ break;
|
||||
+
|
||||
+ case 'N':
|
||||
+ type = "decimal";
|
||||
+ break;
|
||||
+
|
||||
+ case 'B':
|
||||
+ err = TEXT_UTILS_StringToBool(param_value, &value_as_bool);
|
||||
+ if (err == USP_ERR_OK)
|
||||
+ {
|
||||
+ type = "boolean";
|
||||
+ param_value = value_as_bool ? "True" : "False";
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ USP_ERR_SetMessage("%s: Invalid JSON parameter type ('%c') in report map for %s", __FUNCTION__, param_type_value[0], param_path);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (type) {
|
||||
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
|
||||
+ if (timestamp == NULL)
|
||||
+ asprintf(&str, "%s%c%s%c%s%c", param_path, separator, param_value, separator, type, rowseparator);
|
||||
+ else
|
||||
+ asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, param_path, separator, param_value, separator, type, rowseparator);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &output);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+ } else {
|
||||
+ if (str1 == NULL || strlen(str1) == 0)
|
||||
+ asprintf(&str, "%s", param_path);
|
||||
+ else
|
||||
+ asprintf(&str, "%c%s", separator, param_path);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str1);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+
|
||||
+ if (str2 == NULL || strlen(str2) == 0)
|
||||
+ asprintf(&str, "%s", param_value);
|
||||
+ else
|
||||
+ asprintf(&str, "%c%s", separator, param_value);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str2);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (timestamp) {
|
||||
+ free(timestamp);
|
||||
+ timestamp = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerColumn") == 0) {
|
||||
+ asprintf(&str, "%c", rowseparator);
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str1);
|
||||
+ append_string_to_target(str, &str2);
|
||||
+ append_string_to_target(str1, &output);
|
||||
+ append_string_to_target(str2, &output);
|
||||
+ }
|
||||
+
|
||||
+ if (str)
|
||||
+ free(str);
|
||||
+ if (str1)
|
||||
+ free(str1);
|
||||
+ if (str2)
|
||||
+ free(str2);
|
||||
+
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bulkdata_compress_report
|
||||
@@ -2986,9 +3361,18 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
|
||||
flags |= BDC_FLAG_DATE_HEADER;
|
||||
}
|
||||
|
||||
- if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0)
|
||||
- {
|
||||
- flags |= BDC_FLAG_HEADER_OBJ_HIER;
|
||||
+ if (strcmp(ctrl->encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||
+ if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0) {
|
||||
+ flags |= BDC_FLAG_HEADER_OBJ_HIER;
|
||||
+ } else {
|
||||
+ flags |= BDC_FLAG_HEADER_NAME_VAL;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (strcmp(ctrl->csv_format, BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN) == 0) {
|
||||
+ flags |= BDC_FLAG_HEADER_PER_COL;
|
||||
+ } else {
|
||||
+ flags |= BDC_FLAG_HEADER_PER_ROW;
|
||||
+ }
|
||||
}
|
||||
|
||||
// Exit if failed to post a message to BDC thread
|
||||
@@ -6,6 +6,8 @@ set_serial_number() {
|
||||
vendor_id=$1
|
||||
vssn=$2
|
||||
|
||||
# Vendor id is not taken from serial automatically, propagate it as well
|
||||
/userfs/bin/omcicfgCmd set vendorId ${vendor_id}
|
||||
/userfs/bin/omcicfgCmd set sn ${vendor_id}${vssn}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"Device.XPON.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
@@ -13,6 +14,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
@@ -31,6 +33,7 @@
|
||||
"Device.XPON.ONU.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
@@ -51,6 +54,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
@@ -67,6 +71,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -88,6 +93,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -109,6 +115,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
@@ -119,7 +126,7 @@
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].softwareImage.@Count"
|
||||
"key": "ONU[@index].SoftwareImage.@Count"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -129,6 +136,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
@@ -149,6 +157,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
@@ -167,6 +176,7 @@
|
||||
"Device.XPON.ONU.{i}.SoftwareImage.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
@@ -178,7 +188,7 @@
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].softwareImage"
|
||||
"key": "ONU[@index].SoftwareImage"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -187,6 +197,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
@@ -209,6 +220,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -230,6 +242,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
@@ -246,6 +259,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
@@ -262,6 +276,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
@@ -277,6 +292,7 @@
|
||||
"Device.XPON.ONU.{i}.EthernetUNI.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
@@ -297,6 +313,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
@@ -313,6 +330,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -338,6 +356,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -359,6 +378,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -380,6 +400,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -399,6 +420,7 @@
|
||||
"Device.XPON.ONU.{i}.EthernetUNI.{i}.Stats.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
@@ -415,6 +437,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
@@ -431,6 +454,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
@@ -447,6 +471,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
@@ -463,6 +488,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
@@ -479,6 +505,7 @@
|
||||
"Device.XPON.ONU.{i}.ANI.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
@@ -499,6 +526,7 @@
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
@@ -529,6 +557,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -553,6 +582,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
@@ -570,9 +600,31 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"TransceiverNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].ANI[@index].Transceiver.@Count"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Device.XPON.ONU.{i}.ANI.{i}.Stats.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
@@ -589,6 +641,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
@@ -605,6 +658,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
@@ -621,6 +675,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
@@ -637,6 +692,7 @@
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
@@ -648,6 +704,347 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"Device.XPON.ONU.{i}.ANI.{i}.TC.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "TC"
|
||||
}
|
||||
],
|
||||
"Device.XPON.ONU.{i}.ANI.{i}.TC.ONUActivation.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "TC.ONUActivation"
|
||||
}
|
||||
],
|
||||
"ONUState": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "TC.ONUActivation.ONUState"
|
||||
}
|
||||
]
|
||||
},
|
||||
"VendorID": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "TC.ONUActivation.VendorID"
|
||||
}
|
||||
]
|
||||
},
|
||||
"SerialNumber": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "TC.ONUActivation.SerialNumber"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ONUID": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "TC.ONUActivation.ONUID"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Device.XPON.ONU.{i}.ANI.{i}.Transceiver.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].ANI[@index].Transceiver"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ID": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "ID"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Identifier": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Identifier"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ModuleVendor": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "ModuleVendor"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ModuleName": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "ModuleName"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ModuleVersion": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "ModuleVersion"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ModuleFirmwareVersion": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "ModuleFirmwareVersion"
|
||||
}
|
||||
]
|
||||
},
|
||||
"PONMode": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "PONMode"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Connector": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "connector"
|
||||
}
|
||||
]
|
||||
},
|
||||
"RxPower": {
|
||||
"type": "int",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "int",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "RxPower"
|
||||
}
|
||||
]
|
||||
},
|
||||
"TxPower": {
|
||||
"type": "int",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "int",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "TxPower"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Voltage": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Voltage"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Bias": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Bias"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Temperature": {
|
||||
"type": "int",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "int",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Temperature"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=qosmngr
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_VERSION:=1.0.5
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=e3d608e4bacd367fed99bcdd7f56b3fba7b02891
|
||||
PKG_SOURCE_VERSION:=56ebfed11f8f2eb376afda02ebac929c5ad4ee9b
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/qosmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
populate_no_of_queue(){
|
||||
local queue_num=$(get_no_of_queue "airoha")
|
||||
queue_num=8
|
||||
|
||||
# writing no. of queue per port into file and read on classify generate
|
||||
if [ ! -d "/tmp/qos" ]; then
|
||||
@@ -26,7 +26,7 @@ generate_queue(){
|
||||
fi
|
||||
|
||||
# guaranteed number of queues
|
||||
no_of_q="0 1 2 3"
|
||||
no_of_q="0 1 2 3 4 5 6 7"
|
||||
|
||||
i=0
|
||||
local total_q=$((${no_of_q##* } + 1))
|
||||
@@ -61,3 +61,4 @@ touch /etc/config/qos
|
||||
# generate qos queue config
|
||||
config_load ports
|
||||
config_foreach generate_queue ethport
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ hw_intf_init() {
|
||||
# Initialize the hardware setup library
|
||||
hw_init_all() {
|
||||
export TMP_HW_QUEUE_LIST=""
|
||||
export TMP_HW_QUEUE_MASK="0"
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -58,7 +57,10 @@ hw_queue_set() {
|
||||
export TMP_HW_QUEUE_${order}_rate="${rate}"
|
||||
export TMP_HW_QUEUE_${order}_burstsize="${burstsize}"
|
||||
export TMP_HW_QUEUE_LIST="${TMP_HW_QUEUE_LIST} ${order}"
|
||||
export TMP_HW_QUEUE_MASK="$((TMP_HW_QUEUE_MASK | 1 << index))"
|
||||
|
||||
if [ "${rate}" != "" ] && [ $(($rate != 0)) ] ; then
|
||||
errmsg "Per-queue shape rate is not implemented"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -146,8 +148,8 @@ hw_commit_all() {
|
||||
local weight_list=""
|
||||
local glob_alg=""
|
||||
local shape_rate="$TMP_HW_SHAPE_RATE"
|
||||
local queue_mask="$TMP_HW_QUEUE_MASK"
|
||||
local q_count="0"
|
||||
local mac_qos_flag=""
|
||||
|
||||
# Reorder queues
|
||||
for q in ${sorted_list} ; do
|
||||
@@ -163,27 +165,36 @@ hw_commit_all() {
|
||||
|
||||
case "${sc_alg}" in
|
||||
WRR)
|
||||
if [ $(($q_count >= 4)) != 0 ] ; then
|
||||
if [ $(($q_count >= 8)) != 0 ] ; then
|
||||
errmsg "Too many queues, next queues will be ignored"
|
||||
else
|
||||
weight_list="$weight_list $wgt"
|
||||
fi
|
||||
q_count=$((q_count + 1))
|
||||
;;
|
||||
esac
|
||||
|
||||
q_count=$((q_count + 1))
|
||||
done
|
||||
|
||||
if [ "${glob_alg}" == "WRR" ] ; then
|
||||
while [ $((q_count < 4)) != 0 ] ; do
|
||||
weight_list="$weight_list 1"
|
||||
q_count=$((q_count + 1))
|
||||
done
|
||||
fi
|
||||
case "${glob_alg}" in
|
||||
WRR)
|
||||
mac_qos_flag="8QWRR"
|
||||
while [ $((q_count < 8)) != 0 ] ; do
|
||||
weight_list="$weight_list 1"
|
||||
q_count=$((q_count + 1))
|
||||
done
|
||||
;;
|
||||
SP)
|
||||
mac_qos_flag="8QPQ"
|
||||
q_count="8"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${glob_alg}" != "" ] ; then
|
||||
/userfs/bin/qosrule discpline $(hw_sc_alg2str ${glob_alg}) ${weight_list} \
|
||||
uplink-bandwidth ${shape_rate:-0} \
|
||||
queuemask $queue_mask
|
||||
uplink-bandwidth ${shape_rate:-10000000} \
|
||||
queuemask "$(((1 << q_count) - 1))"
|
||||
echo ${mac_qos_flag} > /proc/qdma_wan/mac_qos_flag
|
||||
else
|
||||
/userfs/bin/qosrule discpline Enable 0
|
||||
fi
|
||||
|
||||
@@ -117,9 +117,9 @@ broute_filter_on_vid() {
|
||||
}
|
||||
|
||||
broute_rule_set_traffic_class() {
|
||||
BR_RULE="$BR_RULE -j mark --mark-or 0x$1 --mark-target ACCEPT"
|
||||
BR_RULE="$BR_RULE -j mark --mark-or 0x${1}0 --mark-target ACCEPT"
|
||||
if [ -n "$BR6_RULE" ]; then
|
||||
BR6_RULE="$BR6_RULE -j mark --mark-or 0x$1 --mark-target ACCEPT"
|
||||
BR6_RULE="$BR6_RULE -j mark --mark-or 0x${1}0 --mark-target ACCEPT"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Common classifier library
|
||||
|
||||
# Handle classify section
|
||||
handle_classify() {
|
||||
cid="$1" #classify section ID
|
||||
#counter variable to assign classify order value if not added in config
|
||||
temp_order=1
|
||||
|
||||
# Function to handle a classify order
|
||||
handle_classify_order() {
|
||||
local cid="$1" #classify section ID
|
||||
|
||||
config_get is_enable "$cid" "enable" 1
|
||||
# no need to configure disabled classify rules
|
||||
@@ -11,11 +14,53 @@ handle_classify() {
|
||||
return
|
||||
fi
|
||||
|
||||
handle_ebtables_rules "$cid"
|
||||
handle_iptables_rules "$cid"
|
||||
handle_policer_rules "$cid"
|
||||
# Create classify file containing classify order
|
||||
local corder_file="/tmp/qos/classify.order"
|
||||
|
||||
config_get c_order "$cid" "order"
|
||||
|
||||
if [ -z "$c_order" ]; then
|
||||
c_order=$temp_order;
|
||||
temp_order=$((temp_order + 1))
|
||||
fi
|
||||
|
||||
value=${c_order}_${cid}
|
||||
echo $value >> $corder_file
|
||||
}
|
||||
|
||||
# Sort classify, lower value in uci means higher precedence, so this
|
||||
# function sorts the classify order in assending order
|
||||
sort_classify_by_order() {
|
||||
local corder_file="/tmp/qos/classify.order"
|
||||
local tmp_corder_file="/tmp/qos/tmp_classify.order"
|
||||
|
||||
sort -n -k1 $corder_file > $tmp_corder_file
|
||||
cp $tmp_corder_file $corder_file
|
||||
rm -f $tmp_corder_file
|
||||
}
|
||||
|
||||
# Handle classify section
|
||||
handle_classify() {
|
||||
|
||||
local corder_file="/tmp/qos/classify.order"
|
||||
|
||||
while read -r line; do
|
||||
line_cid=$(echo $line | cut -d '_' -f 2)
|
||||
|
||||
# add ip rule only for classify rules which has non empty
|
||||
# value forwarding policy option
|
||||
# if forwarding policy option value empty then add iptables/
|
||||
# ip6tables/ebtables/rate_limit rules
|
||||
config_get fwding_policy "$line_cid" "forwarding_policy"
|
||||
if [ -n "$fwding_policy" ]; then
|
||||
handle_ip_rule $line_cid $fwding_policy
|
||||
else
|
||||
handle_ebtables_rules $line_cid
|
||||
handle_iptables_rules $line_cid
|
||||
handle_policer_rules $line_cid
|
||||
fi
|
||||
done < "$corder_file"
|
||||
}
|
||||
|
||||
# Configure classifier based on UCI subtree 'qos.classify'
|
||||
configure_classify() {
|
||||
@@ -24,21 +69,34 @@ configure_classify() {
|
||||
rm -f /tmp/qos/classify.ebtables
|
||||
rm -f /tmp/qos/classify.iptables
|
||||
rm -f /tmp/qos/classify.ip6tables
|
||||
rm -f /tmp/qos/classify.order
|
||||
rm -f /tmp/qos/tmp_classify.order
|
||||
rm -f /tmp/qos/classify.iprule
|
||||
|
||||
# Create files that will contain the rules if not present already
|
||||
mkdir -p /tmp/qos/
|
||||
touch /tmp/qos/classify.iptables
|
||||
touch /tmp/qos/classify.ip6tables
|
||||
touch /tmp/qos/classify.ebtables
|
||||
touch /tmp/qos/classify.order
|
||||
touch /tmp/qos/tmp_classify.order
|
||||
touch /tmp/qos/classify.iprule
|
||||
|
||||
# Add flush chain rules
|
||||
flush_chains
|
||||
|
||||
#flush added ip rule
|
||||
flush_ip_rule
|
||||
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_classify classify
|
||||
config_foreach handle_classify_order classify
|
||||
sort_classify_by_order
|
||||
handle_classify
|
||||
|
||||
sh /tmp/qos/classify.ebtables
|
||||
sh /tmp/qos/classify.iptables
|
||||
sh /tmp/qos/classify.ip6tables
|
||||
}
|
||||
sh /tmp/qos/classify.iprule
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ include /lib/ethernet
|
||||
. /lib/qos/common/queue.sh
|
||||
. /lib/qos/common/shaper.sh
|
||||
. /lib/qos/airoha.sh
|
||||
. /lib/qos/ip_rule.sh
|
||||
|
||||
configure_qos() {
|
||||
# queue configuration is being done after shaper configuration,
|
||||
@@ -25,36 +26,6 @@ configure_qos() {
|
||||
configure_classify
|
||||
}
|
||||
|
||||
get_no_of_queue() {
|
||||
platform_name=$1
|
||||
cpu_model=$2
|
||||
|
||||
if [ -z "$platform_name" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$platform_name" == "airoha" ]; then
|
||||
queue_num=4
|
||||
echo "Fix: airohai no_of_queue: $queue_num"
|
||||
elif [ "$platform_name" == "broadcom" ]; then
|
||||
if [[ $cpu_model == "BCM68"* ]]; then
|
||||
queue_num=4
|
||||
echo "Fix: broadcom bcm no_of_queue: $queue_num"
|
||||
elif grep -qE '[0-9]+ archer$' /proc/devices; then
|
||||
queue_num=4
|
||||
echo "Fix: broadcom arcee no_of_queue: $queue_num"
|
||||
else
|
||||
queue_num=8
|
||||
echo "Fix: broadcom else no_of_queue: $queue_num"
|
||||
fi
|
||||
elif [ "$platform_name" == "linux" ]; then
|
||||
queue_num=8
|
||||
echo "Fix: linux no_of_queue: $queue_num"
|
||||
fi
|
||||
|
||||
echo $queue_num
|
||||
}
|
||||
|
||||
reload_qos() {
|
||||
local service_name="$1"
|
||||
|
||||
|
||||
@@ -4,10 +4,17 @@
|
||||
|
||||
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||
cpu_model="$(cat /proc/socinfo | grep 'SoC Name' | cut -d':' -f2)"
|
||||
queue_num=0
|
||||
|
||||
queue_num=8
|
||||
|
||||
populate_no_of_queue(){
|
||||
queue_num=$(get_no_of_queue "broadcom")
|
||||
case $cpu_model in
|
||||
BCM68[3,4,5]*) queue_num=4 ;;
|
||||
esac
|
||||
if grep -qE '[0-9]+ archer$' /proc/devices; then
|
||||
queue_num=4
|
||||
fi
|
||||
|
||||
# writing no. of queue per port into file and read on classify generate
|
||||
if [ ! -d "/tmp/qos" ]; then
|
||||
mkdir -p "/tmp/qos"
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
. /lib/functions.sh
|
||||
include /lib/ethernet
|
||||
|
||||
# include common code
|
||||
. /lib/qos/ip_rule.sh
|
||||
|
||||
IP_RULE=""
|
||||
BR_RULE=""
|
||||
BR6_RULE=""
|
||||
@@ -642,7 +645,7 @@ handle_ebtables_rules() {
|
||||
*)
|
||||
if [ -n "$protocol" ] || [ -n "$dscp_filter" ]; then
|
||||
ip_version=1 #neither ether_type nor ip address used
|
||||
#ethertype is not configured by user so install
|
||||
#ethertype is not configured by user so install
|
||||
#both proto ipv4 and ipv6 rule
|
||||
BR6_RULE="$BR_RULE"
|
||||
broute_filter_on_ether_type "IPv4"
|
||||
@@ -809,7 +812,7 @@ handle_iptables_rules() {
|
||||
|
||||
init_iptables_rule
|
||||
config_get proto "$cid" "proto"
|
||||
config_get traffic_class "$sid" "traffic_class"
|
||||
config_get traffic_class "$cid" "traffic_class"
|
||||
config_get dscp_mark "$cid" "dscp_mark"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get dest_port "$cid" "dest_port"
|
||||
@@ -929,21 +932,12 @@ assign_policer_to_port() {
|
||||
local ifname="$1"
|
||||
local pindex="$2"
|
||||
local portorder="$(db -q get hw.board.ethernetPortOrder)"
|
||||
local wanport="$(db -q get hw.board.ethernetWanPort)"
|
||||
local runner_lan_ports="$(bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/examine port | grep ': port/index=lan' | sed -e 's#\.##g' | cut -f2 -d' ' | sort -u | xargs)"
|
||||
local i=1
|
||||
|
||||
for port in $portorder; do
|
||||
if [ "$ifname" == "$port" ]; then
|
||||
if [ "$wanport" == "$port" ]; then
|
||||
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure port/index=wan0 ingress_rate_limit={traffic_types=8,policer={policer/dir=us,index=$pindex}}
|
||||
else
|
||||
local lanport="$(echo -n "$runner_lan_ports" | cut -f${i} -d' ')"
|
||||
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure $lanport ingress_rate_limit={traffic_types=8,policer={policer/dir=us,index=$pindex}}
|
||||
fi
|
||||
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure port/name=$port ingress_rate_limit={traffic_types=8,policer={policer/dir=us,index=$pindex}}
|
||||
break
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1060,21 +1054,24 @@ sort_classify_by_order() {
|
||||
|
||||
#function to handle a classify section
|
||||
handle_classify() {
|
||||
cid="$1" #classify section ID
|
||||
|
||||
config_get is_enable "$cid" "enable"
|
||||
# no need to configure disabled classify rules
|
||||
if [ "$is_enable" == '0' ]; then
|
||||
return
|
||||
fi
|
||||
local corder_file="/tmp/qos/classify.order"
|
||||
|
||||
while read -r line; do
|
||||
line_cid=$(echo $line | cut -d '_' -f 2)
|
||||
line_cid=${line#*_}
|
||||
|
||||
handle_ebtables_rules $line_cid
|
||||
handle_iptables_rules $line_cid
|
||||
handle_policer_rules $line_cid
|
||||
# add ip rule only for classify rules which has non empty
|
||||
# value forwarding policy option
|
||||
# if forwarding policy option value empty then add iptables/
|
||||
# ip6tables/ebtables/rate_limit rules
|
||||
config_get fwding_policy "$line_cid" "forwarding_policy"
|
||||
if [ -n "$fwding_policy" ]; then
|
||||
handle_ip_rule $line_cid $fwding_policy
|
||||
else
|
||||
handle_ebtables_rules $line_cid
|
||||
handle_iptables_rules $line_cid
|
||||
handle_policer_rules $line_cid
|
||||
fi
|
||||
done < "$corder_file"
|
||||
}
|
||||
|
||||
@@ -1097,6 +1094,7 @@ configure_classify() {
|
||||
rm -f /tmp/qos/classify.ip6tables
|
||||
rm -f /tmp/qos/classify.order
|
||||
rm -f /tmp/qos/tmp_classify.order
|
||||
rm -f /tmp/qos/classify.iprule
|
||||
|
||||
#create files that will contain the rules if not present already
|
||||
mkdir -p /tmp/qos/
|
||||
@@ -1105,19 +1103,25 @@ configure_classify() {
|
||||
touch /tmp/qos/classify.ebtables
|
||||
touch /tmp/qos/classify.order
|
||||
touch /tmp/qos/tmp_classify.order
|
||||
touch /tmp/qos/classify.iprule
|
||||
|
||||
#add flush chain rules
|
||||
flush_chains
|
||||
|
||||
#flush added ip rule
|
||||
flush_ip_rule
|
||||
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_classify_order classify
|
||||
sort_classify_by_order
|
||||
handle_classify classify
|
||||
handle_classify
|
||||
|
||||
sh /tmp/qos/classify.ebtables
|
||||
sh /tmp/qos/classify.iptables
|
||||
sh /tmp/qos/classify.ip6tables
|
||||
sh /tmp/qos/classify.iprule
|
||||
|
||||
# broadcom recommends that each time traffic class is set,
|
||||
# the flows should be flushed for the new mapping to take
|
||||
# effect, it then makes sense to make it a part of the
|
||||
@@ -1218,7 +1222,6 @@ configure_qos() {
|
||||
|
||||
reload_qos() {
|
||||
local service_name="$1"
|
||||
local cpu_model="$(cat /proc/socinfo | grep 'SoC Name' | cut -d':' -f2)"
|
||||
|
||||
if [ -z "$service_name" ]; then
|
||||
configure_qos
|
||||
@@ -1372,7 +1375,7 @@ reload_qos_service() {
|
||||
fi
|
||||
if [ "$policer" == "true" ]; then
|
||||
reload_qos "policer"
|
||||
# change in policer config may need reconfiguration
|
||||
# change in policer config may need reconfiguration
|
||||
# of classifier
|
||||
reload_qos "classify"
|
||||
fi
|
||||
@@ -1383,35 +1386,3 @@ reload_qos_service() {
|
||||
fi
|
||||
cp /etc/config/qos /tmp/qos/qos
|
||||
}
|
||||
|
||||
get_no_of_queue() {
|
||||
platform_name=$1
|
||||
cpu_model=$2
|
||||
|
||||
if [ -z "$platform_name" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$platform_name" == "airoha" ]; then
|
||||
queue_num=4
|
||||
echo "Fix: airohai no_of_queue: $queue_num"
|
||||
elif [ "$platform_name" == "broadcom" ]; then
|
||||
if [[ $cpu_model == "BCM68"* ]]; then
|
||||
queue_num=4
|
||||
echo "Fix: broadcom bcm no_of_queue: $queue_num"
|
||||
elif grep -qE '[0-9]+ archer$' /proc/devices; then
|
||||
queue_num=4
|
||||
echo "Fix: broadcom arcee no_of_queue: $queue_num"
|
||||
else
|
||||
queue_num=8
|
||||
echo "Fix: broadcom else no_of_queue: $queue_num"
|
||||
fi
|
||||
elif [ "$platform_name" == "linux" ]; then
|
||||
queue_num=8
|
||||
echo "Fix: linux no_of_queue: $queue_num"
|
||||
fi
|
||||
|
||||
echo $queue_num
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ generate_dns_rule(){
|
||||
uci set qos.@classify[-1].ethertype="IPv4"
|
||||
uci set qos.@classify[-1].dest_port="53"
|
||||
uci set qos.@classify[-1].traffic_class="$1"
|
||||
uci set qos.@classify[-1].order="$classify_no"
|
||||
}
|
||||
|
||||
generate_dhcp_rule(){
|
||||
@@ -24,6 +25,7 @@ generate_dhcp_rule(){
|
||||
uci set qos.@classify[-1].dest_port="67"
|
||||
uci set qos.@classify[-1].dest_port_range="68"
|
||||
uci set qos.@classify[-1].traffic_class="$1"
|
||||
uci set qos.@classify[-1].order="$classify_no"
|
||||
}
|
||||
|
||||
generate_igmp_rule(){
|
||||
@@ -34,6 +36,7 @@ generate_igmp_rule(){
|
||||
uci set qos.@classify[-1].proto="IGMP"
|
||||
uci set qos.@classify[-1].ethertype="IPv4"
|
||||
uci set qos.@classify[-1].traffic_class="$1"
|
||||
uci set qos.@classify[-1].order="$classify_no"
|
||||
}
|
||||
|
||||
generate_icmp_rule(){
|
||||
@@ -44,6 +47,7 @@ generate_icmp_rule(){
|
||||
uci set qos.@classify[-1].proto="icmp"
|
||||
uci set qos.@classify[-1].ethertype="IPv4"
|
||||
uci set qos.@classify[-1].traffic_class="$1"
|
||||
uci set qos.@classify[-1].order="$classify_no"
|
||||
|
||||
classify_no=$((classify_no + 1))
|
||||
uci add qos classify
|
||||
@@ -51,6 +55,7 @@ generate_icmp_rule(){
|
||||
uci set qos.@classify[-1].proto="icmp"
|
||||
uci set qos.@classify[-1].ethertype="IPv4"
|
||||
uci set qos.@classify[-1].traffic_class="$2"
|
||||
uci set qos.@classify[-1].order="$classify_no"
|
||||
}
|
||||
|
||||
generate_classify(){
|
||||
@@ -93,6 +98,7 @@ generate_classify(){
|
||||
uci rename qos.@classify[-1]="c${classify_no}"
|
||||
uci set qos.@classify[-1].pcp_check="$i"
|
||||
uci set qos.@classify[-1].traffic_class="$i"
|
||||
uci set qos.@classify[-1].order="$classify_no"
|
||||
done
|
||||
|
||||
uci commit qos
|
||||
|
||||
110
qosmngr/files/common/lib/qos/ip_rule.sh
Normal file
110
qosmngr/files/common/lib/qos/ip_rule.sh
Normal file
@@ -0,0 +1,110 @@
|
||||
#!/bin/sh
|
||||
# add ip rule from qos uci
|
||||
|
||||
IP_RULE=""
|
||||
|
||||
init_ip_rule() {
|
||||
IP_RULE=""
|
||||
}
|
||||
|
||||
ip_rule_match_inif() {
|
||||
IP_RULE="$IP_RULE iif $1"
|
||||
}
|
||||
|
||||
ip_rule_match_proto() {
|
||||
IP_RULE="$IP_RULE ipproto $1"
|
||||
}
|
||||
|
||||
ip_rule_match_dest_port() {
|
||||
IP_RULE="$IP_RULE dport $1"
|
||||
}
|
||||
|
||||
ip_rule_match_src_port() {
|
||||
IP_RULE="$IP_RULE sport $1"
|
||||
}
|
||||
|
||||
ip_rule_match_dest_ip() {
|
||||
IP_RULE="$IP_RULE to $1"
|
||||
}
|
||||
|
||||
ip_rule_match_src_ip() {
|
||||
IP_RULE="$IP_RULE from $1"
|
||||
}
|
||||
|
||||
ip_rule_match_dest_port_range() {
|
||||
IP_RULE="$IP_RULE dport $1-$2"
|
||||
}
|
||||
|
||||
ip_rule_match_src_port_range() {
|
||||
IP_RULE="$IP_RULE sport $1-$2"
|
||||
}
|
||||
|
||||
ip_rule_match_tos() {
|
||||
IP_RULE="$IP_RULE tos $1"
|
||||
}
|
||||
|
||||
ip_rule_match_fwmark() {
|
||||
IP_RULE="$IP_RULE fwmark $1"
|
||||
}
|
||||
|
||||
handle_ip_rule() {
|
||||
cid=$1
|
||||
fwding_policy=$2
|
||||
|
||||
init_ip_rule
|
||||
|
||||
# get uci value for selector/match
|
||||
config_get dest_ip "$cid" "dest_ip"
|
||||
config_get src_ip "$cid" "src_ip"
|
||||
config_get ifname "$cid" "ifname"
|
||||
config_get proto "$cid" "proto"
|
||||
config_get tos "$cid" "dscp_filter"
|
||||
config_get fwmark "$cid" "traffic_class"
|
||||
config_get dest_port "$cid" "dest_port"
|
||||
config_get dest_port_range "$cid" "dest_port_range"
|
||||
config_get src_port "$cid" "src_port"
|
||||
config_get src_port_range "$cid" "src_port_range"
|
||||
|
||||
# forming selector/match for rule
|
||||
[ -n "$ifname" ] && ip_rule_match_inif $ifname
|
||||
|
||||
[ -n "$proto" ] && ip_rule_match_proto $proto
|
||||
|
||||
if [ -n "$src_port" -a -z "$src_port_range" ]; then
|
||||
ip_rule_match_src_port $src_port
|
||||
fi
|
||||
|
||||
if [ -n "$dest_port" -a -z "$dest_port_range" ]; then
|
||||
ip_rule_match_dest_port $dest_port
|
||||
fi
|
||||
|
||||
[ -n "$src_ip" ] && ip_rule_match_src_ip $src_ip
|
||||
|
||||
[ -n "$dest_ip" ] && ip_rule_match_dest_ip $dest_ip
|
||||
|
||||
if [ -n "$dest_port" -a -n "$dest_port_range" ]; then
|
||||
ip_rule_match_dest_port_range $dest_port $dest_port_range
|
||||
fi
|
||||
|
||||
if [ -n "$src_port" -a -n "$src_port_range" ]; then
|
||||
ip_rule_match_src_port_range $src_port $src_port_range
|
||||
fi
|
||||
|
||||
[ -n "$tos" ] && ip_rule_match_tos $tos
|
||||
|
||||
[ -n "$fwmark" ] && ip_rule_match_fwmark $fwmark
|
||||
|
||||
# forming full ip rule
|
||||
if [ -n "$IP_RULE" ]; then
|
||||
echo "ip rule add $IP_RULE table $fwding_policy" >> /tmp/qos/classify.iprule
|
||||
echo "ip rule del $IP_RULE table $fwding_policy" >> /tmp/qos/classify.del_iprule
|
||||
fi
|
||||
}
|
||||
|
||||
flush_ip_rule() {
|
||||
if [ -s "/tmp/qos/classify.del_iprule" ]; then
|
||||
sh /tmp/qos/classify.del_iprule
|
||||
rm -f /tmp/qos/classify.del_iprule
|
||||
fi
|
||||
touch /tmp/qos/classify.del_iprule
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
populate_no_of_queue(){
|
||||
local queue_num=$(get_no_of_queue "linux")
|
||||
queue_num=8
|
||||
|
||||
# writing no. of queue per port into file and read on classify generate
|
||||
if [ ! -d "/tmp/qos" ]; then
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
. /lib/functions.sh
|
||||
#set -x
|
||||
|
||||
# include common code
|
||||
. /lib/qos/ip_rule.sh
|
||||
|
||||
IP_RULE=""
|
||||
MAJOR=""
|
||||
|
||||
@@ -510,8 +513,18 @@ handle_classify() {
|
||||
local corder_file="/tmp/qos/classify.order"
|
||||
while read -r line; do
|
||||
line_cid=$(echo $line | cut -d '_' -f 2)
|
||||
handle_iptables_rules $line_cid
|
||||
handle_policer_rules $line_cid
|
||||
# add ip rule only for classify rules which has non empty
|
||||
# value forwarding policy option
|
||||
# if forwarding policy option value empty then add iptables/
|
||||
# ip6tables/ebtables/rate_limit rules
|
||||
config_get fwding_policy "$line_cid" "forwarding_policy"
|
||||
|
||||
if [ -n "$fwding_policy" ]; then
|
||||
handle_ip_rule $line_cid $fwding_policy
|
||||
else
|
||||
handle_iptables_rules $line_cid
|
||||
handle_policer_rules $line_cid
|
||||
fi
|
||||
done < "$corder_file"
|
||||
}
|
||||
|
||||
@@ -520,15 +533,20 @@ configure_classify() {
|
||||
rm -f /tmp/qos/classify.iptables
|
||||
rm -f /tmp/qos/classify.ip6tables
|
||||
rm -f /tmp/qos/classify.order
|
||||
rm -f /tmp/qos/classify.iprule
|
||||
|
||||
# create files that will contain the rules if not present already
|
||||
mkdir -p /tmp/qos/
|
||||
touch /tmp/qos/classify.iptables
|
||||
touch /tmp/qos/classify.ip6tables
|
||||
touch /tmp/qos/classify.order
|
||||
touch /tmp/qos/classify.iprule
|
||||
|
||||
flush_chains
|
||||
|
||||
#flush added ip rule
|
||||
flush_ip_rule
|
||||
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_classify_order classify
|
||||
@@ -537,6 +555,7 @@ configure_classify() {
|
||||
|
||||
sh /tmp/qos/classify.iptables
|
||||
sh /tmp/qos/classify.ip6tables
|
||||
sh /tmp/qos/classify.iprule
|
||||
|
||||
}
|
||||
|
||||
@@ -555,22 +574,22 @@ pre_configure_queue() {
|
||||
done
|
||||
}
|
||||
|
||||
get_link_rate() {
|
||||
intf="$1"
|
||||
speed=0
|
||||
config_load ports
|
||||
get_link_rate() {
|
||||
intf="$1"
|
||||
speed=0
|
||||
config_load ports
|
||||
get_speed() {
|
||||
psid="$1"
|
||||
psid="$1"
|
||||
iname="$2"
|
||||
config_load ports
|
||||
config_load ports
|
||||
config_get ifname "$psid" "ifname"
|
||||
if [ "$ifname" == "$iname" ]; then
|
||||
config_get speed "$psid" "speed"
|
||||
fi
|
||||
}
|
||||
config_foreach get_speed ethport $intf
|
||||
echo "$speed"
|
||||
}
|
||||
}
|
||||
config_foreach get_speed ethport $intf
|
||||
echo "$speed"
|
||||
}
|
||||
|
||||
configure_queue() {
|
||||
qdisc_idx=0
|
||||
@@ -657,35 +676,6 @@ configure_policer() {
|
||||
echo $POLICER_COUNT > /tmp/qos/max_policer_inst
|
||||
}
|
||||
|
||||
get_no_of_queue() {
|
||||
platform_name=$1
|
||||
cpu_model=$2
|
||||
|
||||
if [ -z "$platform_name" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$platform_name" == "airoha" ]; then
|
||||
queue_num=4
|
||||
echo "Fix: airohai no_of_queue: $queue_num"
|
||||
elif [ "$platform_name" == "broadcom" ]; then
|
||||
if [[ $cpu_model == "BCM68"* ]]; then
|
||||
queue_num=4
|
||||
echo "Fix: broadcom bcm no_of_queue: $queue_num"
|
||||
elif grep -qE '[0-9]+ archer$' /proc/devices; then
|
||||
queue_num=4
|
||||
echo "Fix: broadcom arcee no_of_queue: $queue_num"
|
||||
else
|
||||
queue_num=8
|
||||
echo "Fix: broadcom else no_of_queue: $queue_num"
|
||||
fi
|
||||
elif [ "$platform_name" == "linux" ]; then
|
||||
queue_num=8
|
||||
echo "Fix: linux no_of_queue: $queue_num"
|
||||
fi
|
||||
|
||||
echo $queue_num
|
||||
}
|
||||
|
||||
configure_qos() {
|
||||
pre_configure_queue
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ssdpd
|
||||
PKG_VERSION:=1.0.3
|
||||
PKG_VERSION:=1.0.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
@@ -45,8 +45,6 @@ endef
|
||||
endif
|
||||
|
||||
define Package/ssdpd/install
|
||||
$(INSTALL_DIR) $(1)/etc/upnp
|
||||
$(INSTALL_DIR) $(1)/etc/upnp/description
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
@@ -34,6 +34,8 @@ configure_ssdp()
|
||||
|
||||
[ ${enabled} -eq 0 ] && return 0
|
||||
|
||||
mkdir -p /tmp/ssdp/description/
|
||||
|
||||
procd_set_param command ${PROG}
|
||||
|
||||
if [ ${ipv6_enabled} -eq 1 ]; then
|
||||
|
||||
@@ -72,7 +72,332 @@
|
||||
}
|
||||
--- a/minissdpd/ssdpd.c
|
||||
+++ b/minissdpd/ssdpd.c
|
||||
@@ -624,3 +624,8 @@ end:
|
||||
@@ -39,10 +39,9 @@ struct desc_list_elt {
|
||||
struct list_head list;
|
||||
char *url;
|
||||
char *desc_path;
|
||||
- bool is_device_desc;
|
||||
};
|
||||
|
||||
-#define UPNP_DESC_PATH "/etc/upnp/description"
|
||||
+#define UPNP_DESC_PATH "/tmp/ssdp/description"
|
||||
#define UPNP_DISCOVER_TIMEOUT (30 * 1000)
|
||||
|
||||
#ifndef MIN
|
||||
@@ -93,17 +92,41 @@ static void add_dev_to_dev_list(char *de
|
||||
dev->usn = usn;
|
||||
}
|
||||
|
||||
-void free_all_dev_list(void)
|
||||
+static void free_all_dev_list(void)
|
||||
{
|
||||
struct UPNPDev *dev = NULL;
|
||||
+ struct UPNPDev *dev_tmp = NULL;
|
||||
|
||||
- while (dev_list.next != &dev_list) {
|
||||
- dev = list_entry(dev_list.next, struct UPNPDev, list);
|
||||
+ list_for_each_entry_safe(dev, dev_tmp, &dev_list, list) {
|
||||
+ list_del(&dev->list);
|
||||
free(dev->descURL);
|
||||
free(dev->st);
|
||||
free(dev->usn);
|
||||
free(dev);
|
||||
- list_del(&dev->list);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void add_desc_to_desc_list(const char *desc_path, const char *url)
|
||||
+{
|
||||
+ struct desc_list_elt *desc_elt;
|
||||
+
|
||||
+ desc_elt = calloc(1, sizeof(struct desc_list_elt));
|
||||
+ list_add_tail(&desc_elt->list, &desc_list);
|
||||
+
|
||||
+ desc_elt->desc_path = strdup(desc_path);
|
||||
+ desc_elt->url = strdup(url);
|
||||
+}
|
||||
+
|
||||
+static void free_all_desc_list(void)
|
||||
+{
|
||||
+ struct desc_list_elt *desc_elt = NULL;
|
||||
+ struct desc_list_elt *desc_elt_tmp = NULL;
|
||||
+
|
||||
+ list_for_each_entry_safe(desc_elt, desc_elt_tmp, &desc_list, list) {
|
||||
+ list_del(&desc_elt->list);
|
||||
+ free(desc_elt->desc_path);
|
||||
+ free(desc_elt->url);
|
||||
+ free(desc_elt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,8 +190,8 @@ static int receiveDevicesFromMiniSSDPD(i
|
||||
ssize_t n;
|
||||
unsigned char *p;
|
||||
unsigned int bufferindex;
|
||||
- unsigned int i, ndev;
|
||||
- unsigned int urlsize, stsize, usnsize, l;
|
||||
+ unsigned int i = 0, ndev = 0;
|
||||
+ unsigned int urlsize = 0, stsize = 0, usnsize = 0, l = 0;
|
||||
char *url, *st, *usn;
|
||||
|
||||
n = read(s, buffer, sizeof(buffer));
|
||||
@@ -182,11 +205,12 @@ static int receiveDevicesFromMiniSSDPD(i
|
||||
if (n <= 0)
|
||||
return -1;
|
||||
|
||||
- url = (char *)malloc(urlsize);
|
||||
+ url = (char *)calloc(urlsize + 1, sizeof(char));
|
||||
if (url == NULL)
|
||||
return -1;
|
||||
|
||||
READ_COPY_BUFFER(url, urlsize);
|
||||
+ url[urlsize] = 0;
|
||||
if (n <= 0)
|
||||
return -1;
|
||||
|
||||
@@ -194,11 +218,12 @@ static int receiveDevicesFromMiniSSDPD(i
|
||||
if (n <= 0)
|
||||
goto free_url_and_return;
|
||||
|
||||
- st = (char *)malloc(stsize);
|
||||
+ st = (char *)calloc(stsize + 1, sizeof(char));
|
||||
if (st == NULL)
|
||||
goto free_url_and_return;
|
||||
|
||||
READ_COPY_BUFFER(st, stsize);
|
||||
+ st[stsize] = 0;
|
||||
if (n <= 0)
|
||||
goto free_url_and_st_and_return;
|
||||
|
||||
@@ -206,11 +231,12 @@ static int receiveDevicesFromMiniSSDPD(i
|
||||
if (n <= 0)
|
||||
goto free_url_and_st_and_return;
|
||||
|
||||
- usn = (char *)malloc(usnsize);
|
||||
+ usn = (char *)calloc(usnsize + 1, sizeof(char));
|
||||
if (usn == NULL)
|
||||
goto free_url_and_st_and_return;
|
||||
|
||||
READ_COPY_BUFFER(usn, usnsize);
|
||||
+ usn[usnsize] = 0;
|
||||
if (n <= 0)
|
||||
goto free_url_and_st_and_usn_and_return;
|
||||
|
||||
@@ -282,6 +308,21 @@ static bool is_desc_exist(const char *de
|
||||
return false;
|
||||
}
|
||||
|
||||
+static bool is_device_exist(const char *dev_url)
|
||||
+{
|
||||
+ struct UPNPDev *dev = NULL;
|
||||
+
|
||||
+ if (!dev_url)
|
||||
+ return false;
|
||||
+
|
||||
+ list_for_each_entry(dev, &dev_list, list) {
|
||||
+ if (strcmp(dev->descURL, dev_url) == 0)
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static void get_desc_name(const char *desc_url, char *str, size_t len)
|
||||
{
|
||||
if (!desc_url || !str || len == 0)
|
||||
@@ -297,37 +338,14 @@ static void get_desc_name(const char *de
|
||||
}
|
||||
}
|
||||
|
||||
-static void add_desc_to_desc_list(const char *desc_path, const char *url, int is_device_desc)
|
||||
-{
|
||||
- struct desc_list_elt *desc_elt;
|
||||
-
|
||||
- desc_elt = calloc(1, sizeof(struct desc_list_elt));
|
||||
- list_add_tail(&desc_elt->list, &desc_list);
|
||||
-
|
||||
- desc_elt->desc_path = strdup(desc_path);
|
||||
- desc_elt->url = strdup(url);
|
||||
- desc_elt->is_device_desc = is_device_desc;
|
||||
-}
|
||||
-
|
||||
-static void free_all_desc_list(void)
|
||||
-{
|
||||
- struct desc_list_elt *desc_elt = NULL;
|
||||
-
|
||||
- while (desc_list.next != &desc_list) {
|
||||
- desc_elt = list_entry(desc_list.next, struct desc_list_elt, list);
|
||||
- free(desc_elt->desc_path);
|
||||
- free(desc_elt->url);
|
||||
- free(desc_elt);
|
||||
- list_del(&desc_elt->list);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static void __upnp_discover_devices(void)
|
||||
{
|
||||
+ struct desc_list_elt *desc_elt = NULL;
|
||||
+ struct desc_list_elt *desc_elt_tmp = NULL;
|
||||
struct UPNPDev *dev = NULL;
|
||||
char desc_name[128] = {0};
|
||||
char file_path[256] = {0};
|
||||
- int res = 0, is_device_desc = 0;
|
||||
+ int res = 0;
|
||||
|
||||
/*
|
||||
* Discover devices
|
||||
@@ -349,13 +367,26 @@ static void __upnp_discover_devices(void
|
||||
|
||||
get_desc_name(dev->descURL, desc_name, sizeof(desc_name));
|
||||
snprintf(file_path, sizeof(file_path), "%s/%s", UPNP_DESC_PATH, desc_name);
|
||||
- is_device_desc = (dev->usn && strstr(dev->usn, ":service:")) ? 0 : 1;
|
||||
|
||||
// Download Description
|
||||
download_file(file_path, dev->descURL);
|
||||
|
||||
// Add description to descriptions list
|
||||
- add_desc_to_desc_list(file_path, dev->descURL, is_device_desc);
|
||||
+ add_desc_to_desc_list(file_path, dev->descURL);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Remove unused descriptions
|
||||
+ */
|
||||
+ list_for_each_entry_safe(desc_elt, desc_elt_tmp, &desc_list, list) {
|
||||
+
|
||||
+ if (is_device_exist(desc_elt->url))
|
||||
+ continue;
|
||||
+
|
||||
+ list_del(&desc_elt->list);
|
||||
+ free(desc_elt->desc_path);
|
||||
+ free(desc_elt->url);
|
||||
+ free(desc_elt);
|
||||
}
|
||||
|
||||
end:
|
||||
@@ -371,15 +402,27 @@ static int upnp_discovery_res(struct ubu
|
||||
memset(&bb,0,sizeof(struct blob_buf));
|
||||
blob_buf_init(&bb, 0);
|
||||
|
||||
+ void *root_devices_array = blobmsg_open_array(&bb, "root_devices");
|
||||
+ list_for_each_entry_reverse(dev, &dev_list, list) {
|
||||
+ // Parse root device
|
||||
+ if (dev->st && strstr(dev->st, ":rootdevice") != NULL) {
|
||||
+ void *device_obj = blobmsg_open_table(&bb, NULL);
|
||||
+ blobmsg_add_string(&bb, "descurl", dev->descURL);
|
||||
+ blobmsg_add_string(&bb, "st", dev->st);
|
||||
+ blobmsg_add_string(&bb, "usn", dev->usn);
|
||||
+ blobmsg_close_table(&bb, device_obj);
|
||||
+ }
|
||||
+ }
|
||||
+ blobmsg_close_array(&bb, root_devices_array);
|
||||
+
|
||||
void *devices_array = blobmsg_open_array(&bb, "devices");
|
||||
list_for_each_entry_reverse(dev, &dev_list, list) {
|
||||
- // Parse Root device and devices
|
||||
- if ((dev->st && strstr(dev->st, ":rootdevice") != NULL) || (dev->usn && strstr(dev->usn, ":device:") != NULL)) {
|
||||
+ // Parse devices
|
||||
+ if (dev->usn && strstr(dev->usn, ":device:") != NULL) {
|
||||
void *device_obj = blobmsg_open_table(&bb, NULL);
|
||||
blobmsg_add_string(&bb, "descurl", dev->descURL);
|
||||
blobmsg_add_string(&bb, "st", dev->st);
|
||||
blobmsg_add_string(&bb, "usn", dev->usn);
|
||||
- blobmsg_add_string(&bb, "is_root_device", dev->st && strstr(dev->st, ":rootdevice") ? "1" : "0");
|
||||
blobmsg_close_table(&bb, device_obj);
|
||||
}
|
||||
}
|
||||
@@ -472,7 +515,7 @@ static void fill_device_instances(struct
|
||||
blobmsg_close_table(bb, device_obj);
|
||||
}
|
||||
|
||||
-static void fill_service_element(struct blob_buf *bb, mxml_node_t *service)
|
||||
+static void fill_service_instances(struct blob_buf *bb, mxml_node_t *service)
|
||||
{
|
||||
mxml_node_t *b = service;
|
||||
void *service_obj = NULL;
|
||||
@@ -525,6 +568,32 @@ static void fill_service_element(struct
|
||||
blobmsg_close_table(bb, service_obj);
|
||||
}
|
||||
|
||||
+static void fill_device_service_instances(struct blob_buf *bb, bool is_device)
|
||||
+{
|
||||
+ struct desc_list_elt *desc_elt = NULL;
|
||||
+
|
||||
+ list_for_each_entry(desc_elt, &desc_list, list) {
|
||||
+
|
||||
+ FILE *fp = fopen(desc_elt->desc_path, "r");
|
||||
+ if (!fp)
|
||||
+ continue;
|
||||
+
|
||||
+ mxml_node_t *tree = mxmlLoadFile(NULL, fp, MXML_OPAQUE_CALLBACK);
|
||||
+ fclose(fp);
|
||||
+
|
||||
+ if (tree) {
|
||||
+ mxml_node_t *node = mxmlFindElement(tree, tree, "device", NULL, NULL, MXML_DESCEND);
|
||||
+
|
||||
+ if (is_device)
|
||||
+ fill_device_instances(bb, node);
|
||||
+ else
|
||||
+ fill_service_instances(bb, node);
|
||||
+
|
||||
+ mxmlDelete(tree);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int upnp_description_res(struct ubus_context *ctx, struct ubus_object *obj __attribute__((unused)),
|
||||
struct ubus_request_data *req, const char *method __attribute__((unused)), struct blob_attr *msg __attribute__((unused)))
|
||||
{
|
||||
@@ -534,39 +603,25 @@ static int upnp_description_res(struct u
|
||||
memset(&bb,0,sizeof(struct blob_buf));
|
||||
blob_buf_init(&bb, 0);
|
||||
|
||||
+ // Descriptions Array
|
||||
void *desc_array = blobmsg_open_array(&bb, "descriptions");
|
||||
list_for_each_entry(desc_elt, &desc_list, list) {
|
||||
void *device_obj = blobmsg_open_table(&bb, NULL);
|
||||
blobmsg_add_string(&bb, "desc_url", desc_elt->url);
|
||||
- blobmsg_add_u32(&bb, "is_device_desc", desc_elt->is_device_desc);
|
||||
blobmsg_close_table(&bb, device_obj);
|
||||
|
||||
}
|
||||
blobmsg_close_array(&bb, desc_array);
|
||||
|
||||
- list_for_each_entry(desc_elt, &desc_list, list) {
|
||||
-
|
||||
- FILE *fp = fopen(desc_elt->desc_path, "r");
|
||||
- if (!fp)
|
||||
- continue;
|
||||
-
|
||||
- mxml_node_t *tree = mxmlLoadFile(NULL, fp, MXML_OPAQUE_CALLBACK);
|
||||
- fclose(fp);
|
||||
-
|
||||
- if (tree) {
|
||||
- void *devices_array = blobmsg_open_array(&bb, "devices");
|
||||
- mxml_node_t *device = mxmlFindElement(tree, tree, "device", NULL, NULL, MXML_DESCEND);
|
||||
- fill_device_instances(&bb, device);
|
||||
- blobmsg_close_array(&bb, devices_array);
|
||||
-
|
||||
- void *services_array = blobmsg_open_array(&bb, "services");
|
||||
- mxml_node_t *service = mxmlFindElement(tree, tree, "device", NULL, NULL, MXML_DESCEND);
|
||||
- fill_service_element(&bb, service);
|
||||
- blobmsg_close_array(&bb, services_array);
|
||||
+ // Devices Array
|
||||
+ void *devices_array = blobmsg_open_array(&bb, "devices");
|
||||
+ fill_device_service_instances(&bb, true);
|
||||
+ blobmsg_close_array(&bb, devices_array);
|
||||
|
||||
- mxmlDelete(tree);
|
||||
- }
|
||||
- }
|
||||
+ // Services Array
|
||||
+ void *services_array = blobmsg_open_array(&bb, "services");
|
||||
+ fill_device_service_instances(&bb, false);
|
||||
+ blobmsg_close_array(&bb, services_array);
|
||||
|
||||
ubus_send_reply(ctx, req, bb.head);
|
||||
blob_buf_free(&bb);
|
||||
@@ -624,3 +679,9 @@ end:
|
||||
uloop_done();
|
||||
ubus_free(ctx);
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=stunc
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.14
|
||||
PKG_VERSION:=1.1.15
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/stunc.git
|
||||
PKG_SOURCE_VERSION:=06b63878a448b593d907bb3e9c1381dc0e69bca6
|
||||
PKG_SOURCE_VERSION:=09f9868a79e1b5037a99a97fd4dee678869fe98a
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_sulu-builder
|
||||
|
||||
menu "SULU_CORE"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_CORE_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_CORE_URL
|
||||
string "SULU url"
|
||||
default "https://dev.iopsys.eu/websdk/sulu.git"
|
||||
|
||||
config SULU_CORE_VERSION
|
||||
string "SULU repo version"
|
||||
default "80815db11f7b0c1913ae551ff50ed2c89676f489"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_LCM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_LCM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_PLUGIN_LCM_NAME
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-lcm"
|
||||
|
||||
config SULU_PLUGIN_LCM_URL
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-lcm.git"
|
||||
|
||||
config SULU_PLUGIN_LCM_VERSION
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "Version"
|
||||
default "ccd70b399b31530dc1af6a871eee94fbb179d794"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_MULTIAP"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_MULTIAP_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_NAME
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-multi-ap"
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_URL
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-multi-ap.git"
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_VERSION
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "Version"
|
||||
default "3e662d50c5a14225354f6287d1c6a47414b694a6"
|
||||
endmenu
|
||||
|
||||
menu "SULU_THEME_IOPSYS"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_THEME_IOPSYS_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_THEME_IOPSYS_NAME
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-theme-iopsys"
|
||||
|
||||
config SULU_THEME_IOPSYS_URL
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-theme-iopsys.git"
|
||||
|
||||
config SULU_THEME_IOPSYS_VERSION
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "Version"
|
||||
default "e80fea80cdf8d49db0ae70b5c26a5dab49b8a20d"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_CUSTOM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_CUSTOM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default n
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_NAME
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "custom_app"
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_URL
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "URL"
|
||||
default ""
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_VERSION
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "Version"
|
||||
endmenu
|
||||
|
||||
menu "SULU_THEME_CUSTOM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_THEME_CUSTOM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default n
|
||||
|
||||
config SULU_THEME_CUSTOM_NAME
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "plugin_theme_custom"
|
||||
|
||||
config SULU_THEME_CUSTOM_URL
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "URL"
|
||||
default ""
|
||||
|
||||
config SULU_THEME_CUSTOM_VERSION
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "Version"
|
||||
endmenu
|
||||
endmenu
|
||||
@@ -1,178 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021-2022 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=1.3.25
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=696ef814e0b16345f2e8ee0104f3ee1eeaeea5dc
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/${PKG_NAME}
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Build sulu from source
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
CONFLICTS:=sulu
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/description
|
||||
SULU-CE ReactJS based Web UI builder.
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
# Sulu core and other dependent needs to be updated in Config.in
|
||||
SULU_DL_FILE:=sulu_core-${CONFIG_SULU_CORE_VERSION}.tar.gz
|
||||
define Download/sulu_core
|
||||
FILE:=$(SULU_DL_FILE)
|
||||
URL:=$(CONFIG_SULU_CORE_URL)
|
||||
PROTO:=git
|
||||
SUBDIR:=sulu
|
||||
VERSION:=${CONFIG_SULU_CORE_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_CORE_ENABLE),y)
|
||||
$(eval $(call Download,sulu_core))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_LCM_DL:=${CONFIG_SULU_PLUGIN_LCM_NAME}_plugin-${CONFIG_SULU_PLUGIN_LCM_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_lcm
|
||||
FILE:=${SULU_PLUGIN_LCM_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_LCM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_LCM_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_LCM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_LCM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_lcm))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_MULTIAP_DL:=${CONFIG_SULU_PLUGIN_MULTIAP_NAME}_plugin-${CONFIG_SULU_PLUGIN_MULTIAP_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_multiap
|
||||
FILE:=${SULU_PLUGIN_MULTIAP_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_MULTIAP_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_MULTIAP_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_MULTIAP_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_MULTIAP_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_multiap))
|
||||
endif
|
||||
|
||||
SULU_THEME_IOPSYS_DL:=${CONFIG_SULU_THEME_IOPSYS_NAME}_plugin-${CONFIG_SULU_THEME_IOPSYS_VERSION}.tar.gz
|
||||
define Download/sulu_theme_iopsys
|
||||
FILE:=${SULU_THEME_IOPSYS_DL}
|
||||
URL:=${CONFIG_SULU_THEME_IOPSYS_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_THEME_IOPSYS_NAME}
|
||||
VERSION:=${CONFIG_SULU_THEME_IOPSYS_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_THEME_IOPSYS_ENABLE),y)
|
||||
$(eval $(call Download,sulu_theme_iopsys))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_CUSTOM_DL:=${CONFIG_SULU_PLUGIN_CUSTOM_NAME}_plugin-${CONFIG_SULU_PLUGIN_CUSTOM_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_custom
|
||||
FILE:=${SULU_PLUGIN_CUSTOM_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_CUSTOM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_CUSTOM_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_CUSTOM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_CUSTOM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_custom))
|
||||
endif
|
||||
|
||||
SULU_THEME_CUSTOM_DL:=${CONFIG_SULU_THEME_CUSTOM_NAME}_plugin-${CONFIG_SULU_THEME_CUSTOM_VERSION}.tar.gz
|
||||
define Download/sulu_theme_custom
|
||||
FILE:=${SULU_THEME_CUSTOM_DL}
|
||||
URL:=${CONFIG_SULU_THEME_CUSTOM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_THEME_CUSTOM_NAME}
|
||||
VERSION:=${CONFIG_SULU_THEME_CUSTOM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_THEME_CUSTOM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_theme_custom))
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
tar xzf $(DL_DIR)/${SULU_DL_FILE} -C $(PKG_BUILD_DIR)
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_LCM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_LCM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_MULTIAP_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_MULTIAP_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_THEME_IOPSYS_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_THEME_IOPSYS_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_CUSTOM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_CUSTOM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_THEME_CUSTOM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_THEME_CUSTOM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
VERSION="v${PKG_VERSION}" $(MAKE) -C $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/install
|
||||
$(INSTALL_DIR) $(1)/sulu
|
||||
$(INSTALL_DIR) $(1)/sulu/config
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/
|
||||
$(INSTALL_DIR) $(1)/etc/mosquitto/conf.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/dist/* $(1)/sulu
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/*.json $(1)/sulu/config/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/diagnostics.json $(1)/sulu/config/widgets/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/wan.json $(1)/sulu/config/widgets/
|
||||
ifeq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/lcm-store.json $(1)/sulu/config/widgets/
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/etc/config/sulu $(1)/etc/config/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/sulu $(1)/etc/init.d/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/sulu
|
||||
$(INSTALL_DATA) ./files/etc/sulu/roles.json $(1)/etc/sulu/
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/10-add-mqtt-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,${PKG_NAME}))
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
if [ ! -f "/etc/config/mosquitto" ]; then
|
||||
echo "Local mosquitto broker not available"
|
||||
return 0
|
||||
fi
|
||||
|
||||
add_obuspa_config()
|
||||
{
|
||||
if ! uci_get mosquitto obuspa >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener obuspa
|
||||
uci_set mosquitto obuspa enabled 1
|
||||
uci_set mosquitto obuspa port '1883'
|
||||
uci_set mosquitto obuspa no_remote_access '1'
|
||||
uci_set mosquitto obuspa allow_anonymous '1'
|
||||
fi
|
||||
}
|
||||
|
||||
add_sulu_config()
|
||||
{
|
||||
if ! uci_get mosquitto sulu >/dev/null 2>&1; then
|
||||
uci_add mosquitto listener sulu
|
||||
uci_set mosquitto sulu enabled 1
|
||||
uci_set mosquitto sulu port '9009'
|
||||
uci_set mosquitto sulu no_remote_access '1'
|
||||
uci_set mosquitto sulu protocol 'websockets'
|
||||
uci_set mosquitto sulu require_certificates '0'
|
||||
uci_set mosquitto sulu auth_plugin '/usr/lib/mosquitto_auth_shadow.so'
|
||||
uci_set mosquitto sulu acl_file '/tmp/sulu/mqtt.acl'
|
||||
fi
|
||||
}
|
||||
|
||||
uci_load mosquitto
|
||||
add_obuspa_config
|
||||
add_sulu_config
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
add_sulu_nginx_uci()
|
||||
{
|
||||
uci_load nginx
|
||||
|
||||
if ! uci_get nginx _sulu_s >/dev/null 2>&1; then
|
||||
uci_add nginx server _sulu_s
|
||||
uci_set nginx _sulu_s root '/sulu'
|
||||
uci_add_list nginx _sulu_s listen "8443 http2 ssl"
|
||||
uci_add_list nginx _sulu_s listen "[::]:8443 http2 ssl"
|
||||
uci_set nginx _sulu_s server_name '_sulu_s'
|
||||
uci_add_list nginx _sulu_s include 'restrict_locally'
|
||||
uci_add_list nginx _sulu_s include '/etc/sulu/nginx.locations'
|
||||
uci_set nginx _sulu_s uci_manage_ssl 'self-signed'
|
||||
uci_set nginx _sulu_s ssl_certificate '/etc/nginx/conf.d/_lan.crt'
|
||||
uci_set nginx _sulu_s ssl_certificate_key '/etc/nginx/conf.d/_lan.key'
|
||||
uci_set nginx _sulu_s ssl_session_cache 'shared:SSL:32k'
|
||||
uci_set nginx _sulu_s ssl_session_timeout '64m'
|
||||
uci_set nginx _sulu_s access_log 'off; # logd openwrt'
|
||||
fi
|
||||
|
||||
if ! uci_get nginx _suluredirect >/dev/null 2>&1; then
|
||||
uci_add nginx server _suluredirect
|
||||
uci_add_list nginx _suluredirect listen "8080"
|
||||
uci_add_list nginx _suluredirect listen "[::]:8080"
|
||||
uci_set nginx _suluredirect server_name '_suluredirect'
|
||||
uci_set nginx _suluredirect return 'https://$host:8443$request_uri'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
add_sulu_nginx_uci
|
||||
@@ -1,65 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021-2022 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu
|
||||
PKG_VERSION:=1.3.25
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=696ef814e0b16345f2e8ee0104f3ee1eeaeea5dc
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
PKG_RELEASE=$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sulu
|
||||
SECTION:=sulu
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=SULU-CE ReactJS based Web UI Package
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
endef
|
||||
|
||||
define Package/sulu/description
|
||||
SULU-CE ReactJS based Web UI.
|
||||
endef
|
||||
|
||||
define Package/sulu/install
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(CP) $(PKG_BUILD_DIR)/dist/* $(1)/sulu
|
||||
$(CP) $(PKG_BUILD_DIR)/config/*.json $(1)/sulu/config
|
||||
$(CP) $(PKG_BUILD_DIR)/config/widgets/diagnostics.json $(1)/sulu/config/widgets/
|
||||
$(CP) $(PKG_BUILD_DIR)/config/widgets/wan.json $(1)/sulu/config/widgets/
|
||||
ifeq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(CP) $(PKG_BUILD_DIR)/config/widgets/lcm-store.json $(1)/sulu/config/widgets/
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/etc/config/sulu $(1)/etc/config/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/sulu $(1)/etc/init.d/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/sulu
|
||||
$(INSTALL_DATA) ./files/etc/sulu/roles.json $(1)/etc/sulu/
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/10-add-mqtt-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sulu))
|
||||
|
||||
87
sulu/Readme.md
Normal file
87
sulu/Readme.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# SULU-CE
|
||||
SULU is a ReactJS based USP controller, for more details please check sulu [documentation](https://dev.iopsys.eu/websdk/sulu/-/blob/devel/README.md). This directory contains the recipes to build sulu for IOWRT.
|
||||
|
||||
There are two ways to include SULU in iowrt, by
|
||||
1. Adding a pre-build sulu distribution with all the plugins
|
||||
2. Compile sulu at the iowrt build time, which then include all the selected plugins
|
||||
|
||||
Align with above two ways, SULU has two variants
|
||||
1. sulu - This package usages the pre-built distribution, so it faster but only include iopsys default sulu plugins
|
||||
2. sulu-builder - This package builds the sulu along with selected plugins from sources, so user can include their sulu-plugins
|
||||
|
||||
# Directory structure
|
||||
This directory contains iowrt sulu plugins packages along with sulu builder.
|
||||
|
||||
- sulu-builder - Offers sulu and sulu-builder iowrt packages
|
||||
- sulu-base - Sulu core source, needed for sulu-builder
|
||||
- sulu-lcm - Sulu plugin for Life Cycle Management, can be used with sulu-builder
|
||||
- sulu-multi-ap - Sulu plugin for Multi-AP, can be used with sulu-builder
|
||||
- sulu-parental-control - Sulu plugin for Parental control, can be used with sulu-builder
|
||||
- sulu-theme-iopsys - Sulu example theme plugin, can be used with sulu-builder
|
||||
|
||||
# Packages
|
||||
- Select 'CONFIG_PACKAGE_sulu=y' to use pre-build sulu distribution binaries, OR
|
||||
- Select 'CONFIG_PACKAGE_sulu-builder=y' to build sulu along with customized plugins from their source code, this is the preferred way if user wants to include/exclude more/default plugins in sulu.
|
||||
- CONFIG_PACKAGE_sulu-lcm=y, handles life-cycle-management, should only be used with sulu-builder
|
||||
- CONFIG_PACKAGE_sulu-multi-ap=y, handles easy-mesh, should only be used with sulu-builder
|
||||
- CONFIG_PACKAGE_sulu-parental-control=y, Provides access-control and url-filter, should only be used with sulu-builder
|
||||
- CONFIG_PACKAGE_sulu-theme-iopsys=y, Provides an example theme, should only be used with sulu-builder
|
||||
|
||||
# How to select a sulu plugins
|
||||
While building sulu from source, user has to select the all plugins they want to include in sulu, which can be done with 'make menuconfig', below are the list of sulu plugins available currently.
|
||||
```bash
|
||||
# CONFIG_PACKAGE_sulu-lcm is not set
|
||||
# CONFIG_PACKAGE_sulu-multi-ap is not set
|
||||
# CONFIG_PACKAGE_sulu-parental-control is not set
|
||||
# CONFIG_PACKAGE_sulu-theme-iopsys is not set
|
||||
```
|
||||
|
||||
# How to add a new sulu plugin
|
||||
User can also add there own sulu plugins as package with a simple makefile as below:
|
||||
|
||||
```bash
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=<Name of plugin>
|
||||
PKG_VERSION:=<Plugin version number>
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=<Plugin url>
|
||||
PKG_SOURCE_VERSION:=<Plugin version hash to use>
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
```
|
||||
|
||||
# How to add a new sulu plugin with additional install requirements
|
||||
Sometimes it is required to install additional config files along with the package, to do so such sulu plugins need to have below syntax in Makefile
|
||||
```bash
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-lcm
|
||||
PKG_VERSION:=2.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-lcm.git
|
||||
PKG_SOURCE_VERSION:=b3f6028fd168e58b93ae56f616e96712849c656a
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
SULU_PLUGIN_INSTALL:=1
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(CP) $(PKG_BUILD_DIR)/src/config/widgets/lcm-store.json $(1)/sulu/config/widgets/
|
||||
endef
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
```
|
||||
|
||||
In the above example Makefile, if user need to install any plugin specific component, that can be added inside 'Package/$(PKG_NAME)/install' definition.
|
||||
|
||||
After adding the makefile, user need to specify the list of plugins in below config option, so that sulu-builder selects them and build them along with it.
|
||||
```bash
|
||||
CONFIG_SULU_EXTRA_PACKAGES="sulu-plugin1 sulu-plugin2 sulu-theme1"
|
||||
```
|
||||
@@ -1,4 +0,0 @@
|
||||
config global 'global'
|
||||
option role_based_access '1'
|
||||
list user 'admin'
|
||||
list user 'user'
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
. /lib/functions.sh
|
||||
. /etc/sulu/sulu.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t sulu.init -p debug
|
||||
}
|
||||
|
||||
validate_sulu_global_section()
|
||||
{
|
||||
uci_validate_section sulu global global \
|
||||
'enabled:bool:1' \
|
||||
'enable_system_credentials:bool:1' \
|
||||
'role_based_access:bool:0'
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled enable_system_credentials role_based_access
|
||||
|
||||
config_load sulu
|
||||
procd_open_instance sulu
|
||||
|
||||
validate_sulu_global_section || return 0;
|
||||
# append sulu connection injection
|
||||
if [ "${enabled}" -eq "0" ]; then
|
||||
procd_close_instance
|
||||
return 0
|
||||
fi
|
||||
|
||||
update_nginx_template
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 1
|
||||
generate_sulu_conn_config "${role_based_access}"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "sulu" "nginx"
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
error_page 497 301 =307 https://$host:$server_port$request_uri;
|
||||
|
||||
location /robots.txt {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /sitemap.xml {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /ws {
|
||||
proxy_pass_request_headers on;
|
||||
proxy_cache off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
|
||||
proxy_pass http://websocket;
|
||||
}
|
||||
|
||||
location / {
|
||||
autoindex on;
|
||||
expires -1;
|
||||
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range';
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
{
|
||||
"roles": [
|
||||
{
|
||||
"name": "admin",
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_ALL"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.Subscription.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_DEL"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DNS.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.IP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "undefined-1"
|
||||
},
|
||||
{
|
||||
"name": "undefined-2"
|
||||
},
|
||||
{
|
||||
"name": "undefined-3"
|
||||
},
|
||||
{
|
||||
"name": "undefined-4"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,388 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
_RESTART_SERVICES="0"
|
||||
|
||||
mkdir -p /tmp/sulu/
|
||||
|
||||
function slog()
|
||||
{
|
||||
echo "$*" |logger -t sulu.init -p debug
|
||||
}
|
||||
|
||||
function _get_agent_id()
|
||||
{
|
||||
local oui serial endpointid
|
||||
|
||||
endpointid="$(uci_get obuspa localagent EndpointID)"
|
||||
if [ -z "${endpointid}" ]; then
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
echo "${oui}-${serial//+/%2B}"
|
||||
else
|
||||
endpointid="$(echo "${endpointid/::/,}"|cut -d "," -f 2)"
|
||||
endpointid="${endpointid//+/%2B}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _get_endpoint_id()
|
||||
{
|
||||
local oui serial endpointid
|
||||
|
||||
endpointid="$(uci_get obuspa localagent EndpointID)"
|
||||
if [ -z "${endpointid}" ]; then
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
echo "os::${oui}-${serial//+/%2B}"
|
||||
else
|
||||
echo "${endpointid//+/%2B}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _get_sulu_users()
|
||||
{
|
||||
echo "$(uci -q get sulu.global.user)"
|
||||
}
|
||||
|
||||
function _get_sulu_root()
|
||||
{
|
||||
local root
|
||||
|
||||
root="$(uci -q get nginx._sulu_s.root)"
|
||||
echo "${root:-/sulu}"
|
||||
}
|
||||
|
||||
function _get_usp_upstream_port()
|
||||
{
|
||||
local port
|
||||
|
||||
port="$(uci -q get mosquitto.sulu.port)"
|
||||
echo "${port:-9009}"
|
||||
}
|
||||
|
||||
function _get_sulu_acl_file()
|
||||
{
|
||||
local file
|
||||
|
||||
file="$(uci -q get mosquitto.sulu.acl_file)"
|
||||
echo "${file}"
|
||||
}
|
||||
|
||||
function _get_sulu_tls_port()
|
||||
{
|
||||
local port listen
|
||||
|
||||
listen="$(uci -q get nginx._sulu_s.listen)"
|
||||
port="$(echo $listen|grep -Eo '[0-9]+'|head -n 1)"
|
||||
|
||||
echo "${port:-8443}"
|
||||
}
|
||||
|
||||
function update_nginx_template()
|
||||
{
|
||||
local port
|
||||
|
||||
UCI_TEMPLATE="/etc/nginx/uci.conf.template"
|
||||
port="$(_get_usp_upstream_port)"
|
||||
if ! grep -q "upstream websocket { server 127.0.0.1:${port}; }" ${UCI_TEMPLATE}; then
|
||||
sed -i "s/upstream websocket { server 127.0.0.1:[0-9]\+; }/upstream websocket { server 127.0.0.1:${var}; }/" ${UCI_TEMPLATE}
|
||||
log "Restarting nginx"
|
||||
ubus call uci commit '{"config":"nginx"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function generate_sulu_conn_config()
|
||||
{
|
||||
local rbac users SCONFIG
|
||||
|
||||
rbac="${1}"
|
||||
users="$(_get_sulu_users)"
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
|
||||
json_init;
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
json_add_string 'currentConnection' 'rbac';
|
||||
else
|
||||
json_add_string 'currentConnection' 'main';
|
||||
fi
|
||||
json_add_object 'connections';
|
||||
json_add_object 'rbac';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_array 'auth';
|
||||
json_close_array;
|
||||
|
||||
json_add_object 'overrides';
|
||||
for f in ${users}; do
|
||||
json_add_object "${f}";
|
||||
json_add_string 'fromId' "self::sulu-${f}";
|
||||
json_add_string 'publishEndpoint' "/usp/$(_get_agent_id)/${f}/endpoint";
|
||||
json_add_string 'subscribeEndpoint' "/usp/$(_get_agent_id)/${f}/controller";
|
||||
json_close_object;
|
||||
done
|
||||
json_close_object;
|
||||
json_close_object;
|
||||
|
||||
# add the default connection
|
||||
json_add_object 'main';
|
||||
json_add_string 'fromId' 'proto::interop-usp-controller';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_string 'publishEndpoint' "/usp/endpoint";
|
||||
json_add_string 'subscribeEndpoint' "/usp/controller";
|
||||
json_add_array 'auth';
|
||||
json_close_array;
|
||||
json_close_object;
|
||||
json_close_object;
|
||||
|
||||
json_dump > ${SCONFIG}
|
||||
}
|
||||
|
||||
function set_sulu_connection_mode()
|
||||
{
|
||||
local rbac profile config SCONFIG
|
||||
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
rbac="${1}"
|
||||
|
||||
profile="$(jq '.currentConnection' ${SCONFIG})"
|
||||
if [ "$rbac" -eq "1" -a "${profile}" == "\"main\"" ]; then
|
||||
config="$(jq '.currentConnection = "rbac"' ${SCONFIG})"
|
||||
echo "${config}" > ${SCONFIG}
|
||||
elif [ "$rbac" -eq "0" -a "${profile}" == "\"rbac\"" ]; then
|
||||
config="$(jq '.currentConnection = "main"' ${SCONFIG})"
|
||||
echo "${config}" > ${SCONFIG}
|
||||
fi
|
||||
}
|
||||
|
||||
function update_sulu_connection_port()
|
||||
{
|
||||
local port ws_port SCONF
|
||||
|
||||
SCONF="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
ws_port="$(_get_sulu_tls_port)"
|
||||
|
||||
port="$(jq '.connections.rbac.port' ${SCONF})"
|
||||
if [ "${port}" -ne "${ws_port}" ]; then
|
||||
jq ".connections.main.port = ${ws_port} | .connections.rbac.port = ${ws_port}" ${SCONF} > /tmp/sulu/ss_port.json
|
||||
mv /tmp/sulu/ss_port.json ${SCONF}
|
||||
fi
|
||||
}
|
||||
|
||||
function _update_obuspa_config()
|
||||
{
|
||||
local restart
|
||||
|
||||
restart=0
|
||||
if ! uci_get obuspa localmqtt >/dev/null 2>&1; then
|
||||
uci_add obuspa mqtt localmqtt
|
||||
uci_set obuspa localmqtt BrokerAddress "127.0.0.1"
|
||||
uci_set obuspa localmqtt BrokerPort "1883"
|
||||
uci_set obuspa localmqtt TransportProtocol "TCP/IP"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
if ! uci_get obuspa agent_mtp >/dev/null 2>&1; then
|
||||
uci_add obuspa mtp agent_mtp
|
||||
uci_set obuspa agent_mtp Protocol "MQTT"
|
||||
uci_set obuspa agent_mtp ResponseTopicConfigured "/usp/endpoint"
|
||||
uci_set obuspa agent_mtp mqtt "localmqtt"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
if ! uci_get obuspa localcontroller >/dev/null 2>&1; then
|
||||
uci_add obuspa controller localcontroller
|
||||
uci_set obuspa localcontroller EndpointID "proto::interop-usp-controller"
|
||||
uci_set obuspa localcontroller Protocol "MQTT"
|
||||
uci_set obuspa localcontroller Topic "/usp/controller"
|
||||
uci_set obuspa localcontroller mqtt "localmqtt"
|
||||
uci_set obuspa localcontroller assigned_role_name "full_access"
|
||||
restart=1
|
||||
fi
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _remove_obuspa_config()
|
||||
{
|
||||
local restart
|
||||
|
||||
restart=0
|
||||
if [ "$(uci_get obuspa localmqtt)" == "mqtt" ]; then
|
||||
uci_remove obuspa localmqtt
|
||||
restart=1
|
||||
fi
|
||||
if [ "$(uci_get obuspa agent_mtp)" == "mtp" ]; then
|
||||
uci_remove obuspa agent_mtp
|
||||
restart=1
|
||||
fi
|
||||
if [ "$(uci_get obuspa localcontroller)" == "controller" ]; then
|
||||
uci_remove obuspa localcontroller
|
||||
restart=1
|
||||
fi
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _update_obuspa_config_rbac() {
|
||||
local agent users restart
|
||||
|
||||
agent="$(_get_agent_id)"
|
||||
users="$(_get_sulu_users)"
|
||||
restart=0
|
||||
|
||||
for f in ${users}; do
|
||||
local sec
|
||||
|
||||
# Add mqtt
|
||||
sec="mqtt_sulu_${f}"
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa mqtt ${sec}
|
||||
uci_set obuspa ${sec} BrokerAddress "127.0.0.1"
|
||||
uci_set obuspa ${sec} BrokerPort "1883"
|
||||
uci_set obuspa ${sec} TransportProtocol "TCP/IP"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
# Add mtp
|
||||
sec="mtp_sulu_${f}"
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa mtp ${sec}
|
||||
uci_set obuspa ${sec} Protocol "MQTT"
|
||||
uci_set obuspa ${sec} ResponseTopicConfigured "/usp/${agent}/${f}/endpoint"
|
||||
uci_set obuspa ${sec} mqtt "mqtt_sulu_$f"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
# Add controller
|
||||
sec="controller_sulu_${f}"
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa controller ${sec}
|
||||
uci_set obuspa ${sec} EndpointID "self::sulu-${f}"
|
||||
uci_set obuspa ${sec} Protocol "MQTT"
|
||||
uci_set obuspa ${sec} Topic "/usp/${agent}/${f}/controller"
|
||||
uci_set obuspa ${sec} mqtt "mqtt_sulu_$f"
|
||||
uci_set obuspa ${sec} assigned_role_name "$f"
|
||||
restart=1
|
||||
fi
|
||||
done
|
||||
if [ -f "/etc/sulu/roles.json" ]; then
|
||||
uci_set obuspa global role_file "/etc/sulu/roles.json"
|
||||
fi
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _remove_sulu_sec()
|
||||
{
|
||||
local sec
|
||||
|
||||
if [[ "${1}" == *"_sulu_"* ]]; then
|
||||
uci_remove obuspa ${1}
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
function _remove_obuspa_config_rbac()
|
||||
{
|
||||
local restart
|
||||
|
||||
restart=0
|
||||
config_foreach _remove_sulu_sec mqtt
|
||||
restart="$(( restart + $? ))"
|
||||
config_foreach _remove_sulu_sec mtp
|
||||
restart="$(( restart + $? ))"
|
||||
config_foreach _remove_sulu_sec controller
|
||||
restart="$(( restart + $? ))"
|
||||
uci_set obuspa global role_file ""
|
||||
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _create_acl() {
|
||||
local agentid rbac users restart
|
||||
local ACL_FILE
|
||||
|
||||
rbac="${1:-0}"
|
||||
restart="0"
|
||||
|
||||
ACL_FILE="$(_get_sulu_acl_file)"
|
||||
if [ -z "${ACL_FILE}" -o "${rbac}" -eq "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f "${ACL_FILE}" ]; then
|
||||
rm -f "${ACL_FILE}"
|
||||
fi
|
||||
touch "${ACL_FILE}"
|
||||
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
users="$(_get_sulu_users)"
|
||||
agentid="$(_get_agent_id)"
|
||||
for f in ${users}; do
|
||||
if ! grep -q "user $f" ${ACL_FILE}; then
|
||||
echo "user ${f}" >> ${ACL_FILE}
|
||||
echo "topic read /usp/${agentid}/${f}/controller/reply-to/#" >> ${ACL_FILE}
|
||||
echo "topic write /usp/${agentid}/${f}/endpoint/#" >> ${ACL_FILE}
|
||||
echo "topic read /usp/${agentid}/${f}/controller/#" >> ${ACL_FILE}
|
||||
echo "" >> ${ACL_FILE}
|
||||
restart="1"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "${restart}" -gt "0" ]; then
|
||||
slog "Restarting mosquitto..."
|
||||
ubus call uci commit '{"config":"mosquitto"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function update_obuspa_config()
|
||||
{
|
||||
local rbac restart
|
||||
|
||||
rbac="${1}"
|
||||
restart=0
|
||||
|
||||
uci_load obuspa
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
_remove_obuspa_config
|
||||
restart="$(( restart + $? ))"
|
||||
_update_obuspa_config_rbac
|
||||
restart="$(( restart + $? ))"
|
||||
else
|
||||
_remove_obuspa_config_rbac
|
||||
restart="$(( restart + $? ))"
|
||||
_update_obuspa_config
|
||||
restart="$(( restart + $? ))"
|
||||
fi
|
||||
uci_commit obuspa
|
||||
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -gt "0" ]; then
|
||||
slog "Restarting obuspa..."
|
||||
ubus call uci commit '{"config":"obuspa"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function configure_sulu()
|
||||
{
|
||||
local sys_cred rbac restart
|
||||
|
||||
sys_cred="${1}"
|
||||
rbac="${2}"
|
||||
restart="${3:-0}"
|
||||
|
||||
if [ -z "${sys_cred}" -o -z "${rbac}" ]; then
|
||||
slog "Invalid inputs"
|
||||
return 0
|
||||
fi
|
||||
|
||||
_RESTART_SERVICES="${restart}"
|
||||
|
||||
set_sulu_connection_mode "${rbac}"
|
||||
update_obuspa_config "${rbac}"
|
||||
_create_acl "${rbac}"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
UCI_TEMPLATE="/etc/nginx/uci.conf.template"
|
||||
update_nginx_uci_template()
|
||||
{
|
||||
if ! grep -q "upstream websocket" ${UCI_TEMPLATE}; then
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ map $http_upgrade $connection_upgrade { default upgrade; "" close; }' ${UCI_TEMPLATE}
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ upstream websocket { server 127.0.0.1:9009; }' ${UCI_TEMPLATE}
|
||||
fi
|
||||
}
|
||||
|
||||
update_nginx_uci_template
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/sulu/sulu.sh
|
||||
|
||||
config_load sulu
|
||||
config_get enable_system_credentials global enable_system_credentials 1
|
||||
config_get role_based_access global role_based_access 0
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 0
|
||||
generate_sulu_conn_config "${role_based_access}"
|
||||
25
sulu/sulu-base/Makefile
Normal file
25
sulu/sulu-base/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-base
|
||||
PKG_VERSION:=2.0.8
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=c867e8ba1f2a61e88b8c7eb4331465d2dc90c412
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
SULU_MOD:=core
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(CP) $(PKG_BUILD_DIR)/src/config/*.json $(1)/sulu/config/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/config/widgets/diagnostics.json $(1)/sulu/config/widgets/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/config/widgets/wan.json $(1)/sulu/config/widgets/
|
||||
endef
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
124
sulu/sulu-builder/Makefile
Normal file
124
sulu/sulu-builder/Makefile
Normal file
@@ -0,0 +1,124 @@
|
||||
#
|
||||
# Copyright (C) 2021-2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=2.0.8
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=cc34ec44b9d6803bc80752e2a87fbd9c476fc0dc
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(PKG_VERSION)/sulu-builder-$(PKG_SOURCE_VERSION)
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
SULU_PLUGINS:=$(filter-out sulu-builder,$(filter-out Readme.md,$(notdir $(wildcard ../*))))
|
||||
SULU_EXTRA:=$(subst $\",,$(CONFIG_SULU_EXTRA_PACKAGES))
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sulu/default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=SULU
|
||||
TITLE:=SULU-CE
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
endef
|
||||
|
||||
define Package/sulu
|
||||
$(Package/sulu/default)
|
||||
CONFLICTS:=sulu-builder
|
||||
TITLE += (Binaries)
|
||||
VARIANT:=binary
|
||||
DEFAULT_VARIANT:=1
|
||||
endef
|
||||
|
||||
define Package/sulu-builder
|
||||
$(Package/sulu/default)
|
||||
TITLE += (Builder)
|
||||
VARIANT:=builder
|
||||
DEPENDS+=+sulu-base $(foreach plugin,$(SULU_PLUGINS), +PACKAGE_$(plugin):$(plugin)) $(foreach plugin,$(SULU_EXTRA), +PACKAGE_$(plugin):$(plugin))
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/sulu/description
|
||||
SULU-CE ReactJS based Web UI works on USP with websocket.
|
||||
endef
|
||||
|
||||
define Package/sulu-builder/description
|
||||
SULU-CE ReactJS based Web UI builder.
|
||||
endef
|
||||
|
||||
define Package/sulu-builder/config
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_sulu-builder
|
||||
|
||||
config SULU_EXTRA_PACKAGES
|
||||
string "Space separated list of sulu packages"
|
||||
help
|
||||
You can specify the list of non core sulu package,
|
||||
so that sulu-builder include them before building the core.
|
||||
endmenu
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),builder)
|
||||
define Build/Compile
|
||||
VERSION="v${PKG_VERSION}" CORE_DIR="../core/sulu-*" PLUGINS_PATH="../plugins" $(MAKE) -C $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
else
|
||||
define Build/Compile
|
||||
# Pass
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Clean
|
||||
$(RM) -r $(BUILD_DIR)/sulu-$(PKG_VERSION)
|
||||
endef
|
||||
|
||||
define Package/sulu/install/Default
|
||||
$(INSTALL_DIR) $(1)/sulu/config/widgets
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/etc/config/sulu $(1)/etc/config/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/sulu $(1)/etc/init.d/sulu
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/sulu
|
||||
$(INSTALL_DATA) ./files/etc/sulu/roles.json $(1)/etc/sulu/
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/10-add-mqtt-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
define Package/sulu/install
|
||||
$(Package/sulu/install/Default)
|
||||
$(CP) $(PKG_BUILD_DIR)/dist/* $(1)/sulu
|
||||
ifneq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(RM) $(1)/sulu/config/widgets/lcm-store.json
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/sulu-builder/install
|
||||
$(Package/sulu/install/Default)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/dist/* $(1)/sulu
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/*.json $(1)/sulu/config/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/diagnostics.json $(1)/sulu/config/widgets/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/wan.json $(1)/sulu/config/widgets/
|
||||
ifeq ($(CONFIG_PACKAGE_skopeo)$(CONFIG_PACKAGE_umoci),yy)
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/lcm-store.json $(1)/sulu/config/widgets/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sulu-builder))
|
||||
$(eval $(call BuildPackage,sulu))
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user