mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-20 17:14:58 +08:00
Compare commits
132 Commits
mmenshikov
...
mqtt_datam
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
293a8a27a0 | ||
|
|
07eb27b1dd | ||
|
|
548ae9605b | ||
|
|
a4f4add21b | ||
|
|
fe8f39cd5a | ||
|
|
77626b51b0 | ||
|
|
d10ca5330e | ||
|
|
c2e77a5fbe | ||
|
|
93b9aa8312 | ||
|
|
937ad7c0fc | ||
|
|
cb6d5bdc36 | ||
|
|
df3d450671 | ||
|
|
16951b9c31 | ||
|
|
cd9149efad | ||
|
|
c4965c9c05 | ||
|
|
d439066686 | ||
|
|
826aeb477e | ||
|
|
63b776f97d | ||
|
|
a7383806cd | ||
|
|
81d15db29c | ||
|
|
07bf2de658 | ||
|
|
5c94394a6b | ||
|
|
224a40f7b4 | ||
|
|
f7bc58530b | ||
|
|
c11bf82271 | ||
|
|
4bf446929a | ||
|
|
85c916aa6d | ||
|
|
a142950c90 | ||
|
|
0f28109363 | ||
|
|
e2c593662d | ||
|
|
749713615c | ||
|
|
e6ff986010 | ||
|
|
7f8869cdae | ||
|
|
9a5658fa23 | ||
|
|
9874a26de2 | ||
|
|
ee54c28426 | ||
|
|
71d8a2ac30 | ||
|
|
b35cc044b4 | ||
|
|
8d80e4d38f | ||
|
|
55afb62ba0 | ||
|
|
07a8753149 | ||
|
|
5d3027c777 | ||
|
|
8c2421018a | ||
|
|
a4f7d4650b | ||
|
|
ab92e503bc | ||
|
|
f0f3560789 | ||
|
|
a7577d8975 | ||
|
|
243e034156 | ||
|
|
ea242d4e4d | ||
|
|
2c154d09e6 | ||
|
|
62166c5465 | ||
|
|
89264fa175 | ||
|
|
6091b22937 | ||
|
|
e0f2f11174 | ||
|
|
1df0c1472f | ||
|
|
cc5348a282 | ||
|
|
d18a1b6788 | ||
|
|
8553a5c00f | ||
|
|
67d2e0fe01 | ||
|
|
423c7e7f7a | ||
|
|
ff6a0e67da | ||
|
|
65f8a28962 | ||
|
|
ccd154cfa5 | ||
|
|
7b987fa396 | ||
|
|
3f4a439de4 | ||
|
|
a1cc37d3a6 | ||
|
|
8af85b8883 | ||
|
|
55b69db576 | ||
|
|
07f2cc555e | ||
|
|
6b6383c237 | ||
|
|
03344e0df5 | ||
|
|
75ed0c7a18 | ||
|
|
0d076595f8 | ||
|
|
1ba2d5ab89 | ||
|
|
ec6533707f | ||
|
|
f868713ed9 | ||
|
|
1ef8245cf9 | ||
|
|
0385a0b715 | ||
|
|
5dd35e99e2 | ||
|
|
43dd5bf8c7 | ||
|
|
98ea973e61 | ||
|
|
f7d0cc8dbd | ||
|
|
0afb94dc77 | ||
|
|
3835cc0bc9 | ||
|
|
7b766ea7f1 | ||
|
|
4efacdaee5 | ||
|
|
fb91a7f70f | ||
|
|
47f47ac097 | ||
|
|
b4cb466f4e | ||
|
|
9a1cd147d0 | ||
|
|
c67e429387 | ||
|
|
a5e6d08394 | ||
|
|
a37729d885 | ||
|
|
2efa706f67 | ||
|
|
1911881b94 | ||
|
|
8c9f390b89 | ||
|
|
9dacae709b | ||
|
|
363fb57b3e | ||
|
|
99ed84be4d | ||
|
|
930611301b | ||
|
|
e06e0a6599 | ||
|
|
9de5fe3362 | ||
|
|
c9fded45b7 | ||
|
|
545a54eb9f | ||
|
|
b979bf4891 | ||
|
|
d2111b2bad | ||
|
|
ffb839b1d0 | ||
|
|
360e48a3cf | ||
|
|
71198a83de | ||
|
|
87eb713593 | ||
|
|
5fbc3e9efb | ||
|
|
6140efcb5a | ||
|
|
108c98c8bb | ||
|
|
887fb46dbd | ||
|
|
1b65330af4 | ||
|
|
cf709c995f | ||
|
|
6a1b7d91a1 | ||
|
|
a1bbf877a1 | ||
|
|
ac24516ec0 | ||
|
|
aab79b15f1 | ||
|
|
39fd5323b0 | ||
|
|
ba6f732628 | ||
|
|
ada4e7cfd5 | ||
|
|
c9d73a6bcb | ||
|
|
e91fc5169c | ||
|
|
452b1e548a | ||
|
|
630c3ec7ba | ||
|
|
c808bb188d | ||
|
|
dce4728377 | ||
|
|
38d77bcf5c | ||
|
|
e99cdc434f | ||
|
|
225bf15ae7 |
28
bbf/Makefile
28
bbf/Makefile
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=6.7.1
|
||||
PKG_VERSION:=6.8.9
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_VERSION:=f716f92edc0eec04f81a501339100adfa0c3b4ca
|
||||
PKG_SOURCE_VERSION:=4ad900a9bb6b4a0dd38edc1d14e1b6cbfeaa8e9b
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -67,6 +67,17 @@ define Package/libbbfdm-wolfssl
|
||||
VARIANT:=wolfssl
|
||||
endef
|
||||
|
||||
define Package/userinterface
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Package to add Device.UserInterface. datamodel support
|
||||
endef
|
||||
|
||||
define Package/userinterface/description
|
||||
Package to add Device.UserInterface. datamodel support using libbbf JSON Plugin
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/config
|
||||
source "$(SOURCE)/Config_bbfdm.in"
|
||||
endef
|
||||
@@ -155,6 +166,18 @@ define Package/libbbfdm/default/prerm
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/userinterface/install
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/UserInterface.json $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_DATA) ./files/etc/config/userinterface $(1)/etc/config/userinterface
|
||||
$(INSTALL_BIN) ./files/etc/init.d/userinterface $(1)/etc/init.d/userinterface
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/93-userinterface-firewall $(1)/etc/uci-defaults/93-userinterface-firewall
|
||||
$(INSTALL_BIN) ./files/etc/firewall.userinterface $(1)/etc/firewall.userinterface
|
||||
endef
|
||||
|
||||
Package/libbbfdm-openssl/prerm = $(Package/libbbfdm/default/prerm)
|
||||
Package/libbbfdm-wolfssl/prerm = $(Package/libbbfdm/default/prerm)
|
||||
Package/libbbfdm-mbedtls/prerm = $(Package/libbbfdm/default/prerm)
|
||||
@@ -174,6 +197,7 @@ define Build/InstallDev
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,userinterface))
|
||||
$(eval $(call BuildPackage,libbbf_api))
|
||||
$(eval $(call BuildPackage,libbbfdm))
|
||||
$(eval $(call BuildPackage,libbbfdm-openssl))
|
||||
|
||||
112
bbf/files/etc/bbfdm/json/UserInterface.json
Normal file
112
bbf/files/etc/bbfdm/json/UserInterface.json
Normal file
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"Device.UserInterface.": {
|
||||
"type": "object",
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"Device.UserInterface.RemoteAccess.": {
|
||||
"type": "object",
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"Enable": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "userinterface",
|
||||
"section": {
|
||||
"name": "remote_access"
|
||||
},
|
||||
"option": {
|
||||
"name": "enable"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Port": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "userinterface",
|
||||
"section": {
|
||||
"name": "remote_access"
|
||||
},
|
||||
"option": {
|
||||
"name": "port"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"SupportedProtocols": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"list": {
|
||||
"datatype": "string",
|
||||
"enumerations": [
|
||||
"HTTP",
|
||||
"HTTPS"
|
||||
]
|
||||
},
|
||||
"default": "HTTP"
|
||||
},
|
||||
"Protocol": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "userinterface",
|
||||
"section": {
|
||||
"name": "remote_access"
|
||||
},
|
||||
"option": {
|
||||
"name": "protocol"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
bbf/files/etc/config/userinterface
Normal file
6
bbf/files/etc/config/userinterface
Normal file
@@ -0,0 +1,6 @@
|
||||
config userinterface 'remote_access'
|
||||
option enable '0'
|
||||
option interface 'wan'
|
||||
option port '80'
|
||||
option protocol 'HTTP'
|
||||
|
||||
88
bbf/files/etc/firewall.userinterface
Executable file
88
bbf/files/etc/firewall.userinterface
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
IDENTIFIER="REMOTE-ACCESS-WAN"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t firewall.userinterface -p info
|
||||
}
|
||||
|
||||
if [ ! -f "/etc/config/userinterface" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
function exec_cmd()
|
||||
{
|
||||
if ! $@; then
|
||||
log "Failed to run [$@]"
|
||||
fi
|
||||
}
|
||||
|
||||
function configure_firewall_rule()
|
||||
{
|
||||
local enable port protocol gui_port
|
||||
local zone interface
|
||||
|
||||
config_load userinterface
|
||||
config_get_bool enable remote_access enable 1
|
||||
config_get port remote_access port
|
||||
config_get interface remote_access interface
|
||||
|
||||
if [ "${enable}" -eq "0" -o -z "${port}" -o -z "${interface}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_input"
|
||||
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
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_output"
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
function delete_firewall_rule()
|
||||
{
|
||||
local zone interface
|
||||
local CMD
|
||||
|
||||
config_load userinterface
|
||||
config_get interface remote_access interface
|
||||
|
||||
# Clean remote interface rules
|
||||
if [ -z "${interface}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_input"
|
||||
CMD="iptables -w 1 -t filter -L ${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};
|
||||
fi
|
||||
done
|
||||
|
||||
zone="zone_${interface}_output"
|
||||
CMD="iptables -w 1 -t filter -L ${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};
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Delete existing remote access rules
|
||||
delete_firewall_rule
|
||||
|
||||
# Configure the User Interface rule
|
||||
configure_firewall_rule
|
||||
27
bbf/files/etc/init.d/userinterface
Normal file
27
bbf/files/etc/init.d/userinterface
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
local enable
|
||||
|
||||
procd_open_instance usp
|
||||
|
||||
config_load userinterface
|
||||
config_get_bool enable global enable 1
|
||||
|
||||
# Inject firewall rules
|
||||
if [ "${enable}" -eq "1" ]; then
|
||||
/etc/firewall.userinterface
|
||||
fi
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "userinterface"
|
||||
}
|
||||
12
bbf/files/etc/uci-defaults/93-userinterface-firewall
Executable file
12
bbf/files/etc/uci-defaults/93-userinterface-firewall
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOT
|
||||
delete firewall.userinterface
|
||||
set firewall.userinterface=include
|
||||
set firewall.userinterface.path=/etc/firewall.userinterface
|
||||
set firewall.userinterface.reload=1
|
||||
commit firewall
|
||||
EOT
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulkdata
|
||||
PKG_VERSION:=2.0.7
|
||||
PKG_VERSION:=2.0.9
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bulkdata.git
|
||||
PKG_SOURCE_VERSION:=be565bd5b7bf91c81a824601235f68b11e6ea308
|
||||
PKG_SOURCE_VERSION:=6e85d2032e66df581fae7c72cd83cc89367b8fc8
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -12,13 +12,11 @@ start_service() {
|
||||
config_load bulkdata
|
||||
config_get_bool enable bulkdata enable 1
|
||||
|
||||
[ "$enable" -ne "1" ] && {
|
||||
return 0
|
||||
procd_open_instance bulkdata
|
||||
[ "$enable" -eq "1" ] && {
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn "3" "7" "0"
|
||||
}
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn "3" "7" "0"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET)
|
||||
|
||||
@@ -19,7 +19,7 @@ define Package/easy-qos
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Easy QoS
|
||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet)
|
||||
DEPENDS:=@(TARGET_brcmbca||TARGET_airoha)
|
||||
endef
|
||||
|
||||
define Package/easy-qos/description
|
||||
|
||||
@@ -19,7 +19,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
-include $(TOPDIR)/.config
|
||||
|
||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
||||
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||
LINUX_DIR=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.1
|
||||
LINUX_VERSION := 4.1.52
|
||||
LINUXINCLUDE=-Iarch/$(LINUX_KARCH)/mach-bcm963xx/include
|
||||
@@ -85,7 +85,7 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
|
||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
||||
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||
define KernelPackage/easy-soc-events/install-extra
|
||||
cp $(PKG_BUILD_DIR)/easyevent.ko $(FS_DIR)/lib/modules/$(LINUX_VERSION)/extra
|
||||
endef
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=6.7.5
|
||||
PKG_VERSION:=6.8.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=6a7dcbfe7ce41e87a7528b63cf12e67078231629
|
||||
PKG_SOURCE_VERSION:=ddc7b272bec5e3b5c2a216a1f86cd5589a1a4a19
|
||||
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
|
||||
@@ -36,7 +36,7 @@ define Package/easy-soc-libs
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
TARGET_WIFI_TYPE=BROADCOM
|
||||
CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
|
||||
@@ -55,7 +55,7 @@ else ifeq ($(CONFIG_TARGET_iopsys_armvirt),y)
|
||||
TARGET_PLATFORM=TEST
|
||||
TARGET_WIFI_TYPE=TEST
|
||||
TARGET_CFLAGS +=-DIOPSYS_TEST
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_econet),y)
|
||||
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_PLATFORM=ECONET
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_ECONET
|
||||
|
||||
@@ -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_iopsys_econet:ecnt_api
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_ramips:swconfig +TARGET_airoha:ecnt_api
|
||||
endef
|
||||
|
||||
define Package/libethernet/config
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
define Package/libwifi
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= WiFi library (libwifi)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_brcm63xx_arm:bcmkernel
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_brcmbca:bcmkernel
|
||||
endef
|
||||
|
||||
define Package/libwifi/config
|
||||
|
||||
@@ -13,7 +13,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/endptmngr.git
|
||||
PKG_SOURCE_VERSION:=0901382048bb7ce01fc1767fef75e54692f56743
|
||||
PKG_SOURCE_VERSION:=dc12712af8c4088f7873502ca845e51c68a1ada9
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=evoice
|
||||
PKG_VERSION:=0.2.38
|
||||
PKG_VERSION:=0.2.39
|
||||
|
||||
LOCAL_DEV=0
|
||||
LOCAL_DEV_EVOICE_DIR=~/voip/evoice
|
||||
@@ -13,7 +13,7 @@ LOCAL_DEV_EVOICE_DIR=~/voip/evoice
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/evoice.git
|
||||
PKG_SOURCE_VERSION:=8ffed73a755909cdf70d7050c98ce0f407621860
|
||||
PKG_SOURCE_VERSION:=30d65330de0368f73ecf4a2e804c39a2ee280454
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -33,9 +33,9 @@ define Package/$(PKG_NAME)
|
||||
TITLE:=Ensemble Voice
|
||||
URL:=
|
||||
DEPENDS:= +libubox +libubus +libpicoevent +libuci +libstdcpp +libopenssl +libjson-c +libblobmsg-json\
|
||||
+TARGET_iopsys_brcm63xx_arm:bcmkernel\
|
||||
+TARGET_iopsys_econet:kmod-voip_driver\
|
||||
+TARGET_iopsys_econet:voip_app +libbbf_api
|
||||
+TARGET_brcmbca:bcmkernel\
|
||||
+TARGET_airoha:kmod-voip_driver\
|
||||
+TARGET_airoha:voip_app +libbbf_api
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
@@ -56,7 +56,7 @@ endif
|
||||
IDIR = $(STAGING_DIR)/usr/include
|
||||
TONES_INI_REQUIRED=
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
BDIR = bcm963xx/userspace/private/apps/voice
|
||||
CC_FLAGS = -I$(IDIR) -I$(IDIR)/$(BDIR)/inc\
|
||||
@@ -64,7 +64,7 @@ ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
-I$(IDIR)/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
||||
TRG=SVrgBcmFxs
|
||||
JSONFILE=codecs_brcm.json
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_econet),y)
|
||||
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_PLATFORM=ECONET
|
||||
TONES_INI_REQUIRED=y
|
||||
TRG=SVrgMtekOwrt
|
||||
|
||||
@@ -28,7 +28,7 @@ define KernelPackage/$(PKG_NAME)
|
||||
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
|
||||
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
|
||||
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
|
||||
DEPENDS:= +(TARGET_iopsys_brcm63xx_arm):bcmkernel
|
||||
DEPENDS:= +(TARGET_brcmbca):bcmkernel
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_URL:=
|
||||
endef
|
||||
@@ -42,7 +42,7 @@ EXTRA_KCONFIG:= CONFIG_RGB_LED=m
|
||||
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
|
||||
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
LINUX_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.19
|
||||
# This assumes that the MODULES_SUBDIR set by OpenWrt is of the form
|
||||
# lib/modules/4.19.235-abcdef where 4.19.235 is the version of our fake bcmlinux kernel
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.0.15
|
||||
PKG_VERSION:=9.1.2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
PKG_SOURCE_VERSION:=61131746e2831453d0a935dcb3094fc758167f22
|
||||
PKG_SOURCE_VERSION:=b964edb3570797286584793dbadfbef323cddbeb
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -83,6 +83,7 @@ define Package/icwmp/default/install
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||
$(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
|
||||
@@ -92,6 +93,7 @@ define Package/icwmp/default/install
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/update.sh $(1)/etc/icwmpd/update.sh
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp.user
|
||||
endef
|
||||
|
||||
Package/icwmp-openssl/install = $(Package/icwmp/default/install)
|
||||
|
||||
122
icwmp/files/etc/udhcpc.user.d/udhcpc_icwmp.user
Normal file
122
icwmp/files/etc/udhcpc.user.d/udhcpc_icwmp.user
Normal file
@@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
|
||||
CLASS=""
|
||||
OUI=""
|
||||
SERIAL=""
|
||||
|
||||
get_vivsoi() {
|
||||
# opt125 environment variable has data in below format
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | enterprise-number1 |
|
||||
# | |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | data-len1 | |
|
||||
# +-+-+-+-+-+-+-+-+ option-data1 |
|
||||
# / /
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -----
|
||||
# | enterprise-number2 | ^
|
||||
# | | |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
# | data-len2 | | optional
|
||||
# +-+-+-+-+-+-+-+-+ option-data2 | |
|
||||
# / / |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
# ~ ... ~ V
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -----
|
||||
|
||||
# Enterprise Id Len Sub Op SLen Data Sub Op SLen Data Sub Op SLen Data
|
||||
# +-------------+-----+------+------+----+------+-----+----+-----+------+-----+----+
|
||||
# | id | n | 1 | n1 | D1 | 2 | n2 | D2 | ... | 6 | n6 | D6 |
|
||||
# +-------------+-----+------+------+----+------+-----+----+-----+------+-----+----+
|
||||
|
||||
local opt125="$1"
|
||||
local len="$2"
|
||||
local ent_id
|
||||
|
||||
#hex-string 2 character=1 Byte
|
||||
# length in hex string will be twice of actual Byte length
|
||||
[ "$len" -gt "8" ] || return
|
||||
|
||||
data="${opt125}"
|
||||
rem_len="${len}"
|
||||
while [ $rem_len -gt 0 ]; do
|
||||
ent_id=${data:0:8}
|
||||
ent_id=$(printf "%d\n" "0x$ent_id")
|
||||
|
||||
if [ $ent_id -ne 3561 ]; then
|
||||
len_val=${data:8:2}
|
||||
data_len=$(printf "%d\n" "0x$len_val")
|
||||
# add 4 byte for ent_id and 1 byte for len
|
||||
data_len=$(( data_len * 2 + 10 ))
|
||||
# move ahead data to next enterprise id
|
||||
data=${data:"${data_len}":"${rem_len}"}
|
||||
rem_len=$(( rem_len - $data_len ))
|
||||
continue
|
||||
fi
|
||||
|
||||
# read the length of enterprise data
|
||||
len_val=${data:8:2}
|
||||
opt_len=$(printf "%d\n" "0x$len_val")
|
||||
[ $opt_len -eq 0 ] && return
|
||||
|
||||
# populate the option data of enterprise id
|
||||
sub_data_len=$(( opt_len * 2))
|
||||
# starting 10 means ahead of length field
|
||||
sub_data=${data:10:"${sub_data_len}"}
|
||||
|
||||
# parsing of suboption of option 125
|
||||
while [ $sub_data_len -gt 0 ]; do
|
||||
# get the suboption id
|
||||
sub_opt_id=${sub_data:0:2}
|
||||
sub_opt_id=$(printf "%d\n" "0x$sub_opt_id")
|
||||
|
||||
# get the length of suboption
|
||||
sub_opt_len=${sub_data:2:2}
|
||||
sub_opt_len=$(printf "%d\n" "0x$sub_opt_len")
|
||||
sub_opt_len=$(( sub_opt_len * 2 ))
|
||||
|
||||
# get the value of sub option starting 4 means starting after length
|
||||
sub_opt_val=${sub_data:4:${sub_opt_len}}
|
||||
|
||||
# assign the value found in sub option
|
||||
case "${sub_opt_id}" in
|
||||
"4") OUI=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"5") SERIAL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"6") CLASS=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
esac
|
||||
|
||||
# add 2 bytes for sub_opt id and sub_opt len field
|
||||
sub_opt_end=$(( sub_opt_len + 4 ))
|
||||
|
||||
# fetch next sub option hex string
|
||||
sub_data=${sub_data:${sub_opt_end}:${sub_data_len}}
|
||||
|
||||
# update the remaining sub option hex string length
|
||||
sub_data_len=$((sub_data_len - sub_opt_end))
|
||||
done
|
||||
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
wan_intf=$(uci -q get cwmp.cpe.default_wan_interface)
|
||||
if [ -n "${wan_intf}" ] && [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
if [ -n "$opt125" ]; then
|
||||
len=$(printf "$opt125"|wc -c)
|
||||
get_vivsoi "$opt125" "$len"
|
||||
fi
|
||||
|
||||
sec=$(uci -q -c /var/state get cwmp.gatewayinfo)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q -c /var/state add cwmp gatewayinfo)
|
||||
uci -q -c /var/state rename cwmp."${sec}"="gatewayinfo"
|
||||
fi
|
||||
|
||||
uci -q -c /var/state set cwmp.gatewayinfo.class="$CLASS"
|
||||
uci -q -c /var/state set cwmp.gatewayinfo.oui="$OUI"
|
||||
uci -q -c /var/state set cwmp.gatewayinfo.serial="$SERIAL"
|
||||
uci -q -c /var/state commit cwmp
|
||||
fi
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=5.0.19
|
||||
PKG_VERSION:=6.0.16
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=64f8ad63b07ad781fd819dad61739b93e6a47b41
|
||||
PKG_SOURCE_VERSION:=3b12bdd1b0e75f4e5b744e18f00ab5ac703382e6
|
||||
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
|
||||
|
||||
@@ -82,8 +82,10 @@ start_service() {
|
||||
validate_ieee1905_config || return 1;
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "/usr/sbin/ieee1905d"
|
||||
procd_set_param command "/usr/sbin/ieee1905d" "-o" "/tmp/ieee1905.log" "-f"
|
||||
procd_set_param respawn
|
||||
procd_set_param limits core="unlimited"
|
||||
# procd_set_param env IEEE1905_LOG_CMDU=1
|
||||
# procd_set_param stdout 1
|
||||
# procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
|
||||
16
iop/config
16
iop/config
@@ -18,8 +18,21 @@ CONFIG_TARGET_ROOTFS_TARGZ=y
|
||||
# /etc/banner and /etc/device_info #
|
||||
CONFIG_IMAGEOPT=y
|
||||
CONFIG_VERSIONOPT=y
|
||||
CONFIG_VERSION_MANUFACTURER="iopsysWrt"
|
||||
CONFIG_VERSION_MANUFACTURER="IOPSYS"
|
||||
CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/"
|
||||
CONFIG_VERSION_DIST="IOWRT"
|
||||
|
||||
# OpenWrt is given by CONFIG_VERSION_NUMBER which we do not want to override.
|
||||
# disabling CONFIG_VERSION_FILENAMES will hide the OpenWrt version from the image filename
|
||||
# CONFIG_VERSION_FILENAMES is not set
|
||||
|
||||
# CONFIG_VERSION_CODE is set to the IOWRT version instead by the genconfig-script and
|
||||
# CONFIG_VERSION_CODE_FILENAMES will put it into the image filename.
|
||||
CONFIG_VERSION_CODE_FILENAMES=y
|
||||
|
||||
CONFIG_VERSION_HOME_URL="https://iopsys.eu"
|
||||
CONFIG_VERSION_BUG_URL="https://iopsys.eu"
|
||||
CONFIG_VERSION_SUPPORT_URL="https://iopsys.eu"
|
||||
|
||||
# /lib/preinit #
|
||||
CONFIG_PREINITOPT=y
|
||||
@@ -63,6 +76,7 @@ CONFIG_PACKAGE_urlfilter=y
|
||||
CONFIG_PACKAGE_imonitor=m
|
||||
CONFIG_PACKAGE_questd=y
|
||||
CONFIG_PACKAGE_rulengd=y
|
||||
CONFIG_PACKAGE_usermngr=y
|
||||
|
||||
# TR-x69 #
|
||||
CONFIG_PACKAGE_uspd-mbedtls=y
|
||||
|
||||
@@ -13,13 +13,13 @@ function genconfig {
|
||||
export DEVELOPER=0
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcm63xx_arm="target/linux/feeds/iopsys-brcm63xx-arm"
|
||||
ramips="target/linux/feeds/iopsys-ramips"
|
||||
econet="target/linux/feeds/iopsys-econet"
|
||||
x86="target/linux/feeds/iopsys-x86"
|
||||
armvirt="target/linux/feeds/iopsys-armvirt"
|
||||
mediatek="target/linux/feeds/iopsys-mediatek"
|
||||
qualcomm_ipq95xx="target/linux/feeds/ipq95xx"
|
||||
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"
|
||||
mediatek_feed="target/linux/feeds/iopsys-mediatek"
|
||||
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -109,23 +109,23 @@ function genconfig {
|
||||
return
|
||||
fi
|
||||
|
||||
[ -e $brcm63xx_arm/genconfig ] &&
|
||||
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
|
||||
[ -e $ramips/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips; ./genconfig)
|
||||
[ -e $econet/genconfig ] &&
|
||||
iopsys_econet=$(cd $econet; ./genconfig)
|
||||
[ -e $x86/genconfig ] &&
|
||||
iopsys_x86=$(cd $x86; ./genconfig)
|
||||
[ -e $armvirt/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt; ./genconfig)
|
||||
[ -e $mediatek/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx; ./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 ] &&
|
||||
iopsys_x86=$(cd $x86_feed; ./genconfig)
|
||||
[ -e $armvirt_feed/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt_feed; ./genconfig)
|
||||
[ -e $mediatek_feed/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -134,10 +134,10 @@ function genconfig {
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $iopsys_brcm63xx_arm; do
|
||||
for p in $brcmbca; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_brcm63xx_arm"
|
||||
target_config_path="$brcm63xx_arm/config"
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -145,15 +145,15 @@ function genconfig {
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_ramips"
|
||||
target_config_path="$ramips/config"
|
||||
target_config_path="$ramips_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_econet; do
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_econet"
|
||||
target_config_path="$econet/config"
|
||||
target="airoha"
|
||||
target_config_path="$airoha_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -161,7 +161,7 @@ function genconfig {
|
||||
for p in $iopsys_x86; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_x86"
|
||||
target_config_path="$x86/config"
|
||||
target_config_path="$x86_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -169,7 +169,7 @@ function genconfig {
|
||||
for p in $iopsys_armvirt; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_armvirt"
|
||||
target_config_path="$armvirt/config"
|
||||
target_config_path="$armvirt_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -177,7 +177,7 @@ function genconfig {
|
||||
for p in $iopsys_mediatek; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_mediatek"
|
||||
target_config_path="$mediatek/config"
|
||||
target_config_path="$mediatek_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -185,7 +185,7 @@ function genconfig {
|
||||
for p in $ipq95xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq95xx"
|
||||
target_config_path="$qualcomm_ipq95xx/config"
|
||||
target_config_path="$qualcomm_ipq95xx_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -342,7 +342,7 @@ function genconfig {
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
iopsys_ramips | iopsys_econet | iopsys_mediatek | iopsys_brcm63xx_arm)
|
||||
iopsys_ramips | 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)"
|
||||
@@ -388,12 +388,15 @@ function genconfig {
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
local GIT_REV=$(git rev-parse --short HEAD)
|
||||
local GIT_VER="$GIT_TAG"
|
||||
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
|
||||
local git_version
|
||||
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||
local version_lower="${version,,}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Package source tree override if selected
|
||||
|
||||
@@ -12,13 +12,13 @@ function genconfig_min {
|
||||
export DEVELOPER=0
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcm63xx_arm="target/linux/feeds/iopsys-brcm63xx-arm"
|
||||
ramips="target/linux/feeds/iopsys-ramips"
|
||||
econet="target/linux/feeds/iopsys-econet"
|
||||
x86="target/linux/feeds/iopsys-x86"
|
||||
armvirt="target/linux/feeds/iopsys-armvirt"
|
||||
mediatek="target/linux/feeds/iopsys-mediatek"
|
||||
qualcomm_ipq95xx="target/linux/feeds/ipq95xx"
|
||||
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"
|
||||
mediatek_feed="target/linux/feeds/iopsys-mediatek"
|
||||
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -108,23 +108,23 @@ function genconfig_min {
|
||||
return
|
||||
fi
|
||||
|
||||
[ -e $brcm63xx_arm/genconfig ] &&
|
||||
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
|
||||
[ -e $ramips/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips; ./genconfig)
|
||||
[ -e $econet/genconfig ] &&
|
||||
iopsys_econet=$(cd $econet; ./genconfig)
|
||||
[ -e $x86/genconfig ] &&
|
||||
iopsys_x86=$(cd $x86; ./genconfig)
|
||||
[ -e $armvirt/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt; ./genconfig)
|
||||
[ -e $mediatek/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx; ./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 ] &&
|
||||
iopsys_x86=$(cd $x86_feed; ./genconfig)
|
||||
[ -e $armvirt_feed/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt_feed; ./genconfig)
|
||||
[ -e $mediatek_feed/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -133,10 +133,10 @@ function genconfig_min {
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $iopsys_brcm63xx_arm; do
|
||||
for p in $brcmbca; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_brcm63xx_arm"
|
||||
target_config_path="$brcm63xx_arm/config"
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -144,15 +144,15 @@ function genconfig_min {
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_ramips"
|
||||
target_config_path="$ramips/config"
|
||||
target_config_path="$ramips_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_econet; do
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_econet"
|
||||
target_config_path="$econet/config"
|
||||
target="airoha"
|
||||
target_config_path="$airoha_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -160,7 +160,7 @@ function genconfig_min {
|
||||
for p in $iopsys_x86; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_x86"
|
||||
target_config_path="$x86/config"
|
||||
target_config_path="$x86_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -168,7 +168,7 @@ function genconfig_min {
|
||||
for p in $iopsys_armvirt; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_armvirt"
|
||||
target_config_path="$armvirt/config"
|
||||
target_config_path="$armvirt_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -176,7 +176,7 @@ function genconfig_min {
|
||||
for p in $iopsys_mediatek; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_mediatek"
|
||||
target_config_path="$mediatek/config"
|
||||
target_config_path="$mediatek_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -184,7 +184,7 @@ function genconfig_min {
|
||||
for p in $ipq95xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq95xx"
|
||||
target_config_path="$qualcomm_ipq95xx/config"
|
||||
target_config_path="$qualcomm_ipq95xx_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -333,7 +333,7 @@ function genconfig_min {
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
iopsys_ramips | iopsys_econet | iopsys_mediatek | iopsys_brcm63xx_arm)
|
||||
iopsys_ramips | 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)"
|
||||
@@ -379,12 +379,15 @@ function genconfig_min {
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
local GIT_REV=$(git rev-parse --short HEAD)
|
||||
local GIT_VER="$GIT_TAG"
|
||||
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
|
||||
local git_version
|
||||
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||
local version_lower="${version,,}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Package source tree override if selected
|
||||
|
||||
61
libvoice-broadcom/Makefile
Normal file
61
libvoice-broadcom/Makefile
Normal file
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# 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-broadcom
|
||||
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:=b53e93ca1a2fdda56ca9caffb6020e158e684f3d
|
||||
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)
|
||||
|
||||
export CONFIG_BRCM_SDK_VER_504040
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS libvoice for Broadcom
|
||||
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-broadcom -- package has no install section
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
58
libvoice-d2/Makefile
Normal file
58
libvoice-d2/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-d2
|
||||
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:=45e7d35f97f258f5e13c3afa0542db724bf59828
|
||||
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 D2 which is software DSP
|
||||
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-d2 -- package has no install section
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -13,6 +13,9 @@ config AGENT_ISLAND_PREVENTION
|
||||
config AGENT_EASYMESH_R2_CERT
|
||||
bool "Compile for WFA test bed"
|
||||
|
||||
config AGENT_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 2
|
||||
|
||||
config AGENT_EASYMESH_VENDOR_EXT
|
||||
bool "Enable extra features through Easymesh vendor extension"
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=2.10.3.25
|
||||
PKG_VERSION:=2.10.4.11
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=fa73ec8a5128dd9609abfd17ca40dbf10327684b
|
||||
PKG_SOURCE_VERSION:=0852c7803475f7fb919f680d02437ba9672c42fc
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -59,6 +59,8 @@ TARGET_CFLAGS += \
|
||||
-Wno-error=deprecated-declarations \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_AGENT_EASYMESH_VERSION)
|
||||
|
||||
ifeq ($(CONFIG_AGENT_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
||||
TARGET_CFLAGS += -DAGENT_SYNC_DYNAMIC_CNTLR_CONFIG
|
||||
endif
|
||||
|
||||
@@ -7,6 +7,7 @@ config agent 'agent'
|
||||
option island_prevention '0'
|
||||
option eth_onboards_wifi_bhs '0'
|
||||
# option controller_macaddr '0a:1b:2c:3d:4e:50'
|
||||
option scan_on_boot_only '0'
|
||||
|
||||
config dynamic_backhaul
|
||||
option missing_bh_timer '60'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
. /lib/network/utils.sh
|
||||
|
||||
conn_ports_file="/tmp/map.connected.ports"
|
||||
map_bh_file="/tmp/multiap.backhaul"
|
||||
map_bh_file="/var/run/multiap/multiap.backhaul"
|
||||
al_bridge="$(uci -q get mapagent.agent.al_bridge)"
|
||||
[ "${al_bridge:0:3}" = "br-" ] || exit 0
|
||||
al_brnet="${al_bridge:3}"
|
||||
|
||||
@@ -12,7 +12,7 @@ MAP_IF="map"
|
||||
|
||||
|
||||
start_dynbhd_service() {
|
||||
rm -f /tmp/multiap.backhaul
|
||||
rm -f /var/run/multiap/multiap.backhaul
|
||||
procd_open_instance
|
||||
procd_set_param command "/usr/sbin/dynbhd"
|
||||
procd_set_param respawn
|
||||
@@ -34,7 +34,8 @@ validate_agent_section() {
|
||||
'resend_num:uinteger:0' \
|
||||
'dyn_cntlr_sync:bool:true' \
|
||||
'island_prevention:bool:false' \
|
||||
'eth_onboards_wifi_bhs:bool:false'
|
||||
'eth_onboards_wifi_bhs:bool:false' \
|
||||
'scan_on_boot_only:bool:false'
|
||||
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
|
||||
@@ -14,6 +14,10 @@ config CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
string
|
||||
default "\\\\x11\\\\x22\\\\x33"
|
||||
|
||||
config CONTROLLER_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 2
|
||||
|
||||
config CONTROLLER_EASYMESH_VENDOR_EXT_OUI
|
||||
string "Vendor OUI in '\\\\xAB\\\\xCD\\\\xEF' format"
|
||||
default CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=2.11.0.11
|
||||
PKG_VERSION:=2.11.0.20
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=3f462d32e487115b1a1d6f92645d895dc5cd9c44
|
||||
PKG_SOURCE_VERSION:=5ff7f037c040d337982a1e3a51693fb8e0682046
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
@@ -45,6 +45,8 @@ TARGET_CFLAGS += \
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_CONTROLLER_EASYMESH_VERSION)
|
||||
|
||||
ifeq ($(CONFIG_CONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
||||
TARGET_CFLAGS += -DCONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG
|
||||
endif
|
||||
|
||||
@@ -2,15 +2,23 @@ config controller 'controller'
|
||||
option enabled '1'
|
||||
option registrar '2 5'
|
||||
option debug '0'
|
||||
option enable_sta_steer '0'
|
||||
option enable_bsta_steer '0'
|
||||
option use_bcn_metrics '0'
|
||||
option use_usta_metrics '0'
|
||||
option bcn_metrics_max_num '10'
|
||||
option initial_channel_scan '0'
|
||||
option primary_vid '0'
|
||||
option primary_pcp '0'
|
||||
option allow_bgdfs '0'
|
||||
option channel_plan '0'
|
||||
|
||||
config sta_steering
|
||||
option steer_module 'rcpi'
|
||||
option enabled '1'
|
||||
option enable_sta_steer '0'
|
||||
option enable_bsta_steer '0'
|
||||
option use_bcn_metrics '0'
|
||||
option use_usta_metrics '0'
|
||||
option bandsteer '0'
|
||||
option diffsnr '8'
|
||||
|
||||
config ap
|
||||
option band '2'
|
||||
option encryption 'sae-mixed'
|
||||
@@ -60,8 +68,8 @@ config ap
|
||||
# option report_sta_assocfails_rate '0'
|
||||
# option report_metric_periodic '0'
|
||||
# option report_scan '0'
|
||||
# option steer_exclude '0'
|
||||
# option steer_exclude_btm '0'
|
||||
# list steer_exclude 'e0:d4:e8:79:c4:ee'
|
||||
# list steer_exclude_btm 'e0:d4:e8:79:c4:11'
|
||||
# option steer_disallow '0'
|
||||
# option coordinated_cac '0'
|
||||
# option traffic_separation '0'
|
||||
@@ -107,8 +115,8 @@ config ap
|
||||
# option report_sta_assocfails_rate '0'
|
||||
# option report_metric_periodic '0'
|
||||
# option report_scan '0'
|
||||
# option steer_exclude '0'
|
||||
# option steer_exclude_btm '0'
|
||||
# list steer_exclude 'e0:d4:e8:79:c4:ee'
|
||||
# list steer_exclude_btm 'e0:d4:e8:79:c4:11'
|
||||
# option steer_disallow '0'
|
||||
# option coordinated_cac '0'
|
||||
# option traffic_separation '0'
|
||||
|
||||
@@ -19,11 +19,9 @@ validate_controller_section() {
|
||||
'enabled:bool:true' \
|
||||
'registrar:string' \
|
||||
'debug:range(0,16)' \
|
||||
'bcn_metrics_max_num:range(1,256)' \
|
||||
'initial_channel_scan:bool:true' \
|
||||
'resend_num:uinteger:0' \
|
||||
'enable_sta_steer:bool:false' \
|
||||
'enable_bsta_steer:bool:false' \
|
||||
'use_bcn_metrics:bool:false' \
|
||||
'use_usta_metrics:bool:false' \
|
||||
'allow_bgdfs:range(0,2629744)' \
|
||||
'channel_plan:range(0,2629744)' \
|
||||
'enable_ts:bool:false'
|
||||
@@ -36,6 +34,27 @@ validate_controller_section() {
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_sta_steering_section() {
|
||||
local section="$1"
|
||||
|
||||
uci_validate_section mapcontroller $section "${1}" \
|
||||
'steer_module:string' \
|
||||
'enabled:bool:true' \
|
||||
'enable_sta_steer:bool:false' \
|
||||
'enable_bsta_steer:bool:false' \
|
||||
'use_bcn_metrics:bool:false' \
|
||||
'use_usta_metrics:bool:false' \
|
||||
'bandsteer:bool:false' \
|
||||
'diffsnr:range(0,100)'
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "mapcontroller" "Validation of sta_steering section failed"
|
||||
IS_CFG_VALID=0
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_ap_section() {
|
||||
local section="$1"
|
||||
|
||||
@@ -116,6 +135,7 @@ validate_controller_config() {
|
||||
IS_CFG_VALID=1
|
||||
|
||||
validate_controller_section &&
|
||||
config_foreach validate_sta_steering_section sta_steering &&
|
||||
config_foreach validate_ap_section ap &&
|
||||
config_foreach validate_node_section node &&
|
||||
config_foreach validate_radio_section radio
|
||||
|
||||
@@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=map-topology
|
||||
PKG_VERSION:=2.5.1.8
|
||||
PKG_VERSION:=2.5.1.13
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_VERSION:=ee72703a5c89983c881d8faedcdc749b54278790
|
||||
PKG_SOURCE_VERSION:=aaa55a72e719184af32d57a9b40bec1c440774a9
|
||||
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
|
||||
|
||||
308
mqttmngr/LICENSE
Normal file
308
mqttmngr/LICENSE
Normal file
@@ -0,0 +1,308 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
uspd - USP Daemon exposing USP API over uBus
|
||||
Copyright (C) 2019 iopsys Software Solutions AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
44
mqttmngr/Makefile
Normal file
44
mqttmngr/Makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# Copyright (C) 2022 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mqttmngr
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mqttmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
DEPENDS:= +libbbf_api +mosquitto
|
||||
TITLE:=Package to add Device.MQTT. datamodel support
|
||||
endef
|
||||
|
||||
define Package/mqttmngr/description
|
||||
Package to add Device.MQTT. datamodel support
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) src/* $(PKG_BUILD_DIR)
|
||||
mkdir -p $(PKG_BUILD_DIR)/files
|
||||
$(CP) files/* $(PKG_BUILD_DIR)/files/
|
||||
endef
|
||||
|
||||
define Package/mqttmngr/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libmqttmngr.so $(1)/usr/lib/bbfdm/libmqttmngr.so
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/uci-defaults/01-mosquitto-config $(1)/etc/uci-defaults/01-mosquitto-config
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mqttmngr))
|
||||
4
mqttmngr/README.md
Normal file
4
mqttmngr/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# MQTTmngr
|
||||
MQTT manager is a lightweight program to manage MQTT broker. It also provides the TR181 datamodel object `Device.MQTT.` using libbbf DotSO plugin.
|
||||
|
||||
|
||||
47
mqttmngr/files/etc/uci-defaults/01-mosquitto-config
Normal file
47
mqttmngr/files/etc/uci-defaults/01-mosquitto-config
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/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="0"
|
||||
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.include_dir="/etc/mosquitto/conf.d"
|
||||
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
|
||||
17
mqttmngr/src/Makefile
Normal file
17
mqttmngr/src/Makefile
Normal file
@@ -0,0 +1,17 @@
|
||||
LIB = libmqttmngr.so
|
||||
|
||||
LIB_OBJS = mqtt.o
|
||||
|
||||
PROG_CFLAGS = $(CFLAGS) -Wall -Werror -fPIC
|
||||
LIB_LDFLAGS = $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $<
|
||||
|
||||
all: $(LIB)
|
||||
|
||||
$(LIB): $(LIB_OBJS)
|
||||
$(CC) $(PROG_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f *.o $(LIB)
|
||||
334
mqttmngr/src/mqtt.c
Normal file
334
mqttmngr/src/mqtt.c
Normal file
@@ -0,0 +1,334 @@
|
||||
/*
|
||||
* Copyright (C) 2022 iopsys Software Solutions AB
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* Author: Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
|
||||
*/
|
||||
|
||||
#include <libbbf_api.h>
|
||||
|
||||
#include "mqtt.h"
|
||||
|
||||
static bool duplicate_entry_exist(char *name, char *section_type)
|
||||
{
|
||||
bool exist = false;
|
||||
struct uci_section *s = NULL, *stmp = NULL;
|
||||
|
||||
uci_foreach_sections_safe("mosquitto", section_type, stmp, s) {
|
||||
if (DM_STRCMP(name, section_name(s)) == 0) {
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return exist;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* ADD & DEL OBJ
|
||||
**************************************************************/
|
||||
static int addMQTTBroker(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||
{
|
||||
struct uci_section *s = NULL, *dmmap_broker = NULL;
|
||||
char sec_name[40];
|
||||
|
||||
snprintf(sec_name, sizeof(sec_name), "broker_%s", *instance);
|
||||
|
||||
if (bbf_uci_add_section("mosquitto", "listener", &s) == 0) {
|
||||
bbf_uci_rename_section(s, sec_name);
|
||||
bbf_uci_set_value_by_section(s, "enabled", "0");
|
||||
bbf_uci_add_section_bbfdm("dmmap_mqtt", "listener", &dmmap_broker);
|
||||
bbf_uci_set_value_by_section(dmmap_broker, "section_name", sec_name);
|
||||
bbf_uci_set_value_by_section(dmmap_broker, "listener_instance", *instance);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int delMQTTBroker(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||
{
|
||||
struct uci_section *s = NULL, *stmp = NULL;
|
||||
|
||||
switch (del_action) {
|
||||
case DEL_INST:
|
||||
bbf_uci_delete_section_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL);
|
||||
bbf_uci_delete_section_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL);
|
||||
break;
|
||||
case DEL_ALL:
|
||||
bbf_uci_foreach_sections_safe("users", "user", stmp, s) {
|
||||
struct uci_section *dmmap_section = NULL;
|
||||
get_dmmap_section_of_config_section("dmmap_users", "user", section_name(s), &dmmap_section);
|
||||
bbf_uci_delete_section_by_section(s, NULL, NULL);
|
||||
bbf_uci_delete_section_by_section(dmmap_section, NULL, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* ENTRY METHOD
|
||||
*************************************************************/
|
||||
static int browseMQTTBrokerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
struct dmmap_dup *p = NULL;
|
||||
char *inst = NULL;
|
||||
LIST_HEAD(dup_list);
|
||||
|
||||
synchronize_specific_config_sections_with_dmmap("mosquitto", "listener", "dmmap_mqtt", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_instance(dmctx, parent_node, p->dmmap_section, "listener_instance", "listener_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
free_dmmap_config_dup_list(&dup_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* GET & SET PARAM
|
||||
**************************************************************/
|
||||
static int get_MQTT_BrokerNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
int cnt = bbf_get_number_of_entries(ctx, data, instance, browseMQTTBrokerInst);
|
||||
dmasprintf(value, "%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_MQTTBroker_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "listener_alias", value);
|
||||
if ((*value)[0] == '\0')
|
||||
dmasprintf(value, "cpe-%s", instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_MQTTBroker_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "listener_alias", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = bbf_uci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enabled", "0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
string_to_bool(value, &b);
|
||||
bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "section_name", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *curr_name = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Check if the value is empty
|
||||
if (*value == '\0')
|
||||
return FAULT_9007;
|
||||
|
||||
// Check if new name is same as current name
|
||||
curr_name = section_name(((struct dmmap_dup *)data)->config_section);
|
||||
if (DM_STRCMP(curr_name, value) == 0)
|
||||
break;
|
||||
|
||||
// check if duplicate entry already exists
|
||||
if (duplicate_entry_exist(value, "listener"))
|
||||
return FAULT_9001;
|
||||
|
||||
break;
|
||||
case VALUESET:
|
||||
// If new name is same as current name then nothing to do
|
||||
curr_name = section_name(((struct dmmap_dup *)data)->config_section);
|
||||
if (DM_STRCMP(curr_name, value) == 0)
|
||||
break;
|
||||
|
||||
// Update mosquitto config
|
||||
if (0 != bbf_uci_rename_section(((struct dmmap_dup *)data)->config_section, value))
|
||||
return FAULT_9001;
|
||||
|
||||
// Update dmmap_users file
|
||||
bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "section_name", value);
|
||||
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_MQTTBroker_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = bbf_uci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "port", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_MQTTBroker_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "port", value);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char *intf = NULL;
|
||||
|
||||
bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", &intf);
|
||||
if (DM_STRLEN(intf) == 0)
|
||||
return 0;
|
||||
|
||||
adm_entry_get_linker_param(ctx, "Device.IP.Interface.", intf, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||
char *iface = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
return FAULT_9007;
|
||||
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
if (DM_STRLEN(iface) != 0)
|
||||
bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "interface", iface);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_MQTTBroker_Username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
bbf_uci_get_value_by_section(((struct dmmap_dup *)data)->config_section, "username", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_MQTTBroker_Username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Check if the value is empty
|
||||
if (*value == '\0')
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "username", value);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_MQTTBroker_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_MQTTBroker_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
bbf_uci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "password", value);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************
|
||||
* OBJ & LEAF DEFINITION
|
||||
**********************************************************************************************************************************/
|
||||
DM_MAP_OBJ tDynamicObj[] = {
|
||||
/* parentobj, nextobject, parameter */
|
||||
{"Device.", tDeviceMQTTObj, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.MQTT. *** */
|
||||
DMOBJ tDeviceMQTTObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
|
||||
{"MQTT", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tMQTTObj, tMQTTParams, NULL, BBFDM_BOTH, NULL, "2.10"},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.MQTT.Broker. *** */
|
||||
DMOBJ tMQTTObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
|
||||
{"Broker", &DMWRITE, addMQTTBroker, delMQTTBroker, NULL, browseMQTTBrokerInst, NULL, NULL, NULL, tMQTTBrokerParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Name", NULL}, "2.10"},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMLEAF tMQTTParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
|
||||
{"BrokerNumberOfEntries", &DMREAD, DMT_UNINT, get_MQTT_BrokerNumberOfEntries, NULL, BBFDM_BOTH, "2.10"},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMLEAF tMQTTBrokerParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
|
||||
{"Enable", &DMWRITE, DMT_BOOL, get_MQTTBroker_Enable, set_MQTTBroker_Enable, BBFDM_BOTH, "2.10"},
|
||||
{"Alias", &DMWRITE, DMT_STRING, get_MQTTBroker_Alias, set_MQTTBroker_Alias, BBFDM_BOTH, "2.10"},
|
||||
{"Name", &DMWRITE, DMT_STRING, get_MQTTBroker_Name, set_MQTTBroker_Name, BBFDM_BOTH, "2.10"},
|
||||
//{"Status", &DMREAD, DMT_STRING, get_MQTTBroker_Status, NULL, BBFDM_BOTH, "2.10"},
|
||||
{"Port", &DMWRITE, DMT_UNINT, get_MQTTBroker_Port, set_MQTTBroker_Port, BBFDM_BOTH, "2.10"},
|
||||
{"Interface", &DMWRITE, DMT_STRING, get_MQTTBroker_Interface, set_MQTTBroker_Interface, BBFDM_BOTH, "2.10"},
|
||||
{"Username", &DMWRITE, DMT_STRING, get_MQTTBroker_Username, set_MQTTBroker_Username, BBFDM_BOTH, "2.10"},
|
||||
{"Password", &DMWRITE, DMT_STRING, get_MQTTBroker_Password, set_MQTTBroker_Password, BBFDM_BOTH, "2.10"},
|
||||
{0}
|
||||
};
|
||||
|
||||
20
mqttmngr/src/mqtt.h
Normal file
20
mqttmngr/src/mqtt.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2022 iopsys Software Solutions AB
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* Author: Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
|
||||
*/
|
||||
|
||||
#ifndef _MQTT_H
|
||||
#define _MQTT_H
|
||||
|
||||
#include "libbbf_api/dmcommon.h"
|
||||
|
||||
extern DMOBJ tDeviceMQTTObj[];
|
||||
extern DMOBJ tMQTTObj[];
|
||||
extern DMLEAF tMQTTParams[];
|
||||
extern DMLEAF tMQTTBrokerParams[];
|
||||
#endif
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=6.0.0.7
|
||||
PKG_VERSION:=6.0.0.11
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/obuspa.git
|
||||
PKG_SOURCE_VERSION:=b5afdfc4b7ba93698a6ac981fc0f300b5362b7bf
|
||||
PKG_SOURCE_VERSION:=668748cd4801aa5af12d61d9b0837064b9f933cc
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -2,7 +2,7 @@ config obuspa 'global'
|
||||
option enabled '1'
|
||||
option debug '1'
|
||||
option log_level '1'
|
||||
option prototrace '1'
|
||||
option prototrace '0'
|
||||
option db_file '/etc/obuspa/usp.db'
|
||||
#option role_file '/etc/obuspa/roles.json'
|
||||
option dm_caching_exclude '/etc/obuspa/dmcaching_exclude.json'
|
||||
|
||||
@@ -59,6 +59,17 @@ db_set_sql()
|
||||
fi
|
||||
}
|
||||
|
||||
db_del_sql()
|
||||
{
|
||||
local param
|
||||
|
||||
param="${1}"
|
||||
|
||||
if [ -n "${param}" ]; then
|
||||
${PROG} -f ${SQL_DB_FILE} -c dbdel "${param}" >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
db_set()
|
||||
{
|
||||
# if sql db present, update sql db
|
||||
@@ -70,6 +81,14 @@ db_set()
|
||||
fi
|
||||
}
|
||||
|
||||
update_db_dump()
|
||||
{
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
rm ${DB_DUMP}
|
||||
${PROG} -f ${SQL_DB_FILE} -c show database |sort > ${DB_DUMP}
|
||||
fi
|
||||
}
|
||||
|
||||
# if db present then check if it matches with existing instances
|
||||
# fallback to max instance present + 1
|
||||
# In case of no db get the count
|
||||
@@ -296,7 +315,6 @@ publish_endpoint()
|
||||
local AgentEndpointID serial oui user pass
|
||||
|
||||
if ! uci -q get obuspa.localmqtt; then
|
||||
log "Remote mqtt broker configured, skip publishing endpoint"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
@@ -342,6 +360,7 @@ configure_localagent()
|
||||
}
|
||||
|
||||
db_set Device.LocalAgent.EndpointID "${EndpointID}"
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
update_reset_reason()
|
||||
@@ -437,6 +456,7 @@ configure_controller()
|
||||
done
|
||||
|
||||
db_set
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
configure_subscription()
|
||||
@@ -570,7 +590,6 @@ configure_mtp() {
|
||||
log "Validation of mtp section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
sec="${sec/mtp_/cpe-}"
|
||||
get_base_path "Device.LocalAgent.MTP." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
@@ -614,6 +633,7 @@ configure_mtp() {
|
||||
db_set "${BASEPATH}.WebSocket.EnableEncryption" "${EnableEncryption}"
|
||||
fi
|
||||
db_set
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
configure_stomp_connection() {
|
||||
@@ -645,9 +665,10 @@ configure_stomp_connection() {
|
||||
db_set "${BASEPATH}.EnableHeartbeats" "${EnableHeartbeats}"
|
||||
db_set "${BASEPATH}.VirtualHost" "${VirtualHost}"
|
||||
db_set
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
configure_mqtt_client(){
|
||||
configure_mqtt_client() {
|
||||
local BrokerAddress BrokerPort Enable Username Password ProtocolVersion
|
||||
local TransportProtocol ClientID
|
||||
local sec
|
||||
@@ -676,6 +697,7 @@ configure_mqtt_client(){
|
||||
db_set "${BASEPATH}.ClientID" "${ClientID}"
|
||||
|
||||
db_set
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
|
||||
@@ -914,7 +936,7 @@ sync_update_sec()
|
||||
fi
|
||||
}
|
||||
|
||||
sync_db_with_uci()
|
||||
sync_uci_with_db()
|
||||
{
|
||||
if [ ! -f "${DB_DUMP}" ]; then
|
||||
return 0;
|
||||
@@ -935,12 +957,66 @@ sync_db_with_uci()
|
||||
uci_commit obuspa
|
||||
}
|
||||
|
||||
delete_sql_db_entry_with_pattern()
|
||||
{
|
||||
local params pattern
|
||||
|
||||
pattern="${1}"
|
||||
if [ ! -f "${DB_DUMP}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${#pattern}" -lt 7 ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
params="$(grep ${pattern} ${DB_DUMP}|awk '{print $1}')"
|
||||
for p in ${params}; do
|
||||
db_del_sql "${p}"
|
||||
done
|
||||
}
|
||||
|
||||
check_n_delete_db()
|
||||
{
|
||||
local sec t r path
|
||||
|
||||
sec="${1}"
|
||||
if uci -q get obuspa.${sec} >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
t="${2}"
|
||||
r="${3}"
|
||||
sec="${sec/${t}_/cpe-}"
|
||||
|
||||
path=$(grep "${r}\d.Alias => ${sec}" ${DB_DUMP})
|
||||
path=${path%.*}
|
||||
|
||||
delete_sql_db_entry_with_pattern "${path}"
|
||||
}
|
||||
|
||||
reverse_update_db_with_uci()
|
||||
{
|
||||
if [ ! -f "${DB_DUMP}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
export UCI_CONFIG_DIR="/tmp/obuspa"
|
||||
config_load obuspa
|
||||
config_foreach check_n_delete_db controller controller "Device.LocalAgent.Controller."
|
||||
config_foreach check_n_delete_db mtp mtp "Device.LocalAgent.MTP."
|
||||
config_foreach check_n_delete_db mqtt mqtt "Device.MQTT.Client."
|
||||
config_foreach check_n_delete_db stomp stomp "Device.STOMP.Connection."
|
||||
unset UCI_CONFIG_DIR
|
||||
}
|
||||
|
||||
# Create factory reset file
|
||||
db_init()
|
||||
{
|
||||
local reason
|
||||
|
||||
reason="${1}"
|
||||
mkdir -p /tmp/obuspa/
|
||||
# Load configuration
|
||||
config_load $CONFIGURATION
|
||||
config_get SQL_DB_FILE global db_file "/tmp/obuspa/usp.db"
|
||||
@@ -952,7 +1028,12 @@ db_init()
|
||||
|
||||
# Only sync uci with db in case of non service triggers
|
||||
if [ -f "${DB_DUMP}" ] && [ "${reason}" != "update" ]; then
|
||||
sync_db_with_uci
|
||||
sync_uci_with_db
|
||||
fi
|
||||
|
||||
# remove entries from db if deleted from uci
|
||||
if [ -f "${DB_DUMP}" ] && [ "${reason}" == "update" ] && [ -f "/tmp/obuspa/obuspa" ]; then
|
||||
reverse_update_db_with_uci
|
||||
fi
|
||||
|
||||
# Remove reset file if present
|
||||
@@ -977,6 +1058,8 @@ db_init()
|
||||
update_reset_reason
|
||||
uci_commit ${CONFIGURATION}
|
||||
|
||||
cp /etc/config/obuspa /tmp/obuspa/
|
||||
|
||||
[ -f "${DB_DUMP}" ] && rm -f ${DB_DUMP}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/ponmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=PON Manager
|
||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet)
|
||||
DEPENDS:=@(TARGET_brcmbca||TARGET_airoha)
|
||||
endef
|
||||
|
||||
define Package/ponmngr/description
|
||||
@@ -34,9 +34,9 @@ endef
|
||||
|
||||
define Package/ponmngr/install
|
||||
$(CP) ./files/common/* $(1)/
|
||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
||||
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||
$(CP) ./files/broadcom/* $(1)/
|
||||
else ifneq ($(CONFIG_TARGET_iopsys_econet),)
|
||||
else ifneq ($(CONFIG_TARGET_airoha),)
|
||||
$(CP) ./files/airoha/* $(1)/
|
||||
endif
|
||||
endef
|
||||
|
||||
@@ -27,7 +27,7 @@ define Package/qosmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=QoS Manager
|
||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet) +libuci +libubox +libubus +libblobmsg-json +libjson-c +libqos
|
||||
DEPENDS:=@(TARGET_brcmbca||TARGET_airoha) +libuci +libubox +libubus +libblobmsg-json +libjson-c +libqos
|
||||
endef
|
||||
|
||||
define Package/qosmngr/description
|
||||
@@ -40,11 +40,24 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/qosmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
define Package/qosmngr/install/common
|
||||
$(CP) ./files/common/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/qosmngr $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
define Package/qosmngr/install
|
||||
$(CP) ./files/broadcom/* $(1)/
|
||||
$(call Package/qosmngr/install/common,$(1))
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
define Package/qosmngr/install
|
||||
$(CP) ./files/airoha/* $(1)/
|
||||
$(call Package/qosmngr/install/common,$(1))
|
||||
endef
|
||||
endif
|
||||
$(eval $(call BuildPackage,qosmngr))
|
||||
|
||||
48
qosmngr/files/airoha/etc/uci-defaults/60-qos_queue_generate
Normal file
48
qosmngr/files/airoha/etc/uci-defaults/60-qos_queue_generate
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
generate_queue(){
|
||||
section="$1"
|
||||
|
||||
config_get ifname "$section" "ifname"
|
||||
|
||||
if [ "$ifname" != "$ethwan" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# guaranteed number of queues
|
||||
no_of_q="0 1 2 3"
|
||||
|
||||
i=0
|
||||
local total_q=$((${no_of_q##* } + 1))
|
||||
for i in $no_of_q; do
|
||||
order=$((total_q - i))
|
||||
uci add qos queue
|
||||
uci rename qos.@queue[-1]="q_${i}_${ifname}"
|
||||
uci set qos.@queue[-1].enable="1"
|
||||
uci set qos.@queue[-1].ifname="$ifname"
|
||||
uci set qos.@queue[-1].precedence="$order"
|
||||
uci set qos.@queue[-1].scheduling="SP"
|
||||
uci set qos.@queue[-1].rate="0"
|
||||
uci set qos.@queue[-1].burst_size="0"
|
||||
uci set qos.@queue[-1].weight="1"
|
||||
done
|
||||
|
||||
uci commit qos
|
||||
}
|
||||
|
||||
if [ -s "/etc/config/qos" ]; then
|
||||
if uci -q get qos.@queue[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
else
|
||||
rm -f /etc/config/qos
|
||||
fi
|
||||
fi
|
||||
touch /etc/config/qos
|
||||
|
||||
config_load ports
|
||||
config_foreach generate_queue ethport
|
||||
190
qosmngr/files/airoha/lib/qos/airoha.sh
Executable file
190
qosmngr/files/airoha/lib/qos/airoha.sh
Executable file
@@ -0,0 +1,190 @@
|
||||
#!/bin/sh
|
||||
# Implementation of QoS setup for Econet platform.
|
||||
|
||||
errmsg() {
|
||||
echo "$@" >&2
|
||||
return 0
|
||||
}
|
||||
|
||||
get_var() {
|
||||
local varname="$1"
|
||||
eval echo \$\{${varname}\}
|
||||
return 0
|
||||
}
|
||||
|
||||
# Initialized queues
|
||||
# (Not needed on Econet)
|
||||
hw_queue_init_all() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# Initialize all interfaces
|
||||
# (Not needed on Econet)
|
||||
hw_intf_init() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# Initialize the hardware setup library
|
||||
hw_init_all() {
|
||||
export TMP_HW_QUEUE_LIST=""
|
||||
export TMP_HW_QUEUE_MASK="0"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Remember selected queue options. They will be committed
|
||||
# during hw_commit_all()
|
||||
hw_queue_set() {
|
||||
local ifname="$1"
|
||||
local q_count="$2"
|
||||
local order="$3"
|
||||
local qsize="$4"
|
||||
local wgt="$5"
|
||||
local sc_alg="$6"
|
||||
local rate="$7"
|
||||
local burstsize="$8"
|
||||
local index="$((order - 1))"
|
||||
local ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
#if [ "${ifname}" != "${ethwan}" ] ; then
|
||||
# return 2
|
||||
#fi
|
||||
|
||||
export TMP_HW_QUEUE_${order}_no="${q_count}"
|
||||
export TMP_HW_QUEUE_${order}_ifname="${ifname}"
|
||||
export TMP_HW_QUEUE_${order}_order="${order}"
|
||||
export TMP_HW_QUEUE_${order}_qsize="${qsize}"
|
||||
export TMP_HW_QUEUE_${order}_wgt="${wgt}"
|
||||
export TMP_HW_QUEUE_${order}_sc_alg="${sc_alg}"
|
||||
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))"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Set policer options. In fact, they are not supported.
|
||||
hw_policer_set() {
|
||||
local action="$1"
|
||||
local dir="$2"
|
||||
local policer_no="$3"
|
||||
|
||||
shift 3
|
||||
|
||||
case "$action" in
|
||||
add)
|
||||
meter="$1"
|
||||
cir="$2"
|
||||
cbs="$3"
|
||||
ebs="$4"
|
||||
pir="$5"
|
||||
pbs="$6"
|
||||
|
||||
;;
|
||||
del)
|
||||
;;
|
||||
esac
|
||||
errmsg "Policer (action $action, direction $dir) is not implemented"
|
||||
return $?
|
||||
}
|
||||
|
||||
# Set ingress rate. In fact, it is not supported
|
||||
hw_policer_set_ingress_rate() {
|
||||
local ifname="$1"
|
||||
local ingress_rate="$2"
|
||||
local in_burst_size="$3"
|
||||
|
||||
errmsg "Policer (action set_ingress_rate) is not implemented"
|
||||
}
|
||||
|
||||
# Configure shaper rate that will be committed during hw_commit_all()
|
||||
hw_shaper_set() {
|
||||
local ifname="$1"
|
||||
local action="$2"
|
||||
local rate="$3"
|
||||
local burstsize="$4"
|
||||
|
||||
case "${action}" in
|
||||
add)
|
||||
export TMP_HW_SHAPE_RATE="$rate"
|
||||
export TMP_HW_SHAPE_BURSTSIZE="$burstsize"
|
||||
;;
|
||||
del)
|
||||
export TMP_HW_SHAPE_RATE=""
|
||||
export TMP_HW_SHAPE_BURSTSIZE=""
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Convert shaper in UCI terms to Econet terms
|
||||
hw_sc_alg2str() {
|
||||
local sc_alg="$1"
|
||||
|
||||
case "${sc_alg}" in
|
||||
SP)
|
||||
echo "PQ"
|
||||
;;
|
||||
WRR)
|
||||
echo "WRR"
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
return 1
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Commit all options preserved during
|
||||
hw_commit_all() {
|
||||
local sorted_list="$(echo $TMP_HW_QUEUE_LIST | tr ' ' '\n' | sort | xargs)"
|
||||
local weight_list=""
|
||||
local glob_alg=""
|
||||
local shape_rate="$TMP_HW_SHAPE_RATE"
|
||||
local queue_mask="$TMP_HW_QUEUE_MASK"
|
||||
local q_count="0"
|
||||
|
||||
# Reorder queues
|
||||
for q in ${sorted_list} ; do
|
||||
local sc_alg="$(get_var TMP_HW_QUEUE_${q}_sc_alg)"
|
||||
local wgt="$(get_var TMP_HW_QUEUE_${q}_wgt)"
|
||||
|
||||
if [ "$glob_alg" != "" ] && [ "$sc_alg" != "$glob_alg" ] ; then
|
||||
errmsg "Not matching scheduling algorithm: $sc_alg vs $glob_alg"
|
||||
return 1
|
||||
fi
|
||||
|
||||
glob_alg="$sc_alg"
|
||||
|
||||
case "${sc_alg}" in
|
||||
WRR)
|
||||
if [ $(($q_count >= 4)) != 0 ] ; then
|
||||
errmsg "Too many queues, next queues will be ignored"
|
||||
else
|
||||
weight_list="$weight_list $wgt"
|
||||
fi
|
||||
q_count=$((q_count + 1))
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "${glob_alg}" == "WRR" ] ; then
|
||||
while [ $((q_count < 4)) != 0 ] ; do
|
||||
weight_list="$weight_list 1"
|
||||
q_count=$((q_count + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "${glob_alg}" != "" ] ; then
|
||||
/userfs/bin/qosrule discpline $(hw_sc_alg2str ${glob_alg}) ${weight_list} \
|
||||
${shape_rate:+uplink-bandwidth} $shape_rate \
|
||||
queuemask $queue_mask
|
||||
else
|
||||
/userfs/bin/qosrule discpline off
|
||||
fi
|
||||
}
|
||||
453
qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh
Executable file
453
qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh
Executable file
@@ -0,0 +1,453 @@
|
||||
#!/bin/sh
|
||||
# Install ebtables rules
|
||||
|
||||
BR_RULE=""
|
||||
BR6_RULE=""
|
||||
|
||||
init_broute_rule() {
|
||||
BR_RULE=""
|
||||
BR6_RULE=""
|
||||
}
|
||||
|
||||
broute_filter_on_src_if() {
|
||||
BR_RULE="$BR_RULE --in-if $1"
|
||||
}
|
||||
|
||||
broute_filter_on_src_mac() {
|
||||
BR_RULE="$BR_RULE --src $1"
|
||||
}
|
||||
|
||||
broute_filter_on_dst_mac() {
|
||||
BR_RULE="$BR_RULE --dst $1"
|
||||
}
|
||||
|
||||
broute_filter_on_pcp() {
|
||||
case "$BR_RULE" in
|
||||
*proto*)
|
||||
BR_RULE="$BR_RULE --vlan-prio $1"
|
||||
;;
|
||||
*)
|
||||
BR_RULE="$BR_RULE --proto 802_1Q --vlan-prio $1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
broute_filter_on_ether_type() {
|
||||
BR_RULE="$BR_RULE --proto $1"
|
||||
}
|
||||
|
||||
broute_filter_on_ether_type6() {
|
||||
BR6_RULE="$BR6_RULE --proto IPv6"
|
||||
}
|
||||
|
||||
ebt_match_src_ip() {
|
||||
BR_RULE="$BR_RULE --ip-src $1"
|
||||
}
|
||||
|
||||
ebt_match_dst_ip() {
|
||||
BR_RULE="$BR_RULE --ip-dst $1"
|
||||
}
|
||||
|
||||
ebt_match_ipv6_src_ip() {
|
||||
BR_RULE="$BR_RULE --ip6-src $1"
|
||||
}
|
||||
|
||||
ebt_match_ipv6_dst_ip() {
|
||||
BR_RULE="$BR_RULE --ip6-dst $1"
|
||||
}
|
||||
|
||||
ebt_match_ip_src_port() {
|
||||
BR_RULE="$BR_RULE --ip-source-port $1"
|
||||
}
|
||||
|
||||
ebt_match_ip_dst_port() {
|
||||
BR_RULE="$BR_RULE --ip-destination-port $1"
|
||||
}
|
||||
|
||||
ebt_match_ipv6_src_port() {
|
||||
if [ -n "$BR6_RULE" ]; then
|
||||
BR6_RULE="$BR6_RULE --ip6-source-port $1"
|
||||
else
|
||||
BR_RULE="$BR_RULE --ip6-source-port $1"
|
||||
fi
|
||||
}
|
||||
|
||||
ebt_match_ipv6_dst_port() {
|
||||
if [ -n "$BR6_RULE" ]; then
|
||||
BR6_RULE="$BR6_RULE --ip6-destination-port $1"
|
||||
else
|
||||
BR_RULE="$BR_RULE --ip6-destination-port $1"
|
||||
fi
|
||||
}
|
||||
|
||||
ebt_match_ip_protocol() {
|
||||
BR_RULE="$BR_RULE --ip-proto $1"
|
||||
}
|
||||
|
||||
ebt_match_ipv6_protocol() {
|
||||
if [ -n "$BR6_RULE" ]; then
|
||||
BR6_RULE="$BR6_RULE --ip6-proto $1"
|
||||
else
|
||||
BR_RULE="$BR_RULE --ip6-proto $1"
|
||||
fi
|
||||
}
|
||||
|
||||
ebt_match_ipv6_dscp() {
|
||||
if [ -n "$BR6_RULE" ]; then
|
||||
BR6_RULE="$BR6_RULE --ip6-tclass $1"
|
||||
else
|
||||
BR_RULE="$BR_RULE --ip6-tclass $1"
|
||||
fi
|
||||
}
|
||||
|
||||
broute_filter_on_vid() {
|
||||
|
||||
if [ -z "$1" ] || [ "$1" -lt 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
case "$BR_RULE" in
|
||||
*proto*)
|
||||
BR_RULE="$BR_RULE --vlan-id $1"
|
||||
;;
|
||||
*)
|
||||
BR_RULE="$BR_RULE --proto 802_1Q --vlan-id $1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
broute_rule_set_traffic_class() {
|
||||
BR_RULE="$BR_RULE -j mark --mark-or 0x$1 --mark-target ACCEPT"
|
||||
if [ -n "$BR6_RULE" ]; then
|
||||
BR6_RULE="$BR6_RULE -j mark --mark-or 0x$1 --mark-target ACCEPT"
|
||||
fi
|
||||
}
|
||||
|
||||
broute_append_rule() {
|
||||
echo "ebtables -t broute -A qos $BR_RULE" >> /tmp/qos/classify.ebtables
|
||||
if [ -n "$BR6_RULE" ]; then
|
||||
echo "ebtables -t broute -A qos $BR6_RULE" >> /tmp/qos/classify.ebtables
|
||||
fi
|
||||
}
|
||||
|
||||
set_ip_addr()
|
||||
{
|
||||
local cid="$1"
|
||||
local match_src_ip_func="$2"
|
||||
local match_dst_ip_func="$3"
|
||||
|
||||
config_get src_ip "$cid" "src_ip"
|
||||
config_get dst_ip "$cid" "dest_ip"
|
||||
|
||||
if [ -n "$src_ip" ]; then
|
||||
$match_src_ip_func "$src_ip"
|
||||
fi
|
||||
|
||||
if [ -n "$dst_ip" ]; then
|
||||
$match_dst_ip_func "$dst_ip"
|
||||
fi
|
||||
}
|
||||
|
||||
set_ports()
|
||||
{
|
||||
local cid="$1"
|
||||
local match_src_port_func="$2"
|
||||
local match_dst_port_func="$3"
|
||||
local src_port=""
|
||||
local dst_port=""
|
||||
local src_port_range=""
|
||||
local dst_port_range=""
|
||||
|
||||
config_get src_port "$cid" "src_port"
|
||||
config_get dst_port "$cid" "dest_port"
|
||||
config_get src_port_range "$cid" "src_port_range"
|
||||
config_get dst_port_range "$cid" "dest_port_range"
|
||||
|
||||
if [ -n "$src_port" ] && [ -n "$src_port_range" ] ; then
|
||||
$match_src_port_func "$src_port:$src_port_range"
|
||||
elif [ -n "$src_port" ] ; then
|
||||
$match_src_port_func "$src_port"
|
||||
fi
|
||||
|
||||
if [ -n "$dst_port" ] && [ -n "$dst_port_range" ] ; then
|
||||
$match_dst_port_func "$dst_port:$dst_port_range"
|
||||
elif [ -n "$dst_port" ] ; then
|
||||
$match_dst_port_func "$dst_port"
|
||||
fi
|
||||
}
|
||||
|
||||
protocol_string_to_num()
|
||||
{
|
||||
local value="-1"
|
||||
|
||||
case "$1" in
|
||||
*[0-9]*)
|
||||
value="$1"
|
||||
;;
|
||||
TCP|tcp)
|
||||
value=6
|
||||
;;
|
||||
UDP|udp)
|
||||
value=17
|
||||
;;
|
||||
ICMP|icmp)
|
||||
value=1
|
||||
;;
|
||||
ICMPv6|icmpv6)
|
||||
value=58
|
||||
;;
|
||||
IGMP|igmp)
|
||||
value=2
|
||||
;;
|
||||
SCTP|sctp)
|
||||
value=132
|
||||
;;
|
||||
*)
|
||||
value=-1
|
||||
;;
|
||||
esac
|
||||
echo $value
|
||||
}
|
||||
|
||||
broute_ipv4_rule_options()
|
||||
{
|
||||
local cid="$1"
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
|
||||
set_ip_addr "$cid" ebt_match_src_ip ebt_match_dst_ip
|
||||
|
||||
if [ -n "$dscp_filter" ]; then
|
||||
echo "DSCP filter is not supporter"
|
||||
fi
|
||||
|
||||
if [ -n "$protocol" ]; then
|
||||
local proto_num="$(protocol_string_to_num "$protocol")"
|
||||
ebt_match_ip_protocol "$proto_num"
|
||||
|
||||
if [ "$proto_num" == "6" ] || [ "$proto_num" == "17" ] || [ "$proto_num" = "132" ] ; then
|
||||
set_ports "$cid" ebt_match_ip_src_port ebt_match_ip_dst_port
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
broute_ipv6_rule_options()
|
||||
{
|
||||
local cid="$1"
|
||||
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
|
||||
set_ip_addr "$cid" ebt_match_ipv6_src_ip ebt_match_ipv6_dst_ip
|
||||
|
||||
if [ -n "$dscp_filter" ]; then
|
||||
local tos_val
|
||||
local tos_hex
|
||||
|
||||
tos_val=$((dscp_filter<<2))
|
||||
tos_hex=$(printf "%x" $tos_val)
|
||||
ebt_match_ipv6_dscp "$tos_hex"
|
||||
fi
|
||||
|
||||
if [ -n "$protocol" ]; then
|
||||
local proto_num="$(protocol_string_to_num "$protocol")"
|
||||
ebt_match_ipv6_protocol "$proto_num"
|
||||
|
||||
if [ "$proto_num" = "6" ] || [ "$proto_num" = "17" ] || [ "$proto_num" = "132" ] ; then
|
||||
set_ports "$cid" ebt_match_ipv6_src_port ebt_match_ipv6_dst_port
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
handle_ebtables_rules() {
|
||||
local sid="$1"
|
||||
local is_l2_rule=0
|
||||
local src_dhcp_options=""
|
||||
local dst_dhcp_options=""
|
||||
local protocol=""
|
||||
local ip_version=""
|
||||
|
||||
init_broute_rule
|
||||
|
||||
config_get src_if "$sid" "ifname"
|
||||
config_get src_mac "$sid" "src_mac"
|
||||
config_get dst_mac "$sid" "dst_mac"
|
||||
config_get dscp_filter "$sid" "dscp_filter"
|
||||
config_get pcp_check "$sid" "pcp_check"
|
||||
config_get eth_type "$sid" "ethertype"
|
||||
config_get vid "$sid" "vid_check"
|
||||
config_get dhcp_type "$sid" "dhcp_type" # dhcpv4 or v6
|
||||
config_get src_vcid "$sid" "src_vendor_class_id" # dhcp option 60
|
||||
config_get dst_vcid "$sid" "dst_vendor_class_id" # dhcp option 60
|
||||
config_get src_clid "$sid" "src_client_id" # dhcp option 61
|
||||
config_get dst_clid "$sid" "dst_client_id" # dhcp option 61
|
||||
config_get src_ucid "$sid" "src_user_class_id" # dhcp option 77
|
||||
config_get dst_ucid "$sid" "dst_user_class_id" # dhcp option 77
|
||||
config_get traffic_class "$sid" "traffic_class"
|
||||
config_get protocol "$sid" "proto"
|
||||
|
||||
if [ -n "$src_if" ]; then
|
||||
for interf in $(db -q get hw.board.ethernetPortOrder); do
|
||||
if [ "$src_if" == "$interf" ]; then
|
||||
src_if="$src_if+"
|
||||
broute_filter_on_src_if "$src_if"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$src_mac" ]; then
|
||||
broute_filter_on_src_mac "$src_mac"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
if [ -n "$dst_mac" ]; then
|
||||
broute_filter_on_dst_mac "$dst_mac"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
if [ -n "$pcp_check" ]; then
|
||||
broute_filter_on_pcp "$pcp_check"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
if [ -n "$eth_type" ]; then
|
||||
broute_filter_on_ether_type "$eth_type"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
if [ -n "$vid" ]; then
|
||||
broute_filter_on_vid "$vid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
case $eth_type in
|
||||
IPv4|IPV4|0800)
|
||||
ip_version=4
|
||||
;;
|
||||
IPv6|IPV6|86DD)
|
||||
ip_version=6
|
||||
;;
|
||||
*)
|
||||
if [ -z "$eth_type" ]; then
|
||||
case "$src_ip$dst_ip" in
|
||||
*.*)
|
||||
ip_version=4
|
||||
broute_filter_on_ether_type "IPv4"
|
||||
;;
|
||||
*:*)
|
||||
ip_version=6
|
||||
broute_filter_on_ether_type "IPv6"
|
||||
;;
|
||||
*)
|
||||
if [ -n "$protocol" ] || [ -n "$dscp_filter" ]; then
|
||||
# Neither ether_type nor ip address used,
|
||||
# ethertype is not configured by user, so install
|
||||
# both proto IPv4 and IPv6 rule (version 1)
|
||||
ip_version=1
|
||||
BR6_RULE="$BR_RULE"
|
||||
broute_filter_on_ether_type "IPv4"
|
||||
broute_filter_on_ether_type6 "IPv6"
|
||||
fi
|
||||
esac
|
||||
fi
|
||||
esac
|
||||
|
||||
if [ "$ip_version" == "4" ] || [ "$ip_version" == "1" ]; then
|
||||
broute_ipv4_rule_options "$sid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
if [ "$ip_version" == "6" ] || [ "$ip_version" == "1" ]; then
|
||||
broute_ipv6_rule_options "$sid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
# first process options that will help figure our source mac address
|
||||
# dhcp option for "vendor class id"
|
||||
if [ -n "$src_vcid" ]; then
|
||||
src_dhcp_options="$src_dhcp_options vcid=$src_vcid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
# dhcp option for "client id"
|
||||
if [ -n "$src_clid" ]; then
|
||||
src_dhcp_options="$src_dhcp_options clid=$src_clid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
# dhcp option for "user class id"
|
||||
if [ -n "$src_ucid" ]; then
|
||||
src_dhcp_options="$src_dhcp_options ucid=$src_ucid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
# if src mac is already a classification criteria, then it
|
||||
# does not really make sense to add it as a criteria to
|
||||
# filter packets again based on source mac
|
||||
if [ -n "$src_dhcp_options" ] && [ -z "$src_mac" ]; then
|
||||
comp="$(grep -i "$src_dhcp_options" /tmp/dhcp.client.options)"
|
||||
if [ -n "$comp" ]; then
|
||||
s_mac_add="$(echo $comp | head -n1 | awk '{print $1;}')"
|
||||
if [ -n "$s_mac_add" ]; then
|
||||
broute_filter_on_src_mac "$s_mac_add"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now process options that will help figure our destination mac address
|
||||
# dhcp option for "vendor class id"
|
||||
if [ -n "$dst_vcid" ]; then
|
||||
dst_dhcp_options="$dst_dhcp_options vcid=$dst_vcid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
# dhcp option for "client id"
|
||||
if [ -n "$dst_clid" ]; then
|
||||
dst_dhcp_options="$dst_dhcp_options clid=$dst_clid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
# dhcp option for "user class id"
|
||||
if [ -n "$dst_ucid" ]; then
|
||||
dst_dhcp_options="$dst_dhcp_options ucid=$dst_ucid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
# if dst mac is already a classification criteria, then it
|
||||
# does not really make sense to add it as a criteria to
|
||||
# filter packets again based on destination mac
|
||||
if [ -n "$dst_dhcp_options" ] && [ -z "$dst_mac" ] ; then
|
||||
comp="$(grep -i "$dst_dhcp_options" /tmp/dhcp.client.options)"
|
||||
if [ -n "$comp" ]; then
|
||||
d_mac_add="$(echo $comp | head -n1 | awk '{print $1;}')"
|
||||
if [ -n "$d_mac_add" ]; then
|
||||
broute_filter_on_dst_mac "$d_mac_add"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $is_l2_rule -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
[ -n "$traffic_class" ] && broute_rule_set_traffic_class "$traffic_class"
|
||||
|
||||
[ -n "$BR_RULE" ] && broute_append_rule
|
||||
}
|
||||
|
||||
create_ebtables_chains() {
|
||||
ebtables -t broute -N qos
|
||||
ret=$?
|
||||
if [ $ret -eq 0 ]; then
|
||||
ebtables -t broute -I BROUTING -j qos
|
||||
else
|
||||
ebtables -t broute -D BROUTING -j qos
|
||||
ebtables -t broute -I BROUTING -j qos
|
||||
fi
|
||||
}
|
||||
|
||||
flush_ebtables_chains() {
|
||||
echo "ebtables -t broute -F qos" > /tmp/qos/classify.ebtables
|
||||
}
|
||||
|
||||
240
qosmngr/files/airoha/lib/qos/common/chains.iptables.sh
Executable file
240
qosmngr/files/airoha/lib/qos/common/chains.iptables.sh
Executable file
@@ -0,0 +1,240 @@
|
||||
#!/bin/sh
|
||||
# Install iptables rules
|
||||
|
||||
IP_RULE=""
|
||||
|
||||
init_iptables_rule() {
|
||||
IP_RULE=""
|
||||
}
|
||||
|
||||
iptables_filter_intf() {
|
||||
IP_RULE="$IP_RULE -i $1"
|
||||
}
|
||||
|
||||
iptables_filter_proto() {
|
||||
IP_RULE="$IP_RULE -p $1"
|
||||
}
|
||||
|
||||
iptables_filter_ip_src() {
|
||||
IP_RULE="$IP_RULE -s $1"
|
||||
}
|
||||
|
||||
iptables_filter_ip_dest() {
|
||||
IP_RULE="$IP_RULE -d $1"
|
||||
}
|
||||
|
||||
iptables_filter_port_dest() {
|
||||
IP_RULE="$IP_RULE --dport $1"
|
||||
}
|
||||
|
||||
iptables_filter_port_src() {
|
||||
IP_RULE="$IP_RULE --sport $1"
|
||||
}
|
||||
|
||||
iptables_filter_port_dest_range() {
|
||||
IP_RULE="$IP_RULE --dport $1:$2"
|
||||
}
|
||||
|
||||
iptables_filter_port_src_range() {
|
||||
IP_RULE="$IP_RULE --sport $1:$2"
|
||||
}
|
||||
|
||||
iptables_filter_dscp_filter() {
|
||||
IP_RULE="$IP_RULE -m dscp --dscp $1"
|
||||
}
|
||||
|
||||
iptables_filter_ip_len_min() {
|
||||
IP_RULE="$IP_RULE -m length --length $1"
|
||||
}
|
||||
|
||||
iptables_filter_ip_len_max() {
|
||||
IP_RULE="$IP_RULE:$1"
|
||||
}
|
||||
|
||||
iptables_set_dscp_mark() {
|
||||
IP_RULE="$IP_RULE -j DSCP --set-dscp $1"
|
||||
}
|
||||
|
||||
iptables_set_traffic_class() {
|
||||
IP_RULE="$IP_RULE -j MARK --set-xmark 0x${1}0/0xF0"
|
||||
}
|
||||
|
||||
append_rule_to_mangle_table() {
|
||||
if [ "$2" == 4 ]; then
|
||||
echo "iptables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.iptables
|
||||
elif [ "$2" == 6 ]; then
|
||||
echo "ip6tables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.ip6tables
|
||||
elif [ "$2" == 1 ]; then
|
||||
echo "iptables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.iptables
|
||||
echo "ip6tables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.ip6tables
|
||||
fi
|
||||
}
|
||||
|
||||
handle_iptables_rules() {
|
||||
local cid="$1"
|
||||
local ip_version=0
|
||||
local is_l3_rule=0
|
||||
|
||||
init_iptables_rule
|
||||
config_get proto "$cid" "proto"
|
||||
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"
|
||||
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"
|
||||
config_get dest_ip "$cid" "dest_ip"
|
||||
config_get src_ip "$cid" "src_ip"
|
||||
config_get ip_len_min "$cid" "ip_len_min"
|
||||
config_get ip_len_max "$cid" "ip_len_max"
|
||||
config_get ifname "$cid" "ifname"
|
||||
|
||||
#check version of ip
|
||||
case $src_ip$dest_ip in
|
||||
*.*)
|
||||
ip_version=4
|
||||
;;
|
||||
*:*)
|
||||
ip_version=6
|
||||
;;
|
||||
*)
|
||||
ip_version=1 #ip address not used
|
||||
esac
|
||||
|
||||
#filter interface
|
||||
if [ -n "$ifname" ]; then
|
||||
if [ "$ifname" != "lo" ]; then
|
||||
iptables_filter_intf "$ifname"
|
||||
fi
|
||||
fi
|
||||
|
||||
# filter proto
|
||||
if [ -n "$proto" ]; then
|
||||
iptables_filter_proto "$proto"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter src. ip
|
||||
if [ -n "$src_ip" ]; then
|
||||
iptables_filter_ip_src "$src_ip"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter dest. ip
|
||||
if [ -n "$dest_ip" ]; then
|
||||
iptables_filter_ip_dest "$dest_ip"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter dest. port
|
||||
if [ -n "$dest_port" ] && [ -z "$dest_port_range" ]; then
|
||||
iptables_filter_port_dest "$dest_port"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter src. port
|
||||
if [ -n "$src_port" ] && [ -z "$src_port_range" ]; then
|
||||
iptables_filter_port_src "$src_port"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter dest. port range
|
||||
if [ -n "$dest_port" ] && [ -n "$dest_port_range" ]; then
|
||||
|
||||
if [ "$dest_port_range" == "-1" ] ; then
|
||||
dest_port_range="$dest_port"
|
||||
fi
|
||||
|
||||
iptables_filter_port_dest_range "$dest_port" "$dest_port_range"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter src. port range
|
||||
if [ -n "$src_port" ] && [ -n "$src_port_range" ]; then
|
||||
|
||||
if [ "$src_port_range" == "-1" ] ; then
|
||||
src_port_range="$src_port"
|
||||
fi
|
||||
|
||||
iptables_filter_port_src_range "$src_port" "$src_port_range"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter dscp
|
||||
if [ -n "$dscp_filter" ]; then
|
||||
iptables_filter_dscp_filter "$dscp_filter"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter min. IP packet len.
|
||||
if [ -n "$ip_len_min" ]; then
|
||||
iptables_filter_ip_len_min "$ip_len_min"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
#filter max. IP packet len.
|
||||
if [ -n "$ip_len_max" ]; then
|
||||
iptables_filter_ip_len_max "$ip_len_max"
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
if [ -z "$is_l3_rule" ] || [ "$is_l3_rule" -eq 0 ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
#set dscp mark
|
||||
[ -n "$dscp_mark" ] && iptables_set_dscp_mark "$dscp_mark"
|
||||
|
||||
#set packet queue mark
|
||||
[ -n "$traffic_class" ] && iptables_set_traffic_class "$traffic_class"
|
||||
|
||||
#write iptables rule for dscp marking
|
||||
[ -n "$IP_RULE" ] && [ -n "$dscp_mark" ] && append_rule_to_mangle_table "qos_forward" $ip_version
|
||||
|
||||
if [ -n "$IP_RULE" ] && [ -n "$traffic_class" ]; then
|
||||
if [ "$ifname" == "lo" ]; then
|
||||
#write iptables rule for putting WAN directed internal packets in different queue
|
||||
append_rule_to_mangle_table "qos_output" $ip_version
|
||||
else
|
||||
#write iptables rule for putting WAN directed LAN packets in different queue
|
||||
append_rule_to_mangle_table "qos_prerouting" $ip_version
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
create_iptables_chains() {
|
||||
iptables -w -t mangle -N qos_forward
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && iptables -w -t mangle -I FORWARD -j qos_forward
|
||||
|
||||
iptables -w -t mangle -N qos_prerouting
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && iptables -w -t mangle -I PREROUTING -j qos_prerouting
|
||||
|
||||
iptables -w -t mangle -N qos_output
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && iptables -w -t mangle -I OUTPUT -j qos_output
|
||||
|
||||
ip6tables -t mangle -N qos_forward
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && ip6tables -t mangle -I FORWARD -j qos_forward
|
||||
|
||||
ip6tables -t mangle -N qos_prerouting
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && ip6tables -t mangle -I PREROUTING -j qos_prerouting
|
||||
|
||||
ip6tables -t mangle -N qos_output
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && ip6tables -t mangle -I OUTPUT -j qos_output
|
||||
}
|
||||
|
||||
flush_iptables_chains() {
|
||||
echo "iptables -w -t mangle -F qos_forward" > /tmp/qos/classify.iptables
|
||||
echo "iptables -w -t mangle -F qos_prerouting" >> /tmp/qos/classify.iptables
|
||||
echo "iptables -w -t mangle -F qos_output" >> /tmp/qos/classify.iptables
|
||||
|
||||
echo "ip6tables -w -t mangle -F qos_forward" > /tmp/qos/classify.ip6tables
|
||||
echo "ip6tables -w -t mangle -F qos_prerouting" >> /tmp/qos/classify.ip6tables
|
||||
echo "ip6tables -w -t mangle -F qos_output" >> /tmp/qos/classify.ip6tables
|
||||
}
|
||||
12
qosmngr/files/airoha/lib/qos/common/chains.sh
Executable file
12
qosmngr/files/airoha/lib/qos/common/chains.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Set up or flush all chains
|
||||
|
||||
setup_qos() {
|
||||
create_ebtables_chains
|
||||
create_iptables_chains
|
||||
}
|
||||
|
||||
flush_chains() {
|
||||
flush_ebtables_chains
|
||||
flush_iptables_chains
|
||||
}
|
||||
44
qosmngr/files/airoha/lib/qos/common/classify.sh
Executable file
44
qosmngr/files/airoha/lib/qos/common/classify.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
# Common classifier library
|
||||
|
||||
# Handle classify section
|
||||
handle_classify() {
|
||||
cid="$1" #classify section ID
|
||||
|
||||
config_get is_enable "$cid" "enable"
|
||||
# no need to configure disabled classify rules
|
||||
if [ -z "$is_enable" ] || [ "$is_enable" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
handle_ebtables_rules "$cid"
|
||||
handle_iptables_rules "$cid"
|
||||
handle_policer_rules "$cid"
|
||||
}
|
||||
|
||||
|
||||
# Configure classifier based on UCI subtree 'qos.classify'
|
||||
configure_classify() {
|
||||
# Processing classify section
|
||||
# First remove old files
|
||||
rm -f /tmp/qos/classify.ebtables
|
||||
rm -f /tmp/qos/classify.iptables
|
||||
rm -f /tmp/qos/classify.ip6tables
|
||||
|
||||
# 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
|
||||
|
||||
# Add flush chain rules
|
||||
flush_chains
|
||||
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_classify classify
|
||||
|
||||
sh /tmp/qos/classify.ebtables
|
||||
sh /tmp/qos/classify.iptables
|
||||
sh /tmp/qos/classify.ip6tables
|
||||
}
|
||||
132
qosmngr/files/airoha/lib/qos/common/policer.sh
Executable file
132
qosmngr/files/airoha/lib/qos/common/policer.sh
Executable file
@@ -0,0 +1,132 @@
|
||||
#!/bin/sh
|
||||
# Common policer library
|
||||
|
||||
POLICER_COUNT=0
|
||||
|
||||
# Function invoked
|
||||
handle_policer_rules() {
|
||||
local c_sec="$1"
|
||||
local policer_name
|
||||
local ifname
|
||||
local pname
|
||||
local pindex=-1
|
||||
local ingress_rate=0
|
||||
local in_burst_size=0
|
||||
|
||||
config_get policer_name "$c_sec" "policer"
|
||||
if [ -z "$policer_name" ];then
|
||||
# no need to apply policer if policer not present in this
|
||||
# classification rule
|
||||
return
|
||||
fi
|
||||
|
||||
config_get ifname "$c_sec" "ifname"
|
||||
if [ -z "$ifname" ]; then
|
||||
# cannot associate policer as interface is not mentioned
|
||||
return
|
||||
fi
|
||||
|
||||
local i=0
|
||||
local max_policer_inst="$(cat /tmp/qos/max_policer_inst)"
|
||||
while :
|
||||
do
|
||||
if [ "${i}" -eq "$max_policer_inst" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
pname="$(uci -q get qos.@policer[$i].name)"
|
||||
if [ "$policer_name" == "$pname" ]; then
|
||||
pindex=$i
|
||||
ingress_rate="$(uci -q get qos.@policer[$i].committed_rate)"
|
||||
in_burst_rate="$(uci -q get qos.@policer[$i].committed_burst_size)"
|
||||
break
|
||||
fi
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
if [ -z "$pindex" ] || [ "$pindex" -lt 0 ]; then
|
||||
# policer not found, no need to proceed further
|
||||
return
|
||||
fi
|
||||
|
||||
config_ingress_rate_limit "$ifname" "$ingress_rate" "$in_burst_size"
|
||||
|
||||
}
|
||||
|
||||
# Configure ingress rate limit
|
||||
config_ingress_rate_limit() {
|
||||
local ifname="$1"
|
||||
local ingress_rate="$2"
|
||||
local in_burst_size="$3"
|
||||
local port=""
|
||||
|
||||
if [ -z "$ingress_rate" ] || [ "$ingress_rate" -lt 1000 ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
ingress_rate=$((ingress_rate / 1000))
|
||||
|
||||
if [ "$in_burst_size" -eq 0 ]; then
|
||||
in_burst_size="$ingress_rate"
|
||||
else
|
||||
in_burst_size="$((in_burst_size / 1000))"
|
||||
fi
|
||||
|
||||
hw_policer_set_ingress_rate "$ifname" "$port" "$ingress_rate" "$in_burst_size"
|
||||
}
|
||||
|
||||
# Function invoked for handling policer section in UCI
|
||||
handle_policer() {
|
||||
local p_sec="$1" # policer section ID
|
||||
local dir=1 # default direction, upstream
|
||||
|
||||
config_get is_enable "$p_sec" "enable"
|
||||
|
||||
# No need to configure disabled policer
|
||||
if [ -z "$is_enable" ] || [ "$is_enable" == "0" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get cir "$p_sec" "committed_rate"
|
||||
config_get cbs "$p_sec" "committed_burst_size" -1
|
||||
config_get ebs "$p_sec" "excess_burst_size" 0
|
||||
config_get pir "$p_sec" "peak_rate" 0
|
||||
config_get pbs "$p_sec" "peak_burst_size" 0
|
||||
config_get meter "$p_sec" "meter_type" 0
|
||||
|
||||
hw_policer_set add "$dir" "$POLICER_COUNT" "$meter" "$cir" "$cbs" "$ebs" "$pir" "$pbs"
|
||||
|
||||
POLICER_COUNT=$((POLICER_COUNT + 1))
|
||||
}
|
||||
|
||||
# Configure policer based on UCI subtree 'qos.policer'
|
||||
configure_policer() {
|
||||
for intf in $(db get hw.board.ethernetPortOrder); do
|
||||
if [ -n "${intf}" ] ; then
|
||||
hw_policer_set_ingress_rate "$intf" 0 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Delete policer
|
||||
local i=0
|
||||
local max_p_inst=0
|
||||
if [ -f "/tmp/qos/max_policer_inst" ]; then
|
||||
max_p_inst=$(cat /tmp/qos/max_policer_inst)
|
||||
fi
|
||||
|
||||
while :
|
||||
do
|
||||
if [ "$i" -eq "$max_p_inst" ]; then
|
||||
break
|
||||
fi
|
||||
hw_policer_set del 1 $i
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
# reset the policer counter
|
||||
echo 0 > /tmp/qos/max_policer_inst
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_policer policer
|
||||
echo $POLICER_COUNT > /tmp/qos/max_policer_inst
|
||||
}
|
||||
50
qosmngr/files/airoha/lib/qos/common/queue.sh
Executable file
50
qosmngr/files/airoha/lib/qos/common/queue.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# Handle queues and their order
|
||||
|
||||
Q_COUNT=0
|
||||
|
||||
# Preliminary configuration of a queue
|
||||
pre_configure_queue() {
|
||||
# Delete queues
|
||||
hw_queue_init_all
|
||||
|
||||
for intf in $(db get hw.board.ethernetPortOrder); do
|
||||
hw_intf_init "${intf}"
|
||||
done
|
||||
}
|
||||
|
||||
# UCI queue section handler
|
||||
handle_queue() {
|
||||
local qid="$1" #queue section ID
|
||||
local intf_name="$2"
|
||||
|
||||
config_get is_enable "$qid" "enable"
|
||||
|
||||
# no need to configure disabled queues
|
||||
if [ -z "${is_enable}" ] || [ "${is_enable}" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get ifname "$qid" "ifname"
|
||||
# if ifname is empty that is good enough to break
|
||||
if [ -z "$ifname" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get sc_alg "$qid" "scheduling"
|
||||
config_get wgt "$qid" "weight" 1
|
||||
config_get rate "$qid" "rate"
|
||||
config_get bs "$qid" "burst_size"
|
||||
config_get qsize "$qid" "queue_size" 1024
|
||||
config_get precedence "$qid" "precedence"
|
||||
|
||||
hw_queue_set "${ifname}" "${Q_COUNT}" "${precedence}" "$qsize" "$wgt" "$sc_alg" "$shapingrate" "$rate" "$bs"
|
||||
Q_COUNT=$((Q_COUNT + 1))
|
||||
}
|
||||
|
||||
# Configure all queues specified in UCI tree 'qos.queue'
|
||||
configure_queue() {
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_queue queue
|
||||
}
|
||||
46
qosmngr/files/airoha/lib/qos/common/shaper.sh
Executable file
46
qosmngr/files/airoha/lib/qos/common/shaper.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
# Common shaper library
|
||||
|
||||
# UCI 'shaper' section handler.
|
||||
# It will verify shaper configuration sanity and then invoke
|
||||
# hardware-specific functions
|
||||
handle_shaper() {
|
||||
sid="$1" #queue section ID
|
||||
|
||||
config_get is_enable "$sid" "enable"
|
||||
# no need to configure disabled queues
|
||||
if [ -z "${is_enable}" ] || [ "${is_enable}" == "0" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
config_get ifname "$sid" "ifname"
|
||||
# if ifname is empty that is good enough to break
|
||||
if [ -z "$ifname" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get rate "$sid" "rate"
|
||||
# Convert the rate from bps to kbps.
|
||||
if [ -z "${rate}" ] || [ "${rate}" -lt 1000 ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
rate=$((rate / 1000))
|
||||
config_get bs "$sid" "burst_size"
|
||||
|
||||
hw_shaper_set "$ifname" add "$rate" "$bs"
|
||||
}
|
||||
|
||||
# Configure shaper based on options saved to UCI tree 'qos.shaper'
|
||||
configure_shaper() {
|
||||
# Delete existing shaper
|
||||
for intf in $(db get hw.board.ethernetPortOrder); do
|
||||
hw_shaper_set "$intf" del
|
||||
done
|
||||
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
# Processing shaper section(s)
|
||||
config_foreach handle_shaper shaper
|
||||
}
|
||||
55
qosmngr/files/airoha/lib/qos/qos.sh
Executable file
55
qosmngr/files/airoha/lib/qos/qos.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
# The entrypoint for the QoS setup library
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/network/port.sh
|
||||
|
||||
. /lib/qos/common/chains.sh
|
||||
. /lib/qos/common/chains.ebtables.sh
|
||||
. /lib/qos/common/chains.iptables.sh
|
||||
. /lib/qos/common/classify.sh
|
||||
. /lib/qos/common/policer.sh
|
||||
. /lib/qos/common/queue.sh
|
||||
. /lib/qos/common/shaper.sh
|
||||
. /lib/qos/airoha.sh
|
||||
|
||||
configure_qos() {
|
||||
# queue configuration is being done after shaper configuration,
|
||||
# If port shapingrate configuration on DISC device is called after queue configuration then
|
||||
# driver overwrites the queue shaping rate with default value of port shaping rate.
|
||||
pre_configure_queue
|
||||
setup_qos
|
||||
configure_shaper
|
||||
configure_queue
|
||||
configure_policer
|
||||
configure_classify
|
||||
}
|
||||
|
||||
reload_qos() {
|
||||
local service_name="$1"
|
||||
|
||||
hw_init_all
|
||||
case "${service_name}" in
|
||||
shaper)
|
||||
configure_shaper
|
||||
;;
|
||||
queue)
|
||||
pre_configure_queue
|
||||
configure_queue
|
||||
;;
|
||||
classify)
|
||||
configure_classify
|
||||
;;
|
||||
policer)
|
||||
configure_policer
|
||||
;;
|
||||
"")
|
||||
configure_qos
|
||||
;;
|
||||
esac
|
||||
hw_commit_all
|
||||
}
|
||||
|
||||
reload_qos_service() {
|
||||
reload_qos
|
||||
}
|
||||
@@ -13,6 +13,9 @@ SP_Q_PRIO=7
|
||||
#counter variable to assign classify order value if not added in config
|
||||
temp_order=1
|
||||
|
||||
cfg_name=""
|
||||
cfg_type=""
|
||||
|
||||
# Function to handle a queue order and
|
||||
# update total number of queues
|
||||
handle_q_order() {
|
||||
@@ -64,6 +67,37 @@ sort_by_precedence() {
|
||||
done
|
||||
}
|
||||
|
||||
# function to handle a queue section shapingrate
|
||||
handle_queue_shapingrate() {
|
||||
local qid="$1" #queue section ID
|
||||
local intf_name="$2"
|
||||
|
||||
config_get is_enable "$qid" "enable"
|
||||
|
||||
# no need to configure disabled queues
|
||||
if [ $is_enable == '0' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get ifname "$qid" "ifname"
|
||||
# if ifname is empty that is good enough to break
|
||||
if [ -z "$ifname" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
# This is to get the qid per interface.
|
||||
if [ "$intf_name" != "$ifname" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get rate "$qid" "rate"
|
||||
config_get bs "$qid" "burst_size"
|
||||
|
||||
# Call tmctl which is a broadcomm command to configure queues shapingrate.
|
||||
tmctl setqcfg --devtype 0 --if $ifname --qid $Q_COUNT --shapingrate $rate --burstsize $bs &>/dev/null
|
||||
Q_COUNT=$((Q_COUNT + 1))
|
||||
}
|
||||
|
||||
# function to handle a queue section
|
||||
handle_queue() {
|
||||
local qid="$1" #queue section ID
|
||||
@@ -189,6 +223,14 @@ handle_shaper() {
|
||||
}
|
||||
|
||||
setup_qos() {
|
||||
if [ ! -d "/tmp/qos" ]; then
|
||||
mkdir -p /tmp/qos
|
||||
fi
|
||||
if [ ! -f "/tmp/qos/qos" ]; then
|
||||
touch /tmp/qos/qos
|
||||
cp /etc/config/qos /tmp/qos/qos
|
||||
fi
|
||||
|
||||
ebtables -t broute -N qos
|
||||
ret=$?
|
||||
if [ $ret -eq 0 ]; then
|
||||
@@ -610,12 +652,12 @@ handle_ebtables_rules() {
|
||||
fi
|
||||
esac
|
||||
|
||||
if [ $ip_version = "4" ] || [ $ip_version = "1" ]; then
|
||||
if [ "$ip_version" == "4" ] || [ "$ip_version" == "1" ]; then
|
||||
broute_ipv4_rule_options "$sid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
if [ $ip_version = "6" ] || [ $ip_version = "1" ]; then
|
||||
if [ "$ip_version" == "6" ] || [ "$ip_version" == "1" ]; then
|
||||
broute_ipv6_rule_options "$sid"
|
||||
is_l2_rule=1
|
||||
fi
|
||||
@@ -1022,10 +1064,9 @@ handle_classify() {
|
||||
|
||||
config_get is_enable "$cid" "enable"
|
||||
# no need to configure disabled classify rules
|
||||
if [ $is_enable == '0' ]; then
|
||||
if [ "$is_enable" == '0' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local corder_file="/tmp/qos/classify.order"
|
||||
|
||||
while read -r line; do
|
||||
@@ -1103,6 +1144,15 @@ pre_configure_queue() {
|
||||
done
|
||||
}
|
||||
|
||||
configure_queue_shaping_rate() {
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
for interf in $(db -q get hw.board.ethernetPortOrder); do
|
||||
Q_COUNT=0
|
||||
config_foreach handle_queue_shapingrate queue $interf
|
||||
done
|
||||
}
|
||||
|
||||
configure_queue() {
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
@@ -1127,7 +1177,7 @@ configure_policer() {
|
||||
local port=$(echo $unitport | cut -d ' ' -f 2)
|
||||
# setting rate and burst size to 0 disables rate limiting
|
||||
if [ $port != "" -a $unit != "" ]; then
|
||||
ethswctl -c rxratectrl -n $unit -p $port -x 0 -y 0
|
||||
ethswctl -c rxratectrl -n $unit -p $port -x 0 -y 0 &>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -1174,6 +1224,10 @@ reload_qos() {
|
||||
configure_qos
|
||||
elif [ "$service_name" == "shaper" ]; then
|
||||
configure_shaper
|
||||
# call to configure queue shaping rate as in some platform port shaping rate
|
||||
# configuration overwrites the queue shaping rate in driver to default value
|
||||
# this will restore the queue shping rate
|
||||
configure_queue_shaping_rate
|
||||
elif [ "$service_name" == "queue" ]; then
|
||||
pre_configure_queue
|
||||
configure_queue
|
||||
@@ -1183,3 +1237,149 @@ reload_qos() {
|
||||
configure_policer
|
||||
fi
|
||||
}
|
||||
|
||||
get_cfg_added_deleted()
|
||||
{
|
||||
# return true if there is difference in number of queue configuration
|
||||
# in /etc/config/qos and /tmp/qos/qos, false is returned if both file
|
||||
# has same count of queue configuration.
|
||||
local queue=0
|
||||
local classify=0
|
||||
local shaper=0
|
||||
local policer=0
|
||||
local old_cfg="false"
|
||||
|
||||
config_cb() {
|
||||
# invoked on the just previous config_load, get the count of
|
||||
# queue configuration in /etc/config/qos and /tmp/qos/qos.
|
||||
cfg_type="$1"
|
||||
cfg_name="$2"
|
||||
if [ -z $cfg_name ] || [ -z $cfg_type ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$old_cfg" == "false" ]; then
|
||||
eval $cfg_type=$(($cfg_type + 1))
|
||||
else
|
||||
eval $cfg_type=$(($cfg_type - 1))
|
||||
fi
|
||||
option_cb() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
if [ -z "$option" ] || [ -z "$value" ]; then
|
||||
return
|
||||
fi
|
||||
if [ "$old_cfg" == "false" ]; then
|
||||
eval $cfg_type=$(($cfg_type + 1))
|
||||
else
|
||||
eval $cfg_type=$(($cfg_type - 1))
|
||||
fi
|
||||
}
|
||||
}
|
||||
# config_load will trigger call for config_cb that is getting count
|
||||
# of qos configuration, respective config counts will come.
|
||||
config_load qos
|
||||
# config_load will trigger call for config_cb that is decreasing count
|
||||
# of qos configuration.
|
||||
old_cfg="true"
|
||||
UCI_CONFIG_DIR="/tmp/qos"
|
||||
config_load qos
|
||||
UCI_CONFIG_DIR="/etc/config"
|
||||
reset_cb
|
||||
|
||||
if [ $classify -ne 0 ]; then
|
||||
modified_config="classify"
|
||||
fi
|
||||
if [ $shaper -ne 0 ]; then
|
||||
modified_config="$modified_config shaper"
|
||||
fi
|
||||
if [ $policer -ne 0 ]; then
|
||||
modified_config="$modified_config policer"
|
||||
fi
|
||||
if [ $queue -eq 0 ]; then
|
||||
echo "$modified_config"
|
||||
return
|
||||
else
|
||||
echo "queue"
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
# reload_qos_service is invoked on qos service reload.
|
||||
reload_qos_service() {
|
||||
q_cfg_restart="false"
|
||||
policer="false"
|
||||
classify="false"
|
||||
shaper="false"
|
||||
|
||||
setup_qos
|
||||
|
||||
if ! [[ -f "/etc/config/qos" && -f "/tmp/qos/qos" ]]; then
|
||||
configure_qos
|
||||
cp /etc/config/qos /tmp/qos/qos
|
||||
fi
|
||||
|
||||
config_cb() {
|
||||
# this is invoked when config_load is called.
|
||||
cfg_type="$1"
|
||||
cfg_name="$2"
|
||||
if [ -z $cfg_name ] || [ -z $cfg_type ]; then
|
||||
return
|
||||
fi
|
||||
option_cb() {
|
||||
# checking for if any parameters value is modified in queue cfg
|
||||
# comparsion is done between /etc/config/qos and /tmp/qos/qos
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
local old_value=""
|
||||
if [ -z "$option" ] || [ -z "$value" ]; then
|
||||
return
|
||||
fi
|
||||
old_value=$(uci -q -c "/tmp/qos" get qos.$cfg_name.$option)
|
||||
if ! [ "$old_value" == "$value" ]; then
|
||||
if [ "$cfg_type" == "queue" ]; then
|
||||
q_cfg_restart="true"
|
||||
else
|
||||
eval $cfg_type="true"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
}
|
||||
# if there is new addition/deletion of queue configuration
|
||||
# then return is queue to trigger restart of qos.
|
||||
# Otehrwise shaper policer classify
|
||||
# respective operation config is invoked that does not change queue statistics
|
||||
cfg_added_deleted=$(get_cfg_added_deleted)
|
||||
if [ "$cfg_added_deleted" == "queue" ]; then
|
||||
configure_qos
|
||||
else
|
||||
q_cfg_restart="false"
|
||||
# config_load will trigger call for config_cb that is checking
|
||||
# for modification in config value of queue config.
|
||||
# if change of value of queue config is there then q_cfg_restart
|
||||
# is set as true, else other qos config flag is set as true.
|
||||
config_load qos
|
||||
reset_cb
|
||||
if [ "$q_cfg_restart" == "true" ]; then
|
||||
configure_qos
|
||||
else
|
||||
for config in $cfg_added_deleted
|
||||
do
|
||||
eval $config="true"
|
||||
done
|
||||
if [ "$shaper" == "true" ]; then
|
||||
reload_qos "shaper"
|
||||
fi
|
||||
if [ "$policer" == "true" ]; then
|
||||
reload_qos "policer"
|
||||
# change in policer config may need reconfiguration
|
||||
# of classifier
|
||||
reload_qos "classify"
|
||||
fi
|
||||
if [ "$classify" == "true" ]; then
|
||||
reload_qos "classify"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
cp /etc/config/qos /tmp/qos/qos
|
||||
}
|
||||
@@ -11,7 +11,8 @@ NAME=qosmngr
|
||||
PROG=/usr/sbin/qosmngr
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/qos
|
||||
|
||||
. /lib/qos/qos.sh
|
||||
|
||||
start_service() {
|
||||
if [ -f "/etc/config/qos" ]; then
|
||||
@@ -37,3 +38,8 @@ restart() {
|
||||
setup_qos
|
||||
start
|
||||
}
|
||||
|
||||
reload_service()
|
||||
{
|
||||
reload_qos_service
|
||||
}
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=questd
|
||||
PKG_VERSION:=5.2.4
|
||||
PKG_VERSION:=5.2.5
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/questd
|
||||
PKG_SOURCE_VERSION:=2ca3ae0c29dcbbf01282f6118eb8d5e5bc9a1c45
|
||||
PKG_SOURCE_VERSION:=38af3655416c80933f89f5a03638403a7c051a42
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -13,7 +13,7 @@ menu "SULU_CORE"
|
||||
|
||||
config SULU_CORE_VERSION
|
||||
string "SULU repo version"
|
||||
default "ea9b80a6f7a5fc2230d97706fd1ddbbac66fc6a7"
|
||||
default "c7e62f7f7cda1961012e8149d220ac1eb26d362f"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_LCM"
|
||||
@@ -35,7 +35,7 @@ menu "SULU_PLUGIN_LCM"
|
||||
config SULU_PLUGIN_LCM_VERSION
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "Version"
|
||||
default "068e71a3ec28dfa984f20fdc9796784f36d497dd"
|
||||
default "ccd70b399b31530dc1af6a871eee94fbb179d794"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_MULTIAP"
|
||||
@@ -57,7 +57,7 @@ menu "SULU_PLUGIN_MULTIAP"
|
||||
config SULU_PLUGIN_MULTIAP_VERSION
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "Version"
|
||||
default "7f4744e328478bdf8e6d599a1b99751c3c2cccb4"
|
||||
default "3c79d57bee453e7b62c7b7626e33bf273212bbc9"
|
||||
endmenu
|
||||
|
||||
menu "SULU_THEME_IOPSYS"
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=1.3.0
|
||||
PKG_VERSION:=1.3.16
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=524418f7a2e6e2b1d807b2a87f9f80ac3cb1d1b6
|
||||
PKG_SOURCE_VERSION:=81d4bb268914dc3822293e93519ae6adbd6ddbea
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -22,7 +22,7 @@ define Package/${PKG_NAME}
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Build sulu from source
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
CONFLICTS:=sulu
|
||||
endef
|
||||
|
||||
@@ -148,10 +148,30 @@ define Package/${PKG_NAME}/install
|
||||
$(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
|
||||
$(CP) ./files/* $(1)/
|
||||
$(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/mosquitto/conf.d/
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/conf.d/obuspa.conf $(1)/etc/mosquitto/conf.d/
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/conf.d/sulu.conf $(1)/etc/mosquitto/conf.d/
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/sulu.password $(1)/etc/mosquitto/sulu.password
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/conf.d
|
||||
$(INSTALL_DATA) ./files/etc/nginx/conf.d/sulu.conf $(1)/etc/nginx/conf.d/
|
||||
|
||||
$(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_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,${PKG_NAME}))
|
||||
|
||||
9
sulu-builder/files/etc/config/sulu
Normal file
9
sulu-builder/files/etc/config/sulu
Normal file
@@ -0,0 +1,9 @@
|
||||
config global 'global'
|
||||
option root '/sulu'
|
||||
option port '8080'
|
||||
option ws_port '9001'
|
||||
option enabled '1'
|
||||
option enable_system_credentials '1'
|
||||
option role_based_access '1'
|
||||
list user 'admin'
|
||||
list user 'user'
|
||||
@@ -1,19 +1,42 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
. /lib/functions.sh
|
||||
. /etc/sulu/sulu.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t sulu.init -p debug
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance sulu
|
||||
# append sulu connection injection
|
||||
procd_close_instance
|
||||
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
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 1
|
||||
update_nginx_config "${enabled}" 1
|
||||
update_sulu_connection_port
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
@@ -23,5 +46,5 @@ reload_service() {
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_config_trigger "config.change" "obuspa" /etc/init.d/sulu reload
|
||||
procd_add_reload_trigger "sulu"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
listener 9001
|
||||
protocol websockets
|
||||
plugin /usr/lib/mosquitto_auth_shadow.so
|
||||
require_certificate false
|
||||
allow_anonymous false
|
||||
|
||||
1
sulu-builder/files/etc/mosquitto/sulu.password
Normal file
1
sulu-builder/files/etc/mosquitto/sulu.password
Normal file
@@ -0,0 +1 @@
|
||||
admin:$6$OmM9kU/lYct3KJ9j$iP0WK4ezEtRm8+EAggNp7WbJFoWO0p7IUdI0v/hr1WcVHyfFAC30Pb8Csn7GqwwqI2dcmnDOAITnimo2VNe6ug==
|
||||
27
sulu-builder/files/etc/nginx/conf.d/sulu.conf
Normal file
27
sulu-builder/files/etc/nginx/conf.d/sulu.conf
Normal file
@@ -0,0 +1,27 @@
|
||||
server {
|
||||
listen 8080;
|
||||
listen [::]:8080;
|
||||
server_name _sulu;
|
||||
root /sulu;
|
||||
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,18 +0,0 @@
|
||||
location /config/ {
|
||||
autoindex on;
|
||||
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,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
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,If-Modified-Since,Cache-Control,Content-Type,Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||
}
|
||||
}
|
||||
95
sulu-builder/files/etc/sulu/roles.json
Normal file
95
sulu-builder/files/etc/sulu/roles.json
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
439
sulu-builder/files/etc/sulu/sulu.sh
Normal file
439
sulu-builder/files/etc/sulu/sulu.sh
Normal file
@@ -0,0 +1,439 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
ACL_FILE="/tmp/sulu/mqtt.acl"
|
||||
_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}"
|
||||
else
|
||||
echo "$(echo "${endpointid/::/,}"|cut -d "," -f 2)"
|
||||
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}"
|
||||
else
|
||||
echo "${endpointid}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _get_sulu_users()
|
||||
{
|
||||
echo "$(uci -q get sulu.global.user)"
|
||||
}
|
||||
|
||||
function _get_sulu_root()
|
||||
{
|
||||
local root
|
||||
|
||||
root="$(uci -q get sulu.global.root)"
|
||||
echo "${root:-/sulu}"
|
||||
}
|
||||
|
||||
function _get_sulu_port()
|
||||
{
|
||||
local port
|
||||
|
||||
port="$(uci -q get sulu.global.port)"
|
||||
echo "${port:-8080}"
|
||||
}
|
||||
|
||||
function _get_sulu_ws_port()
|
||||
{
|
||||
local port
|
||||
|
||||
port="$(uci -q get sulu.global.ws_port)"
|
||||
echo "${port:-9001}"
|
||||
}
|
||||
|
||||
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_ws_port)";
|
||||
json_add_string 'protocol' 'ws';
|
||||
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_ws_port)";
|
||||
json_add_string 'protocol' 'ws';
|
||||
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_ws_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
|
||||
|
||||
rbac="${1:-0}"
|
||||
|
||||
[ -f "${ACL_FILE}" ] && rm -f "${ACL_FILE}"
|
||||
|
||||
if [ "${rbac}" -eq "0" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
agentid="$(_get_agent_id)"
|
||||
users="$(_get_sulu_users)"
|
||||
for f in ${users}; do
|
||||
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}
|
||||
done
|
||||
}
|
||||
|
||||
function update_mosquitto_broker_config()
|
||||
{
|
||||
local system_cred rbac restart ws_port
|
||||
|
||||
MB_SULU_CONF="/etc/mosquitto/conf.d/sulu.conf"
|
||||
system_cred="${1}"
|
||||
rbac="${2}"
|
||||
restart=0
|
||||
ws_port="$(_get_sulu_ws_port)"
|
||||
|
||||
if [ "${system_cred}" -eq "1" ]; then
|
||||
if grep -q "password_file " ${MB_SULU_CONF}; then
|
||||
sed -i '/password_file /d' ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
if ! grep -q "plugin .*mosquitto_auth_shadow.so" ${MB_SULU_CONF}; then
|
||||
echo "plugin /usr/lib/mosquitto_auth_shadow.so" >> ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
else
|
||||
if grep -q 'plugin .*mosquitto_auth_shadow.so' ${MB_SULU_CONF}; then
|
||||
sed -i '/plugin .*mosquitto_auth_shadow.so/d' ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
if ! grep -q "password_file /etc/mosquitto/sulu.password" ${MB_SULU_CONF}; then
|
||||
echo "password_file /etc/mosquitto/sulu.password" >> ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
_create_acl "${rbac}"
|
||||
if ! grep -q "acl_file ${ACL_FILE}" ${MB_SULU_CONF}; then
|
||||
echo "acl_file ${ACL_FILE}" >> ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
else
|
||||
if grep -q "acl_file ${ACL_FILE}" ${MB_SULU_CONF}; then
|
||||
sed -i '/acl_file /d' ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! grep -q "listener ${ws_port}" ${MB_SULU_CONF}; then
|
||||
sed -i "s/listener [0-9]\+/listener ${ws_port}/" ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -eq "1" ]; then
|
||||
slog "Restarting mqtt broker..."
|
||||
/etc/init.d/mosquitto restart &
|
||||
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 update_nginx_config()
|
||||
{
|
||||
local enabled restart port
|
||||
|
||||
NCONF="/etc/nginx/conf.d/sulu.conf"
|
||||
restart=0
|
||||
enabled="${1:-0}"
|
||||
_RESTART_SERVICES="${2:-0}"
|
||||
port="$(_get_sulu_port)"
|
||||
root="$(_get_sulu_root)"
|
||||
|
||||
if [ "${enabled}" -eq "1" ]; then
|
||||
if [ ! -f "${NCONF}" ]; then
|
||||
cp /etc/sulu/nginx.conf ${NCONF}
|
||||
restart=1
|
||||
fi
|
||||
if ! grep -q "listen ${port}" ${NCONF}; then
|
||||
sed -i "s/listen [0-9]\+/listen ${port}/" ${NCONF}
|
||||
sed -i "s/listen \[::\]:[0-9]\+/listen [::]:${port}/" ${NCONF}
|
||||
restart=1
|
||||
fi
|
||||
if ! grep -q "root ${root}" ${NCONF}; then
|
||||
sed -i "s/root .*;/root ${root//\//\\/};/" ${NCONF}
|
||||
restart=1
|
||||
fi
|
||||
else
|
||||
if [ -f "${NCONF}" ]; then
|
||||
rm -f ${NCONF}
|
||||
restart=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -eq "1" ]; then
|
||||
slog "Restarting nginx..."
|
||||
ubus call uci commit '{"config":"nginx"}'
|
||||
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}"
|
||||
|
||||
update_mosquitto_broker_config "${sys_cred}" "${rbac}"
|
||||
set_sulu_connection_mode "${rbac}"
|
||||
update_obuspa_config "${rbac}"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
mkdir -p /tmp/sulu
|
||||
|
||||
uci -q get nginx._sulu && exit 0
|
||||
|
||||
uci -q set nginx._sulu=server
|
||||
uci -q add_list nginx._sulu.listen='8080'
|
||||
uci -q add_list nginx._sulu.listen='[::]:8080'
|
||||
uci -q set nginx._sulu.root='/sulu'
|
||||
uci -q set nginx._sulu.server_name='_sulu'
|
||||
uci -q add_list nginx._sulu.include='conf.d/sulu.locations'
|
||||
11
sulu-builder/files/etc/uci-defaults/99-fix-sulu-config
Normal file
11
sulu-builder/files/etc/uci-defaults/99-fix-sulu-config
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/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
|
||||
config_get enabled global enabled 0
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 0
|
||||
generate_sulu_conn_config "${role_based_access}"
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu
|
||||
PKG_VERSION:=1.3.0
|
||||
PKG_VERSION:=1.3.16
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=524418f7a2e6e2b1d807b2a87f9f80ac3cb1d1b6
|
||||
PKG_SOURCE_VERSION:=81d4bb268914dc3822293e93519ae6adbd6ddbea
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
@@ -27,7 +27,7 @@ define Package/sulu
|
||||
SECTION:=sulu
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=SULU-CE ReactJS based Web UI Package
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
endef
|
||||
|
||||
define Package/sulu/description
|
||||
@@ -35,18 +35,34 @@ define Package/sulu/description
|
||||
endef
|
||||
|
||||
define Package/sulu/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)/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
|
||||
$(CP) ./files/* $(1)/
|
||||
$(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/mosquitto/conf.d/
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/conf.d/obuspa.conf $(1)/etc/mosquitto/conf.d/
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/conf.d/sulu.conf $(1)/etc/mosquitto/conf.d/
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/sulu.password $(1)/etc/mosquitto/sulu.password
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/conf.d
|
||||
$(INSTALL_DATA) ./files/etc/nginx/conf.d/sulu.conf $(1)/etc/nginx/conf.d/
|
||||
|
||||
$(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_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sulu))
|
||||
|
||||
9
sulu/files/etc/config/sulu
Normal file
9
sulu/files/etc/config/sulu
Normal file
@@ -0,0 +1,9 @@
|
||||
config global 'global'
|
||||
option root '/sulu'
|
||||
option port '8080'
|
||||
option ws_port '9001'
|
||||
option enabled '1'
|
||||
option enable_system_credentials '1'
|
||||
option role_based_access '1'
|
||||
list user 'admin'
|
||||
list user 'user'
|
||||
@@ -1,19 +1,42 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
. /lib/functions.sh
|
||||
. /etc/sulu/sulu.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t sulu.init -p debug
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance sulu
|
||||
# append sulu connection injection
|
||||
procd_close_instance
|
||||
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
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 1
|
||||
update_nginx_config "${enabled}" 1
|
||||
update_sulu_connection_port
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
@@ -23,5 +46,5 @@ reload_service() {
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_config_trigger "config.change" "obuspa" /etc/init.d/sulu reload
|
||||
procd_add_reload_trigger "sulu"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
listener 9001
|
||||
protocol websockets
|
||||
plugin /usr/lib/mosquitto_auth_shadow.so
|
||||
require_certificate false
|
||||
allow_anonymous false
|
||||
|
||||
1
sulu/files/etc/mosquitto/sulu.password
Normal file
1
sulu/files/etc/mosquitto/sulu.password
Normal file
@@ -0,0 +1 @@
|
||||
admin:$6$OmM9kU/lYct3KJ9j$iP0WK4ezEtRm8+EAggNp7WbJFoWO0p7IUdI0v/hr1WcVHyfFAC30Pb8Csn7GqwwqI2dcmnDOAITnimo2VNe6ug==
|
||||
27
sulu/files/etc/nginx/conf.d/sulu.conf
Normal file
27
sulu/files/etc/nginx/conf.d/sulu.conf
Normal file
@@ -0,0 +1,27 @@
|
||||
server {
|
||||
listen 8080;
|
||||
listen [::]:8080;
|
||||
server_name _sulu;
|
||||
root /sulu;
|
||||
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,18 +0,0 @@
|
||||
location /config/ {
|
||||
autoindex on;
|
||||
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,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
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,If-Modified-Since,Cache-Control,Content-Type,Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||
}
|
||||
}
|
||||
95
sulu/files/etc/sulu/roles.json
Normal file
95
sulu/files/etc/sulu/roles.json
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
439
sulu/files/etc/sulu/sulu.sh
Normal file
439
sulu/files/etc/sulu/sulu.sh
Normal file
@@ -0,0 +1,439 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
ACL_FILE="/tmp/sulu/mqtt.acl"
|
||||
_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}"
|
||||
else
|
||||
echo "$(echo "${endpointid/::/,}"|cut -d "," -f 2)"
|
||||
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}"
|
||||
else
|
||||
echo "${endpointid}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _get_sulu_users()
|
||||
{
|
||||
echo "$(uci -q get sulu.global.user)"
|
||||
}
|
||||
|
||||
function _get_sulu_root()
|
||||
{
|
||||
local root
|
||||
|
||||
root="$(uci -q get sulu.global.root)"
|
||||
echo "${root:-/sulu}"
|
||||
}
|
||||
|
||||
function _get_sulu_port()
|
||||
{
|
||||
local port
|
||||
|
||||
port="$(uci -q get sulu.global.port)"
|
||||
echo "${port:-8080}"
|
||||
}
|
||||
|
||||
function _get_sulu_ws_port()
|
||||
{
|
||||
local port
|
||||
|
||||
port="$(uci -q get sulu.global.ws_port)"
|
||||
echo "${port:-9001}"
|
||||
}
|
||||
|
||||
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_ws_port)";
|
||||
json_add_string 'protocol' 'ws';
|
||||
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_ws_port)";
|
||||
json_add_string 'protocol' 'ws';
|
||||
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_ws_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
|
||||
|
||||
rbac="${1:-0}"
|
||||
|
||||
[ -f "${ACL_FILE}" ] && rm -f "${ACL_FILE}"
|
||||
|
||||
if [ "${rbac}" -eq "0" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
agentid="$(_get_agent_id)"
|
||||
users="$(_get_sulu_users)"
|
||||
for f in ${users}; do
|
||||
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}
|
||||
done
|
||||
}
|
||||
|
||||
function update_mosquitto_broker_config()
|
||||
{
|
||||
local system_cred rbac restart ws_port
|
||||
|
||||
MB_SULU_CONF="/etc/mosquitto/conf.d/sulu.conf"
|
||||
system_cred="${1}"
|
||||
rbac="${2}"
|
||||
restart=0
|
||||
ws_port="$(_get_sulu_ws_port)"
|
||||
|
||||
if [ "${system_cred}" -eq "1" ]; then
|
||||
if grep -q "password_file " ${MB_SULU_CONF}; then
|
||||
sed -i '/password_file /d' ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
if ! grep -q "plugin .*mosquitto_auth_shadow.so" ${MB_SULU_CONF}; then
|
||||
echo "plugin /usr/lib/mosquitto_auth_shadow.so" >> ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
else
|
||||
if grep -q 'plugin .*mosquitto_auth_shadow.so' ${MB_SULU_CONF}; then
|
||||
sed -i '/plugin .*mosquitto_auth_shadow.so/d' ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
if ! grep -q "password_file /etc/mosquitto/sulu.password" ${MB_SULU_CONF}; then
|
||||
echo "password_file /etc/mosquitto/sulu.password" >> ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
_create_acl "${rbac}"
|
||||
if ! grep -q "acl_file ${ACL_FILE}" ${MB_SULU_CONF}; then
|
||||
echo "acl_file ${ACL_FILE}" >> ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
else
|
||||
if grep -q "acl_file ${ACL_FILE}" ${MB_SULU_CONF}; then
|
||||
sed -i '/acl_file /d' ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! grep -q "listener ${ws_port}" ${MB_SULU_CONF}; then
|
||||
sed -i "s/listener [0-9]\+/listener ${ws_port}/" ${MB_SULU_CONF}
|
||||
restart=1
|
||||
fi
|
||||
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -eq "1" ]; then
|
||||
slog "Restarting mqtt broker..."
|
||||
/etc/init.d/mosquitto restart &
|
||||
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 update_nginx_config()
|
||||
{
|
||||
local enabled restart port
|
||||
|
||||
NCONF="/etc/nginx/conf.d/sulu.conf"
|
||||
restart=0
|
||||
enabled="${1:-0}"
|
||||
_RESTART_SERVICES="${2:-0}"
|
||||
port="$(_get_sulu_port)"
|
||||
root="$(_get_sulu_root)"
|
||||
|
||||
if [ "${enabled}" -eq "1" ]; then
|
||||
if [ ! -f "${NCONF}" ]; then
|
||||
cp /etc/sulu/nginx.conf ${NCONF}
|
||||
restart=1
|
||||
fi
|
||||
if ! grep -q "listen ${port}" ${NCONF}; then
|
||||
sed -i "s/listen [0-9]\+/listen ${port}/" ${NCONF}
|
||||
sed -i "s/listen \[::\]:[0-9]\+/listen [::]:${port}/" ${NCONF}
|
||||
restart=1
|
||||
fi
|
||||
if ! grep -q "root ${root}" ${NCONF}; then
|
||||
sed -i "s/root .*;/root ${root//\//\\/};/" ${NCONF}
|
||||
restart=1
|
||||
fi
|
||||
else
|
||||
if [ -f "${NCONF}" ]; then
|
||||
rm -f ${NCONF}
|
||||
restart=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -eq "1" ]; then
|
||||
slog "Restarting nginx..."
|
||||
ubus call uci commit '{"config":"nginx"}'
|
||||
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}"
|
||||
|
||||
update_mosquitto_broker_config "${sys_cred}" "${rbac}"
|
||||
set_sulu_connection_mode "${rbac}"
|
||||
update_obuspa_config "${rbac}"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
mkdir -p /tmp/sulu
|
||||
|
||||
uci -q get nginx._sulu && exit 0
|
||||
|
||||
uci -q set nginx._sulu=server
|
||||
uci -q add_list nginx._sulu.listen='8080'
|
||||
uci -q add_list nginx._sulu.listen='[::]:8080'
|
||||
uci -q set nginx._sulu.root='/sulu'
|
||||
uci -q set nginx._sulu.server_name='_sulu'
|
||||
uci -q add_list nginx._sulu.include='conf.d/sulu.locations'
|
||||
11
sulu/files/etc/uci-defaults/99-fix-sulu-config
Normal file
11
sulu/files/etc/uci-defaults/99-fix-sulu-config
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/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
|
||||
config_get enabled global enabled 0
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 0
|
||||
generate_sulu_conn_config "${role_based_access}"
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.1.17
|
||||
PKG_VERSION:=2.1.19
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5124ea8051c06e8c3563b384660b08db199c93eb
|
||||
PKG_SOURCE_VERSION:=d7a069beab09ee1134ba1bc784c3bc9269df2e23
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/swmodd.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -16,11 +16,12 @@ is_container_running() {
|
||||
|
||||
configure_crun_container() {
|
||||
local name type autostart du_status requested_state url username password
|
||||
local BRIDGE BUNDLE
|
||||
local BRIDGE BUNDLE BOOT
|
||||
local RUNNER="/etc/swmodd/run.sh"
|
||||
|
||||
BUNDLE="${2}"
|
||||
BRIDGE="${3}"
|
||||
BOOT="${4}"
|
||||
|
||||
config_get name ${1} name ""
|
||||
config_get type ${1} type ""
|
||||
@@ -102,36 +103,59 @@ configure_crun_container() {
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${autostart}" -eq 0 ]; then
|
||||
ubus call service delete "{\"name\":\"crun\",\"instance\":\"${name}\"}"
|
||||
# stop the container if not enabled
|
||||
crun kill --all "${name}" 9
|
||||
return 0;
|
||||
fi
|
||||
if [ "${BOOT}" -eq "1" ]; then
|
||||
if [ "${autostart}" -eq 1 ]; then
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} description "${result}"
|
||||
fi
|
||||
|
||||
if is_container_running "${name}"; then
|
||||
log "Container [$name] req_status [${requested_state}]"
|
||||
if [ "${requested_state}" == "Idle" ]; then
|
||||
crun pause "${name}"
|
||||
elif [ "${requested_state}" == "Active" ]; then
|
||||
${RUNNER} -u -n "${name}" -i "${BRIDGE}"
|
||||
crun resume "${name}"
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} vendor "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} version "${result}"
|
||||
fi
|
||||
uci_set ocicontainer ${1} requested_state "Active"
|
||||
else
|
||||
uci_set ocicontainer ${1} requested_state "Idle"
|
||||
return 0;
|
||||
fi
|
||||
else
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} description "${result}"
|
||||
fi
|
||||
log "Container [$name] req_status [${requested_state}]"
|
||||
if [ "${requested_state}" == "Idle" ]; then
|
||||
if is_container_running "${name}"; then
|
||||
crun pause "${name}"
|
||||
else
|
||||
return 0;
|
||||
fi
|
||||
elif [ "${requested_state}" == "Active" ]; then
|
||||
if is_container_running "${name}"; then
|
||||
${RUNNER} -u -n "${name}" -i "${BRIDGE}"
|
||||
crun resume "${name}"
|
||||
else
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} description "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} vendor "${result}"
|
||||
fi
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} vendor "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} version "${result}"
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} version "${result}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
return 0;
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -144,8 +168,12 @@ configure_crun_container() {
|
||||
procd_close_instance "${name}"
|
||||
}
|
||||
|
||||
boot() {
|
||||
start "bootstrap"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local bundle bridge
|
||||
local bundle bridge boot
|
||||
|
||||
# Check if crun present
|
||||
if ! command -v crun >/dev/null 2>&1; then
|
||||
@@ -153,6 +181,12 @@ start_service() {
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${1}" == "bootstrap" ]; then
|
||||
boot=1
|
||||
else
|
||||
boot=0
|
||||
fi
|
||||
|
||||
config_load swmodd
|
||||
config_get bundle globals oci_bundle_root ""
|
||||
config_get bridge globals lan_bridge "br-lan"
|
||||
@@ -165,8 +199,9 @@ start_service() {
|
||||
if [ -f "${bundle}/ocicontainer" ]; then
|
||||
UCI_CONFIG_DIR="${bundle}"
|
||||
config_load ocicontainer
|
||||
config_foreach configure_crun_container du_eu_assoc "${bundle}" "${bridge}"
|
||||
uci_commit
|
||||
config_foreach configure_crun_container du_eu_assoc "${bundle}" "${bridge}" "${boot}"
|
||||
uci_commit ocicontainer
|
||||
|
||||
# Add a timer for DuStateChange!
|
||||
(sleep 5 && ubus -t 5 call swmodules reload) &
|
||||
fi
|
||||
|
||||
@@ -12,7 +12,7 @@ PKG_VERSION:=2016.08
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
ifdef CONFIG_TARGET_iopsys_econet
|
||||
ifdef CONFIG_TARGET_airoha
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/ensemble/u-boot.git
|
||||
PKG_SOURCE_VERSION:=1b320f0656bfc8504fa4f771dd77d8e403ed00e0
|
||||
else
|
||||
@@ -55,7 +55,7 @@ endef
|
||||
define uboot/en7562
|
||||
TITLE:=U-Boot for the en7562
|
||||
CONFIG:=econet-en7562-ram
|
||||
DEPENDS:=@TARGET_iopsys_econet
|
||||
DEPENDS:=@TARGET_airoha
|
||||
UBOOT_IMG:=u-boot-nand.bin
|
||||
endef
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=urlfilter
|
||||
PKG_VERSION:=1.1.4
|
||||
PKG_VERSION:=1.1.5
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "This object contains the information about URLs to be blocked or allowed to access from specified MAC addresses in given time duration.",
|
||||
"access": false,
|
||||
"array": false,
|
||||
"Enable": {
|
||||
@@ -18,6 +19,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Enable or disable URLFiltering on the CPE.",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
@@ -42,6 +44,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Enable or disable access of the URLs specified in <<param|BlacklistURL>> from all connected devices.",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
@@ -66,6 +69,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Comma separated list of URLs to be blacklisted from all connected devices.",
|
||||
"list": {
|
||||
"datatype": "string"
|
||||
},
|
||||
@@ -92,7 +96,8 @@
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
],
|
||||
"description": "<<numentries>>",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
@@ -115,6 +120,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Table contain details of the blacklist/whitelist profiles.",
|
||||
"uniqueKeys": [
|
||||
"Name"
|
||||
],
|
||||
@@ -141,6 +147,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Name of the profile. This should be unique for each entry in the table.",
|
||||
"datatype": "string",
|
||||
"range": [
|
||||
{
|
||||
@@ -171,6 +178,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Comma separated list of URLs which should be allowed to access.",
|
||||
"list": {
|
||||
"datatype": "string"
|
||||
},
|
||||
@@ -198,6 +206,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Comma separated list of URLs which should not be allowed to access.",
|
||||
"list": {
|
||||
"datatype": "string"
|
||||
},
|
||||
@@ -225,7 +234,8 @@
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
],
|
||||
"description": "<<numentries>>",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
@@ -248,6 +258,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Table contain MAC addresses on which <<object|Profile>> should be applied along with other information like filtering should be applied on which day, the timing information when the filtering should be done etc.",
|
||||
"access": true,
|
||||
"array": true,
|
||||
"mapping": [
|
||||
@@ -271,6 +282,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Enable or disable this filter instance on the CPE.",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
@@ -295,6 +307,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Path of the <<object|Profile>> that should be applied.",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
@@ -320,6 +333,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Comma separated list of MAC addresses for which the filtering should be done.",
|
||||
"list": {
|
||||
"datatype": "string"
|
||||
},
|
||||
@@ -347,6 +361,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Comma separated list of weekdays. Filtering should be done on the mentioned days only.",
|
||||
"list": {
|
||||
"datatype": "string"
|
||||
},
|
||||
@@ -374,6 +389,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Time when filtering shall start.",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
@@ -398,6 +414,7 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "The duration in seconds to filter the URLs from start time.",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
|
||||
56
usermngr/Makefile
Normal file
56
usermngr/Makefile
Normal file
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (C) 2022 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=usermngr
|
||||
PKG_VERSION:=1.0.3
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/usermngr.git
|
||||
PKG_SOURCE_VERSION:=a1c6ed3add2edb59f0b71bffa9b8aaa8b8240a61
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/usermngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
DEPENDS:= +shadow-utils +libbbf_api
|
||||
TITLE:=Package to add Device.Users. datamodel support
|
||||
endef
|
||||
|
||||
define Package/usermngr/description
|
||||
Package to add Device.Users. datamodel support
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/usermngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/usermngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/init.d/users $(1)/etc/init.d/users
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/uci-defaults/90-indicate-bootstrap $(1)/etc/uci-defaults/90-indicate-bootstrap
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/uci-defaults/91-sync-shells $(1)/etc/uci-defaults/91-sync-shells
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/libusermngr.so $(1)/usr/lib/bbfdm/libusermngr.so
|
||||
$(INSTALL_BIN) ./files/etc/config/users $(1)/etc/config/users
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,usermngr))
|
||||
7
usermngr/files/etc/config/users
Normal file
7
usermngr/files/etc/config/users
Normal file
@@ -0,0 +1,7 @@
|
||||
config user 'admin'
|
||||
option enabled '1'
|
||||
option remote_access '1'
|
||||
|
||||
config user 'user'
|
||||
option enabled '1'
|
||||
option remote_access '1'
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uspd
|
||||
PKG_VERSION:=2.2.14
|
||||
PKG_VERSION:=2.2.22
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/uspd.git
|
||||
PKG_SOURCE_VERSION:=1c3b886bb5e654049ae81cda726dffae950369c7
|
||||
PKG_SOURCE_VERSION:=828abe8f0234eb7cd36115bb2e4a5b4113c0510f
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -2,3 +2,5 @@ config uspd 'usp'
|
||||
option granularitylevel '0'
|
||||
option debug '0'
|
||||
option loglevel '1'
|
||||
option refresh_time '5'
|
||||
option transaction_timeout '10'
|
||||
|
||||
@@ -4,19 +4,21 @@
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
export LIBVOICE_MAKE_OPTS:=$(TOPDIR)/tmp/.libvoice-opts.mk
|
||||
include $(TOPDIR)/rules.mk
|
||||
-include $(LIBVOICE_MAKE_OPTS)
|
||||
|
||||
PKG_NAME:=voicemngr
|
||||
PKG_VERSION:=0.1
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
LOCAL_SRC_DIR:=~/git/voip/voicemngr
|
||||
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/voicemngr.git
|
||||
PKG_SOURCE_VERSION:=4a8583a647d97aa8c3b1bf7ab71206c1438b86a6
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=8cdd77393ac6a631649eac71ff33603bfc2b55b3
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -25,29 +27,22 @@ endif
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
TARGET_PLATFORM:=
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
TARGET_PLATFORM:=BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_qualcomm),y)
|
||||
TARGET_PLATFORM:=QUALCOMM
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
export CONFIG_BRCM_SDK_VER_504040
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
define Package/voicemngr
|
||||
export LIBVOICE_CFLAGS
|
||||
export LIBVOICE_LIBS
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS Voice Manager
|
||||
URL:=
|
||||
DEPENDS:= +libubox +ubus +libpicoevent +uci +TARGET_iopsys_brcm63xx_arm:bcmkernel +TARGET_iopsys_qualcomm:vtsp
|
||||
DEPENDS:= +libubox +ubus +libpicoevent +uci +TARGET_brcmbca:bcmkernel +TARGET_brcmbca:libvoice-broadcom \
|
||||
+TARGET_ipq95xx:libvoice-d2
|
||||
endef
|
||||
|
||||
define Package/voicemngr/description
|
||||
define Package/$(PKG_NAME)/description
|
||||
Voice manager is a daemon that bridges Asterisk and platform specific DSP/SLIC APIs
|
||||
endef
|
||||
|
||||
@@ -55,16 +50,22 @@ ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
@echo "Building from the local source. TARGET_PLATFORM=$(TARGET_PLATFORM)"
|
||||
rsync -av --exclude=.* $(LOCAL_SRC_DIR)/* $(PKG_BUILD_DIR)/
|
||||
$(LN) $(LIBVOICE_PKG_BUILD_DIR)/*.[ch] $(PKG_BUILD_DIR)/libvoice/
|
||||
endef
|
||||
else
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(LN) $(LIBVOICE_PKG_BUILD_DIR)/*.[ch] $(PKG_BUILD_DIR)/libvoice/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/voicemngr/install
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/voicemngr $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
|
||||
$(CP) $(PKG_BUILD_DIR)/libvoice/libvoice.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,voicemngr))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
menu "Configuration"
|
||||
|
||||
config WFA_DELM_MULTIAP_MODE
|
||||
bool "Enable Multi-AP mode"
|
||||
default y
|
||||
config DECOLLECTOR_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 2
|
||||
|
||||
config WIFI_DELM_DEBUG
|
||||
bool "Enable debug logs"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wfadatad
|
||||
PKG_VERSION:=2.10.0.4
|
||||
PKG_VERSION:=2.11.0.4
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b5b6e881b110d86c6ea725c30c1be4de77e9ecfb
|
||||
PKG_SOURCE_VERSION:=24dcb18f3e60082c70ab17b0707073fd2981f0a9
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wfadatad.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -73,6 +73,7 @@ endif
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_DECOLLECTOR_EASYMESH_VERSION)
|
||||
|
||||
EXECS := \
|
||||
$(if $(CONFIG_PACKAGE_wfadatad),agent/deagent) \
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wifimngr
|
||||
PKG_VERSION:=14.3.1
|
||||
PKG_VERSION:=14.3.2
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=cdaf1ffa68b9ea2bf4fcd6960938caa111a2a895
|
||||
PKG_SOURCE_VERSION:=b8cd9f543756f49a4da2d02cce45094f1544d920
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wifimngr.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
MAPFILE="/tmp/multiap.backhaul"
|
||||
MAPFILE="/var/run/multiap/multiap.backhaul"
|
||||
|
||||
wifi_onoff() {
|
||||
local devices="$(uci show wireless | grep '=wifi-device' | awk -F'[.,=]' '{print$2}')"
|
||||
|
||||
Reference in New Issue
Block a user