mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-24 11:05:02 +08:00
Compare commits
177 Commits
bbfdm_chec
...
quickjs-ng
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6226c8045e | ||
|
|
498a06916b | ||
|
|
332057fdd4 | ||
|
|
58aff3cb45 | ||
|
|
5678b6dcaa | ||
|
|
a597c514f7 | ||
|
|
3c1dcf90eb | ||
|
|
62dc6c28a3 | ||
|
|
2703ea0421 | ||
|
|
b4a0572b7c | ||
|
|
428055c911 | ||
|
|
97723f9e7a | ||
|
|
2dceb5b44b | ||
|
|
8c9689caf7 | ||
|
|
af5bb94c8c | ||
|
|
9db65fcfba | ||
|
|
2b43c27e53 | ||
|
|
c16f4d3f82 | ||
|
|
99a4f3c036 | ||
|
|
71217d4f68 | ||
|
|
ad012d7549 | ||
|
|
6cca837500 | ||
|
|
6bec3c159c | ||
|
|
fd921bb196 | ||
|
|
60d2f92da3 | ||
|
|
8f83250890 | ||
|
|
652ec8a4af | ||
|
|
937b824055 | ||
|
|
889723079b | ||
|
|
7a457ae32a | ||
|
|
7e5e38e657 | ||
|
|
44edac6572 | ||
|
|
fea3e1e4ef | ||
|
|
eae31a6dd4 | ||
|
|
3a1a65d5df | ||
|
|
70a22d0299 | ||
|
|
2a19a1a92a | ||
|
|
5b865c9dbc | ||
|
|
bc041faf04 | ||
|
|
de08bc79a1 | ||
|
|
9ab8dbdb3b | ||
|
|
f3cb8ad566 | ||
|
|
95e9630c4b | ||
|
|
2c6a9e76c8 | ||
|
|
653b74aacf | ||
|
|
c6437fbf53 | ||
|
|
3a4ad69af9 | ||
|
|
0379e816c5 | ||
|
|
b8f99bbe64 | ||
|
|
42df10c708 | ||
|
|
7369ee4c20 | ||
|
|
dc3aa2ec9d | ||
|
|
312d28bec4 | ||
|
|
45a754f567 | ||
|
|
491f2ca07d | ||
|
|
2d5f9229f2 | ||
|
|
16536b9bc3 | ||
|
|
f552b68f10 | ||
|
|
7c444911f7 | ||
|
|
7a12fb28b1 | ||
|
|
a430d76517 | ||
|
|
b48c7e14dc | ||
|
|
269d72c30a | ||
|
|
f19082aa1e | ||
|
|
43f0296ea2 | ||
|
|
6418f9fa8f | ||
|
|
58ecaf9c15 | ||
|
|
0f8887f676 | ||
|
|
a1193cc6b8 | ||
|
|
392a41b38a | ||
|
|
c3128d3a14 | ||
|
|
4d88e123a9 | ||
|
|
fb050cae2e | ||
|
|
90af4f350b | ||
|
|
605f0faacc | ||
|
|
065772401b | ||
|
|
886000a830 | ||
|
|
0b5a84e33a | ||
|
|
a2763cd075 | ||
|
|
4a8b27ed95 | ||
|
|
6eef7e4b21 | ||
|
|
a0bde81de4 | ||
|
|
5e04f9312b | ||
|
|
a1e7f80ae0 | ||
|
|
ed5169b94c | ||
|
|
c64701e6b2 | ||
|
|
db6672c9ee | ||
|
|
05c4d0d3d1 | ||
|
|
6535fe465c | ||
|
|
2703db3f2e | ||
|
|
bb603cb492 | ||
|
|
f8d7788d6f | ||
|
|
97df4367eb | ||
|
|
21fbf0253c | ||
|
|
ced2b4187f | ||
|
|
bfdd27f72a | ||
|
|
6f1953e4a4 | ||
|
|
fd816f8ee1 | ||
|
|
cbdc083db5 | ||
|
|
eb1897a730 | ||
|
|
546450566e | ||
|
|
5fb51c6fd9 | ||
|
|
5d84d0ae29 | ||
|
|
340709b527 | ||
|
|
38bef28d00 | ||
|
|
ba53aeda7d | ||
|
|
bd63c5a090 | ||
|
|
89c1fbb38a | ||
|
|
d6ff1d851b | ||
|
|
107b1576e8 | ||
|
|
47694dc23e | ||
|
|
002836769c | ||
|
|
cafb9f09ba | ||
|
|
a440adbef9 | ||
|
|
2ba04321b3 | ||
|
|
9126f2ef7d | ||
|
|
ed01ddf670 | ||
|
|
7e360f7b30 | ||
|
|
e15dcd3b25 | ||
|
|
9ee00a3c82 | ||
|
|
ba94d88f0d | ||
|
|
041e51edf3 | ||
|
|
6ca5af0790 | ||
|
|
6d32d6e8b3 | ||
|
|
2b4f9029f8 | ||
|
|
8c3bf8763e | ||
|
|
1c6243113c | ||
|
|
eedf8d2761 | ||
|
|
bf8b4de5da | ||
|
|
fd208e0e5f | ||
|
|
5b090176a1 | ||
|
|
93b1952f50 | ||
|
|
ddcfeeb339 | ||
|
|
8cea3573f7 | ||
|
|
8ac0f69992 | ||
|
|
65dea29e5f | ||
|
|
2cecb4f75a | ||
|
|
a47d302ec7 | ||
|
|
a9b3a392dd | ||
|
|
397611aff5 | ||
|
|
21c9fafc4d | ||
|
|
41efd7d712 | ||
|
|
f1e37ac0d8 | ||
|
|
ab6d3935d1 | ||
|
|
db529f651e | ||
|
|
975bf57de0 | ||
|
|
6fb3a1b91d | ||
|
|
57ae4eb344 | ||
|
|
dc79aa56f9 | ||
|
|
8334b65ad4 | ||
|
|
e9caa2e7cd | ||
|
|
49a31dbd49 | ||
|
|
31f223f7a0 | ||
|
|
8e33d24256 | ||
|
|
e6df8f9ad0 | ||
|
|
2c3e9ce606 | ||
|
|
616e15b9c4 | ||
|
|
93d2d09dcc | ||
|
|
ece7e8f22c | ||
|
|
879b473d20 | ||
|
|
ac9da0ec6f | ||
|
|
7c5046d9d8 | ||
|
|
69ccc34b2c | ||
|
|
87a6852c1a | ||
|
|
b0d1ada967 | ||
|
|
09cccc39cc | ||
|
|
7227cbd8da | ||
|
|
c57b0322b0 | ||
|
|
db626422dc | ||
|
|
26ffa55453 | ||
|
|
adc2b26a78 | ||
|
|
51e3ad0404 | ||
|
|
d9448a0de4 | ||
|
|
84eff7c8e0 | ||
|
|
53d940586e | ||
|
|
712435786a | ||
|
|
e57bbc0306 |
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.15.30
|
||||
PKG_VERSION:=1.17.0
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=6cbfa27973558c706f7bc88465a0dc234800a75f
|
||||
PKG_SOURCE_VERSION:=a4f61081381a35fc98fa1cec58e964c3e6db2c55
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -8,13 +8,16 @@
|
||||
"ieee1905",
|
||||
"mapcontroller",
|
||||
"mosquitto",
|
||||
"nginx"
|
||||
"nginx",
|
||||
"netmode"
|
||||
],
|
||||
"cwmp": [
|
||||
"firewall",
|
||||
"network",
|
||||
"dhcp",
|
||||
"mapcontroller",
|
||||
"wireless",
|
||||
"time"
|
||||
"time",
|
||||
"netmode"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,19 +10,10 @@ log() {
|
||||
echo "${@}"|logger -t bbf.config -p info
|
||||
}
|
||||
|
||||
create_needed_directories()
|
||||
{
|
||||
mkdir -p /tmp/bbfdm/.cwmp
|
||||
mkdir -p /tmp/bbfdm/.usp
|
||||
mkdir -p /tmp/bbfdm/.bbfdm
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
local log_level
|
||||
|
||||
create_needed_directories
|
||||
|
||||
config_load bbfdm
|
||||
config_get log_level "reload_handler" log_level 2
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
]
|
||||
},
|
||||
"dhcp_refresh": {
|
||||
"if_operator": "OR",
|
||||
"if" : [
|
||||
{
|
||||
"event": "host"
|
||||
},
|
||||
{
|
||||
"event": "wifi.dataelements.Associated"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bridgemngr
|
||||
PKG_VERSION:=1.0.15
|
||||
PKG_VERSION:=1.1.1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/bridgemngr
|
||||
PKG_SOURCE_VERSION:=124e2d1625717a8ef5a434b5a31bb4ce5dc98333
|
||||
PKG_SOURCE_VERSION:=b6a657e1c83b49f09323b4012ef229c604b82854
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddnsmngr
|
||||
PKG_VERSION:=1.0.11
|
||||
PKG_VERSION:=1.0.12
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ddnsmngr.git
|
||||
PKG_SOURCE_VERSION:=9f2f4dabc71c4f405b1c5df576d20d793d299e94
|
||||
PKG_SOURCE_VERSION:=44af9a7b3fec3929f8554af9633a5b8068189b48
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=decollector
|
||||
PKG_VERSION:=6.2.1.5
|
||||
PKG_VERSION:=6.2.1.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=624082fe2763492b2360c8d035b2ae83e94970d0
|
||||
PKG_SOURCE_VERSION:=ca92325ece080389ffb405c95048b64071eda653
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.7.7
|
||||
PKG_VERSION:=3.7.10
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=289a91b3e7f221f16c976efd147bd4b203420b41
|
||||
PKG_SOURCE_VERSION:=1f851980a6ba616df54f79930225f8bcd563b711
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dnsmngr
|
||||
PKG_VERSION:=1.0.17
|
||||
PKG_VERSION:=1.0.18
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dnsmngr.git
|
||||
PKG_SOURCE_VERSION:=2ceb76e98cf23a8d52ab3f464d38d62385311a87
|
||||
PKG_SOURCE_VERSION:=80fa147e6f1f0d9c1a62a62a693ff3adaef45363
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dslmngr
|
||||
PKG_VERSION:=1.2.9
|
||||
PKG_VERSION:=1.2.10
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/dslmngr.git
|
||||
PKG_SOURCE_VERSION:=5340cb31f759301f5aca3fd848fc3a63b0b4663f
|
||||
PKG_SOURCE_VERSION:=8fb4093b4d26b3cb06603e110d424005e33cf5d6
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -30,6 +30,8 @@ include ../bbfdm/bbfdm.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
else ifneq ($(CONFIG_TARGET_airoha),)
|
||||
TARGET_PLATFORM=AIROHA
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET)
|
||||
endif
|
||||
@@ -41,7 +43,7 @@ define Package/dslmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=XDSL status and configration utility
|
||||
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl +libeasy
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service +TARGET_airoha:br2684ctl
|
||||
endef
|
||||
|
||||
define Package/dslmngr/description
|
||||
@@ -75,7 +77,10 @@ define Package/dslmngr/install
|
||||
$(CP) ./files/common/* $(1)/
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
$(CP) ./files/broadcom/* $(1)/
|
||||
else ifneq ($(CONFIG_TARGET_airoha),)
|
||||
$(CP) ./files/airoha/* $(1)/
|
||||
endif
|
||||
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dslmngr $(1)/sbin/
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
|
||||
26
dslmngr/files/airoha/etc/init.d/xdsl_wan
Executable file
26
dslmngr/files/airoha/etc/init.d/xdsl_wan
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=99
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
readonly need_xdsl="$(jsonfilter -i /etc/board.json -e @.dsl)"
|
||||
[ -f /etc/board.json ] || return 0
|
||||
|
||||
if [ "$need_xdsl" != "" ]; then
|
||||
procd_open_instance xdsl_wan
|
||||
procd_set_param command /sbin/xdsl_wan
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
fi
|
||||
}
|
||||
|
||||
boot() {
|
||||
: # boot-up is handled from 'hsm' application
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "dsl"
|
||||
}
|
||||
28
dslmngr/files/airoha/lib/dsl/airoha.sh
Normal file
28
dslmngr/files/airoha/lib/dsl/airoha.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
xtm_remove_devices() {
|
||||
:
|
||||
}
|
||||
|
||||
xtm_create_devices() {
|
||||
:
|
||||
}
|
||||
|
||||
xdsl_configure() {
|
||||
# Support bridged WAN interface
|
||||
ebtables --concurrent -t broute -D BROUTING -p 0xbeed -j DROP 2> /dev/null
|
||||
ebtables --concurrent -t broute -I BROUTING -p 0xbeed -j DROP
|
||||
}
|
||||
|
||||
xdsl_stop() {
|
||||
return 0
|
||||
}
|
||||
|
||||
xdsl_init() {
|
||||
readonly need_xdsl="$(jsonfilter -i /etc/board.json -e @.dsl)"
|
||||
[ "$need_xdsl" = "" ] && exit 0
|
||||
|
||||
echo "Starting DSL"
|
||||
}
|
||||
240
dslmngr/files/airoha/sbin/xdsl_wan
Executable file
240
dslmngr/files/airoha/sbin/xdsl_wan
Executable file
@@ -0,0 +1,240 @@
|
||||
#!/bin/sh
|
||||
|
||||
source "/lib/functions.sh"
|
||||
source "/lib/functions/network.sh"
|
||||
source "/lib/functions/system.sh"
|
||||
|
||||
PREVLINK=""
|
||||
PREVWANMODE=""
|
||||
WANMODE=""
|
||||
CONFIGURED=0
|
||||
CINDEX=0
|
||||
WANPORT="$(jsonfilter -i /etc/board.json -e @.network.wan.device)"
|
||||
|
||||
delete_atm_device() {
|
||||
/userfs/bin/blapi_cmd xdsl atm_delete_interface $CINDEX
|
||||
CINDEX=$((CINDEX+1))
|
||||
}
|
||||
|
||||
delete_atm_devices() {
|
||||
CINDEX=0
|
||||
config_load dsl
|
||||
config_foreach delete_atm_device atm-device
|
||||
}
|
||||
|
||||
configure_atm_device() {
|
||||
local vpi vci encapsulation qos_class pcr mbs scr
|
||||
local encap qos ethmac
|
||||
|
||||
config_get vpi $1 vpi "8"
|
||||
config_get vci $1 vci "35"
|
||||
config_get encapsulation $1 encapsulation "llc"
|
||||
config_get qos_class $1 qos_class "ubr"
|
||||
config_get pcr $1 pcr "0"
|
||||
config_get mbs $1 mbs "0"
|
||||
config_get scr $1 scr "0"
|
||||
|
||||
case $encapsulation in # llc, vcmux
|
||||
vcmux)
|
||||
encap="1483 Bridged IP VC-Mux"
|
||||
;;
|
||||
*)
|
||||
encap="1483 Bridged IP LLC"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
ethmac="$(echo -n "$(macaddr_add 02:AA:BB:01:23:40 $((CINDEX+2)))" | sed 's#:##g')"
|
||||
|
||||
/userfs/bin/blapi_cmd xdsl create_device $CINDEX ATM "" "$ethmac"
|
||||
/userfs/bin/blapi_cmd xdsl atm_create_interface $CINDEX ATM "$qos_class" "$encap" "$vpi" "$vci" "$pcr" "$scr" "$mbs" 0
|
||||
|
||||
CINDEX=$((CINDEX+1))
|
||||
}
|
||||
|
||||
create_atm_devices() {
|
||||
delete_atm_devices
|
||||
|
||||
CINDEX=0
|
||||
config_foreach configure_atm_device atm-device
|
||||
}
|
||||
|
||||
configure_line() {
|
||||
local mode profile bitswap sra us0 sesdrop sos ginp mod prof
|
||||
local adsl1_flag=0 issue2_flag=0 Glite_flag=0 adsl2_flag=0 adsl2p_flag=0 vdsl2_flag=0
|
||||
local pro_8a_flag=0 pro_8b_flag=0 pro_8c_flag=0 pro_8d_flag=0 pro_12a_flag=0 pro_12b_flag=0 pro_17a_flag=0 pro_30a_flag=0 pro_35b_flag=0
|
||||
|
||||
config_get mode $1 mode "vdsl2"
|
||||
config_get profile $1 profile "35b"
|
||||
config_get bitswap $1 bitswap "1"
|
||||
config_get sra $1 sra "1"
|
||||
config_get us0 $1 us0 "1"
|
||||
config_get sos $1 sos "0"
|
||||
config_get sos $1 roc "0"
|
||||
config_get sos $1 ginp "0"
|
||||
|
||||
for mod in $mode; do
|
||||
[ "$mod" = "gdmt" ] && adsl1_flag=1
|
||||
[ "$mod" = "glite" ] && Glite_flag=1
|
||||
[ "$mod" = "t1413" ] && issue2_flag=1
|
||||
[ "$mod" = "adsl2" ] && adsl2_flag=1
|
||||
[ "$mod" = "adsl2p" ] && adsl2p_flag=1
|
||||
[ "$mod" = "vdsl2" ] && vdsl2_flag=1
|
||||
done
|
||||
|
||||
for prof in $profile; do
|
||||
[ "$prof" = "8a" ] && pro_8a_flag=1
|
||||
[ "$prof" = "8b" ] && pro_8b_flag=1
|
||||
[ "$prof" = "8c" ] && pro_8c_flag=1
|
||||
[ "$prof" = "8d" ] && pro_8d_flag=1
|
||||
[ "$prof" = "12a" ] && pro_12a_flag=1
|
||||
[ "$prof" = "12b" ] && pro_12b_flag=1
|
||||
[ "$prof" = "17a" ] && pro_17a_flag=1
|
||||
[ "$prof" = "30a" ] && pro_30a_flag=1
|
||||
[ "$prof" = "35b" ] && pro_35b_flag=1
|
||||
done
|
||||
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_profile "$pro_8a_flag" "$pro_8b_flag" "$pro_8c_flag" "$pro_8d_flag" "$pro_12a_flag" "$pro_12b_flag" "$pro_17a_flag" "$pro_30a_flag" "$pro_35b_flag"
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_mode "$adsl1_flag" "$issue2_flag" "$Glite_flag" "$adsl2_flag" "$adsl2p_flag" "$vdsl2_flag"
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_ginp "$((!ginp))"
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_sos_roc "$((!sos))" "$((!roc))"
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_us0 "$((!us0))"
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_sra "$((!sra))"
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_bitswap "$((!bitswap))"
|
||||
|
||||
CONFIGURED=1
|
||||
}
|
||||
|
||||
configure_lines() {
|
||||
config_load dsl
|
||||
config_foreach configure_line dsl-line
|
||||
}
|
||||
|
||||
call_wan_hotplug() {
|
||||
# initializations
|
||||
local updown="$1"
|
||||
local ethwan="$2"
|
||||
|
||||
# ethernet hotlugs expect LINK and PORT environment variables set
|
||||
env -i LINK="$updown" PORT="$ethwan" /sbin/hotplug-call ethernet
|
||||
}
|
||||
|
||||
if [ "$WANPORT" = "ae_wan" -a -f /proc/device-tree/ae_wan/wan-dsl ]; then
|
||||
/etc/init.d/br2684ctl stop
|
||||
else
|
||||
/etc/init.d/br2684ctl start
|
||||
fi
|
||||
|
||||
# Wait for nas0 interface to come up.
|
||||
while [ "$(devstatus "$WANPORT" | jsonfilter -e @.up)" != "true" ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while [ true ]; do
|
||||
LINK="$(awk '/ADSL link status:/{print $4}' /proc/tc3162/adsl_stats)"
|
||||
[ \( "$LINK" = "down" -o "$LINK" = "up" \) ] && break
|
||||
sleep 1
|
||||
done
|
||||
sleep 2
|
||||
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_sysvid "26 00 47 4E 58 53 00 00" # GNXS vendor id
|
||||
/userfs/bin/blapi_cmd xdsl set_adsl_version "$(ubus call fwbank dump | jsonfilter -e "@.bank[@.active=true].swver" | cut -f1 -d'_' | cut -f1 -d'-' | hexdump -e '11/1 "%02x " "\n"' | head -n1)"
|
||||
/userfs/bin/blapi_cmd xdsl set_power_up_down 1
|
||||
/userfs/bin/blapi_cmd xdsl set_power_up_down 0
|
||||
sleep 1
|
||||
|
||||
while [ true ]; do
|
||||
LINK="$(awk '/ADSL link status:/{print $4}' /proc/tc3162/adsl_stats)"
|
||||
|
||||
if [ "$LINK" != "$PREVLINK" -a \( "$LINK" = "down" -o "$LINK" = "up" \) ]; then
|
||||
if [ "$LINK" = "down" ]; then
|
||||
[ "$CONFIGURED" -eq 0 ] && configure_lines # Needs to be done once the slave SoC is in down state and we've not been able to auto-sync.
|
||||
if [ -n "$WANMODE" ]; then
|
||||
if [ "$WANMODE" = "PTM" ]; then
|
||||
/userfs/bin/blapi_cmd xdsl ptm_do_reset_sequence 0 1
|
||||
else
|
||||
delete_atm_devices
|
||||
fi
|
||||
fi
|
||||
|
||||
call_wan_hotplug "down" "$WANPORT"
|
||||
else
|
||||
CONFIGURED=1
|
||||
WANMODE="$(awk '/TPSTC type:/{print $4}' /proc/tc3162/adsl_stats)"
|
||||
if [ "$WANMODE" != "$PREVWANMODE" ]; then
|
||||
OLDWANPORT="$WANPORT"
|
||||
network_defer_device "$OLDWANPORT"
|
||||
|
||||
if [ -f /proc/device-tree/ae_wan/wan-dsl ]; then
|
||||
WANPORT="ae_wan"
|
||||
else
|
||||
WANPORT="nas10"
|
||||
fi
|
||||
|
||||
if [ "$WANMODE" = "PTM" ]; then
|
||||
/etc/init.d/br2684ctl stop
|
||||
delete_atm_devices
|
||||
/userfs/bin/blapi_cmd system set_wan_mode 1
|
||||
/userfs/bin/blapi_cmd xdsl reload_ko 2
|
||||
/userfs/bin/blapi_cmd xdsl ptm_do_reset_sequence 1 2
|
||||
|
||||
# Set extended TPID for PTM packet flow
|
||||
sys memwl 1FB50000 81001839
|
||||
# VLAN TPID - VLAN
|
||||
sys memwl 1FB50F18 8100
|
||||
|
||||
ifconfig ${WANPORT} mtu 1500
|
||||
else
|
||||
/userfs/bin/blapi_cmd system set_wan_mode 0
|
||||
/userfs/bin/blapi_cmd xdsl reload_ko 1
|
||||
/etc/init.d/br2684ctl start
|
||||
|
||||
# Set extended TPID for ATM packet flow
|
||||
sys memwl 1FB50000 884C1839
|
||||
# VLAN TPID - MPOA
|
||||
sys memwl 1FB50F18 884C
|
||||
|
||||
ifconfig ${WANPORT} mtu 1982
|
||||
ifconfig ${WANPORT} down up
|
||||
|
||||
OLDWANPORT="$WANPORT"
|
||||
ATMINDEX="$(cat /sys/class/atm/TSARM*/atmindex | tail -n1 2> /dev/null)"
|
||||
WANPORT="nas$((ATMINDEX))"
|
||||
fi
|
||||
|
||||
if [ "$OLDWANPORT" != "$WANPORT" ]; then
|
||||
call_wan_hotplug "down" "$OLDWANPORT"
|
||||
|
||||
FILES="$(grep "$OLDWANPORT" /etc/config/* | cut -f1 -d: | uniq | cut -f4 -d/ | xargs)"
|
||||
for FILE in $FILES; do
|
||||
sed -i -e "s#${OLDWANPORT}#${WANPORT}#g" "/etc/config/${FILE}"
|
||||
"/etc/init.d/${FILE}" restart
|
||||
done
|
||||
else
|
||||
/etc/init.d/network restart
|
||||
fi
|
||||
ifconfig ${OLDWANPORT} down up
|
||||
fi
|
||||
|
||||
if [ "$WANMODE" = "PTM" ]; then
|
||||
: # ToDo
|
||||
else
|
||||
create_atm_devices
|
||||
fi
|
||||
|
||||
call_wan_hotplug "up" "$WANPORT"
|
||||
PREVWANMODE="$WANMODE"
|
||||
fi
|
||||
|
||||
# Toggle link state
|
||||
network_defer_device "$WANPORT"
|
||||
network_ready_device "$WANPORT"
|
||||
|
||||
# We are only interested in the transtion from init -> up/down and up/down -> down/up and vice versa.
|
||||
# Since we poll the status via in-band signaling packets might get lost and the /procfs file is empty.
|
||||
# This state we don't want to handle as it will toggle the link and do a re-setup which is totally unnecessary and unwanted.
|
||||
PREVLINK="$LINK"
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
done
|
||||
@@ -25,6 +25,7 @@ config dsl-line line
|
||||
list profile 12b
|
||||
list profile 17a
|
||||
list profile 30a
|
||||
list profile 35b
|
||||
option bitswap 1
|
||||
option sra 1
|
||||
option us0 1 # VDSL2 only
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethmngr
|
||||
PKG_VERSION:=3.0.7
|
||||
PKG_VERSION:=3.0.8
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/ethmngr.git
|
||||
PKG_SOURCE_VERSION:=171cf63d972c6fa81b97281531e457a0967c16c7
|
||||
PKG_SOURCE_VERSION:=c73e5b15718ca40b2740bbe6151dfbb2bcca16df
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=firewallmngr
|
||||
PKG_VERSION:=1.0.9
|
||||
PKG_VERSION:=1.0.10
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/firewallmngr.git
|
||||
PKG_SOURCE_VERSION:=77ad8425b73a3ac63f6160dc217635394ac87907
|
||||
PKG_SOURCE_VERSION:=05ad0d6f7f21520eecd05429c14d1963de2a8463
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
ZONE_NAME_FILE="/tmp/service_fw_zone"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t firewall.service -p info
|
||||
}
|
||||
@@ -17,6 +19,37 @@ exec_cmd() {
|
||||
return 0
|
||||
}
|
||||
|
||||
collect_zone_name() {
|
||||
local name network
|
||||
|
||||
config_get name "${1}" name ""
|
||||
if [ -z "${name}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get network "${1}" network ""
|
||||
for i in ${network}; do
|
||||
var="${i}_zone"
|
||||
echo "${var}=${name}" >> "${ZONE_NAME_FILE}"
|
||||
done
|
||||
}
|
||||
|
||||
load_zone_names() {
|
||||
rm -f "${ZONE_NAME_FILE}"
|
||||
config_foreach collect_zone_name zone
|
||||
}
|
||||
|
||||
get_firewall_zone() {
|
||||
if [ ! -f "${ZONE_NAME_FILE}" ]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
|
||||
var="${1}_zone="
|
||||
name="$(cat ${ZONE_NAME_FILE} | grep ${var} | head -n 1 | cut -d'=' -f 2)"
|
||||
echo "${name}"
|
||||
}
|
||||
|
||||
add_iptable_rule() {
|
||||
chain_name=$1
|
||||
protocol=$2
|
||||
@@ -135,9 +168,14 @@ add_service() {
|
||||
fi
|
||||
|
||||
action=$(echo "${target}" | tr a-z A-Z)
|
||||
chain_name="zone_${interface}_input"
|
||||
res=0
|
||||
zone_name="$(get_firewall_zone ${interface})"
|
||||
if [ -z "${zone_name}" ]; then
|
||||
log "Rule can not be added without zone name for interface ${interface}"
|
||||
return
|
||||
fi
|
||||
|
||||
chain_name="zone_${zone_name}_input"
|
||||
res=0
|
||||
count=$(echo "${proto}" | sed -n "/-1/p" | wc -l)
|
||||
|
||||
if [ "${count}" -eq 0 ]; then
|
||||
@@ -160,4 +198,9 @@ add_service() {
|
||||
}
|
||||
|
||||
config_load firewall
|
||||
|
||||
load_zone_names
|
||||
|
||||
config_foreach add_service "service"
|
||||
|
||||
rm -f "${ZONE_NAME_FILE}"
|
||||
|
||||
@@ -5,15 +5,16 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fluent-bit
|
||||
PKG_VERSION:=4.0.2
|
||||
PKG_VERSION:=4.0.4
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit.git
|
||||
PKG_SOURCE_VERSION=v$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit/archive/refs/tags/
|
||||
PKG_HASH:=aa0577ba7251081c8d5398b2a905b5b0585bb657ca13b39a5e12931437516f08
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
@@ -65,9 +66,9 @@ CMAKE_OPTIONS += \
|
||||
-DFLB_IN_DISK=Yes \
|
||||
-DFLB_IN_EXEC=Yes \
|
||||
-DFLB_IN_HEAD=Yes \
|
||||
-DFLB_IN_KMSG=Yes \
|
||||
-DFLB_IN_TAIL=Yes \
|
||||
-DFLB_IN_FORWARD=No \
|
||||
-DFLB_IN_KMSG=No \
|
||||
-DFLB_IN_PROC=No \
|
||||
-DFLB_IN_RANDOM=No \
|
||||
-DFLB_IN_SERIAL=No \
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
tag syslog
|
||||
path /dev/log
|
||||
|
||||
[INPUT]
|
||||
name kmsg
|
||||
tag kernel
|
||||
|
||||
[OUTPUT]
|
||||
name null
|
||||
match *
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
diff --git a/plugins/out_syslog/syslog.c b/plugins/out_syslog/syslog.c
|
||||
index 4ecc7c4ac..cfe568245 100644
|
||||
--- a/plugins/out_syslog/syslog.c
|
||||
+++ b/plugins/out_syslog/syslog.c
|
||||
@@ -776,12 +776,42 @@ static flb_sds_t syslog_format(struct flb_syslog *ctx, msgpack_object *o,
|
||||
}
|
||||
|
||||
if (ctx->parsed_mode != FLB_SYSLOG_UDP) {
|
||||
+ unsigned int msg_len = 0;
|
||||
+
|
||||
+ /* Create new SDS for length prefix */
|
||||
+ flb_sds_t prefix = flb_sds_create_size(ctx->maxsize + 32);
|
||||
+ if (!prefix) {
|
||||
+ ret_sds = NULL;
|
||||
+ goto clean;
|
||||
+ }
|
||||
+
|
||||
+ /* Add newline also to make behaviour similar to syslog-ng */
|
||||
tmp = flb_sds_cat(*s, "\n", 1);
|
||||
if (!tmp) {
|
||||
+ flb_sds_destroy(prefix);
|
||||
ret_sds = NULL;
|
||||
goto clean;
|
||||
}
|
||||
*s = tmp;
|
||||
+
|
||||
+ msg_len = flb_sds_len(*s);
|
||||
+ tmp = flb_sds_printf(&prefix, "%u ", msg_len);
|
||||
+ if (!tmp) {
|
||||
+ flb_sds_destroy(prefix);
|
||||
+ ret_sds = NULL;
|
||||
+ goto clean;
|
||||
+ }
|
||||
+ prefix = tmp;
|
||||
+
|
||||
+ tmp = flb_sds_cat(prefix, *s, msg_len);
|
||||
+ if (!tmp) {
|
||||
+ flb_sds_destroy(prefix);
|
||||
+ ret_sds = NULL;
|
||||
+ goto clean;
|
||||
+ }
|
||||
+
|
||||
+ flb_sds_destroy(*s);
|
||||
+ *s = tmp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
32
fluent-bit/patches/0005-kmsg_log.patch
Normal file
32
fluent-bit/patches/0005-kmsg_log.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
diff --git a/plugins/in_kmsg/in_kmsg.c b/plugins/in_kmsg/in_kmsg.c
|
||||
index cd5c4cd17..9524cf194 100644
|
||||
--- a/plugins/in_kmsg/in_kmsg.c
|
||||
+++ b/plugins/in_kmsg/in_kmsg.c
|
||||
@@ -165,6 +165,15 @@ static inline int process_line(const char *line,
|
||||
|
||||
flb_time_set(&ts, ctx->boot_time.tv_sec + tv.tv_sec, tv.tv_usec * 1000);
|
||||
|
||||
+ /* Format syslog timestamp: "Jul 03 10:31:53" */
|
||||
+ time_t real_time = ctx->boot_time.tv_sec + tv.tv_sec;
|
||||
+ struct tm tm_info;
|
||||
+ char syslog_ts[32];
|
||||
+
|
||||
+ localtime_r(&real_time, &tm_info);
|
||||
+ strftime(syslog_ts, sizeof(syslog_ts), "%b %d %H:%M:%S", &tm_info);
|
||||
+ int syslog_ts_len = strlen(syslog_ts);
|
||||
+
|
||||
/* Now process the human readable message */
|
||||
p = strchr(p, ';');
|
||||
if (!p) {
|
||||
@@ -198,7 +207,10 @@ static inline int process_line(const char *line,
|
||||
FLB_LOG_EVENT_UINT64_VALUE(tv.tv_usec),
|
||||
|
||||
FLB_LOG_EVENT_CSTRING_VALUE("msg"),
|
||||
- FLB_LOG_EVENT_STRING_VALUE((char *) p, line_len - 1));
|
||||
+ FLB_LOG_EVENT_STRING_VALUE((char *) p, line_len - 1),
|
||||
+
|
||||
+ FLB_LOG_EVENT_CSTRING_VALUE("syslog_ts"),
|
||||
+ FLB_LOG_EVENT_STRING_VALUE(syslog_ts, syslog_ts_len));
|
||||
}
|
||||
|
||||
if (ret == FLB_EVENT_ENCODER_SUCCESS) {
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostmngr
|
||||
PKG_VERSION:=1.2.20
|
||||
PKG_VERSION:=1.3.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=3948618fa8fa23a0ddc51632b0036dbd08e27696
|
||||
PKG_SOURCE_VERSION:=3663ca4d001508509774115d6797b932f9ed4f69
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/hostmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.9.6
|
||||
PKG_VERSION:=9.9.10
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
|
||||
PKG_SOURCE_VERSION:=5dba542b280495730176da468bc45ed5dcc8c94e
|
||||
PKG_SOURCE_VERSION:=1a842e0a3836f616973e6a92f0b0b6ca82ec39bb
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -88,6 +88,7 @@ define Package/icwmp/install
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/95-set-random-inform-time $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/85-migrate-gw-info $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/999-cwmp-conn-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/vendor_log.sh $(1)/etc/icwmpd/vendor_log.sh
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/firewall.cwmp $(1)/etc/icwmpd/firewall.cwmp
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
|
||||
|
||||
@@ -1,14 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
ZONE_NAME_FILE="/tmp/cwmp_fw_zone"
|
||||
|
||||
#created by the icwmp package
|
||||
log() {
|
||||
echo "${@}"|logger -t firewall.cwmp -p info
|
||||
}
|
||||
|
||||
collect_zone_name() {
|
||||
local name network
|
||||
|
||||
config_get name "${1}" name ""
|
||||
if [ -z "${name}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get network "${1}" network ""
|
||||
for i in ${network}; do
|
||||
var="${i}_zone"
|
||||
echo "${var}=${name}" >> "${ZONE_NAME_FILE}"
|
||||
done
|
||||
}
|
||||
|
||||
load_zone_names() {
|
||||
rm -f "${ZONE_NAME_FILE}"
|
||||
config_load firewall
|
||||
config_foreach collect_zone_name zone
|
||||
}
|
||||
|
||||
get_firewall_zone() {
|
||||
zone="$(uci show firewall|grep network|grep -w "${1}"|cut -d. -f 2)"
|
||||
zone="${zone:-wan}" # defaults to wan zone
|
||||
echo "$zone"
|
||||
if [ ! -f "${ZONE_NAME_FILE}" ]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
|
||||
var="${1}_zone="
|
||||
name="$(cat ${ZONE_NAME_FILE} | grep ${var} | head -n 1 | cut -d'=' -f 2)"
|
||||
echo "${name}"
|
||||
}
|
||||
|
||||
cleanup_upstream_rules() {
|
||||
@@ -169,4 +199,6 @@ configure_connection_req_rules() {
|
||||
fi
|
||||
}
|
||||
|
||||
load_zone_names
|
||||
configure_connection_req_rules "$@"
|
||||
rm -f "${ZONE_NAME_FILE}"
|
||||
|
||||
@@ -16,79 +16,6 @@ log() {
|
||||
echo "${@}"|logger -t cwmp.init -p info
|
||||
}
|
||||
|
||||
regenerate_ssl_link() {
|
||||
local cert_dir
|
||||
|
||||
cert_dir="${1%/}"
|
||||
if [ -f "${cert_dir}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# do not generate the c_rehash if its system default cert path
|
||||
# ca-certificate package already generates c_rehash on compilation
|
||||
[ ! -d "${cert_dir}" ] || [ "${cert_dir}" = "/etc/ssl/certs" ] && return 0
|
||||
|
||||
generate_links() {
|
||||
local file_type="$1"
|
||||
local files="${cert_dir}"/*."${file_type}"
|
||||
for cfile in ${files}; do
|
||||
if [ -f "${cfile}" ]; then
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
if [ ! -f "${cert_dir}/${rehash}.0" ]; then
|
||||
log "Generating c_rehash for ${cfile}=>${rehash}.0"
|
||||
ln -s "${cfile}" "${cert_dir}/${rehash}.0"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
generate_links "pem"
|
||||
}
|
||||
|
||||
enable_dhcp_option43() {
|
||||
local wan="${1}"
|
||||
|
||||
### Ask for DHCP Option 43 only if CWMP is enabled ###
|
||||
local reqopts="$(uci -q get network."${wan}".reqopts)"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
local newreqopts=""
|
||||
local option43_present=0
|
||||
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
43) option43_present=1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ${option43_present} -eq 1 ]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
newreqopts="$reqopts 43"
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
fi
|
||||
}
|
||||
|
||||
set_vendor_id() {
|
||||
local wan="${1}"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
vendorid="$(uci -q get network."${wan}".vendorid)"
|
||||
if [ -z "${vendorid}" ]; then
|
||||
uci -q set network."${wan}".vendorid="dslforum.org"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
elif [[ $vendorid != *"dslforum.org"* ]]; then
|
||||
uci -q set network."${wan}".vendorid="${vendorid},dslforum.org"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_resolvfile() {
|
||||
local time=$1
|
||||
local tm=1
|
||||
@@ -211,28 +138,6 @@ validate_defaults() {
|
||||
}
|
||||
|
||||
boot() {
|
||||
local dhcp_discovery wan_interface skip_dhcp_boot_options
|
||||
|
||||
config_load cwmp
|
||||
config_get wan_interface cpe default_wan_interface "wan"
|
||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
config_get skip_dhcp_boot_options acs skip_dhcp_boot_options "0"
|
||||
|
||||
if [ "${dhcp_discovery}" = "enable" ] || [ "${dhcp_discovery}" = "1" ]; then
|
||||
if [ "${skip_dhcp_boot_options}" -ne 1 ]; then
|
||||
# Set dhcp option 43 if not already configured
|
||||
enable_dhcp_option43 "${wan_interface}"
|
||||
# Set dhcp option 60
|
||||
set_vendor_id "${wan_interface}"
|
||||
fi
|
||||
fi
|
||||
|
||||
config_get ssl_capath acs ssl_capath
|
||||
|
||||
if [ -n "${ssl_capath}" ]; then
|
||||
regenerate_ssl_link "${ssl_capath}"
|
||||
fi
|
||||
|
||||
# Copy backup data so that if it restart latter on, it gets the info
|
||||
copy_cwmp_etc_files_to_varstate
|
||||
mkdir -p /var/run/icwmpd/
|
||||
|
||||
107
icwmp/files/etc/uci-defaults/999-cwmp-conn-config
Normal file
107
icwmp/files/etc/uci-defaults/999-cwmp-conn-config
Normal file
@@ -0,0 +1,107 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t cwmp.defaults -p info
|
||||
}
|
||||
|
||||
set_vendor_id() {
|
||||
local wan="${1}"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
vendorid="$(uci -q get network."${wan}".vendorid)"
|
||||
if [ -z "${vendorid}" ]; then
|
||||
uci -q set network."${wan}".vendorid="dslforum.org"
|
||||
elif [[ $vendorid != *"dslforum.org"* ]]; then
|
||||
uci -q set network."${wan}".vendorid="${vendorid},dslforum.org"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
enable_dhcp_option43() {
|
||||
local wan="${1}"
|
||||
|
||||
local reqopts="$(uci -q get network."${wan}".reqopts)"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
local newreqopts=""
|
||||
local option43_present=0
|
||||
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
43) option43_present=1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ${option43_present} -eq 1 ]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
newreqopts="$reqopts 43"
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
fi
|
||||
}
|
||||
|
||||
regenerate_ssl_link() {
|
||||
local cert_dir
|
||||
|
||||
cert_dir="${1%/}"
|
||||
if [ -f "${cert_dir}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# do not generate the c_rehash if its system default cert path
|
||||
# ca-certificate package already generates c_rehash on compilation
|
||||
[ ! -d "${cert_dir}" ] || [ "${cert_dir}" = "/etc/ssl/certs" ] && return 0
|
||||
|
||||
generate_links() {
|
||||
local file_type="$1"
|
||||
local files="${cert_dir}"/*."${file_type}"
|
||||
for cfile in ${files}; do
|
||||
if [ -f "${cfile}" ]; then
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
if [ ! -f "${cert_dir}/${rehash}.0" ]; then
|
||||
log "Generating c_rehash for ${cfile}=>${rehash}.0"
|
||||
ln -s "${cfile}" "${cert_dir}/${rehash}.0"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
generate_links "pem"
|
||||
}
|
||||
|
||||
configure_dhcp_discovery() {
|
||||
local dhcp_discovery wan_interface skip_dhcp_boot_options
|
||||
|
||||
config_load cwmp
|
||||
config_get wan_interface cpe default_wan_interface "wan"
|
||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
config_get skip_dhcp_boot_options acs skip_dhcp_boot_options "0"
|
||||
|
||||
if [ "${dhcp_discovery}" = "enable" ] || [ "${dhcp_discovery}" = "1" ]; then
|
||||
if [ "${skip_dhcp_boot_options}" -ne 1 ]; then
|
||||
# Set dhcp option 43 if not already configured
|
||||
enable_dhcp_option43 "${wan_interface}"
|
||||
# Set dhcp option 60
|
||||
set_vendor_id "${wan_interface}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
configure_ssl_path() {
|
||||
local ssl_capath
|
||||
|
||||
config_load cwmp
|
||||
config_get ssl_capath acs ssl_capath
|
||||
|
||||
if [ -n "${ssl_capath}" ]; then
|
||||
regenerate_ssl_link "${ssl_capath}"
|
||||
fi
|
||||
}
|
||||
|
||||
configure_dhcp_discovery
|
||||
configure_ssl_path
|
||||
@@ -1,16 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 IOPSYS Software Solutions AB
|
||||
# Copyright (C) 2025 Genexis Sweden AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=8.7.8
|
||||
PKG_VERSION:=8.7.33
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=9c507bfb7f45fad81097262f05dc7cd11760e6b0
|
||||
PKG_SOURCE_VERSION:=cb5b8f76c854b89607cd1750d3a4052ecd71ac9d
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -105,6 +106,7 @@ TARGET_CFLAGS += -DHAS_UBUS
|
||||
|
||||
ifeq ($(CONFIG_IEEE1905_BUILD_TR181_PLUGIN),y)
|
||||
TARGET_CFLAGS += -DBUILD_TR181_PLUGIN
|
||||
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\"
|
||||
endif
|
||||
|
||||
MAKE_FLAGS += \
|
||||
@@ -114,7 +116,7 @@ MAKE_PATH:=src
|
||||
|
||||
|
||||
define Package/ieee1905/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(CP) ./files/etc $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
23
ieee1905/files/datamodel_description.json
Normal file
23
ieee1905/files/datamodel_description.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"Device.IEEE1905.AL.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"{BBF_VENDOR_PREFIX}LocalOnlyMode": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Enable or disable interfaces from ieee1905.",
|
||||
"datatype": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ config al-iface
|
||||
list ifname 'br-lan'
|
||||
list ifname '/eth.*'
|
||||
list ifname '/wl.*'
|
||||
list ifname '/ra.*'
|
||||
list ifname '/wds.*'
|
||||
|
||||
# ap sections are auto-generated/overwritten during onboarding
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/system.sh
|
||||
|
||||
BMAC=$(db -q get hw.board.basemac)
|
||||
BMAC=$(get_mac_label)
|
||||
BMAC=${BMAC//:/}
|
||||
BMAC=${BMAC// /}
|
||||
BMAC=$(printf "%12.12X" $((0x$BMAC)))
|
||||
|
||||
[ "$BMAC" == "" ] && exit 1
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ PKG_NAME:=iopsys-analytics
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=00189cea0a78b7a30dbfdd363b6d8e836437d1bc
|
||||
PKG_SOURCE_VERSION:=25e32ac5a860aec6e53e3449565b71595073e014
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/iopsys-analytics.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -31,8 +31,8 @@ define Package/$(PKG_NAME)
|
||||
+@PACKAGE_COLLECTD_ENCRYPTED_NETWORK \
|
||||
# remote syslog
|
||||
DEPENDS+= \
|
||||
+syslog-ng \
|
||||
+@SYSLOGNG_LOGROTATE \
|
||||
+@PACKAGE_syslog-ng:SYSLOGNG_LOGROTATE \
|
||||
+PACKAGE_fluent-bit:logrotate \
|
||||
|
||||
endef
|
||||
|
||||
@@ -44,7 +44,13 @@ endef
|
||||
Build/Compile=
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(CP) -r $(PKG_BUILD_DIR)/files/* $(1)/
|
||||
$(CP) -r $(PKG_BUILD_DIR)/files/common/* $(1)/
|
||||
ifneq ($(CONFIG_PACKAGE_fluent-bit),)
|
||||
$(CP) -r $(PKG_BUILD_DIR)/files/fluent-bit/* $(1)/
|
||||
endif
|
||||
ifneq ($(CONFIG_PACKAGE_syslog-ng),)
|
||||
$(CP) -r $(PKG_BUILD_DIR)/files/syslog-ng/* $(1)/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -6,13 +6,13 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ipt-trigger
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_VERSION:=1.0.3
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=4f3d4427403e0a9be7653c1b92907ae8ae5f21ae
|
||||
PKG_SOURCE_VERSION:=ac1beae4794f99533b28db7d0e6e80f4c268a3e8
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ipt-trigger.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
55
json-schema-validator/Makefile
Normal file
55
json-schema-validator/Makefile
Normal file
@@ -0,0 +1,55 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=json-schema-validator
|
||||
PKG_VERSION:=2.3.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/pboettch/json-schema-validator.git
|
||||
PKG_SOURCE_VERSION:=$(PKG_VERSION)
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
PKG_BUILD_DEPENDS:=nlohmann-json
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DJSON_VALIDATOR_BUILD_TESTS=OFF \
|
||||
-DJSON_VALIDATOR_BUILD_EXAMPLES=OFF \
|
||||
-DJSON_VALIDATOR_INSTALL=ON \
|
||||
-DJSON_VALIDATOR_SHARED_LIBS=OFF
|
||||
|
||||
define Package/json-schema-validator
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=JSON Schema Validator for nlohmann::json
|
||||
URL:=https://github.com/pboettch/json-schema-validator
|
||||
DEPENDS:=+libstdcpp +nlohmann-json
|
||||
endef
|
||||
|
||||
define Package/json-schema-validator/description
|
||||
A JSON Schema Validator for Modern C++ using nlohmann/json.
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/nlohmann
|
||||
$(CP) $(PKG_BUILD_DIR)/src/nlohmann/json-schema.hpp $(1)/usr/include/nlohmann/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libnlohmann_json_schema_validator*.a $(1)/usr/lib/ 2>/dev/null || true
|
||||
$(CP) $(PKG_BUILD_DIR)/libnlohmann_json_schema_validator*.so* $(1)/usr/lib/ 2>/dev/null || true
|
||||
endef
|
||||
|
||||
define Package/json-schema-validator/install
|
||||
true
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,json-schema-validator))
|
||||
44
jsonval/Makefile
Normal file
44
jsonval/Makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=jsonval
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/jsonval
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Command-line JSON Schema Validator
|
||||
DEPENDS:=+nlohmann-json +json-schema-validator +libstdcpp
|
||||
endef
|
||||
|
||||
define Package/jsonval/description
|
||||
A small CLI tool to validate JSON files against a schema using json-schema-validator and nlohmann/json.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
cp -r ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(TARGET_CXX) \
|
||||
$(TARGET_CXXFLAGS) -std=c++17 \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/nlohmann \
|
||||
-L$(STAGING_DIR)/usr/lib \
|
||||
$(PKG_BUILD_DIR)/main.cpp \
|
||||
-o $(PKG_BUILD_DIR)/jsonval \
|
||||
-lnlohmann_json_schema_validator
|
||||
endef
|
||||
|
||||
define Package/jsonval/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/jsonval $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,jsonval))
|
||||
64
jsonval/src/main.cpp
Normal file
64
jsonval/src/main.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <nlohmann/json-schema.hpp>
|
||||
|
||||
using nlohmann::json;
|
||||
using nlohmann::json_schema::json_validator;
|
||||
using namespace std;
|
||||
|
||||
void print_usage(const string& prog_name) {
|
||||
cerr << "Usage: " << prog_name << " -s <schema.json> -j <data.json>" << endl;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
string schema_path, data_path;
|
||||
|
||||
// Simple argument parsing
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
string arg = argv[i];
|
||||
if ((arg == "-s" || arg == "--schema") && i + 1 < argc) {
|
||||
schema_path = argv[++i];
|
||||
} else if ((arg == "-j" || arg == "--json") && i + 1 < argc) {
|
||||
data_path = argv[++i];
|
||||
} else {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (schema_path.empty() || data_path.empty()) {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ifstream schema_file(schema_path);
|
||||
ifstream data_file(data_path);
|
||||
|
||||
if (!schema_file.is_open() || !data_file.is_open()) {
|
||||
cerr << "Error: Could not open one or both files." << endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
json schema, document;
|
||||
try {
|
||||
schema_file >> schema;
|
||||
data_file >> document;
|
||||
} catch (const json::parse_error& e) {
|
||||
cerr << "Parse error: " << e.what() << endl;
|
||||
return 3;
|
||||
}
|
||||
|
||||
try {
|
||||
json_validator validator;
|
||||
validator.set_root_schema(schema);
|
||||
validator.validate(document);
|
||||
cout << "Valid" << endl;
|
||||
} catch (const std::exception& e) {
|
||||
cerr << "Validation failed: " << e.what() << endl;
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libdsl
|
||||
PKG_VERSION:=7.2.100
|
||||
PKG_VERSION:=7.3.0
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=20875ec79fcc7c546c2f1253c867d6afbc8bff75
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/libdsl.git
|
||||
PKG_SOURCE_VERSION:=2a7a49fac35c3d8078ffe051594c0425d355cacd
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -37,6 +37,9 @@ else ifeq ($(CONFIG_TARGET_x86),y)
|
||||
else ifeq ($(CONFIG_TARGET_armvirt),y)
|
||||
TARGET_PLATFORM=TEST
|
||||
TARGET_CFLAGS +=-DIOPSYS_TEST
|
||||
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_PLATFORM=AIROHA
|
||||
TARGET_CFLAGS +=-DIOPSYS_AIROHA
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
@@ -57,7 +60,7 @@ define Package/libdsl
|
||||
SUBMENU:=IOPSYS HAL libs
|
||||
MENU:=1
|
||||
TITLE:= xDSL library (libdsl)
|
||||
DEPENDS+=TARGET_brcmbca:bcm963xx-bsp
|
||||
DEPENDS+=TARGET_brcmbca:bcm963xx-bsp +TARGET_airoha:libeasy
|
||||
endef
|
||||
|
||||
define Package/libdsl/description
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-airoha
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.3
|
||||
PKG_VERSION:=1.1.7
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@@ -17,7 +17,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=f4ffa38b77e20f9e2a6b6ffd5b2bf83cddb6bffc
|
||||
PKG_SOURCE_VERSION:=3a30086a68a3409f0396acb01380f91daabf7a2f
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libwifi
|
||||
PKG_VERSION:=7.12.10
|
||||
PKG_VERSION:=7.13.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=2bd3a37cc5c14af93d0af1643610285d8d382fba
|
||||
PKG_SOURCE_VERSION:=65a7cd643c07e3f0a11d5b20225d4d87b8646513
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libwifi.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=logmngr
|
||||
PKG_VERSION:=1.0.15
|
||||
PKG_VERSION:=1.0.17
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/system/logmngr.git
|
||||
PKG_SOURCE_VERSION:=1561b71a2225af737db9f091204247ab4e141abb
|
||||
PKG_SOURCE_VERSION:=ad2636c642d56967e78c0c84bf82cb0e2b6311f2
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -29,7 +29,6 @@ define Package/logmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Logging Manager
|
||||
DEPENDS:=+LOGMNGR_BACKEND_FLUENTBIT:fluent-bit
|
||||
DEPENDS+=+@LOGMNGR_BACKEND_FLUENTBIT:BUSYBOX_CONFIG_KLOGD
|
||||
DEPENDS+=+LOGMNGR_BACKEND_SYSLOG_NG:syslog-ng
|
||||
DEPENDS+=+LOGMNGR_LOGROTATE:logrotate
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
@@ -61,8 +60,6 @@ define Package/logmngr/install
|
||||
$(INSTALL_DIR) $(1)/lib/logmngr
|
||||
ifeq ($(CONFIG_LOGMNGR_BACKEND_FLUENTBIT),y)
|
||||
$(INSTALL_DATA) ./files/lib/logmngr/fluent-bit.sh $(1)/lib/logmngr/
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) ./files/logmngr-klogd $(1)/usr/libexec/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/logread $(1)/sbin/
|
||||
endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
CONF_FILE=/etc/fluent-bit/fluent-bit.conf
|
||||
TMP_CONF_FILE=/tmp/fluent-bit/fluent-bit.conf
|
||||
CONF_DIR=/etc/fluent-bit/conf.d
|
||||
FLUENT_BIT_CONF_DIR=/etc/fluent-bit/conf.d
|
||||
|
||||
append_conf() {
|
||||
echo "$*" >> ${TMP_CONF_FILE}
|
||||
@@ -15,12 +15,12 @@ create_config_file() {
|
||||
mkdir -p /tmp/fluent-bit
|
||||
rm -f ${TMP_CONF_FILE}
|
||||
touch ${TMP_CONF_FILE}
|
||||
# include all files placed in CONF_DIR directory
|
||||
# include all files placed in FLUENT_BIT_CONF_DIR directory
|
||||
# fluent-bit does not support using directory in include directive
|
||||
# also, if no file is found then fluent-bit aborts
|
||||
# so only add include if any file is present in the CONF_DIR
|
||||
if [ -d "$CONF_DIR" ] && [ "$(ls -A "$CONF_DIR")" ]; then
|
||||
echo "@INCLUDE ${CONF_DIR}/*" >> ${TMP_CONF_FILE}
|
||||
# so only add include if any file is present in the FLUENT_BIT_CONF_DIR
|
||||
if [ -d "$FLUENT_BIT_CONF_DIR" ] && [ "$(ls -A "$FLUENT_BIT_CONF_DIR")" ]; then
|
||||
echo "@INCLUDE ${FLUENT_BIT_CONF_DIR}/*" >> ${TMP_CONF_FILE}
|
||||
fi
|
||||
echo "" >> ${TMP_CONF_FILE}
|
||||
}
|
||||
@@ -36,6 +36,20 @@ create_service_section() {
|
||||
echo " parsers_file /etc/fluent-bit/parsers.conf" >> ${TMP_CONF_FILE}
|
||||
echo " hot_reload on" >> ${TMP_CONF_FILE}
|
||||
echo "" >> ${TMP_CONF_FILE}
|
||||
|
||||
# Generate default input for kmsg
|
||||
echo "[INPUT]" >> ${TMP_CONF_FILE}
|
||||
echo " name kmsg" >> ${TMP_CONF_FILE}
|
||||
echo " Tag KMSG" >> ${TMP_CONF_FILE}
|
||||
echo "" >> ${TMP_CONF_FILE}
|
||||
|
||||
echo "[OUTPUT]" >> ${TMP_CONF_FILE}
|
||||
echo " name file" >> ${TMP_CONF_FILE}
|
||||
echo " match KMSG" >> ${TMP_CONF_FILE}
|
||||
echo " file /var/log/messages" >> ${TMP_CONF_FILE}
|
||||
echo " format template" >> ${TMP_CONF_FILE}
|
||||
echo " template {syslog_ts} {hostname} kernel: {msg}" >> ${TMP_CONF_FILE}
|
||||
echo "" >> ${TMP_CONF_FILE}
|
||||
}
|
||||
|
||||
create_input_section() {
|
||||
@@ -340,9 +354,4 @@ logmngr_init() {
|
||||
fi
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
|
||||
procd_open_instance klogd
|
||||
procd_set_param command /usr/libexec/logmngr-klogd
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
|
||||
LOGROTATE_FILE=/etc/logrotate.conf
|
||||
LOGROTATE_TMP_FILE=/tmp/logrotate/logrotate.conf
|
||||
CONF_DIR=/etc/logrotate.d
|
||||
|
||||
create_logrotate_file() {
|
||||
mkdir -p /tmp/logrotate
|
||||
rm -f ${LOGROTATE_TMP_FILE}
|
||||
touch ${LOGROTATE_TMP_FILE}
|
||||
echo -e "include ${CONF_DIR}" >> ${LOGROTATE_TMP_FILE}
|
||||
echo -e "" >> ${LOGROTATE_TMP_FILE}
|
||||
}
|
||||
|
||||
handle_logrotate() {
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
until [ -S /dev/log ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exec /sbin/klogd -n
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=6.3.5.6
|
||||
PKG_VERSION:=6.3.6.7
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=36caa3955e89ffc504710873a83901b20c717320
|
||||
PKG_SOURCE_VERSION:=f611be0c05e3f4fb3d35a5a1ad51f5a4ad6406ca
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
@@ -61,6 +61,14 @@ remove_from_bridge() {
|
||||
[ -n "$ifname" ] && brctl delif ${al_bridge} ${ifname}
|
||||
}
|
||||
|
||||
get_network_id() {
|
||||
local ifname=$1
|
||||
|
||||
[ -n "$ifname" ] || return
|
||||
network_id=$(wpa_cli -i $ifname list_n|tail -n 1 | awk '{print $1}')
|
||||
echo ${network_id}
|
||||
}
|
||||
|
||||
update_bstas() {
|
||||
section="$1"
|
||||
action="$2"
|
||||
@@ -68,14 +76,15 @@ update_bstas() {
|
||||
config_get ifname "$section" ifname
|
||||
config_get_bool enabled "$section" enabled 0
|
||||
|
||||
network_id=$(get_network_id $ifname)
|
||||
if [ "$action" = "down" ]; then
|
||||
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" disable_network $network_id > /dev/null 2>&1
|
||||
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
elif [ "$action" = "up" ]; then
|
||||
[ "$enabled" -eq 0 ] && return
|
||||
wpa_cli -i "$ifname" reconnect > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" enable_network 0 > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" enable_network $network_id > /dev/null 2>&1
|
||||
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -259,5 +259,6 @@ map_genconf () {
|
||||
}
|
||||
fi
|
||||
uci -q commit mapcontroller
|
||||
ubus send bbfdm.wifidmd.reload
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=6.3.0.18
|
||||
PKG_VERSION:=6.4.0.12
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=b76714a5254756a66f2a8663b70d07dbe7818aaa
|
||||
PKG_SOURCE_VERSION:=ae10f447f8d83ed6b98d2b82da2dda64be2c3183
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@genexis.eu>
|
||||
|
||||
LOCAL_DEV=0
|
||||
@@ -74,12 +74,29 @@ ifeq ($(CONFIG_CONTROLLER_PROPAGATE_PROBE_REQ),y)
|
||||
TARGET_CFLAGS += -DPROPAGATE_PROBE_REQ
|
||||
endif
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/map-controller
|
||||
$(INSTALL_DIR) $(1)/usr/include/map-controller/utils
|
||||
$(CP) $(PKG_BUILD_DIR)/src/wifi_dataelements.h $(1)/usr/include/map-controller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/cntlr_commands_impl.h $(1)/usr/include/map-controller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/cntlr_commands.h $(1)/usr/include/map-controller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/cntlr_apis.h $(1)/usr/include/map-controller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/wifi_opclass.h $(1)/usr/include/map-controller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/steer_module.h $(1)/usr/include/map-controller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/timer.h $(1)/usr/include/map-controller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/timer_impl.h $(1)/usr/include/map-controller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/utils/debug.h $(1)/usr/include/map-controller/utils
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/src/libcntlr-apis.so $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/map-controller/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mapcontroller $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/mapcontroller
|
||||
$(CP) $(PKG_BUILD_DIR)/src/libcntlr-apis.so $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/src/plugins/steer/rcpi/rcpi.so $(1)/usr/lib/mapcontroller/rcpi.so
|
||||
endef
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@ config controller 'controller'
|
||||
option enable_ts '0'
|
||||
option primary_vid '1'
|
||||
option primary_pcp '0'
|
||||
option allow_bgdfs '0'
|
||||
option stale_sta_timeout '30d'
|
||||
option channel_plan '0'
|
||||
option de_collect_interval '60'
|
||||
|
||||
config sta_steering
|
||||
@@ -26,6 +24,10 @@ config sta_steering
|
||||
option plugins_policy 'any'
|
||||
list plugins 'rcpi'
|
||||
|
||||
config channel_plan
|
||||
option preclear_dfs '0'
|
||||
option acs '0'
|
||||
|
||||
###################
|
||||
# Default AP sections credentials will by updated
|
||||
# by uci-defaults script 99-mapcntlr
|
||||
|
||||
@@ -71,7 +71,7 @@ validate_ap_section() {
|
||||
'encryption:or("sae", "sae+aes", "psk2",
|
||||
"psk2+aes", "sae-mixed", "sae-mixed+aes",
|
||||
"none", "psk-mixed", "psk-mixed+aes",
|
||||
"psk", "psk+aes")' \
|
||||
"psk", "psk+aes", "wpa", "wpa2", "wpa-mixed")' \
|
||||
'key:string' \
|
||||
'vid:range(1,65535):1' \
|
||||
'type:or("backhaul", "fronthaul", "combined")' \
|
||||
|
||||
11
map-plugins/Config.in
Normal file
11
map-plugins/Config.in
Normal file
@@ -0,0 +1,11 @@
|
||||
if (PACKAGE_map-plugins)
|
||||
|
||||
menu "Options"
|
||||
|
||||
config STEER_RATE_PLUGIN
|
||||
bool "STA steering based on estimated throughput of target-AP"
|
||||
default PACKAGE_map-plugins-steer-rate
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
||||
68
map-plugins/Makefile
Normal file
68
map-plugins/Makefile
Normal file
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Copyright (C) 2025 Genexis Sweden AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-plugins
|
||||
PKG_VERSION:=0.0.4
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=74bf151851112ecee731d447af016c8dc668adcf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/map-plugins.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=PROPRIETARY GENEXIS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_CONFIG_DEPENDS := CONFIG_PACKAGE_mapcontroller
|
||||
PKG_BUILD_DEPENDS := map-controller
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
include $(wildcard plugins/*.mk)
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Wall"
|
||||
|
||||
plugins := \
|
||||
$(if $(CONFIG_PACKAGE_map-plugins-steer-rate),steer-rate)
|
||||
|
||||
ppkg:=$(patsubst plugins/%.mk,map-plugins-%,$(wildcard plugins/*.mk))
|
||||
|
||||
define Package/map-plugins/Default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Multi-AP value added services
|
||||
endef
|
||||
|
||||
define Package/map-plugins/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/map-plugins
|
||||
$(call Package/map-plugins/Default)
|
||||
TITLE:=Multi-AP plugins modules
|
||||
DEPENDS+=+libeasy +libwifiutils +map-controller
|
||||
endef
|
||||
|
||||
define Package/map-plugins/description
|
||||
Provides extra Multi-AP services viz. steering, channel-planning etc.
|
||||
endef
|
||||
|
||||
define Package/map-plugins/install
|
||||
:
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(foreach p,$(ppkg),$(call Build/Compile/$(p),$(1)))
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,map-plugins))
|
||||
$(eval $(foreach p,$(ppkg),$(call BuildPackage,$(p))))
|
||||
20
map-plugins/plugins/steer-rate.mk
Normal file
20
map-plugins/plugins/steer-rate.mk
Normal file
@@ -0,0 +1,20 @@
|
||||
define Package/map-plugins-steer-rate
|
||||
$(call Package/map-plugins/Default)
|
||||
TITLE:=STA steering based on estimated throughput of target-AP
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +map-controller \
|
||||
+map-plugins
|
||||
endef
|
||||
|
||||
define Package/map-plugins-steer-rate/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/mapcontroller
|
||||
$(CP) $(PKG_BUILD_DIR)/steer/rate/rate.so $(1)/usr/lib/mapcontroller/rate.so
|
||||
endef
|
||||
|
||||
define Build/Compile/map-plugins-steer-rate
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/steer/rate \
|
||||
CC="$(TARGET_CC)" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)"
|
||||
endef
|
||||
@@ -65,12 +65,69 @@ generate_igmp_proxy_config(){
|
||||
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
|
||||
}
|
||||
|
||||
generate_mld_snooping_config(){
|
||||
local u_itf="$1"
|
||||
|
||||
uci add mcast snooping
|
||||
uci rename mcast.@snooping[-1]="mc_snooping_MLD"
|
||||
uci set mcast.@snooping[-1].enable="1"
|
||||
uci set mcast.@snooping[-1].proto="mld"
|
||||
uci set mcast.@snooping[-1].version="2"
|
||||
uci set mcast.@snooping[-1].robustness="2"
|
||||
uci set mcast.@snooping[-1].query_interval="125"
|
||||
uci set mcast.@snooping[-1].query_response_interval="100"
|
||||
uci set mcast.@snooping[-1].last_member_query_interval="10"
|
||||
uci set mcast.@snooping[-1].fast_leave="1"
|
||||
uci set mcast.@snooping[-1].snooping_mode="2"
|
||||
uci set mcast.@snooping[-1].interface="$u_itf"
|
||||
}
|
||||
|
||||
generate_igmp_snooping_config(){
|
||||
local u_itf="$1"
|
||||
|
||||
uci add mcast snooping
|
||||
uci rename mcast.@snooping[-1]="igmp_snooping_1"
|
||||
uci set mcast.@snooping[-1].enable="1"
|
||||
uci set mcast.@snooping[-1].proto="igmp"
|
||||
uci set mcast.@snooping[-1].version="2"
|
||||
uci set mcast.@snooping[-1].robustness="2"
|
||||
uci set mcast.@snooping[-1].query_interval="125"
|
||||
uci set mcast.@snooping[-1].query_response_interval="100"
|
||||
uci set mcast.@snooping[-1].last_member_query_interval="10"
|
||||
uci set mcast.@snooping[-1].fast_leave="1"
|
||||
uci set mcast.@snooping[-1].snooping_mode="2"
|
||||
uci set mcast.@snooping[-1].interface="$u_itf"
|
||||
|
||||
uci add_list mcast.@snooping[-1].filter="239.0.0.0/8"
|
||||
}
|
||||
|
||||
check_wan_bridge() {
|
||||
local config="$1"
|
||||
local wan_device="$2"
|
||||
local name type
|
||||
|
||||
[ $((is_wan_bridge)) -ne 0 ] && return
|
||||
|
||||
config_get type "$config" type
|
||||
config_get name "$config" name
|
||||
|
||||
[ "$type" = "bridge" -a "$wan_device" = "$name" ] && is_wan_bridge=1
|
||||
}
|
||||
|
||||
generate_mcast_config(){
|
||||
local up_itf="$(uci -q get network.wan.device)"
|
||||
local is_wan_bridge=0
|
||||
|
||||
up_itf="$(uci -q get network.wan.device)"
|
||||
config_load network
|
||||
config_foreach check_wan_bridge device "$up_itf"
|
||||
|
||||
generate_igmp_proxy_config "$up_itf"
|
||||
generate_mld_proxy_config "$up_itf"
|
||||
if [ $((is_wan_bridge)) -eq 0 ]; then
|
||||
generate_igmp_proxy_config "$up_itf"
|
||||
generate_mld_proxy_config "$up_itf"
|
||||
else
|
||||
generate_igmp_snooping_config "$up_itf"
|
||||
generate_mld_snooping_config "$up_itf"
|
||||
fi
|
||||
}
|
||||
|
||||
interfaces_ok(){
|
||||
|
||||
@@ -1,2 +1,140 @@
|
||||
# Forward multicast packets from wan to lan
|
||||
iptables -w -t filter -A zone_wan_forward -p udp -d 224.0.0.0/240.0.0.0 -m comment --comment "!fw3: Allow-Multicast-UDP" -j zone_lan_dest_ACCEPT
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
ZONE_NAME_FILE="/tmp/mcast_fw_zone"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t firewall.mcast -p info
|
||||
}
|
||||
|
||||
collect_zone_name() {
|
||||
local name network
|
||||
|
||||
config_get name "${1}" name ""
|
||||
if [ -z "${name}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get network "${1}" network ""
|
||||
for i in ${network}; do
|
||||
var="${i}_zone"
|
||||
echo "${var}=${name}" >> "${ZONE_NAME_FILE}"
|
||||
done
|
||||
}
|
||||
|
||||
load_zone_names() {
|
||||
rm -f "${ZONE_NAME_FILE}"
|
||||
config_load firewall
|
||||
config_foreach collect_zone_name zone
|
||||
}
|
||||
|
||||
get_firewall_zone() {
|
||||
if [ ! -f "${ZONE_NAME_FILE}" ]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
|
||||
var="${1}_zone="
|
||||
name="$(cat ${ZONE_NAME_FILE} | grep ${var} | head -n 1 | cut -d'=' -f 2)"
|
||||
|
||||
echo "${name}"
|
||||
}
|
||||
|
||||
# Get interface name for a device (e.g., br-lan -> lan)
|
||||
find_interface_for_device() {
|
||||
local dev="${1}"
|
||||
local intf=""
|
||||
local intf_dump idx
|
||||
|
||||
if [ -z "${dev}" ]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
|
||||
intf_dump="$(ubus -t 5 call network.interface dump)"
|
||||
if [ -z "${intf_dump}" ]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
|
||||
json_load "${intf_dump}"
|
||||
json_select interface
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
|
||||
idx=1
|
||||
while json_is_a ${idx} object; do
|
||||
json_select ${idx}
|
||||
if [ "$?" -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
json_get_var device device
|
||||
if [ "${device}" = "${dev}" ]; then
|
||||
json_get_var intf interface
|
||||
break
|
||||
fi
|
||||
|
||||
idx=$(( idx + 1 ))
|
||||
json_select ..
|
||||
done
|
||||
|
||||
echo "${intf}"
|
||||
}
|
||||
|
||||
# Setup iptables rule to allow multicast from upstream to downstream
|
||||
setup_multicast_rule() {
|
||||
local upstream_dev="$1"
|
||||
local downstream_dev="$2"
|
||||
local upstream_zone downstream_zone
|
||||
local upstream_iface downstream_iface
|
||||
|
||||
upstream_iface=$(find_interface_for_device "$upstream_dev")
|
||||
downstream_iface=$(find_interface_for_device "$downstream_dev")
|
||||
|
||||
[ -z "$upstream_iface" ] || [ -z "$downstream_iface" ] && {
|
||||
log "Failed to map devices to interfaces"
|
||||
return
|
||||
}
|
||||
|
||||
upstream_zone=$(get_firewall_zone "$upstream_iface")
|
||||
downstream_zone=$(get_firewall_zone "$downstream_iface")
|
||||
|
||||
[ -z "$upstream_zone" ] || [ -z "$downstream_zone" ] && {
|
||||
log "Failed to map interfaces to zones"
|
||||
return
|
||||
}
|
||||
|
||||
iptables -w -t filter -A zone_${upstream_zone}_forward -p udp \
|
||||
-d 224.0.0.0/240.0.0.0 \
|
||||
-m comment --comment "!fw3: Allow-Multicast-UDP" \
|
||||
-j zone_${downstream_zone}_dest_ACCEPT
|
||||
}
|
||||
|
||||
apply_mcast_rule() {
|
||||
local cfg="$1"
|
||||
local up down proto
|
||||
|
||||
config_get proto "$cfg" proto
|
||||
[ "$proto" = "igmp" ] || return
|
||||
|
||||
config_get up "$cfg" upstream_interface
|
||||
config_get down "$cfg" downstream_interface
|
||||
|
||||
[ -n "$up" ] && [ -n "$down" ] && setup_multicast_rule "$up" "$down"
|
||||
}
|
||||
|
||||
add_multicast_rules() {
|
||||
config_load mcast
|
||||
config_foreach apply_mcast_rule proxy
|
||||
}
|
||||
|
||||
load_zone_names
|
||||
|
||||
add_multicast_rules
|
||||
|
||||
rm -f "${ZONE_NAME_FILE}"
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netmngr
|
||||
PKG_VERSION:=1.1.6
|
||||
PKG_VERSION:=1.1.8
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/netmngr.git
|
||||
PKG_SOURCE_VERSION:=f1422e4de76990f7037ca265431d5f1031621c93
|
||||
PKG_SOURCE_VERSION:=6310f32b80f8abeccbf99ad55ce88792b19342d6
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netmode
|
||||
PKG_VERSION:=1.1.2
|
||||
PKG_VERSION:=1.1.6
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
"name": "mode"
|
||||
}
|
||||
},
|
||||
"linker_obj": "Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.[Name==@key]."
|
||||
"linker_obj": "Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.*.Name"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -207,6 +207,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"Type": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"description": "Datatype for this argument",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci_sec",
|
||||
"data": "@Parent",
|
||||
"key": "type"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Description": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
|
||||
127
netmode/files/etc/netmodes/bridged/scripts/10-bridged
Normal file
127
netmode/files/etc/netmodes/bridged/scripts/10-bridged
Normal file
@@ -0,0 +1,127 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
source "/etc/device_info"
|
||||
|
||||
l2_mcast_config() {
|
||||
# configure L2 mcast config for snooping
|
||||
logger -s -p user.info -t "netmode" "Generating L2 mcast configuration"
|
||||
|
||||
# remove proxy sections
|
||||
uci -q delete mcast.igmp_proxy_1
|
||||
uci -q delete mcast.mc_proxy_MLD
|
||||
|
||||
# add igmp_snooping section
|
||||
uci -q set mcast.igmp_snooping_1=snooping
|
||||
uci -q set mcast.igmp_snooping_1.enable='1'
|
||||
uci -q set mcast.igmp_snooping_1.proto='igmp'
|
||||
uci -q set mcast.igmp_snooping_1.version='2'
|
||||
uci -q set mcast.igmp_snooping_1.robustness='2'
|
||||
uci -q set mcast.igmp_snooping_1.query_interval='125'
|
||||
uci -q set mcast.igmp_snooping_1.query_response_interval='100'
|
||||
uci -q set mcast.igmp_snooping_1.last_member_query_interval='10'
|
||||
uci -q set mcast.igmp_snooping_1.fast_leave='1'
|
||||
uci -q set mcast.igmp_snooping_1.snooping_mode='2'
|
||||
uci -q set mcast.igmp_snooping_1.interface='br-lan'
|
||||
uci -q add_list mcast.igmp_snooping_1.filter='239.0.0.0/8'
|
||||
|
||||
# add mld_snooping section
|
||||
uci -q set mcast.mld_snooping_1=snooping
|
||||
uci -q set mcast.mld_snooping_1.enable='1'
|
||||
uci -q set mcast.mld_snooping_1.proto='mld'
|
||||
uci -q set mcast.mld_snooping_1.version='2'
|
||||
uci -q set mcast.mld_snooping_1.robustness='2'
|
||||
uci -q set mcast.mld_snooping_1.query_interval='125'
|
||||
uci -q set mcast.mld_snooping_1.query_response_interval='100'
|
||||
uci -q set mcast.mld_snooping_1.last_member_query_interval='10'
|
||||
uci -q set mcast.mld_snooping_1.fast_leave='1'
|
||||
uci -q set mcast.mld_snooping_1.snooping_mode='2'
|
||||
uci -q set mcast.mld_snooping_1.interface='br-lan'
|
||||
|
||||
uci -q commit mcast
|
||||
}
|
||||
|
||||
l2_network_config() {
|
||||
logger -s -p user.info -t "netmode" "Generating L2 network configuration"
|
||||
|
||||
# Configure L2 Network Mode
|
||||
uci -q set network.lan=interface
|
||||
uci -q set network.lan.proto='dhcp'
|
||||
uci -q set network.lan.vendorid="$(uci -q get network.wan.vendorid)"
|
||||
uci -q set network.lan.clientid="$(uci -q get network.wan.clientid)"
|
||||
uci -q set network.lan.reqopts="$(uci -q get network.wan.reqopts)"
|
||||
uci -q set network.lan.sendopts="$(uci -q get network.wan.sendopts)"
|
||||
uci -q set network.lan.device='br-lan'
|
||||
uci -q set network.lan.force_link='1'
|
||||
|
||||
uci -q set network.lan6=interface
|
||||
uci -q set network.lan6.proto='dhcpv6'
|
||||
uci -q set network.lan6.device='@lan'
|
||||
uci -q set network.lan6.reqprefix='no'
|
||||
|
||||
uci -q set network.wan.disabled='1'
|
||||
uci -q set network.wan6.disabled='1'
|
||||
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
|
||||
add_port_to_br_lan() {
|
||||
port="$1"
|
||||
[ -n "$port" -a -d /sys/class/net/$port ] || continue
|
||||
uci add_list network.br_lan.ports="$port"
|
||||
}
|
||||
|
||||
if [ -f /etc/board.json ]; then
|
||||
json_load_file /etc/board.json
|
||||
json_select network
|
||||
json_select lan
|
||||
if json_is_a ports array; then
|
||||
json_for_each_item add_port_to_br_lan ports
|
||||
else
|
||||
json_get_var device device
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
uci -q commit network
|
||||
|
||||
# Disable DHCP Server
|
||||
uci -q set dhcp.lan.ignore=1
|
||||
uci -q commit dhcp
|
||||
/etc/init.d/odhcpd disable
|
||||
|
||||
# Disable SSDPD
|
||||
uci -q set ssdpd.ssdp.enabled="0"
|
||||
uci -q commit ssdpd
|
||||
|
||||
# Update CWMP Agent WAN Interface
|
||||
uci -q set cwmp.cpe.default_wan_interface="lan"
|
||||
uci -q commit cwmp
|
||||
|
||||
# Update gateway WAN Interface
|
||||
uci -q set gateway.global.wan_interface="lan"
|
||||
uci -q commit gateway
|
||||
|
||||
# disable firewall
|
||||
uci -q set firewall.globals.enabled="0"
|
||||
uci -q commit firewall
|
||||
}
|
||||
|
||||
l2_network_config
|
||||
l2_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd stop 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
108
netmode/files/etc/netmodes/routed-dhcp/scripts/10-routed-dhcp
Normal file
108
netmode/files/etc/netmodes/routed-dhcp/scripts/10-routed-dhcp
Normal file
@@ -0,0 +1,108 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
source "/etc/device_info"
|
||||
|
||||
l3_mcast_config() {
|
||||
# configure L3 mcast config
|
||||
logger -s -p user.info -t "netmode" "Generating L3 mcast configuration"
|
||||
|
||||
rm -f /etc/config/mcast
|
||||
sh /rom/etc/uci-defaults/61-mcast_config_generate
|
||||
uci -q commit mcast
|
||||
}
|
||||
|
||||
l3_network_config() {
|
||||
logger -s -p user.info -t "netmode" "Generating L3 network configuration"
|
||||
|
||||
# Configure L3 Network Mode
|
||||
uci -q set network.lan=interface
|
||||
uci -q set network.lan.device='br-lan'
|
||||
uci -q set network.lan.proto='static'
|
||||
uci -q set network.lan.ipaddr='192.168.1.1'
|
||||
uci -q set network.lan.netmask='255.255.255.0'
|
||||
uci -q set network.lan.ip6assign='60'
|
||||
uci -q delete network.lan.vendorid
|
||||
uci -q delete network.lan.clientid
|
||||
uci -q delete network.lan.reqopts
|
||||
uci -q delete network.lan.sendopts
|
||||
|
||||
uci -q delete network.lan6
|
||||
|
||||
uci -q set network.wan=interface
|
||||
uci -q set network.wan.proto='dhcp'
|
||||
uci -q delete network.wan.disabled
|
||||
uci -q delete network.wan.username
|
||||
uci -q delete network.wan.password
|
||||
|
||||
uci -q set network.wan6=interface
|
||||
uci -q set network.wan6.proto='dhcpv6'
|
||||
uci -q delete network.wan6.disabled
|
||||
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
|
||||
add_port_to_br_lan() {
|
||||
port="$1"
|
||||
[ -n "$port" -a -d /sys/class/net/$port ] || continue
|
||||
uci add_list network.br_lan.ports="$port"
|
||||
}
|
||||
|
||||
if [ -f /etc/board.json ]; then
|
||||
json_load_file /etc/board.json
|
||||
json_select network
|
||||
json_select lan
|
||||
if json_is_a ports array; then
|
||||
json_for_each_item add_port_to_br_lan ports
|
||||
else
|
||||
json_get_var device device
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
if [ -n "$device" ]; then
|
||||
uci -q set network.wan.device="$device"
|
||||
uci -q set network.wan6.device="$device"
|
||||
fi
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
uci -q commit network
|
||||
|
||||
# Enable DHCP Server
|
||||
uci -q set dhcp.lan.ignore=0
|
||||
uci -q set dhcp.wan.ignore=1
|
||||
uci -q commit dhcp
|
||||
/etc/init.d/odhcpd enable
|
||||
|
||||
# Enable SSDPD
|
||||
uci -q set ssdpd.ssdp.enabled="1"
|
||||
uci -q commit ssdpd
|
||||
|
||||
# Update CWMP Agent WAN Interface
|
||||
uci -q set cwmp.cpe.default_wan_interface="wan"
|
||||
uci -q commit cwmp
|
||||
|
||||
# Update gateway WAN Interface
|
||||
uci -q set gateway.global.wan_interface="wan"
|
||||
uci -q commit gateway
|
||||
|
||||
# Enable firewall
|
||||
uci -q set firewall.globals.enabled="1"
|
||||
uci -q commit firewall
|
||||
}
|
||||
|
||||
l3_network_config
|
||||
l3_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd restart 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
106
netmode/files/etc/netmodes/routed-pppoe/scripts/10-routed-pppoe
Normal file
106
netmode/files/etc/netmodes/routed-pppoe/scripts/10-routed-pppoe
Normal file
@@ -0,0 +1,106 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
source "/etc/device_info"
|
||||
|
||||
l3_mcast_config() {
|
||||
# configure L3 mcast config
|
||||
logger -s -p user.info -t "netmode" "Generating L3 mcast configuration"
|
||||
|
||||
rm -f /etc/config/mcast
|
||||
sh /rom/etc/uci-defaults/61-mcast_config_generate
|
||||
uci -q commit mcast
|
||||
}
|
||||
|
||||
l3_network_pppoe_config() {
|
||||
logger -s -p user.info -t "netmode" "Generating L3 network configuration"
|
||||
|
||||
# Configure L3 Network Mode
|
||||
uci -q set network.lan=interface
|
||||
uci -q set network.lan.device='br-lan'
|
||||
uci -q set network.lan.proto='static'
|
||||
uci -q set network.lan.ipaddr='192.168.1.1'
|
||||
uci -q set network.lan.netmask='255.255.255.0'
|
||||
uci -q set network.lan.ip6assign='60'
|
||||
uci -q delete network.lan.vendorid
|
||||
uci -q delete network.lan.clientid
|
||||
uci -q delete network.lan.reqopts
|
||||
uci -q delete network.lan.sendopts
|
||||
|
||||
uci -q delete network.lan6
|
||||
|
||||
uci -q set network.wan=interface
|
||||
uci -q set network.wan.proto='pppoe'
|
||||
uci -q set network.wan.username="$NETMODE_username"
|
||||
uci -q set network.wan.password="$NETMODE_password"
|
||||
uci -q delete network.wan.disabled
|
||||
|
||||
uci -q set network.wan6.disabled='1'
|
||||
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
|
||||
add_port_to_br_lan() {
|
||||
port="$1"
|
||||
[ -n "$port" -a -d /sys/class/net/$port ] || continue
|
||||
uci add_list network.br_lan.ports="$port"
|
||||
}
|
||||
|
||||
if [ -f /etc/board.json ]; then
|
||||
json_load_file /etc/board.json
|
||||
json_select network
|
||||
json_select lan
|
||||
if json_is_a ports array; then
|
||||
json_for_each_item add_port_to_br_lan ports
|
||||
else
|
||||
json_get_var device device
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
if [ -n "$device" ]; then
|
||||
uci -q set network.wan.device="$device"
|
||||
uci -q set network.wan6.device="$device"
|
||||
fi
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
uci -q commit network
|
||||
|
||||
# Enable DHCP Server
|
||||
uci -q set dhcp.lan.ignore=0
|
||||
uci -q set dhcp.wan.ignore=1
|
||||
uci -q commit dhcp
|
||||
/etc/init.d/odhcpd enable
|
||||
|
||||
# Enable SSDPD
|
||||
uci -q set ssdpd.ssdp.enabled="1"
|
||||
uci -q commit ssdpd
|
||||
|
||||
# Update CWMP Agent WAN Interface
|
||||
uci -q set cwmp.cpe.default_wan_interface="wan"
|
||||
uci -q commit cwmp
|
||||
|
||||
# Update gateway WAN Interface
|
||||
uci -q set gateway.global.wan_interface="wan"
|
||||
uci -q commit gateway
|
||||
|
||||
# Enable firewall
|
||||
uci -q set firewall.globals.enabled="1"
|
||||
uci -q commit firewall
|
||||
}
|
||||
|
||||
l3_network_pppoe_config
|
||||
l3_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd restart 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
@@ -11,21 +11,19 @@
|
||||
"supported_args": [
|
||||
{
|
||||
"name": "username",
|
||||
"description": "PPoE username",
|
||||
"description": "PPPoE username",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"#value": "TestUser"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"description": "PPoE password",
|
||||
"description": "PPPoE password",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"#value": "TestPassword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "bridged",
|
||||
"description": "Bridged mode (Layer 2)"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ fi
|
||||
|
||||
configure_supp_modes_args()
|
||||
{
|
||||
local obj inst name description required value parent
|
||||
local obj inst name description required value parent type
|
||||
|
||||
obj="${1}"
|
||||
inst="${2}"
|
||||
@@ -32,12 +32,14 @@ configure_supp_modes_args()
|
||||
json_get_var description description
|
||||
json_get_var value value
|
||||
json_get_var required required
|
||||
json_get_var type type
|
||||
|
||||
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}=supported_args
|
||||
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.name="${name}"
|
||||
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.description="${description}"
|
||||
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.required="${required}"
|
||||
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.value="${value}"
|
||||
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.type="${type}"
|
||||
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.dm_parent="${parent}"
|
||||
|
||||
json_select ..
|
||||
|
||||
25
netmode/files/lib/netmode/post/datamodel_init.sh
Normal file
25
netmode/files/lib/netmode/post/datamodel_init.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is to cleanup dmmap and restart datamodel related services
|
||||
# when wan mode changes
|
||||
|
||||
if [ -d "/etc/bbfdm/dmmap/" ]; then
|
||||
rm -rf /etc/bbfdm/dmmap/*
|
||||
fi
|
||||
|
||||
# If device is booting up, no need to restart services
|
||||
if [ ! -f /var/run/boot_complete ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -x "/etc/init.d/bbfdm.services" ]; then
|
||||
/etc/init.d/bbfdm.services restart
|
||||
fi
|
||||
|
||||
if [ -x "/etc/init.d/bbfdmd" ]; then
|
||||
/etc/init.d/bbfdmd restart
|
||||
fi
|
||||
|
||||
if [ -x "/etc/init.d/obuspa" ]; then
|
||||
/etc/init.d/obuspa restart
|
||||
fi
|
||||
42
nlohmann-json/Makefile
Normal file
42
nlohmann-json/Makefile
Normal file
@@ -0,0 +1,42 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=nlohmann-json
|
||||
PKG_VERSION:=3.11.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/nlohmann/json.git
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE.MIT
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/nlohmann-json
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=JSON for Modern C++ (nlohmann/json)
|
||||
endef
|
||||
|
||||
define Package/nlohmann-json/description
|
||||
JSON for Modern C++ is a single-header C++ library for working with JSON.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
# Header-only, nothing to compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/nlohmann
|
||||
$(CP) $(PKG_BUILD_DIR)/single_include/nlohmann/json.hpp $(1)/usr/include/nlohmann/
|
||||
endef
|
||||
|
||||
define Package/nlohmann-json/install
|
||||
true
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,nlohmann-json))
|
||||
43
nng/Makefile
Normal file
43
nng/Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=nng
|
||||
PKG_VERSION:=1.11
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/nanomsg/nng.git
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE.txt
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/nng
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=NNG - nanomsg-next-gen
|
||||
URL:=https://github.com/nanomsg/nng
|
||||
DEPENDS:=+libpthread +libatomic
|
||||
endef
|
||||
|
||||
define Package/nng/description
|
||||
NNG is a lightweight messaging library, a successor to nanomsg.
|
||||
endef
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DNNG_ENABLE_EXAMPLES=OFF \
|
||||
-DNNG_ENABLE_TESTS=OFF
|
||||
|
||||
define Package/nng/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnng.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,nng))
|
||||
@@ -70,4 +70,13 @@ config OBUSPA_VENDOR_PREFIX
|
||||
config OBUSPA_OVERRIDE_CT_ROLE
|
||||
bool "Override ControllerTrust role with factory default roles"
|
||||
default y
|
||||
|
||||
config OBUSPA_VC_POLL_PERIOD
|
||||
int "Polling interval in sec for ValueChange Subscriptions"
|
||||
range 15 120
|
||||
default "15"
|
||||
help
|
||||
Obuspa relies on a polling mechanism to determine the ValueChange, Add, Del Subscriptions.
|
||||
Short poll period could give more responsive subscription events, but might delay overall experience in slower CPUs with good amount of subscriptions, on the other hand, a bigger value results into less responsive subscription handling. This value must be in range of 15 to 120 secs. (default 15)
|
||||
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=10.0.0.9
|
||||
PKG_VERSION:=10.0.4.2
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||
PKG_SOURCE_VERSION:=3e9299063e3c65565d2c834b5ab654fda830f749
|
||||
PKG_SOURCE_VERSION:=65dabfdb8fbb2f3c2590f3bfb2fabedef8dcd76e
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -107,6 +107,10 @@ ifneq ($(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM),)
|
||||
TARGET_CFLAGS += -DOBUSPA_MAX_CONTROLLERS_NUM=$(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_OBUSPA_VC_POLL_PERIOD),)
|
||||
TARGET_CFLAGS += -DOBUSPA_VC_POLL_PERIOD=$(CONFIG_OBUSPA_VC_POLL_PERIOD)
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
|
||||
|
||||
@@ -10,4 +10,4 @@ config obuspa 'global'
|
||||
#option client_cert '/etc/obuspa/client.pem'
|
||||
option log_dest 'syslog'
|
||||
option dm_caching_exclude '/etc/obuspa/transient_dm.json'
|
||||
|
||||
option dualstack_pref 'IPv6'
|
||||
|
||||
@@ -278,6 +278,11 @@ update_reset_reason()
|
||||
fi
|
||||
}
|
||||
|
||||
update_dual_stack_pref()
|
||||
{
|
||||
db_set Internal.DualStackPreference "${1}"
|
||||
}
|
||||
|
||||
get_role_index()
|
||||
{
|
||||
local name drole
|
||||
@@ -989,6 +994,8 @@ db_init()
|
||||
|
||||
#log "Create reset file ...."
|
||||
config_load $CONFIGURATION
|
||||
config_get dualstack_pref global dualstack_pref "IPv6"
|
||||
|
||||
global_init
|
||||
config_foreach configure_localagent localagent
|
||||
global_init
|
||||
@@ -1003,8 +1010,10 @@ db_init()
|
||||
config_foreach configure_subscription subscription
|
||||
global_init
|
||||
config_foreach configure_challenges challenge
|
||||
global_init
|
||||
|
||||
update_reset_reason
|
||||
update_dual_stack_pref "${dualstack_pref}"
|
||||
|
||||
uci_commit ${CONFIGURATION}
|
||||
|
||||
cp /etc/config/obuspa /tmp/obuspa/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Index: obuspa-10.0.0.1/src/core/device_controller.c
|
||||
Index: obuspa-10.0.4.0/src/core/device_controller.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/device_controller.c
|
||||
+++ obuspa-10.0.0.1/src/core/device_controller.c
|
||||
@@ -4211,6 +4211,14 @@ int ProcessControllerAdded(int cont_inst
|
||||
--- obuspa-10.0.4.0.orig/src/core/device_controller.c
|
||||
+++ obuspa-10.0.4.0/src/core/device_controller.c
|
||||
@@ -4214,6 +4214,14 @@ int ProcessControllerAdded(int cont_inst
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ Index: obuspa-10.0.0.1/src/core/device_controller.c
|
||||
// Exit if unable to get the object instance numbers present in this controller's MTP table
|
||||
USP_SNPRINTF(path, sizeof(path), "%s.%d.MTP", device_cont_root, cont_instance);
|
||||
err = DATA_MODEL_GetInstances(path, &iv);
|
||||
@@ -4252,14 +4260,6 @@ int ProcessControllerAdded(int cont_inst
|
||||
@@ -4255,14 +4263,6 @@ int ProcessControllerAdded(int cont_inst
|
||||
DEVICE_MQTT_UpdateControllerTopics();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Index: obuspa-10.0.0.1/src/core/bdc_exec.c
|
||||
Index: obuspa-10.0.4.0/src/core/bdc_exec.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/bdc_exec.c
|
||||
+++ obuspa-10.0.0.1/src/core/bdc_exec.c
|
||||
--- obuspa-10.0.4.0.orig/src/core/bdc_exec.c
|
||||
+++ obuspa-10.0.4.0/src/core/bdc_exec.c
|
||||
@@ -549,10 +549,25 @@ int StartSendingReport(bdc_connection_t
|
||||
|
||||
// Set the list of headers
|
||||
@@ -30,10 +30,10 @@ Index: obuspa-10.0.0.1/src/core/bdc_exec.c
|
||||
bc->headers = curl_slist_append(bc->headers, "Content-Encoding: gzip");
|
||||
}
|
||||
|
||||
Index: obuspa-10.0.0.1/src/core/bdc_exec.h
|
||||
Index: obuspa-10.0.4.0/src/core/bdc_exec.h
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/bdc_exec.h
|
||||
+++ obuspa-10.0.0.1/src/core/bdc_exec.h
|
||||
--- obuspa-10.0.4.0.orig/src/core/bdc_exec.h
|
||||
+++ obuspa-10.0.4.0/src/core/bdc_exec.h
|
||||
@@ -54,6 +54,8 @@ void BDC_EXEC_ScheduleExit(void);
|
||||
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
|
||||
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
|
||||
@@ -45,10 +45,10 @@ Index: obuspa-10.0.0.1/src/core/bdc_exec.h
|
||||
+#define BDC_FLAG_HEADER_PER_ROW 0x00000020 // If set, report format in header would be csv ParameterPerRow
|
||||
+#define BDC_FLAG_HEADER_PER_COL 0x00000040 // If set, report format in header would be csv ParameterPerColumn
|
||||
#endif
|
||||
Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/device_bulkdata.c
|
||||
+++ obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
--- obuspa-10.0.4.0.orig/src/core/device_bulkdata.c
|
||||
+++ obuspa-10.0.4.0/src/core/device_bulkdata.c
|
||||
@@ -71,8 +71,12 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -95,7 +95,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
|
||||
@@ -247,7 +259,8 @@ bulkdata_profile_t *bulkdata_find_free_p
|
||||
bulkdata_profile_t *bulkdata_find_profile(int profile_id);
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map, combined_role_t *combined_role);
|
||||
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
|
||||
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp);
|
||||
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
|
||||
@@ -103,16 +103,16 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
|
||||
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
|
||||
int bulkdata_start_profile(bulkdata_profile_t *bp);
|
||||
@@ -262,6 +275,8 @@ char *bulkdata_platform_calc_uri_query_s
|
||||
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
|
||||
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv);
|
||||
@@ -263,6 +276,8 @@ int bulkdata_platform_get_param_refs(int
|
||||
int bulkdata_platform_calc_combined_role(int instance, combined_role_t **bulkdata_role, combined_role_t *combined_role, int *cont_instance);
|
||||
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv, combined_role_t *combined_role);
|
||||
void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map);
|
||||
+void append_string_to_target(char *str, char **output);
|
||||
+char *csv_encode(const char *str);
|
||||
int GetAuto_BulkDataController(dm_req_t *req, char *buf, int len);
|
||||
#ifdef ENABLE_MQTT
|
||||
int Validate_BulkDataMqttReference(dm_req_t *req, char *value);
|
||||
void bulkdata_process_profile_mqtt(bulkdata_profile_t *bp);
|
||||
@@ -299,7 +314,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
@@ -301,7 +316,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT);
|
||||
err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols));
|
||||
@@ -121,7 +121,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT);
|
||||
@@ -314,7 +329,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
@@ -316,7 +331,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING);
|
||||
@@ -129,8 +129,8 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE_JSON, Validate_BulkDataEncodingType, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME);
|
||||
|
||||
@@ -326,9 +341,16 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadOnlyAuto("Device.BulkData.Profile.{i}.Controller", GetAuto_BulkDataController, DM_STRING);
|
||||
@@ -329,9 +344,16 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Parameter.{i}.Reference", "", Validate_BulkDataReference, NULL, DM_STRING);
|
||||
|
||||
// Device.BulkData.Profile.{i}.JSONEncoding
|
||||
@@ -148,7 +148,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
// Device.BulkData.Profile.{i}.HTTP
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
|
||||
@@ -614,9 +636,10 @@ int Validate_BulkDataProtocol(dm_req_t *
|
||||
@@ -687,9 +709,10 @@ int Validate_BulkDataProtocol(dm_req_t *
|
||||
int Validate_BulkDataEncodingType(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
@@ -162,7 +162,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -720,9 +743,36 @@ int Validate_BulkDataReference(dm_req_t
|
||||
@@ -793,9 +816,36 @@ int Validate_BulkDataReference(dm_req_t
|
||||
int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
@@ -201,7 +201,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -2053,6 +2103,14 @@ int bulkdata_platform_get_profile_contro
|
||||
@@ -2151,6 +2201,14 @@ int bulkdata_platform_get_profile_contro
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
// Exit if unable to get ReportTimestamp
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
|
||||
@@ -2061,6 +2119,54 @@ int bulkdata_platform_get_profile_contro
|
||||
@@ -2159,6 +2217,54 @@ int bulkdata_platform_get_profile_contro
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
#ifdef ENABLE_MQTT
|
||||
{
|
||||
char protocol[32];
|
||||
@@ -2334,7 +2440,7 @@ void bulkdata_process_profile_http(bulkd
|
||||
@@ -2492,7 +2598,7 @@ void bulkdata_process_profile_http(bulkd
|
||||
{
|
||||
int err;
|
||||
report_t *cur_report;
|
||||
@@ -280,7 +280,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
profile_ctrl_params_t ctrl;
|
||||
unsigned char *compressed_report;
|
||||
int compressed_len;
|
||||
@@ -2373,10 +2479,23 @@ void bulkdata_process_profile_http(bulkd
|
||||
@@ -2541,26 +2647,39 @@ void bulkdata_process_profile_http(bulkd
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
@@ -308,7 +308,9 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2385,14 +2504,14 @@ void bulkdata_process_profile_http(bulkd
|
||||
// Print out the JSON report, if debugging is enabled
|
||||
- USP_LOG_Info("\nBULK DATA: %sing at time %s, to url=%s", ctrl.method, iso8601_cur_time(buf, sizeof(buf)), ctrl.url);
|
||||
+ USP_LOG_Info("BULK DATA: %sing at time %s, to url=%s", ctrl.method, iso8601_cur_time(buf, sizeof(buf)), ctrl.url);
|
||||
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
|
||||
if (enable_protocol_trace)
|
||||
{
|
||||
@@ -327,7 +329,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
}
|
||||
// NOTE: From this point on, only the compressed_report exists
|
||||
|
||||
@@ -2422,8 +2541,15 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2590,8 +2709,15 @@ void bulkdata_process_profile_usp_event(
|
||||
kv_vector_t event_args;
|
||||
kv_pair_t kv;
|
||||
report_t *cur_report;
|
||||
@@ -341,11 +343,11 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
+ char escape_char[10];
|
||||
+ char csv_format[20];
|
||||
+ char row_timestamp[33];
|
||||
|
||||
// Exit if the MTP has not been connected to successfully after bootup
|
||||
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
|
||||
@@ -2432,13 +2558,63 @@ void bulkdata_process_profile_usp_event(
|
||||
goto exit;
|
||||
combined_role_t *bulkdata_role;
|
||||
combined_role_t combined_role;
|
||||
int cont_instance;
|
||||
@@ -2610,13 +2736,63 @@ void bulkdata_process_profile_usp_event(
|
||||
return;
|
||||
}
|
||||
|
||||
- // Exit if unable to get ReportTimestamp
|
||||
@@ -415,7 +417,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
|
||||
// When sending via USP events, only one report is ever sent in each USP event
|
||||
// So ensure all retained reports are removed. NOTE: Clearing the reports here is only necessary when switching protocol from HTTP to USP event, and where HTTP had some unsent reports
|
||||
@@ -2456,11 +2632,17 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2634,11 +2810,17 @@ void bulkdata_process_profile_usp_event(
|
||||
}
|
||||
bp->num_retained_reports = 1;
|
||||
|
||||
@@ -436,7 +438,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2468,15 +2650,15 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2646,15 +2828,15 @@ void bulkdata_process_profile_usp_event(
|
||||
|
||||
// Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add()
|
||||
kv.key = "Data";
|
||||
@@ -446,7 +448,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
event_args.num_entries = 1;
|
||||
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.Push!", bp->profile_id);
|
||||
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args);
|
||||
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args, cont_instance);
|
||||
|
||||
- // Free the report. No need to free the event_args as json_report is the only thing dynamically allocated in it
|
||||
- free(json_report); // The report is not allocated via USP_MALLOC
|
||||
@@ -455,7 +457,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
|
||||
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them
|
||||
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
|
||||
@@ -2548,11 +2730,24 @@ void bulkdata_process_profile_mqtt(bulkd
|
||||
@@ -2736,15 +2918,28 @@ void bulkdata_process_profile_mqtt(bulkd
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
@@ -485,7 +487,21 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
}
|
||||
|
||||
// Print out the JSON report, if debugging is enabled
|
||||
@@ -2763,7 +2958,7 @@ int bulkdata_reduce_to_alt_name(char *sp
|
||||
- USP_LOG_Debug("\nBULK DATA: Sending at time %s to MQTT topic %s", iso8601_cur_time(buf, sizeof(buf)), ctrl.mqtt_publish_topic);
|
||||
+ USP_LOG_Debug("BULK DATA: Sending at time %s to MQTT topic %s", iso8601_cur_time(buf, sizeof(buf)), ctrl.mqtt_publish_topic);
|
||||
if (enable_protocol_trace)
|
||||
{
|
||||
USP_LOG_String(kLogLevel_Info, kLogType_Protocol, report);
|
||||
@@ -2939,7 +3134,7 @@ int bulkdata_reduce_to_alt_name(char *sp
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
-** bulkdata_generate_json_report
|
||||
+** bulkdata_generate_json_name_value_pair_report
|
||||
**
|
||||
** Generates a JSON name-value pair format report
|
||||
** NOTE: The report contains all retained failed reports, as well as the current report
|
||||
@@ -2951,7 +3146,7 @@ int bulkdata_reduce_to_alt_name(char *sp
|
||||
** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||
**
|
||||
**************************************************************************/
|
||||
@@ -494,7 +510,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
{
|
||||
JsonNode *top; // top of report
|
||||
JsonNode *array; // array of reports (retained + current)
|
||||
@@ -2868,6 +3063,483 @@ char *bulkdata_generate_json_report(bulk
|
||||
@@ -3056,6 +3251,483 @@ char *bulkdata_generate_json_report(bulk
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -978,7 +994,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bulkdata_compress_report
|
||||
@@ -3071,6 +3743,20 @@ int bulkdata_schedule_sending_http_repor
|
||||
@@ -3259,6 +3931,20 @@ int bulkdata_schedule_sending_http_repor
|
||||
flags |= BDC_FLAG_DATE_HEADER;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Index: obuspa-10.0.0.1/src/core/expr_vector.c
|
||||
Index: obuspa-10.0.4.0/src/core/expr_vector.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/expr_vector.c
|
||||
+++ obuspa-10.0.0.1/src/core/expr_vector.c
|
||||
--- obuspa-10.0.4.0.orig/src/core/expr_vector.c
|
||||
+++ obuspa-10.0.4.0/src/core/expr_vector.c
|
||||
@@ -59,6 +59,7 @@ char *expr_op_2_str[kExprOp_Max] =
|
||||
"<", // kExprOp_LessThan
|
||||
">", // kExprOp_GreaterThan
|
||||
@@ -10,7 +10,7 @@ Index: obuspa-10.0.0.1/src/core/expr_vector.c
|
||||
};
|
||||
|
||||
|
||||
@@ -483,6 +484,15 @@ char *SplitOnOperator(char *buf, expr_op
|
||||
@@ -487,6 +488,15 @@ char *SplitOnOperator(char *buf, expr_op
|
||||
*op = '\0';
|
||||
return &op[2];
|
||||
}
|
||||
@@ -26,10 +26,10 @@ Index: obuspa-10.0.0.1/src/core/expr_vector.c
|
||||
|
||||
// Exit if found the "<" operator
|
||||
op = strchr(buf, '<');
|
||||
Index: obuspa-10.0.0.1/src/core/path_resolver.c
|
||||
Index: obuspa-10.0.4.0/src/core/path_resolver.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/path_resolver.c
|
||||
+++ obuspa-10.0.0.1/src/core/path_resolver.c
|
||||
--- obuspa-10.0.4.0.orig/src/core/path_resolver.c
|
||||
+++ obuspa-10.0.4.0/src/core/path_resolver.c
|
||||
@@ -1088,7 +1088,7 @@ int ResolveUniqueKey(char *resolved, cha
|
||||
char temp[MAX_DM_PATH];
|
||||
bool is_match;
|
||||
@@ -107,10 +107,10 @@ Index: obuspa-10.0.0.1/src/core/path_resolver.c
|
||||
// Determine the function to call to perform the comparison
|
||||
if (type_flags & (DM_INT | DM_UINT | DM_ULONG | DM_LONG | DM_DECIMAL))
|
||||
{
|
||||
Index: obuspa-10.0.0.1/src/include/usp_api.h
|
||||
Index: obuspa-10.0.4.0/src/include/usp_api.h
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/include/usp_api.h
|
||||
+++ obuspa-10.0.0.1/src/include/usp_api.h
|
||||
--- obuspa-10.0.4.0.orig/src/include/usp_api.h
|
||||
+++ obuspa-10.0.4.0/src/include/usp_api.h
|
||||
@@ -106,6 +106,7 @@ typedef enum
|
||||
kExprOp_LessThan, // '<'
|
||||
kExprOp_GreaterThan, // '>'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Index: obuspa-10.0.0.2/src/core/device.h
|
||||
Index: obuspa-10.0.4.0/src/core/device.h
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/core/device.h
|
||||
+++ obuspa-10.0.0.2/src/core/device.h
|
||||
@@ -305,6 +305,8 @@ void DEVICE_CTRUST_ApplyPermissionsToSub
|
||||
--- obuspa-10.0.4.0.orig/src/core/device.h
|
||||
+++ obuspa-10.0.4.0/src/core/device.h
|
||||
@@ -310,6 +310,8 @@ void DEVICE_CTRUST_ApplyPermissionsToSub
|
||||
char *DEVICE_CTRUST_InstSelToPermTarget(int role_index, void *is, int *perm_instance);
|
||||
int DEVICE_CTRUST_SetRoleParameter(int instance, char *param_name, char *new_value);
|
||||
int DEVICE_CTRUST_SetPermissionParameter(int instance1, int instance2, char *param_name, char *new_value);
|
||||
@@ -11,11 +11,11 @@ Index: obuspa-10.0.0.2/src/core/device.h
|
||||
int DEVICE_REQUEST_Init(void);
|
||||
int DEVICE_REQUEST_Add(char *path, char *command_key, int *instance);
|
||||
void DEVICE_REQUEST_OperationComplete(int instance, int err_code, char *err_msg, kv_vector_t *output_args);
|
||||
Index: obuspa-10.0.0.2/src/core/device_ctrust.c
|
||||
Index: obuspa-10.0.4.0/src/core/device_ctrust.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/core/device_ctrust.c
|
||||
+++ obuspa-10.0.0.2/src/core/device_ctrust.c
|
||||
@@ -235,6 +235,7 @@ credential_t *FindCredentialByCertInstan
|
||||
--- obuspa-10.0.4.0.orig/src/core/device_ctrust.c
|
||||
+++ obuspa-10.0.4.0/src/core/device_ctrust.c
|
||||
@@ -236,6 +236,7 @@ credential_t *FindCredentialByCertInstan
|
||||
int Get_CredentialRole(dm_req_t *req, char *buf, int len);
|
||||
int Get_CredentialCertificate(dm_req_t *req, char *buf, int len);
|
||||
int Get_CredentialNumEntries(dm_req_t *req, char *buf, int len);
|
||||
@@ -23,7 +23,7 @@ Index: obuspa-10.0.0.2/src/core/device_ctrust.c
|
||||
|
||||
#ifndef REMOVE_DEVICE_SECURITY
|
||||
int InitChallengeTable();
|
||||
@@ -354,6 +355,10 @@ int DEVICE_CTRUST_Init(void)
|
||||
@@ -355,6 +356,10 @@ int DEVICE_CTRUST_Init(void)
|
||||
challenge_response_input_args, NUM_ELEM(challenge_response_input_args),
|
||||
NULL, 0);
|
||||
#endif
|
||||
@@ -34,7 +34,7 @@ Index: obuspa-10.0.0.2/src/core/device_ctrust.c
|
||||
// Exit if any errors occurred
|
||||
if (err != USP_ERR_OK)
|
||||
{
|
||||
@@ -2908,3 +2913,139 @@ exit:
|
||||
@@ -2939,3 +2944,139 @@ exit:
|
||||
return err;
|
||||
}
|
||||
#endif // REMOVE_DEVICE_SECURITY
|
||||
|
||||
@@ -35,3 +35,16 @@ Index: obuspa-10.0.0.2/src/core/data_model.c
|
||||
return USP_ERR_OBJECT_DOES_NOT_EXIST;
|
||||
}
|
||||
|
||||
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
|
||||
index 388697a..444b4da 100644
|
||||
--- a/src/core/mqtt.c
|
||||
+++ b/src/core/mqtt.c
|
||||
@@ -4020,7 +4020,7 @@ void MessageV5Callback(struct mosquitto *mosq, void *userdata, const struct mosq
|
||||
if (mosquitto_property_read_string(props, RESPONSE_TOPIC,
|
||||
&response_info_ptr, false) == NULL)
|
||||
{
|
||||
- USP_LOG_Warning("%s: No response topic in received MESSAGE frame", __FUNCTION__);
|
||||
+ USP_LOG_Info("%s: No response topic in received MESSAGE frame", __FUNCTION__);
|
||||
}
|
||||
|
||||
// Send the message to the data model thread for further processing
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/device_bulkdata.c
|
||||
+++ obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
@@ -375,6 +375,8 @@ int DEVICE_BULKDATA_Init(void)
|
||||
--- obuspa-10.0.4.0.orig/src/core/device_bulkdata.c
|
||||
+++ obuspa-10.0.4.0/src/core/device_bulkdata.c
|
||||
@@ -378,6 +378,8 @@ int DEVICE_BULKDATA_Init(void)
|
||||
// Device.BulkData.Profile.{i}.MQTT
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.Reference", "", Validate_BulkDataMqttReference, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.PublishTopic", "", NULL, NULL, DM_STRING);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Index: obuspa-10.0.0.2/src/core/device.h
|
||||
Index: obuspa-10.0.4.0/src/core/device.h
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/core/device.h
|
||||
+++ obuspa-10.0.0.2/src/core/device.h
|
||||
@@ -346,6 +346,10 @@ void DEVICE_CONTROLLER_SetInheritedRole(
|
||||
--- obuspa-10.0.4.0.orig/src/core/device.h
|
||||
+++ obuspa-10.0.4.0/src/core/device.h
|
||||
@@ -352,6 +352,10 @@ void DEVICE_CONTROLLER_SetInheritedRole(
|
||||
int DEVICE_CONTROLLER_CountEnabledWebsockClientConnections(void);
|
||||
#endif
|
||||
|
||||
@@ -13,10 +13,10 @@ Index: obuspa-10.0.0.2/src/core/device.h
|
||||
#ifndef REMOVE_USP_BROKER
|
||||
int DEVICE_SUBSCRIPTION_RouteNotification(Usp__Msg *usp, int instance, char *subscribed_path);
|
||||
bool DEVICE_SUBSCRIPTION_MarkVendorLayerSubs(int broker_instance, subs_notify_t notify_type, char *path, int group_id);
|
||||
Index: obuspa-10.0.0.2/src/core/device_controller.c
|
||||
Index: obuspa-10.0.4.0/src/core/device_controller.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/core/device_controller.c
|
||||
+++ obuspa-10.0.0.2/src/core/device_controller.c
|
||||
--- obuspa-10.0.4.0.orig/src/core/device_controller.c
|
||||
+++ obuspa-10.0.4.0/src/core/device_controller.c
|
||||
@@ -968,6 +968,78 @@ int DEVICE_CONTROLLER_QueueBinaryMessage
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
@@ -96,10 +96,10 @@ Index: obuspa-10.0.0.2/src/core/device_controller.c
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** DEVICE_CONTROLLER_IsMTPConfigured
|
||||
Index: obuspa-10.0.0.2/src/core/msg_handler.c
|
||||
Index: obuspa-10.0.4.0/src/core/msg_handler.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.2.orig/src/core/msg_handler.c
|
||||
+++ obuspa-10.0.0.2/src/core/msg_handler.c
|
||||
--- obuspa-10.0.4.0.orig/src/core/msg_handler.c
|
||||
+++ obuspa-10.0.4.0/src/core/msg_handler.c
|
||||
@@ -1220,6 +1220,15 @@ int ValidateUspRecord(UspRecord__Record
|
||||
usp_service_instance = USP_BROKER_GetUspServiceInstance(rec->from_id, 0);
|
||||
#endif
|
||||
|
||||
401
obuspa/patches/2004-mqtt-dualstack-fallback.patch
Normal file
401
obuspa/patches/2004-mqtt-dualstack-fallback.patch
Normal file
@@ -0,0 +1,401 @@
|
||||
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
|
||||
index 70978501b1..96119fe080 100644
|
||||
--- a/src/core/mqtt.c
|
||||
+++ b/src/core/mqtt.c
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/x509v3.h>
|
||||
+#include <netdb.h>
|
||||
#include <mosquitto.h>
|
||||
|
||||
#include "mqtt.h"
|
||||
@@ -201,8 +202,9 @@ int EnableMosquitto(mqtt_client_t *client);
|
||||
void SetupCallbacks(mqtt_client_t *client);
|
||||
void QueueUspConnectRecord_MQTT(mqtt_client_t *client, mtp_send_item_t *msi, char *controller_topic, time_t expiry_time);
|
||||
int SendQueueHead(mqtt_client_t *client);
|
||||
+bool check_connectivity(struct addrinfo *list_addr, unsigned int port, sa_family_t family, char *dst_ip, int size);
|
||||
void Connect(mqtt_client_t *client);
|
||||
-int PerformMqttClientConnect(mqtt_client_t *client);
|
||||
+int PerformMqttClientConnect(mqtt_client_t *client, const char *host_ip);
|
||||
int ConnectSetEncryption(mqtt_client_t *client);
|
||||
void ConnectCallback(struct mosquitto *mosq, void *userdata, int result);
|
||||
void ConnectV5Callback(struct mosquitto *mosq, void *userdata, int result, int flags, const mosquitto_property *props);
|
||||
@@ -245,7 +247,7 @@ void HandleMqttReconnect(mqtt_client_t *client);
|
||||
void HandleMqttReconnectAfterDisconnect(mqtt_client_t *client);
|
||||
void HandleMqttDisconnect(mqtt_client_t *client);
|
||||
void DisconnectIfAllSubscriptionsFailed(mqtt_client_t *client);
|
||||
-bool IsMqttBrokerUp(mqtt_client_t *client);
|
||||
+bool IsMqttBrokerUp(mqtt_client_t *client, char *dst_ip, int size);
|
||||
void RemoveMqttQueueItem(mqtt_client_t *client, mqtt_send_item_t *queued_msg);
|
||||
void RemoveExpiredMqttMessages(mqtt_client_t *client);
|
||||
void ParseSubscribeTopicsFromConnack(mqtt_client_t *client, mosquitto_property *prop);
|
||||
@@ -2350,6 +2352,143 @@ int SendQueueHead(mqtt_client_t *client)
|
||||
return err;
|
||||
}
|
||||
|
||||
+bool check_connectivity(struct addrinfo *list_addr, unsigned int port, sa_family_t family, char *dst_ip, int size)
|
||||
+{
|
||||
+ int err;
|
||||
+ struct sockaddr_storage saddr;
|
||||
+ socklen_t saddr_len;
|
||||
+ sa_family_t sock_family;
|
||||
+ int socket_fd = INVALID;
|
||||
+ fd_set writefds;
|
||||
+ struct timeval timeout;
|
||||
+ int num_sockets;
|
||||
+ int so_err;
|
||||
+ socklen_t so_len = sizeof(so_err);
|
||||
+ struct addrinfo *iterator;
|
||||
+ struct sockaddr_in *a;
|
||||
+ struct sockaddr_in6 *a6;
|
||||
+ nu_ipaddr_t dst;
|
||||
+
|
||||
+ if (list_addr == NULL || dst_ip == NULL)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ for (iterator=list_addr; iterator!=NULL; iterator=iterator->ai_next)
|
||||
+ {
|
||||
+ if (iterator->ai_family != family)
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (family == AF_INET)
|
||||
+ {
|
||||
+ a = (struct sockaddr_in *) iterator->ai_addr;
|
||||
+ err = nu_ipaddr_from_inaddr(&a->sin_addr, &dst);
|
||||
+
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ USP_LOG_Error("%s: nu_ipaddr_from_inaddr() failed: %s", __FUNCTION__, strerror(err));
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ a6 = (struct sockaddr_in6 *) iterator->ai_addr;
|
||||
+ err = nu_ipaddr_from_in6addr(&a6->sin6_addr, &dst);
|
||||
+
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ USP_LOG_Error("%s: nu_ipaddr_from_in6addr() failed: %s", __FUNCTION__, strerror(err));
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Next IP if unable to make a socket address structure to probe the MQTT server
|
||||
+ err = nu_ipaddr_to_sockaddr(&dst, port, &saddr, &saddr_len);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // Next IP if unable to determine which address family to use to contact the MQTT broker
|
||||
+ err = nu_ipaddr_get_family(&dst, &sock_family);
|
||||
+ if (err != USP_ERR_OK)
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // Return if unable to create the socket
|
||||
+ socket_fd = socket(sock_family, SOCK_STREAM, 0);
|
||||
+ if (socket_fd == -1)
|
||||
+ {
|
||||
+ USP_LOG_Error("%s: failed to open socket", __FUNCTION__);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // Return if unable to set the socket as non blocking
|
||||
+ // We do this before connecting so that we can timeout on connect taking too long
|
||||
+ err = fcntl(socket_fd, F_SETFL, O_NONBLOCK);
|
||||
+ if (err == -1)
|
||||
+ {
|
||||
+ USP_ERR_ERRNO("fcntl", errno);
|
||||
+ close(socket_fd);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // Next IP if unable to connect to the MQTT Broker
|
||||
+ // NOTE: The connect is performed in non-blocking mode
|
||||
+ err = connect(socket_fd, (struct sockaddr *) &saddr, saddr_len);
|
||||
+ if ((err == -1) && (errno != EINPROGRESS))
|
||||
+ {
|
||||
+ USP_ERR_ERRNO("connect", errno);
|
||||
+ close(socket_fd);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // Set up arguments for the select() call
|
||||
+ FD_ZERO(&writefds);
|
||||
+ FD_SET(socket_fd, &writefds);
|
||||
+ timeout.tv_sec = MQTT_CONNECT_TIMEOUT;
|
||||
+ timeout.tv_usec = 0;
|
||||
+
|
||||
+ // Next IP if the connect timed out
|
||||
+ num_sockets = select(socket_fd + 1, NULL, &writefds, NULL, &timeout);
|
||||
+ if (num_sockets == 0)
|
||||
+ {
|
||||
+ USP_LOG_Error("%s: connect timed out", __FUNCTION__);
|
||||
+ close(socket_fd);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // Next IP if unable to determine whether the connect was successful or not
|
||||
+ err = getsockopt(socket_fd, SOL_SOCKET, SO_ERROR, &so_err, &so_len);
|
||||
+ if (err == -1)
|
||||
+ {
|
||||
+ USP_ERR_ERRNO("getsockopt", errno);
|
||||
+ close(socket_fd);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // Next IP if connect was not successful
|
||||
+ if (so_err != 0)
|
||||
+ {
|
||||
+ USP_LOG_Error("%s: async connect failed", __FUNCTION__);
|
||||
+ close(socket_fd);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ close(socket_fd);
|
||||
+
|
||||
+ // Connect was successful
|
||||
+ nu_ipaddr_str(&dst, dst_ip, size);
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** IsMqttBrokerUp
|
||||
@@ -2364,109 +2503,92 @@ int SendQueueHead(mqtt_client_t *client)
|
||||
** \return true if the MQTT Broker is up, false otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
-bool IsMqttBrokerUp(mqtt_client_t *client)
|
||||
+bool IsMqttBrokerUp(mqtt_client_t *client, char *dst_ip, int size)
|
||||
{
|
||||
int err;
|
||||
bool prefer_ipv6;
|
||||
- nu_ipaddr_t dst;
|
||||
- struct sockaddr_storage saddr;
|
||||
- socklen_t saddr_len;
|
||||
- sa_family_t family;
|
||||
- int socket_fd = INVALID;
|
||||
- fd_set writefds;
|
||||
- struct timeval timeout;
|
||||
- int num_sockets;
|
||||
- int so_err;
|
||||
- socklen_t so_len = sizeof(so_err);
|
||||
+ bool ipv4_supported = false;
|
||||
+ bool ipv6_supported = false;
|
||||
bool result = false;
|
||||
+ struct addrinfo *addr_list = NULL;
|
||||
+ struct addrinfo hints;
|
||||
|
||||
// Get the preference for IPv4 or IPv6, if dual stack
|
||||
prefer_ipv6 = DEVICE_LOCAL_AGENT_GetDualStackPreference();
|
||||
|
||||
- // Exit if unable to determine the IP address of the MQTT Broker
|
||||
- err = tw_ulib_diags_lookup_host(client->conn_params.host, AF_UNSPEC, prefer_ipv6, NULL, &dst);
|
||||
- if (err != USP_ERR_OK)
|
||||
- {
|
||||
- goto exit;
|
||||
- }
|
||||
+ USP_LOG_Debug("%s: dual-stack preference is: %s", __FUNCTION__, prefer_ipv6 ? "IPv6" : "IPv4");
|
||||
|
||||
- // Exit if unable to make a socket address structure to probe the MQTT server
|
||||
- err = nu_ipaddr_to_sockaddr(&dst, client->conn_params.port, &saddr, &saddr_len);
|
||||
- if (err != USP_ERR_OK)
|
||||
- {
|
||||
- goto exit;
|
||||
- }
|
||||
+ // Initialise the hints to use, when obtaining the IP address of the specified host using getaddrinfo()
|
||||
+ memset(&hints, 0, sizeof(hints));
|
||||
+ hints.ai_family = AF_UNSPEC;
|
||||
+ hints.ai_flags |= AI_ADDRCONFIG;
|
||||
|
||||
- // Exit if unable to determine which address family to use to contact the MQTT broker
|
||||
- // NOTE: This shouldn't fail if tw_ulib_diags_lookup_host() is correct
|
||||
- err = nu_ipaddr_get_family(&dst, &family);
|
||||
- if (err != USP_ERR_OK)
|
||||
+ err = getaddrinfo(client->conn_params.host, NULL, &hints, &addr_list);
|
||||
+ if (err != USP_ERR_OK || addr_list == NULL)
|
||||
{
|
||||
- goto exit;
|
||||
+ USP_ERR_SetMessage("%s: getaddrinfo() failed to resolve: %s", __FUNCTION__, client->conn_params.host);
|
||||
+ return result;
|
||||
}
|
||||
|
||||
- // Exit if unable to create the socket
|
||||
- socket_fd = socket(family, SOCK_STREAM, 0);
|
||||
- if (socket_fd == -1)
|
||||
+ // Exit if unable to determine which address families are supported by the device
|
||||
+ // NOTE: In theory, setting getaddrinfo hints to AI_ADDRCONFIG, should filter by supported address family
|
||||
+ // However, unfortunately that flag does not take into account whether the address is globally routable (for IPv6) as well
|
||||
+ err = nu_ipaddr_get_ip_supported_families(&ipv4_supported, &ipv6_supported);
|
||||
+ if (err != USP_ERR_OK)
|
||||
{
|
||||
- goto exit;
|
||||
+ USP_LOG_Error("%s: Failed to determine device IP families", __FUNCTION__);
|
||||
+ return result;
|
||||
}
|
||||
|
||||
- // Exit if unable to set the socket as non blocking
|
||||
- // We do this before connecting so that we can timeout on connect taking too long
|
||||
- err = fcntl(socket_fd, F_SETFL, O_NONBLOCK);
|
||||
- if (err == -1)
|
||||
+ if (ipv4_supported == false && ipv6_supported == false)
|
||||
{
|
||||
- USP_ERR_ERRNO("fcntl", errno);
|
||||
- goto exit;
|
||||
+ // couldn't determine device ip mode
|
||||
+ USP_LOG_Error("%s: Could not determine device IP families", __FUNCTION__);
|
||||
+ return result;
|
||||
}
|
||||
|
||||
- // Exit if unable to connect to the MQTT Broker
|
||||
- // NOTE: The connect is performed in non-blocking mode
|
||||
- err = connect(socket_fd, (struct sockaddr *) &saddr, saddr_len);
|
||||
- if ((err == -1) && (errno != EINPROGRESS))
|
||||
+ if (ipv6_supported == false)
|
||||
{
|
||||
- USP_ERR_ERRNO("connect", errno);
|
||||
- goto exit;
|
||||
+ // device has only ipv4 address so only try with ipv4 addresses
|
||||
+ USP_LOG_Debug("%s: Check connectivity with IPv4 only", __FUNCTION__);
|
||||
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET, dst_ip, size);
|
||||
}
|
||||
-
|
||||
- // Set up arguments for the select() call
|
||||
- FD_ZERO(&writefds);
|
||||
- FD_SET(socket_fd, &writefds);
|
||||
- timeout.tv_sec = MQTT_CONNECT_TIMEOUT;
|
||||
- timeout.tv_usec = 0;
|
||||
-
|
||||
- // Exit if the connect timed out
|
||||
- num_sockets = select(socket_fd + 1, NULL, &writefds, NULL, &timeout);
|
||||
- if (num_sockets == 0)
|
||||
+ else if (ipv4_supported == false)
|
||||
{
|
||||
- USP_LOG_Error("%s: connect timed out", __FUNCTION__);
|
||||
- goto exit;
|
||||
+ // device has only ipv6 address so only try with ipv6 addresses
|
||||
+ USP_LOG_Debug("%s: Check connectivity with IPv6 only", __FUNCTION__);
|
||||
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET6, dst_ip, size);
|
||||
}
|
||||
-
|
||||
- // Exit if unable to determine whether the connect was successful or not
|
||||
- err = getsockopt(socket_fd, SOL_SOCKET, SO_ERROR, &so_err, &so_len);
|
||||
- if (err == -1)
|
||||
+ else
|
||||
{
|
||||
- USP_ERR_ERRNO("getsockopt", errno);
|
||||
- goto exit;
|
||||
- }
|
||||
+ // device has both ipv6 and ipv4 address, so we need to search as per preference
|
||||
+ if (prefer_ipv6 == true)
|
||||
+ {
|
||||
|
||||
- // Exit if connect was not successful
|
||||
- if (so_err != 0)
|
||||
- {
|
||||
- USP_LOG_Error("%s: async connect failed", __FUNCTION__);
|
||||
- goto exit;
|
||||
+ // First try with v6 then fallback to v4
|
||||
+ USP_LOG_Debug("%s: Check connectivity with IPv6 first", __FUNCTION__);
|
||||
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET6, dst_ip, size);
|
||||
+ if (result == false)
|
||||
+ {
|
||||
+ USP_LOG_Debug("%s: Check connectivity fallback with IPv4", __FUNCTION__);
|
||||
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET, dst_ip, size);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ // First try with v4 then fallback to v6
|
||||
+ USP_LOG_Debug("%s: Check connectivity with IPv4 first", __FUNCTION__);
|
||||
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET, dst_ip, size);
|
||||
+ if (result == false)
|
||||
+ {
|
||||
+ USP_LOG_Debug("%s: Check connectivity fallback with IPv6", __FUNCTION__);
|
||||
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET6, dst_ip, size);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
- // Connect was successful
|
||||
- result = true;
|
||||
-
|
||||
-exit:
|
||||
- // Tidy up
|
||||
- if (socket_fd != INVALID)
|
||||
- {
|
||||
- close(socket_fd);
|
||||
+ if (addr_list != NULL) {
|
||||
+ (void) freeaddrinfo(addr_list);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -2487,18 +2609,20 @@ void Connect(mqtt_client_t *client)
|
||||
{
|
||||
int err = USP_ERR_OK;
|
||||
bool is_up;
|
||||
+ char dst_ip[INET6_ADDRSTRLEN] = {0};
|
||||
|
||||
// Exit if after probing the MQTT Broker, it is not up
|
||||
// In this case, we do not attempt to call libmosquitto's connect function, as that function will end up blocking for 2 minutes (since the MQTT broker is down)
|
||||
- is_up = IsMqttBrokerUp(client);
|
||||
- if (is_up == false)
|
||||
+ is_up = IsMqttBrokerUp(client, dst_ip, sizeof(dst_ip));
|
||||
+ if (is_up == false || strlen(dst_ip) == 0)
|
||||
{
|
||||
+ USP_LOG_Debug("%s: MQTT broker(%s) is not UP", __FUNCTION__, client->conn_params.host);
|
||||
err = USP_ERR_INTERNAL_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Start the MQTT Connect
|
||||
- err = PerformMqttClientConnect(client);
|
||||
+ err = PerformMqttClientConnect(client, dst_ip);
|
||||
|
||||
// Exit if failed to connect
|
||||
if (err != USP_ERR_OK)
|
||||
@@ -2531,7 +2655,7 @@ exit:
|
||||
** \return USP_ERR_INTERNAL_ERROR if failed to connect (and should retry)
|
||||
**
|
||||
**************************************************************************/
|
||||
-int PerformMqttClientConnect(mqtt_client_t *client)
|
||||
+int PerformMqttClientConnect(mqtt_client_t *client, const char *host_ip)
|
||||
{
|
||||
int version;
|
||||
mosquitto_property *proplist = NULL;
|
||||
@@ -2601,19 +2725,19 @@ int PerformMqttClientConnect(mqtt_client_t *client)
|
||||
// We do this to prevent the data model thread from potentially being blocked, whilst the connect call is taking place
|
||||
OS_UTILS_UnlockMutex(&mqtt_access_mutex);
|
||||
|
||||
- USP_LOG_Info("Sending CONNECT frame to (host=%s, port=%d)", client->conn_params.host, client->conn_params.port);
|
||||
+ USP_LOG_Info("Sending CONNECT frame to (host=%s, ip=%s, port=%d)", client->conn_params.host, host_ip, client->conn_params.port);
|
||||
FRAME_TRACE_DUMP(client);
|
||||
|
||||
// Perform the TCP connect
|
||||
// NOTE: TCP connect can block for around 2 minutes if the broker does not respond to the TCP handshake
|
||||
if (version == kMqttProtocol_5_0)
|
||||
{
|
||||
- mosq_err = mosquitto_connect_bind_v5(client->mosq, client->conn_params.host, client->conn_params.port,
|
||||
+ mosq_err = mosquitto_connect_bind_v5(client->mosq, host_ip, client->conn_params.port,
|
||||
keep_alive, NULL, proplist);
|
||||
}
|
||||
else
|
||||
{
|
||||
- mosq_err = mosquitto_connect(client->mosq, client->conn_params.host, client->conn_params.port,
|
||||
+ mosq_err = mosquitto_connect(client->mosq, host_ip, client->conn_params.port,
|
||||
keep_alive);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
if PACKAGE_parental-control
|
||||
|
||||
config PARENTAL_CONTROL_INCLUDE_URLFILTER_BUNDLES
|
||||
bool "Include default bundle files"
|
||||
default n
|
||||
config PARENTAL_CONTROL_URLFILTERING
|
||||
bool "Enables URL Filter functions and datamodel"
|
||||
default y
|
||||
help
|
||||
Set this option to include bundle files by default,
|
||||
they are also included in the UCI, urlfilter
|
||||
still needs to be enabled though.
|
||||
Set this option to include url filter feature
|
||||
|
||||
config PARENTAL_CONTROL_VENDOR_PREFIX
|
||||
string "Package specific datamodel Vendor Prefix for TR181 extensions"
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2021-2024 IOPSYS
|
||||
# Copyright (C) 2021-2025 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=parental-control
|
||||
PKG_VERSION:=1.1.6
|
||||
PKG_VERSION:=1.2.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/parental-control.git
|
||||
PKG_SOURCE_VERSION:=5128498a36c8f1ac48d320850c292c7e66256884
|
||||
PKG_SOURCE_VERSION:=120dbcd6508b817d2ce3d579a1bfbd5bfd1a44cb
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -49,8 +49,11 @@ endif
|
||||
|
||||
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(VENDOR_PREFIX)\\\"
|
||||
|
||||
TARGET_LDFLAGS += \
|
||||
-lcmph
|
||||
ifeq ($(CONFIG_PARENTAL_CONTROL_URLFILTERING),y)
|
||||
TARGET_CFLAGS+=-DPARENTAL_CONTROL_ULRFILTER
|
||||
endif
|
||||
|
||||
TARGET_LDFLAGS += -lcmph
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
@@ -85,8 +88,12 @@ define Package/parental-control/install
|
||||
|
||||
$(BBFDM_REGISTER_SERVICES) -v ${VENDOR_PREFIX} ./bbfdm_service.json $(1) parentalcontrol
|
||||
|
||||
ifeq ($(CONFIG_PARENTAL_CONTROL_INCLUDE_URLFILTER_BUNDLES),y)
|
||||
$(INSTALL_DATA) ./files/etc/parentalcontrol/urlbundles.tar.xz $(1)/etc/parentalcontrol/
|
||||
ifeq ($(CONFIG_PARENTAL_CONTROL_URLFILTERING),y)
|
||||
$(INSTALL_DATA) ./files/etc/uci-defaults/55-add-default-bundles $(1)/etc/uci-defaults/
|
||||
$(CP) ./files/urlbundle_override.json $(1)/etc/parentalcontrol/
|
||||
else
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) -v ${VENDOR_PREFIX} ./files/urlbundle_override.json $(1) parentalcontrol
|
||||
$(INSTALL_DATA) ./files/etc/uci-defaults/50-parental_control_urlfilter $(1)/etc/uci-defaults/
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
@@ -1,93 +1,4 @@
|
||||
config globals 'globals'
|
||||
option enable '0'
|
||||
option loglevel '3'
|
||||
|
||||
config urlbundle 'urlbundle_1'
|
||||
option enable '0'
|
||||
option name 'Abuse'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/abuse-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_2'
|
||||
option enable '0'
|
||||
option name 'Ads'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/ads-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_3'
|
||||
option enable '0'
|
||||
option name 'Crypto'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/crypto-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_4'
|
||||
option enable '1'
|
||||
option name 'Drugs'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/drugs-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_5'
|
||||
option enable '0'
|
||||
option name 'Everything else'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/everything-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_6'
|
||||
option enable '1'
|
||||
option name 'Facebook/Instagram'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/facebook-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_7'
|
||||
option enable '1'
|
||||
option name 'Fraud'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/fraud-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_8'
|
||||
option enable '1'
|
||||
option name 'Gambling'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/gambling-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_9'
|
||||
option enable '0'
|
||||
option name 'Malware'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/malware-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_10'
|
||||
option enable '1'
|
||||
option name 'Phishing'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/phishing-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_11'
|
||||
option enable '1'
|
||||
option name 'Piracy'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/piracy-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_12'
|
||||
option enable '0'
|
||||
option name 'Porn'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/porn-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_13'
|
||||
option enable '1'
|
||||
option name 'Ransomware'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/ransomware-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_14'
|
||||
option enable '0'
|
||||
option name 'Redirect'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/redirect-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_15'
|
||||
option enable '1'
|
||||
option name 'Scam'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/scam-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_16'
|
||||
option enable '0'
|
||||
option name 'TikTok'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/tiktok-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_17'
|
||||
option enable '0'
|
||||
option name 'Torrent'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/torrent-nl.txt'
|
||||
|
||||
config urlbundle 'urlbundle_18'
|
||||
option enable '0'
|
||||
option name 'Tracking'
|
||||
option download_url 'https://blocklistproject.github.io/Lists/alt-version/tracking-nl.txt'
|
||||
option urlfilter '1'
|
||||
|
||||
@@ -2,15 +2,22 @@
|
||||
|
||||
. /lib/parentalcontrol/parentalcontrol.sh
|
||||
|
||||
enabled="$(uci -q get parentalcontrol.globals.enable)"
|
||||
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
|
||||
|
||||
# if parentalcontrol is enabled, add the rules, else remove them
|
||||
if [ "$(uci -q get parentalcontrol.globals.enable)" == "1" ]; then
|
||||
if [ "${enabled}" -eq "1" ]; then
|
||||
# this is for urlfilter daemon
|
||||
add_iptables_nfqueue_rules
|
||||
# this for internet_access and profile_bedtime_schedule sections
|
||||
add_internet_schedule_rules
|
||||
if [ "${urlfilter}" -eq "1" ]; then
|
||||
# this for internet_access and profile_bedtime_schedule sections
|
||||
add_internet_schedule_rules
|
||||
fi
|
||||
else
|
||||
# remove urlfilter daemon rules
|
||||
remove_iptables_nfqueue_rules
|
||||
# remove internet_access and profile_bedtime_schedule rules
|
||||
remove_internet_schedule_rules
|
||||
if [ "${urlfilter}" -eq "1" ]; then
|
||||
# remove internet_access and profile_bedtime_schedule rules
|
||||
remove_internet_schedule_rules
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -12,7 +12,8 @@ validate_global_section() {
|
||||
uci_validate_section parentalcontrol globals globals \
|
||||
'enable:bool:1' \
|
||||
'loglevel:uinteger:3' \
|
||||
'bundle_path:string'
|
||||
'bundle_path:string' \
|
||||
'urlfilter:bool'
|
||||
}
|
||||
|
||||
remove_fw_rules() {
|
||||
@@ -23,27 +24,36 @@ remove_fw_rules() {
|
||||
}
|
||||
|
||||
configure_fw_rules() {
|
||||
local enable
|
||||
|
||||
remove_fw_rules
|
||||
local enable urlfilter
|
||||
|
||||
config_load parentalcontrol
|
||||
config_get_bool enable globals enable 0
|
||||
config_get_bool urlfilter globals urlfilter 0
|
||||
|
||||
remove_fw_rules
|
||||
|
||||
if [ "${enable}" -eq "0" ]; then
|
||||
# Parental control is disabled
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Now flush the existing connections, otherwise,
|
||||
# URL filtering cannot be performed on already open sites.
|
||||
if [ -n "$(which conntrack)" ]; then
|
||||
sleep 5
|
||||
conntrack -F
|
||||
if [ "${urlfilter}" -eq "1" ]; then
|
||||
if [ ! -f "${OVERRIDE_JSON}" ]; then
|
||||
# throw error
|
||||
log "ERROR: urlfiltering disabled at compile time but enabled in config"
|
||||
else
|
||||
# Now flush the existing connections, otherwise,
|
||||
# URL filtering cannot be performed on already open sites.
|
||||
if [ -n "$(which conntrack)" ]; then
|
||||
sleep 5
|
||||
conntrack -F
|
||||
fi
|
||||
|
||||
# this is for urlfilter daemon
|
||||
add_iptables_nfqueue_rules
|
||||
fi
|
||||
fi
|
||||
|
||||
# this is for urlfilter daemon
|
||||
add_iptables_nfqueue_rules
|
||||
# this for internet_access and profile_bedtime_schedule sections
|
||||
add_internet_schedule_rules
|
||||
}
|
||||
@@ -68,7 +78,7 @@ copy_dhcp_leases() {
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enable loglevel bundle_path
|
||||
local enable loglevel bundle_path urlfilter
|
||||
|
||||
config_load parentalcontrol
|
||||
validate_global_section
|
||||
@@ -80,6 +90,12 @@ start_service() {
|
||||
# add firewall rules
|
||||
configure_fw_rules
|
||||
|
||||
if [ "${urlfilter}" -eq "1" ]; then
|
||||
enable_urlfilter_dm
|
||||
else
|
||||
disable_urlfilter_dm
|
||||
fi
|
||||
|
||||
# if the router is, for example, upgraded and then it boots up
|
||||
# then /tmp/dhcp.leases will be empty until clients try to get a lease,
|
||||
# in that case, hostnames will not be processed by the daemon,
|
||||
@@ -88,7 +104,7 @@ start_service() {
|
||||
# and will be used as a backup in case /tmp/dhcp.leases is empty
|
||||
copy_dhcp_leases
|
||||
|
||||
procd_open_instance "parentalcontrol_dm"
|
||||
procd_open_instance "parentalcontrol"
|
||||
procd_set_param command nice -n 10 "${PROG}" # Lower priority
|
||||
procd_append_param command -l ${loglevel}
|
||||
procd_set_param respawn
|
||||
@@ -103,7 +119,7 @@ stop_service() {
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
ret=$(ubus call service list '{"name":"parentalcontrol"}' | jsonfilter -qe '@.parentalcontrol.instances.parentalcontrol_dm.running')
|
||||
ret=$(ubus call service list '{"name":"parentalcontrol"}' | jsonfilter -qe '@.parentalcontrol.instances.parentalcontrol.running')
|
||||
if [ "$ret" != "true" ]; then
|
||||
stop
|
||||
start
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
[ ! -f "/etc/config/parentalcontrol" ] && exit 0
|
||||
|
||||
uci -q set parentalcontrol.globals.urlfilter='0'
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
COUNT=1
|
||||
|
||||
add_urlbundle()
|
||||
{
|
||||
local enabled name url
|
||||
|
||||
enabled="${1}"; shift
|
||||
url="${1}"; shift
|
||||
name="${@}"
|
||||
|
||||
uci -q set parentalcontrol.urlbundle_${COUNT}=urlbundle
|
||||
uci -q set parentalcontrol.urlbundle_${COUNT}.enable="${enabled}"
|
||||
uci -q set parentalcontrol.urlbundle_${COUNT}.name="${name}"
|
||||
uci -q set parentalcontrol.urlbundle_${COUNT}.download_url="${url}"
|
||||
|
||||
COUNT="$((COUNT+1))"
|
||||
}
|
||||
|
||||
add_urlbundle "0" "https://blocklistproject.github.io/Lists/alt-version/abuse-nl.txt" "Abuse"
|
||||
add_urlbundle "0" "https://blocklistproject.github.io/Lists/alt-version/ads-nl.txt" "Ads"
|
||||
add_urlbundle "0" "https://blocklistproject.github.io/Lists/alt-version/crypto-nl.txt" "Crypto"
|
||||
add_urlbundle "1" "https://blocklistproject.github.io/Lists/alt-version/drugs-nl.txt" "Drugs"
|
||||
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/everything-nl.txt' "Everything else"
|
||||
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/facebook-nl.txt' 'Facebook/Instagram'
|
||||
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/fraud-nl.txt' 'Fraud'
|
||||
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/gambling-nl.txt' 'Gambling'
|
||||
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/malware-nl.txt' 'Malware'
|
||||
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/phishing-nl.txt' 'Phishing'
|
||||
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/piracy-nl.txt' 'Piracy'
|
||||
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/porn-nl.txt' 'Porn'
|
||||
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/ransomware-nl.txt' 'Ransomware'
|
||||
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/redirect-nl.txt' 'Redirect'
|
||||
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/scam-nl.txt' 'Scam'
|
||||
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/tiktok-nl.txt' 'TikTok'
|
||||
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/torrent-nl.txt' 'Torrent'
|
||||
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/tracking-nl.txt' 'Tracking'
|
||||
|
||||
exit 0
|
||||
@@ -311,6 +311,9 @@ parse_macs_or_hostnames() {
|
||||
local input="$1"
|
||||
local lease_file="/tmp/dhcp.leases"
|
||||
|
||||
[ -f "$lease_file" ] || lease_file="/etc/parentalcontrol/dhcp.leases"
|
||||
[ -f "$lease_file" ] || { log "Error: No DHCP lease file found."; return 1; }
|
||||
|
||||
for item in $input; do
|
||||
case "$item" in
|
||||
??:??:??:??:??:??)
|
||||
@@ -509,3 +512,25 @@ remove_internet_schedule_rules() {
|
||||
ip6tables -w -X parentalcontrol_forward
|
||||
fi
|
||||
}
|
||||
|
||||
OVERRIDE_JSON="/etc/parentalcontrol/urlbundle_override.json"
|
||||
DM_PLUGIN_PATH="/usr/share/bbfdm/micro_services/parentalcontrol/urlbundle_override.json"
|
||||
|
||||
enable_urlfilter_dm() {
|
||||
if [ -f "${DM_PLUGIN_PATH}" ]; then
|
||||
rm ${DM_PLUGIN_PATH}
|
||||
echo "Please restart to apply"
|
||||
fi
|
||||
}
|
||||
|
||||
disable_urlfilter_dm() {
|
||||
mkdir -p "$(dirname ${DM_PLUGIN_PATH})"
|
||||
|
||||
if [ ! -f "${DM_PLUGIN_PATH}" ]; then
|
||||
if [ -f "${OVERRIDE_JSON}" ]; then
|
||||
cp "${OVERRIDE_JSON}" "${DM_PLUGIN_PATH}"
|
||||
echo "Please restart to apply"
|
||||
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -224,6 +224,14 @@ cleanup_bundle_files() {
|
||||
|
||||
# Main handler for all profile URL bundles
|
||||
handle_filter_for_bundles() {
|
||||
local urlfilter
|
||||
|
||||
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
|
||||
if [ "${urlfilter}" -ne "1" ]; then
|
||||
logger -p info "urlbundle not supported"
|
||||
return
|
||||
fi
|
||||
|
||||
ubus -t 20 wait_for bbfdm.parentalcontrol
|
||||
|
||||
if [ "$?" -ne 0 ]; then
|
||||
|
||||
89
parental-control/files/urlbundle_override.json
Normal file
89
parental-control/files/urlbundle_override.json
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"json_plugin_version": 2,
|
||||
"Device.X_IOWRT_EU_ParentalControl.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"DefaultBundles": {
|
||||
"type": "string",
|
||||
"protocols": [
|
||||
"none"
|
||||
],
|
||||
"read": true,
|
||||
"write": false
|
||||
},
|
||||
"MaxBlockHistory": {
|
||||
"type": "unsignedInt",
|
||||
"protocols": [
|
||||
"none"
|
||||
],
|
||||
"read": true,
|
||||
"write": true,
|
||||
"datatype": "unsignedInt"
|
||||
},
|
||||
"BlockHistoryNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"none"
|
||||
],
|
||||
"datatype": "unsignedInt"
|
||||
},
|
||||
"URLBundleNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"none"
|
||||
],
|
||||
"datatype": "unsignedInt"
|
||||
},
|
||||
"Device.X_IOWRT_EU_ParentalControl.BlockHistory.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"none"
|
||||
],
|
||||
"access": false,
|
||||
"array": true
|
||||
},
|
||||
"Device.X_IOWRT_EU_ParentalControl.URLBundle.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"none"
|
||||
],
|
||||
"access": true,
|
||||
"array": true
|
||||
}
|
||||
},
|
||||
"Device.X_IOWRT_EU_ParentalControl.Profile.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": true,
|
||||
"array": true,
|
||||
"URLFilterNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"none"
|
||||
],
|
||||
"datatype": "unsignedInt"
|
||||
},
|
||||
"Device.X_IOWRT_EU_ParentalControl.Profile.{i}.URLFilter.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"none"
|
||||
],
|
||||
"access": true,
|
||||
"array": true
|
||||
}
|
||||
}
|
||||
}
|
||||
85
quickjs-ng/Makefile
Normal file
85
quickjs-ng/Makefile
Normal file
@@ -0,0 +1,85 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=quickjs-ng
|
||||
PKG_VERSION:=2024-07-22
|
||||
PKG_RELEASE:=1
|
||||
|
||||
# Fetch the source from the official git repository
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/quickjs-ng/quickjs.git
|
||||
PKG_SOURCE_VERSION:=HEAD
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_MAINTAINER:=QuickJS-NG Maintainers <maintainers@quickjs-ng.org>
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += -fPIC
|
||||
|
||||
# Configure arguments – QuickJS uses a simple Makefile, no autotools.
|
||||
# We only need to make sure the correct toolchain variables are used.
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CC="$(TARGET_CC)" \
|
||||
AR="$(TARGET_AR)" \
|
||||
LD="$(TARGET_LD)" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
PREFIX="/usr" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)"
|
||||
|
||||
# Package definition
|
||||
|
||||
define Package/quickjs-ng
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=QuickJS-NG – Lightweight JavaScript engine
|
||||
URL:=https://github.com/quickjs-ng/quickjs
|
||||
DEPENDS:=+libatomic
|
||||
endef
|
||||
|
||||
define Package/quickjs-ng/description
|
||||
QuickJS-NG is a modern fork of Fabrice Bellard's QuickJS JavaScript engine.
|
||||
It aims to keep up with the latest ECMAScript features while remaining small
|
||||
and embeddable. This package provides the `qjs` interpreter, the `qjsc`
|
||||
compiler and the shared library that can be linked by third-party software.
|
||||
endef
|
||||
|
||||
# Overwrite the default compile and install steps – QuickJS ships its own Makefile.
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) all install
|
||||
endef
|
||||
|
||||
# Install development files into the staging directory so other packages can
|
||||
# link against QuickJS-NG at build-time.
|
||||
|
||||
define Build/InstallDev
|
||||
# Headers
|
||||
$(INSTALL_DIR) $(1)/usr/include/quickjs
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/include/*.h $(1)/usr/include/quickjs/
|
||||
# Ensure quickjs-libc.h is present (some install targets may omit it)
|
||||
$(CP) $(PKG_BUILD_DIR)/quickjs-libc.h $(1)/usr/include/quickjs/
|
||||
|
||||
# Library
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/lib/libqjs.a $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
# Main runtime package install
|
||||
|
||||
define Package/quickjs-ng/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/qjs $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/qjsc $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/local/lib/libqjs.a $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,quickjs-ng))
|
||||
@@ -38,7 +38,7 @@ define Package/quickjs-websocket
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=WebSocket API for QuickJS
|
||||
MAINTAINER:=Erik Karlsson <erik.karlsson@genexis.eu>
|
||||
DEPENDS:=+quickjs +libwebsockets-openssl
|
||||
DEPENDS:=+quickjs-ng +libwebsockets-openssl
|
||||
endef
|
||||
|
||||
define Package/quickjs-websocket/description
|
||||
|
||||
@@ -930,7 +930,7 @@ static int js_lws_init(JSContext *ctx, JSModuleDef *m)
|
||||
{
|
||||
JSValue proto;
|
||||
|
||||
JS_NewClassID(&js_lws_context_class_id);
|
||||
JS_NewClassID(JS_GetRuntime(ctx), &js_lws_context_class_id);
|
||||
JS_NewClass(JS_GetRuntime(ctx), js_lws_context_class_id,
|
||||
&js_lws_context_class);
|
||||
proto = JS_NewObject(ctx);
|
||||
@@ -938,7 +938,7 @@ static int js_lws_init(JSContext *ctx, JSModuleDef *m)
|
||||
countof(js_lws_context_proto_funcs));
|
||||
JS_SetClassProto(ctx, js_lws_context_class_id, proto);
|
||||
|
||||
JS_NewClassID(&js_lws_wsi_class_id);
|
||||
JS_NewClassID(JS_GetRuntime(ctx), &js_lws_wsi_class_id);
|
||||
JS_NewClass(JS_GetRuntime(ctx), js_lws_wsi_class_id, &js_lws_wsi_class);
|
||||
proto = JS_NewObject(ctx);
|
||||
JS_SetPropertyFunctionList(ctx, proto, js_lws_wsi_proto_funcs,
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=quickjs
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/bellard/quickjs.git
|
||||
PKG_SOURCE_DATE:=2022-03-06
|
||||
PKG_SOURCE_VERSION:=2788d71e823b522b178db3b3660ce93689534e6d
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_LICENSE:=MIT
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/quickjs
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=QuickJS Javascript engine
|
||||
URL:=https://bellard.org/quickjs/
|
||||
MAINTAINER:=Erik Karlsson <erik.karlsson@genexis.eu>
|
||||
DEPENDS:=+libatomic
|
||||
endef
|
||||
|
||||
define Package/quickjs/description
|
||||
QuickJS is a small and embeddable Javascript engine. It supports
|
||||
the ES2020 specification including modules, asynchronous
|
||||
generators, proxies and BigInt.
|
||||
endef
|
||||
|
||||
MAKE_FLAGS = \
|
||||
prefix=/usr \
|
||||
CONFIG_SMALL=y \
|
||||
EXTRA_LIBS="-latomic" \
|
||||
CROSS_PREFIX="$(TARGET_CROSS)"
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib/quickjs
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/quickjs/libquickjs.a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/quickjs/libquickjs.lto.a $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/include/quickjs
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/quickjs/quickjs.h $(1)/usr/include/quickjs/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/quickjs/quickjs-libc.h $(1)/usr/include/quickjs/
|
||||
endef
|
||||
|
||||
define Package/quickjs/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qjs $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,quickjs))
|
||||
@@ -1,87 +0,0 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 49b1f6f..2c96eae 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -33,6 +33,8 @@ CONFIG_LTO=y
|
||||
#CONFIG_WERROR=y
|
||||
# force 32 bit build for some utilities
|
||||
#CONFIG_M32=y
|
||||
+# build with -Os instead of -O2
|
||||
+#CONFIG_SMALL=y
|
||||
|
||||
ifdef CONFIG_DARWIN
|
||||
# use clang instead of gcc
|
||||
@@ -52,6 +54,13 @@ CONFIG_BIGNUM=y
|
||||
|
||||
OBJDIR=.obj
|
||||
|
||||
+CFLAGS_ENV:=$(CFLAGS)
|
||||
+LDFLAGS_ENV:=$(LDFLAGS)
|
||||
+
|
||||
+HOST_BUILD=
|
||||
+CFLAGS=$(if $(HOST_BUILD),,$(CFLAGS_ENV))
|
||||
+LDFLAGS=$(if $(HOST_BUILD),,$(LDFLAGS_ENV))
|
||||
+
|
||||
ifdef CONFIG_WIN32
|
||||
ifdef CONFIG_M32
|
||||
CROSS_PREFIX=i686-w64-mingw32-
|
||||
@@ -66,7 +75,7 @@ endif
|
||||
ifdef CONFIG_CLANG
|
||||
HOST_CC=clang
|
||||
CC=$(CROSS_PREFIX)clang
|
||||
- CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
+ CFLAGS += -g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -Wno-sign-compare
|
||||
CFLAGS += -Wno-missing-field-initializers
|
||||
@@ -87,7 +96,7 @@ ifdef CONFIG_CLANG
|
||||
else
|
||||
HOST_CC=gcc
|
||||
CC=$(CROSS_PREFIX)gcc
|
||||
- CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
+ CFLAGS += -g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||
CFLAGS += -Wno-array-bounds -Wno-format-truncation
|
||||
ifdef CONFIG_LTO
|
||||
AR=$(CROSS_PREFIX)gcc-ar
|
||||
@@ -110,9 +119,13 @@ endif
|
||||
CFLAGS+=$(DEFINES)
|
||||
CFLAGS_DEBUG=$(CFLAGS) -O0
|
||||
CFLAGS_SMALL=$(CFLAGS) -Os
|
||||
+ifdef CONFIG_SMALL
|
||||
+CFLAGS_OPT=$(CFLAGS) -Os
|
||||
+else
|
||||
CFLAGS_OPT=$(CFLAGS) -O2
|
||||
+endif
|
||||
CFLAGS_NOLTO:=$(CFLAGS_OPT)
|
||||
-LDFLAGS=-g
|
||||
+LDFLAGS+=-g
|
||||
ifdef CONFIG_LTO
|
||||
CFLAGS_SMALL+=-flto
|
||||
CFLAGS_OPT+=-flto
|
||||
@@ -195,6 +208,8 @@ qjsc$(EXE): $(OBJDIR)/qjsc.o $(QJS_LIB_OBJS)
|
||||
|
||||
ifneq ($(CROSS_PREFIX),)
|
||||
|
||||
+$(QJSC): HOST_BUILD=1
|
||||
+
|
||||
$(QJSC): $(OBJDIR)/qjsc.host.o \
|
||||
$(patsubst %.o, %.host.o, $(QJS_LIB_OBJS))
|
||||
$(HOST_CC) $(LDFLAGS) -o $@ $^ $(HOST_LIBS)
|
||||
@@ -262,6 +277,8 @@ run-test262-32: $(patsubst %.o, %.m32.o, $(OBJDIR)/run-test262.o $(QJS_LIB_OBJS)
|
||||
$(OBJDIR)/%.o: %.c | $(OBJDIR)
|
||||
$(CC) $(CFLAGS_OPT) -c -o $@ $<
|
||||
|
||||
+$(OBJDIR)/%.host.o: HOST_BUILD=1
|
||||
+
|
||||
$(OBJDIR)/%.host.o: %.c | $(OBJDIR)
|
||||
$(HOST_CC) $(CFLAGS_OPT) -c -o $@ $<
|
||||
|
||||
@@ -286,6 +303,8 @@ $(OBJDIR)/%.check.o: %.c | $(OBJDIR)
|
||||
regexp_test: libregexp.c libunicode.c cutils.c
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -DTEST -o $@ libregexp.c libunicode.c cutils.c $(LIBS)
|
||||
|
||||
+unicode_gen: HOST_BUILD=1
|
||||
+
|
||||
unicode_gen: $(OBJDIR)/unicode_gen.host.o $(OBJDIR)/cutils.host.o libunicode.c unicode_gen_def.h
|
||||
$(HOST_CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJDIR)/unicode_gen.host.o $(OBJDIR)/cutils.host.o
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
diff --git a/quickjs.c b/quickjs.c
|
||||
index 7916013..3936eec 100644
|
||||
--- a/quickjs.c
|
||||
+++ b/quickjs.c
|
||||
@@ -67,6 +67,16 @@
|
||||
#define CONFIG_PRINTF_RNDN
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_PRINTF_RNDN
|
||||
+#if !defined(FE_DOWNWARD) || !defined(FE_UPWARD)
|
||||
+#ifdef CONFIG_BIGNUM
|
||||
+#define CONFIG_DTOA_LIBBF
|
||||
+#else
|
||||
+#error "CONFIG_BIGNUM required if printf is RNDN and there is no fenv support"
|
||||
+#endif
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
/* define to include Atomics.* operations which depend on the OS
|
||||
threads */
|
||||
#if !defined(EMSCRIPTEN)
|
||||
@@ -11299,6 +11309,11 @@ static char *i64toa(char *buf_end, int64_t n, unsigned int base)
|
||||
return q;
|
||||
}
|
||||
|
||||
+/* maximum buffer size for js_dtoa */
|
||||
+#define JS_DTOA_BUF_SIZE 128
|
||||
+
|
||||
+#ifndef CONFIG_DTOA_LIBBF
|
||||
+
|
||||
/* buf1 contains the printf result */
|
||||
static void js_ecvt1(double d, int n_digits, int *decpt, int *sign, char *buf,
|
||||
int rounding_mode, char *buf1, int buf1_size)
|
||||
@@ -11318,9 +11333,6 @@ static void js_ecvt1(double d, int n_digits, int *decpt, int *sign, char *buf,
|
||||
*decpt = atoi(buf1 + n_digits + 2 + (n_digits > 1)) + 1;
|
||||
}
|
||||
|
||||
-/* maximum buffer size for js_dtoa */
|
||||
-#define JS_DTOA_BUF_SIZE 128
|
||||
-
|
||||
/* needed because ecvt usually limits the number of digits to
|
||||
17. Return the number of digits. */
|
||||
static int js_ecvt(double d, int n_digits, int *decpt, int *sign, char *buf,
|
||||
@@ -11429,6 +11441,8 @@ static void js_fcvt(char *buf, int buf_size, double d, int n_digits)
|
||||
js_fcvt1(buf, buf_size, d, n_digits, rounding_mode);
|
||||
}
|
||||
|
||||
+#endif /* CONFIG_DTOA_LIBBF */
|
||||
+
|
||||
/* radix != 10 is only supported with flags = JS_DTOA_VAR_FORMAT */
|
||||
/* use as many digits as necessary */
|
||||
#define JS_DTOA_VAR_FORMAT (0 << 0)
|
||||
@@ -11442,8 +11456,10 @@ static void js_fcvt(char *buf, int buf_size, double d, int n_digits)
|
||||
/* XXX: slow and maybe not fully correct. Use libbf when it is fast enough.
|
||||
XXX: radix != 10 is only supported for small integers
|
||||
*/
|
||||
-static void js_dtoa1(char *buf, double d, int radix, int n_digits, int flags)
|
||||
+static JSValue js_dtoa(JSContext *ctx,
|
||||
+ double d, int radix, int n_digits, int flags)
|
||||
{
|
||||
+ char buf[JS_DTOA_BUF_SIZE];
|
||||
char *q;
|
||||
|
||||
if (!isfinite(d)) {
|
||||
@@ -11465,6 +11481,25 @@ static void js_dtoa1(char *buf, double d, int radix, int n_digits, int flags)
|
||||
ptr = i64toa(buf1 + sizeof(buf1), i64, radix);
|
||||
strcpy(buf, ptr);
|
||||
} else {
|
||||
+#ifdef CONFIG_DTOA_LIBBF
|
||||
+ bf_flags_t bf_flags;
|
||||
+ generic_conv:
|
||||
+ bf_flags = BF_RNDNA;
|
||||
+ switch (flags & 3) {
|
||||
+ case JS_DTOA_VAR_FORMAT:
|
||||
+ bf_flags |= BF_FTOA_FORMAT_FREE_MIN;
|
||||
+ break;
|
||||
+ case JS_DTOA_FIXED_FORMAT:
|
||||
+ bf_flags |= BF_FTOA_FORMAT_FIXED;
|
||||
+ break;
|
||||
+ case JS_DTOA_FRAC_FORMAT:
|
||||
+ bf_flags |= BF_FTOA_FORMAT_FRAC;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (flags & JS_DTOA_FORCE_EXP)
|
||||
+ bf_flags |= BF_FTOA_FORCE_EXP;
|
||||
+ return js_ftoa(ctx, JS_NewFloat64(ctx, d), radix, n_digits, bf_flags);
|
||||
+#else /* CONFIG_DTOA_LIBBF */
|
||||
if (d == 0.0)
|
||||
d = 0.0; /* convert -0 to 0 */
|
||||
if (flags == JS_DTOA_FRAC_FORMAT) {
|
||||
@@ -11528,14 +11563,8 @@ static void js_dtoa1(char *buf, double d, int radix, int n_digits, int flags)
|
||||
sprintf(q, "%d", p);
|
||||
}
|
||||
}
|
||||
+#endif /* CONFIG_DTOA_LIBBF */
|
||||
}
|
||||
-}
|
||||
-
|
||||
-static JSValue js_dtoa(JSContext *ctx,
|
||||
- double d, int radix, int n_digits, int flags)
|
||||
-{
|
||||
- char buf[JS_DTOA_BUF_SIZE];
|
||||
- js_dtoa1(buf, d, radix, n_digits, flags);
|
||||
return JS_NewString(ctx, buf);
|
||||
}
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
diff --git a/quickjs-libc.c b/quickjs-libc.c
|
||||
index e180dd0..76182d2 100644
|
||||
--- a/quickjs-libc.c
|
||||
+++ b/quickjs-libc.c
|
||||
@@ -358,12 +358,89 @@ fail:
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
|
||||
+// For reading files that are not seekable, per second answer from stackoverflow:
|
||||
+// https://stackoverflow.com/questions/14002954/c-programming-how-to-read-the-whole-file-contents-into-a-buffer
|
||||
+
|
||||
+#define READALL_CHUNK 10*1024
|
||||
+
|
||||
+static int readall(FILE *f, JSContext *ctx, uint8_t **dataptr, size_t *sizeptr)
|
||||
+{
|
||||
+ uint8_t *data = NULL, *temp;
|
||||
+ size_t size = 0;
|
||||
+ size_t used = 0;
|
||||
+ size_t n;
|
||||
+
|
||||
+ while (1) {
|
||||
+ if (used + READALL_CHUNK + 1 > size) {
|
||||
+ size = used + READALL_CHUNK + 1;
|
||||
+
|
||||
+ /* Overflow check. Some ANSI C compilers
|
||||
+ may optimize this away, though. */
|
||||
+ if (size <= used) {
|
||||
+ if (ctx)
|
||||
+ js_free(ctx, data);
|
||||
+ else
|
||||
+ free(data);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (ctx)
|
||||
+ temp = js_realloc(ctx, data, size);
|
||||
+ else
|
||||
+ temp = realloc(data, size);
|
||||
+
|
||||
+ if (temp == NULL) {
|
||||
+ if (ctx)
|
||||
+ js_free(ctx, data);
|
||||
+ else
|
||||
+ free(data);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ data = temp;
|
||||
+ }
|
||||
+
|
||||
+ n = fread(data + used, 1, READALL_CHUNK, f);
|
||||
+ if (n == 0)
|
||||
+ break;
|
||||
+
|
||||
+ used += n;
|
||||
+ }
|
||||
+
|
||||
+ if (ferror(f)) {
|
||||
+ if (ctx)
|
||||
+ js_free(ctx, data);
|
||||
+ else
|
||||
+ free(data);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (ctx)
|
||||
+ temp = js_realloc(ctx, data, used + 1);
|
||||
+ else
|
||||
+ temp = realloc(data, used + 1);
|
||||
+
|
||||
+ if (temp == NULL) {
|
||||
+ if (ctx)
|
||||
+ js_free(ctx, data);
|
||||
+ else
|
||||
+ free(data);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ data = temp;
|
||||
+ data[used] = '\0';
|
||||
+
|
||||
+ *dataptr = data;
|
||||
+ *sizeptr = used;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
uint8_t *buf;
|
||||
size_t buf_len;
|
||||
- long lret;
|
||||
+ long lret = 0;
|
||||
|
||||
f = fopen(filename, "rb");
|
||||
if (!f)
|
||||
@@ -371,7 +448,7 @@ uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||
if (fseek(f, 0, SEEK_END) < 0)
|
||||
goto fail;
|
||||
lret = ftell(f);
|
||||
- if (lret < 0)
|
||||
+ if (lret <= 0)
|
||||
goto fail;
|
||||
/* XXX: on Linux, ftell() return LONG_MAX for directories */
|
||||
if (lret == LONG_MAX) {
|
||||
@@ -387,13 +464,19 @@ uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||
buf = malloc(buf_len + 1);
|
||||
if (!buf)
|
||||
goto fail;
|
||||
- if (fread(buf, 1, buf_len, f) != buf_len) {
|
||||
- errno = EIO;
|
||||
+ buf_len = fread(buf, 1, buf_len, f);
|
||||
+ if (ferror(f)) {
|
||||
if (ctx)
|
||||
js_free(ctx, buf);
|
||||
else
|
||||
free(buf);
|
||||
fail:
|
||||
+ // Files in proc and sysfs may not be seekable or may falsely
|
||||
+ // appear to be of zero size. Try to read them in another way.
|
||||
+ if (lret == 0 && readall(f, ctx, &buf, pbuf_len) == 0) {
|
||||
+ fclose(f);
|
||||
+ return buf;
|
||||
+ }
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
@@ -94,6 +94,16 @@
|
||||
"file": "/tmp/dhcp.client.options"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Firewall fw3 reload status",
|
||||
"cmd": "cat /var/log/firewall.log",
|
||||
"dependency" : [
|
||||
{
|
||||
"type": "file",
|
||||
"file": "/var/log/firewall.log"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
if PACKAGE_sshmngr
|
||||
choice
|
||||
prompt "Select backend for SSH management"
|
||||
default SSHMNGR_BACKEND_OPENSSH
|
||||
default SSHMNGR_BACKEND_OPENSSH_PAM
|
||||
depends on PACKAGE_sshmngr
|
||||
help
|
||||
Select which backend daemon to use for SSH
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user