mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-20 01:20:35 +08:00
Compare commits
336 Commits
sysmngr_co
...
for_build
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16c919b1ee | ||
|
|
c68b1c01eb | ||
|
|
a053e7752f | ||
|
|
558bd40b9f | ||
|
|
432969f0bf | ||
|
|
a7dfecba54 | ||
|
|
0ba1417643 | ||
|
|
29d6ad2fbd | ||
|
|
f7ef772ebf | ||
|
|
d0c9d595c8 | ||
|
|
912d98f496 | ||
|
|
8fb1b55e57 | ||
|
|
c5e79244c7 | ||
|
|
499f77d498 | ||
|
|
480c954677 | ||
|
|
9a5564bca4 | ||
|
|
67ee062946 | ||
|
|
7ecdc3ccb4 | ||
|
|
36490a7cda | ||
|
|
1d31c5f795 | ||
|
|
9a934269ae | ||
|
|
82e8c63c88 | ||
|
|
4fe71d66d3 | ||
|
|
74eac091ff | ||
|
|
94cf651a6c | ||
|
|
08f909388c | ||
|
|
148d25caf0 | ||
|
|
8d8cc94cdf | ||
|
|
0d6c7b2f70 | ||
|
|
0623e7017f | ||
|
|
013f820b12 | ||
|
|
9fd4584cdb | ||
|
|
3b3035441e | ||
|
|
38f36f3bdf | ||
|
|
b27646211b | ||
|
|
70b5c78d22 | ||
|
|
2356ed6075 | ||
|
|
39d484817e | ||
|
|
a73c089c2a | ||
|
|
22d9f90528 | ||
|
|
ac93499202 | ||
|
|
4dfc3455fb | ||
|
|
5bc00d53fd | ||
|
|
6ec25f158c | ||
|
|
9817ca11b5 | ||
|
|
ca49dfac97 | ||
|
|
44238e2033 | ||
|
|
e1d4bddbcf | ||
|
|
c6a739ddc0 | ||
|
|
38f657fa84 | ||
|
|
f5488143cd | ||
|
|
cebbf0f860 | ||
|
|
dcac2bd261 | ||
|
|
82c6cca440 | ||
|
|
2a952644c5 | ||
|
|
fac25dc016 | ||
|
|
623e1dc34e | ||
|
|
ed30787ca4 | ||
|
|
d68e0847c4 | ||
|
|
08cb598de4 | ||
|
|
2763ba7656 | ||
|
|
2591116be3 | ||
|
|
06876807c1 | ||
|
|
65344ebdc5 | ||
|
|
7dc743630c | ||
|
|
a8d7adbd1f | ||
|
|
ba215d1d6f | ||
|
|
fdfa1526b8 | ||
|
|
a93bde6fb5 | ||
|
|
4135fbe369 | ||
|
|
e4e63ba991 | ||
|
|
832947703c | ||
|
|
14e5601aed | ||
|
|
d3b2d4d9bf | ||
|
|
8741d7d82e | ||
|
|
910538aad7 | ||
|
|
5f36441b11 | ||
|
|
075728ce3e | ||
|
|
21687b6dc9 | ||
|
|
b5c2667d68 | ||
|
|
589c856cb7 | ||
|
|
e819a32cd7 | ||
|
|
bc8c70f7d0 | ||
|
|
fb17c3f51b | ||
|
|
0dfd361033 | ||
|
|
6d31feaa00 | ||
|
|
9df2d4b15e | ||
|
|
b91ae7f7f0 | ||
|
|
6df1768244 | ||
|
|
0a7245d2f9 | ||
|
|
6166ba0041 | ||
|
|
02577401c7 | ||
|
|
eccfd8970a | ||
|
|
7097827eb8 | ||
|
|
29e9ba389a | ||
|
|
4c6f70342a | ||
|
|
4708da4734 | ||
|
|
55aba515ff | ||
|
|
b1c9ce0d25 | ||
|
|
d3ae8b5020 | ||
|
|
ca962744b8 | ||
|
|
31c7500042 | ||
|
|
e71ee20840 | ||
|
|
38763bfc0d | ||
|
|
a43e3530c9 | ||
|
|
86ede4ab6b | ||
|
|
d234e7adcc | ||
|
|
e7e5ede6b9 | ||
|
|
476aee97a6 | ||
|
|
784c6553d8 | ||
|
|
e2883f0f45 | ||
|
|
30d01926a8 | ||
|
|
f6510849d6 | ||
|
|
d49e72be07 | ||
|
|
35e9ed9b1b | ||
|
|
e66516242a | ||
|
|
4affd50d2c | ||
|
|
06dec89452 | ||
|
|
130dbeacd5 | ||
|
|
d576d81b1f | ||
|
|
ee6edfa5a9 | ||
|
|
2f8c5e3f53 | ||
|
|
5c0010edf8 | ||
|
|
001eb7e0a3 | ||
|
|
a2209f555b | ||
|
|
8c09e8658e | ||
|
|
1d85f324a4 | ||
|
|
65926415ad | ||
|
|
50e865df53 | ||
|
|
cf352e9990 | ||
|
|
ecec95ca57 | ||
|
|
9a051abbf1 | ||
|
|
d3b5d8d598 | ||
|
|
3c4bbfb6d6 | ||
|
|
0122493c01 | ||
|
|
6098c3ab56 | ||
|
|
252c98c4ef | ||
|
|
5ea17980c8 | ||
|
|
3ba06fa10f | ||
|
|
013086f558 | ||
|
|
3a8f8d604f | ||
|
|
8612f5d4f6 | ||
|
|
6aef37d406 | ||
|
|
753dc05320 | ||
|
|
74878254b7 | ||
|
|
4f2697217a | ||
|
|
e36a9bc381 | ||
|
|
a52d654c4f | ||
|
|
6cf5641ea7 | ||
|
|
bce378a665 | ||
|
|
9952f6e580 | ||
|
|
7d0b38b9a7 | ||
|
|
3a503ea955 | ||
|
|
13cac21c60 | ||
|
|
f251701534 | ||
|
|
5b882870c9 | ||
|
|
25f3acf2fd | ||
|
|
c1fe6b05a6 | ||
|
|
4ee9169771 | ||
|
|
7172201515 | ||
|
|
c366451def | ||
|
|
5874a005c6 | ||
|
|
ffab63b86f | ||
|
|
929dd55d21 | ||
|
|
3636e217a6 | ||
|
|
b99d4413dc | ||
|
|
f2f6f6b787 | ||
|
|
f2ea1049e0 | ||
|
|
ba837ff98a | ||
|
|
324244d26b | ||
|
|
0cded2b974 | ||
|
|
27f0f7454f | ||
|
|
3ff559907b | ||
|
|
d73f8975cf | ||
|
|
3ddf258a74 | ||
|
|
cd2c817223 | ||
|
|
370c5938aa | ||
|
|
ddd88a894c | ||
|
|
459f2571ec | ||
|
|
c555b48d16 | ||
|
|
6a0f353c93 | ||
|
|
21e742d9f7 | ||
|
|
f4654e78c5 | ||
|
|
72c3e3c8ce | ||
|
|
1adf7b669f | ||
|
|
39ec8635c3 | ||
|
|
5a3fbb7902 | ||
|
|
5ecc3945f9 | ||
|
|
8a52715ad1 | ||
|
|
8333a499d0 | ||
|
|
941a46dae6 | ||
|
|
86d7bf8c67 | ||
|
|
4ef5d86feb | ||
|
|
c97637fd5f | ||
|
|
033613f999 | ||
|
|
b18f6dc39c | ||
|
|
5f5b171d5a | ||
|
|
469e9d1196 | ||
|
|
53b824d2e0 | ||
|
|
4df9b5ab94 | ||
|
|
130cf8fd53 | ||
|
|
bfd327ca02 | ||
|
|
bcea816742 | ||
|
|
ee6a27dc76 | ||
|
|
78eb76e913 | ||
|
|
21c3354b31 | ||
|
|
dcfa48d1f7 | ||
|
|
56d352fc83 | ||
|
|
56093ef532 | ||
|
|
60f1d0edbf | ||
|
|
c2021e765a | ||
|
|
83c31acbc7 | ||
|
|
9380411fa6 | ||
|
|
2a47619b32 | ||
|
|
f2c665a0cf | ||
|
|
1dca89c130 | ||
|
|
63d3ca365b | ||
|
|
fa4f08aa29 | ||
|
|
858dd78ff7 | ||
|
|
eb0e19355d | ||
|
|
4015982a87 | ||
|
|
0b6e35e36b | ||
|
|
cca03dc995 | ||
|
|
3d69811bf4 | ||
|
|
5a7e44cd04 | ||
|
|
b883f2b310 | ||
|
|
97a845fda2 | ||
|
|
21cdf07e54 | ||
|
|
13094c3a1b | ||
|
|
d3cb6a70da | ||
|
|
19570e553d | ||
|
|
50e2add3ab | ||
|
|
e33340ea8d | ||
|
|
6b882610c2 | ||
|
|
383dedb443 | ||
|
|
a8a2066675 | ||
|
|
73dfc49647 | ||
|
|
083cbd7b56 | ||
|
|
e87bcbb819 | ||
|
|
f8561996ab | ||
|
|
01d320300e | ||
|
|
3faecd3979 | ||
|
|
984962e34e | ||
|
|
6140bfa09c | ||
|
|
2cbb433cbd | ||
|
|
c676cde1fb | ||
|
|
363c2ff155 | ||
|
|
2a2650b43e | ||
|
|
a5c13c4ae7 | ||
|
|
bf40d37745 | ||
|
|
8889d06568 | ||
|
|
e7d2f54bda | ||
|
|
1e31d2accd | ||
|
|
1e08854dce | ||
|
|
cb27d96fe6 | ||
|
|
943667adc6 | ||
|
|
89b2c6ab19 | ||
|
|
760cd38113 | ||
|
|
1abc312d2c | ||
|
|
09abf6d6b1 | ||
|
|
fa203d73e0 | ||
|
|
880741d8c3 | ||
|
|
42bd6390b5 | ||
|
|
c9856f2a5b | ||
|
|
c086f72400 | ||
|
|
a50c380722 | ||
|
|
2755d6be1c | ||
|
|
359db9ddc3 | ||
|
|
e4f3daf1ed | ||
|
|
557ea195ba | ||
|
|
1c14d9f652 | ||
|
|
b8ebda638c | ||
|
|
db089a3920 | ||
|
|
4110c22f64 | ||
|
|
5b07fcce33 | ||
|
|
2219f2efba | ||
|
|
ba3b00c784 | ||
|
|
9598258993 | ||
|
|
32ab2eb2cc | ||
|
|
63c27601e5 | ||
|
|
f2d4b6ff7d | ||
|
|
e945226956 | ||
|
|
9a7ff0bbf2 | ||
|
|
97830621a6 | ||
|
|
1c77fb2e76 | ||
|
|
67c4a3c317 | ||
|
|
7f17359913 | ||
|
|
b6212b90d8 | ||
|
|
74cbe1062a | ||
|
|
2be4eeebb7 | ||
|
|
a49407ad79 | ||
|
|
24737321b0 | ||
|
|
3a72a7ee61 | ||
|
|
d9b6136916 | ||
|
|
537e1758c3 | ||
|
|
c6bbe14c6f | ||
|
|
8af265a689 | ||
|
|
193a6cf502 | ||
|
|
d6c148f7e3 | ||
|
|
afdc0006b5 | ||
|
|
2cb0f6e159 | ||
|
|
db72ee376e | ||
|
|
2bbeb83eb2 | ||
|
|
f718adf692 | ||
|
|
2aaf56ac6d | ||
|
|
426cc077e0 | ||
|
|
879e549581 | ||
|
|
78f6198d0a | ||
|
|
6ddaa150b4 | ||
|
|
9188a99c99 | ||
|
|
352a56448e | ||
|
|
5c7fea694f | ||
|
|
5474007dcf | ||
|
|
320d155a96 | ||
|
|
73f91e09db | ||
|
|
36d2b24bae | ||
|
|
f9010d9ef1 | ||
|
|
aeda3280b3 | ||
|
|
5e3b30daa8 | ||
|
|
ee2165b184 | ||
|
|
1b7fa8ba15 | ||
|
|
052dc52801 | ||
|
|
4373ec21aa | ||
|
|
892e0f3599 | ||
|
|
d9a742b734 | ||
|
|
9e1a8de1bd | ||
|
|
73c8e7eb75 | ||
|
|
41ba4fcedc | ||
|
|
b673daf265 | ||
|
|
06b9f7eb00 | ||
|
|
092026794e | ||
|
|
0bc9dd365f | ||
|
|
f4eb3ec090 | ||
|
|
7596b3b4f4 | ||
|
|
d546e1699f | ||
|
|
fe4a859af6 |
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.15.4
|
||||
PKG_VERSION:=1.15.29
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=1c417534a8a72d5370414f74b693e226ce96af0f
|
||||
PKG_SOURCE_VERSION:=08cf6a9725b34c0421f2ee8f762aa1878b8cca1f
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -70,6 +70,15 @@ define Package/bbfdmd/config
|
||||
source "$(SOURCE)/Config_bbfdmd.in"
|
||||
endef
|
||||
|
||||
# Below config is a hack to force-recompile dependent micro-services
|
||||
define Package/libbbfdm-api/config
|
||||
if PACKAGE_bbfdmd
|
||||
config BBF_LIBBBFDM_VERSION
|
||||
string "Internal config variable to force recompile"
|
||||
default "v${PKG_VERSION}"
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-api/description
|
||||
Library contains the API(UCI, UBUS, JSON, CLI and Browse) of libbbfdm
|
||||
endef
|
||||
@@ -146,6 +155,10 @@ define Package/bbfdmd/install
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/91-fix-bbfdmd-enabled-option $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/ruleng.bbfdm $(1)/etc/uci-defaults
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/ruleng
|
||||
$(INSTALL_BIN) ./files/etc/ruleng/bbfdm.json $(1)/etc/ruleng
|
||||
endef
|
||||
|
||||
define Package/dm-service/install
|
||||
|
||||
@@ -6,6 +6,7 @@ BBFDM_BASE_DM_PATH=/usr/share/bbfdm
|
||||
BBFDM_INPUT_PATH=/etc/bbfdm/micro_services
|
||||
BBFDM_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
PKG_CONFIG_DEPENDS += CONFIG_BBF_LIBBBFDM_VERSION
|
||||
#BBFDM_VERSION:=$(shell grep -oP '(?<=^PKG_VERSION:=).*' ${BBFDM_DIR}/Makefile)
|
||||
#BBFDM_TOOLS:=$(BUILD_DIR)/bbfdm-$(BBFDM_VERSION)/tools
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
"firewall",
|
||||
"network",
|
||||
"dhcp",
|
||||
"stunc",
|
||||
"xmpp",
|
||||
"wireless",
|
||||
"time"
|
||||
]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
config bbfdmd 'bbfdmd'
|
||||
option enable '1'
|
||||
option debug '0'
|
||||
option loglevel '4'
|
||||
option loglevel '3'
|
||||
|
||||
config micro_services 'micro_services'
|
||||
option enable '1'
|
||||
|
||||
62
bbfdm/files/etc/ruleng/bbfdm.json
Normal file
62
bbfdm/files/etc/ruleng/bbfdm.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"hosts_refresh": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "host"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"object": "bbfdm.hostmngr",
|
||||
"method":"refresh_references_db",
|
||||
"args" : {},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"dhcp_refresh": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "host"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"object": "bbfdm.dhcpmngr",
|
||||
"method":"refresh_references_db",
|
||||
"args" : {},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"ieee1905_refresh_add": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "ieee1905.neighbor.add"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"object": "bbfdm.ieee1905",
|
||||
"method":"refresh_references_db",
|
||||
"args" : {},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"ieee1905_refresh_del": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "ieee1905.neighbor.del"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"object": "bbfdm.ieee1905",
|
||||
"method":"refresh_references_db",
|
||||
"args" : {},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -51,10 +51,6 @@ parse_bbfdm_sysctl_conf_file() {
|
||||
|
||||
# Replace the original file with the modified content
|
||||
mv "$tmpfile" "${bbfdm_sysctl_conf}"
|
||||
|
||||
# Apply the changes
|
||||
uci commit network
|
||||
sysctl -e -p "${bbfdm_sysctl_conf}" >&-
|
||||
}
|
||||
|
||||
parse_bbfdm_sysctl_conf_file
|
||||
|
||||
2
bbfdm/files/etc/uci-defaults/ruleng.bbfdm
Normal file
2
bbfdm/files/etc/uci-defaults/ruleng.bbfdm
Normal file
@@ -0,0 +1,2 @@
|
||||
uci -q set ruleng.bbfdm=rule
|
||||
uci -q set ruleng.bbfdm.recipe='/etc/ruleng/bbfdm.json'
|
||||
@@ -12,6 +12,7 @@ DEST=""
|
||||
VENDOR_EXTN=""
|
||||
TOOLS="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
SRC=""
|
||||
EXTRA_DATA=""
|
||||
|
||||
while getopts ":mpsdtv:" opt; do
|
||||
case ${opt} in
|
||||
@@ -46,6 +47,9 @@ shift
|
||||
DEST="${1}"
|
||||
shift
|
||||
DATA="${1}"
|
||||
shift
|
||||
EXTRA_DATA="${1}"
|
||||
|
||||
|
||||
install_bin() {
|
||||
if ! install -m0755 ${1} ${2}; then
|
||||
@@ -144,8 +148,9 @@ if [ "${INPUT_FILE}" -eq "1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${DATA}" ]; then
|
||||
echo "# Package name not provided ...."
|
||||
service_name="$(cat ${SRC}|jq -r '.daemon.service_name')"
|
||||
if [ -z "${service_name}" ]; then
|
||||
echo "# service_name not defined in service json ...."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -156,7 +161,7 @@ if [ "${INPUT_FILE}" -eq "1" ]; then
|
||||
fi
|
||||
|
||||
install_dir ${DEST}/etc/bbfdm/services
|
||||
install_data ${tempfile} ${DEST}/etc/bbfdm/services/${DATA}.json
|
||||
install_data ${tempfile} ${DEST}/etc/bbfdm/services/${service_name}.json
|
||||
|
||||
if [ -f "${tempfile}" ]; then
|
||||
rm ${tempfile}
|
||||
@@ -176,7 +181,7 @@ if [ "${MICRO_SERVICE}" -eq "1" ]; then
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}.${extn##*.}
|
||||
else
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}/$(basename ${SRC})
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}/$(printf "%02d" ${EXTRA_DATA})$(basename ${SRC})
|
||||
fi
|
||||
else
|
||||
if [ "${PLUGIN}" -eq "1" ]; then
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bridgemngr
|
||||
PKG_VERSION:=1.0.11
|
||||
PKG_VERSION:=1.0.14
|
||||
|
||||
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:=18c2921a1cf5bfa027c11c5e6ca605ef69fd1168
|
||||
PKG_SOURCE_VERSION:=99bc3a3a0a2571917eda7085c21952f779fdb471
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -59,8 +59,8 @@ define Package/bridgemngr/install
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libbridgemngr.so $(1) $(PKG_NAME)
|
||||
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_EXT), y)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libbridgeext.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) -v ${VENDOR_PREFIX} ./files/VLAN_Filtering_Extension.json $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libbridgeext.so $(1) $(PKG_NAME) 10
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) -v ${VENDOR_PREFIX} ./files/VLAN_Filtering_Extension.json $(1) $(PKG_NAME) 11
|
||||
endif
|
||||
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bridging $(1)/etc/init.d/
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulkdata
|
||||
PKG_VERSION:=2.1.19
|
||||
PKG_VERSION:=2.1.20
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bulkdata.git
|
||||
PKG_SOURCE_VERSION:=628525b02ae9ccd39f4bc85cf616ed4a102bca48
|
||||
PKG_SOURCE_VERSION:=a5e57962938ca143ede65d92be90b6e9fce66e15
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
"enable": "1",
|
||||
"service_name": "bulkdata",
|
||||
"unified_daemon": true,
|
||||
"proto": "cwmp",
|
||||
"services": [
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "BulkData",
|
||||
"proto": "cwmp"
|
||||
"object": "BulkData"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddnsmngr
|
||||
PKG_VERSION:=1.0.10
|
||||
PKG_VERSION:=1.0.11
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ddnsmngr.git
|
||||
PKG_SOURCE_VERSION:=5144e73fad92d23ae706894a4357436c3fe89355
|
||||
PKG_SOURCE_VERSION:=9f2f4dabc71c4f405b1c5df576d20d793d299e94
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
#
|
||||
# Copyright (C) 2021-2023 IOPSYS Software Solutions AB
|
||||
# Copyright (C) 2021-2024 IOPSYS Software Solutions AB
|
||||
# Copyright (C) 2025 Genexis AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=decollector
|
||||
PKG_VERSION:=6.2.0.1
|
||||
PKG_VERSION:=6.2.1.3
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=575ecfff3779aadcea83d890ba975109c0f7d6a3
|
||||
PKG_SOURCE_VERSION:=40b6d6183a282bb8f48b3cf554691f54b5928ecf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@genexis.eu>
|
||||
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
@@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.7.3
|
||||
PKG_VERSION:=3.7.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=393dfd7637fdeccc24ef286c3daec9a232896b98
|
||||
PKG_SOURCE_VERSION:=289a91b3e7f221f16c976efd147bd4b203420b41
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -56,11 +56,14 @@ endif
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DIR) $(1)/etc/dspg
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app/dectmngr $(1)/usr/sbin/
|
||||
$(STRIP) $(1)/usr/sbin/dectmngr
|
||||
ifeq ($(CONFIG_TARGET_airoha),)
|
||||
$(CP) ./firmware/common/* $(1)/etc/dspg/
|
||||
endif
|
||||
$(CP) ./files/etc/* $(1)/etc/
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/dect $(1)/lib/upgrade/keep.d/dect
|
||||
endef
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
config dect 'global'
|
||||
option log_dect_cmbs 'syslog'
|
||||
option log_level 'realtime,warning,error'
|
||||
option log_dect_cmbs 'syslog'
|
||||
option log_level 'realtime,warning,error'
|
||||
|
||||
config dect 'base'
|
||||
option enable '1'
|
||||
|
||||
@@ -11,6 +11,25 @@ LOG_PATH=/var/log/dectmngr
|
||||
DB_PATH=/etc/dect
|
||||
DCX81_UART_DT_ALIAS=/proc/device-tree/aliases/dcx81-uart
|
||||
|
||||
get_extension_shift() {
|
||||
local dect_exts
|
||||
|
||||
get_dect_extension() {
|
||||
local ext=$1
|
||||
local type
|
||||
|
||||
config_get type $ext type
|
||||
|
||||
[ "$type" == "dect" ] && echo $ext
|
||||
}
|
||||
|
||||
config_load "asterisk"
|
||||
|
||||
dect_exts=$(config_foreach get_dect_extension "extension" |sort |head -n1)
|
||||
|
||||
echo "${dect_exts#extension}"
|
||||
}
|
||||
|
||||
# Ask dectmngr to exit nicely and wait for it to clean up, which is a slow process.
|
||||
stop_and_wait_dectmngr() {
|
||||
dect_pid=$(pidof $PROG)
|
||||
@@ -38,13 +57,53 @@ get_dcx81_device() {
|
||||
device_name_line="$(grep '^DEVNAME=' "$uevent_file")" || return 1
|
||||
readonly device="/dev/${device_name_line##DEVNAME=}"
|
||||
[ -c "$device" ] || return 1
|
||||
printf "%s" "$device"
|
||||
printf "%s" "$(basename $device)"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
check_dcx81_firmware() {
|
||||
local dcx81_uart=$1
|
||||
local fw_link="/lib/firmware/dcx81_firmware"
|
||||
local fw_file
|
||||
|
||||
[ -L "$fw_link" ] || return
|
||||
|
||||
fw_file=$(readlink -f $fw_link)
|
||||
[ -f "$fw_file" ] || return
|
||||
|
||||
# the symbolic link is not needed
|
||||
rm -f $fw_link
|
||||
|
||||
eval $(/sbin/cmbs_tcx -comname "$dcx81_uart" -fw_version |grep DCX81_FW_Version)
|
||||
[ -n "$DCX81_FW_Version" ] || return
|
||||
|
||||
if echo $(basename $fw_file) | grep -qi "$DCX81_FW_Version" ; then
|
||||
logger -t "$PROG" "DCX81 running expected $DCX81_FW_Version"
|
||||
return;
|
||||
fi
|
||||
|
||||
logger -t "$PROG" "DCX81 firmware upgrading to $fw_file"
|
||||
/sbin/cmbs_tcx -comname "$dcx81_uart" -fwu "$fw_file" 2>&1 >/dev/null &
|
||||
|
||||
echo -n "Updrading DCX81 firmware.." >/dev/console
|
||||
local wait_time=0
|
||||
while pidof cmbs_tcx >/dev/null && [ "$wait_time" -lt "200" ] ; do
|
||||
sleep 5
|
||||
wait_time=$(($wait_time + 5))
|
||||
echo -n "." >/dev/console
|
||||
done
|
||||
|
||||
if pidof cmbs_tcx >/dev/null ; then
|
||||
killall -9 cmbs_tcx
|
||||
logger -t "$PROG" "DCX81 firmware upgrade timeout"
|
||||
else
|
||||
logger -t "$PROG" "DCX81 firmware upgrade done"
|
||||
fi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local opt_ext=
|
||||
local rfpi=
|
||||
@@ -59,9 +118,13 @@ start_service() {
|
||||
local dcx81_uart_device
|
||||
if ! dcx81_uart_device="$(get_dcx81_device)"; then
|
||||
logger -t "$PROG" -p daemon.warning "Could not determine DCX81 UART device. Falling back to default ttyH0."
|
||||
dcx81_uart_device=/dev/ttyH0
|
||||
dcx81_uart_device="ttyH0"
|
||||
fi
|
||||
|
||||
check_dcx81_firmware $dcx81_uart_device
|
||||
|
||||
opt_ext="-extensionShift $(get_extension_shift)"
|
||||
|
||||
rfpi=$(db -q get hw.board.dect_rfpi)
|
||||
[ -n "$rfpi" -a ${#rfpi} -eq 14 ] && opt_ext="$opt_ext -rfpi $rfpi"
|
||||
|
||||
@@ -77,24 +140,27 @@ start_service() {
|
||||
|
||||
config_load dect
|
||||
config_get log_dect_cmbs global log_dect_cmbs syslog
|
||||
config_get pcm_slot_start global pcm_slot_start
|
||||
config_get pcm_fsync global pcm_fsync
|
||||
|
||||
[ -n "$pcm_fsync" ] && opt_ext="$opt_ext -sync $pcm_fsync"
|
||||
[ -n "$pcm_slot_start" ] && opt_ext="$opt_ext -slotsShift $pcm_slot_start"
|
||||
|
||||
procd_open_instance
|
||||
|
||||
# dectmngr takes expects device without /dev
|
||||
readonly dcx81_uart_device_wo_dev="${dcx81_uart_device##/dev/}"
|
||||
case "$log_dect_cmbs" in
|
||||
none)
|
||||
echo "Starting dectmngr with cmbs logging disabled"
|
||||
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" $opt_ext
|
||||
procd_set_param command "$PROG" -comname "$dcx81_uart_device" $opt_ext
|
||||
rm -f $LOG_PATH/*
|
||||
;;
|
||||
file)
|
||||
echo "Starting dectmngr with cmbs logging enabled to file"
|
||||
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" -log $LOG_PATH/dect-cmbs.log $opt_ext
|
||||
procd_set_param command "$PROG" -comname "$dcx81_uart_device" -log $LOG_PATH/dect-cmbs.log $opt_ext
|
||||
;;
|
||||
*)
|
||||
echo "Starting dectmngr with cmbs logging enabled to syslog"
|
||||
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" -syslog $opt_ext
|
||||
procd_set_param command "$PROG" -comname "$dcx81_uart_device" -syslog $opt_ext
|
||||
rm -f $LOG_PATH/*
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dhcpmngr
|
||||
PKG_VERSION:=1.0.5
|
||||
PKG_VERSION:=1.0.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dhcpmngr.git
|
||||
PKG_SOURCE_VERSION:=2a517188211849bcc324a9f9727eeb34d076c032
|
||||
PKG_SOURCE_VERSION:=986f66608959f4f589009d580b046e250d8c620d
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -10,7 +10,6 @@ uci -q get dhcp.odhcpd >/dev/null 2>&1 && {
|
||||
[ -e /usr/lib/unbound/odhcpd.sh ] && [ -e /usr/sbin/unbound ] && {
|
||||
# then set unbound script as leasetrigger in dhcp UCI
|
||||
uci -q set dhcp.odhcpd.leasetrigger='/usr/lib/unbound/odhcpd.sh'
|
||||
uci commit dhcp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dnsmngr
|
||||
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/network/dnsmngr.git
|
||||
PKG_SOURCE_VERSION:=32bd2501fca8a4f45ba13ee0e4762756c60fe721
|
||||
PKG_SOURCE_VERSION:=2ceb76e98cf23a8d52ab3f464d38d62385311a87
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -72,7 +72,7 @@ define Package/dnsmngr/install
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libdnsmngr.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_SCRIPT) -d $(PKG_BUILD_DIR)/scripts/nslookup $(1)
|
||||
ifeq ($(CONFIG_DNSMNGR_DNS_SD),y)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libdns_sd.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libdns_sd.so $(1) $(PKG_NAME) 10
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethmngr
|
||||
PKG_VERSION:=3.0.5
|
||||
PKG_VERSION:=3.0.7
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/ethmngr.git
|
||||
PKG_SOURCE_VERSION:=01e1c5f6642a8fa79fc445c71558ad02bda40eb5
|
||||
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
|
||||
PKG_SOURCE_VERSION:=171cf63d972c6fa81b97281531e457a0967c16c7
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$PORT" -a -n "$LINK" ] || exit 0
|
||||
|
||||
case "$PORT" in
|
||||
# do not generate ethport ubus event
|
||||
# for wifi, dsl and brige devices
|
||||
wl*|wds*|atm*|ptm*|br-*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
speed=0
|
||||
duplex=full
|
||||
|
||||
if [ "$LINK" = "up" ]; then
|
||||
devspeed="$(ubus -t 2 call network.device status "{\"name\":\"$PORT\"}" | jsonfilter -e @.speed)"
|
||||
speed=${devspeed:0:-1}
|
||||
duplex=${devspeed:0-1}
|
||||
[ "$duplex" == "H" ] && duplex="half" || duplex="full"
|
||||
fi
|
||||
|
||||
ubus send ethport "{\"ifname\":\"$PORT\",\"link\":\"$LINK\",\"speed\":\"$speed\",\"duplex\":\"$duplex\"}"
|
||||
23
ethmngr/files/etc/ruleng/ethport.json
Normal file
23
ethmngr/files/etc/ruleng/ethport.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"ethport_update": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "network.device",
|
||||
"match": {
|
||||
"wireless": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"cli": "/sbin/hotplug-call ethernet",
|
||||
"envs": {
|
||||
"PORT": "&network.device->ifname",
|
||||
"LINK": "&network.device->link"
|
||||
},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
2
ethmngr/files/etc/uci-defaults/ruleng.ethport
Normal file
2
ethmngr/files/etc/uci-defaults/ruleng.ethport
Normal file
@@ -0,0 +1,2 @@
|
||||
uci -q set ruleng.ethport=rule
|
||||
uci -q set ruleng.ethport.recipe='/etc/ruleng/ethport.json'
|
||||
@@ -7,7 +7,11 @@ USE_PROCD=1
|
||||
. /lib/port-trigger/port_trigger.sh
|
||||
|
||||
start_service() {
|
||||
port_trigger_handling
|
||||
port_trigger_add
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
port_trigger_clean
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
@@ -17,5 +21,6 @@ service_triggers()
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
@@ -119,18 +119,12 @@ process_port_trigger() {
|
||||
fi
|
||||
}
|
||||
|
||||
port_trigger_handling() {
|
||||
port_trigger_add() {
|
||||
rm /tmp/port_trigger_iptables 2> /dev/null
|
||||
rm /tmp/port_trigger_ip6tables 2> /dev/null
|
||||
touch /tmp/port_trigger_iptables
|
||||
touch /tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -F prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t filter -F forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t nat -F prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "ip6tables -w -t nat -F prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
echo "ip6tables -w -t filter -F forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -N prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t nat -I PREROUTING -j prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
@@ -139,7 +133,7 @@ port_trigger_handling() {
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t filter -I forwarding_wan_rule -j forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t nat -N prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t nat -I prerouting_wan_rule -j prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t nat -A prerouting_wan_rule -j prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
|
||||
echo "ip6tables -w -t nat -N prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
ret=$?
|
||||
@@ -155,3 +149,21 @@ port_trigger_handling() {
|
||||
sh /tmp/port_trigger_iptables
|
||||
sh /tmp/port_trigger_ip6tables
|
||||
}
|
||||
|
||||
port_trigger_clean() {
|
||||
iptables -w -t nat -D PREROUTING -j prerouting_porttrigger 2> /dev/null
|
||||
iptables -w -t nat -F prerouting_porttrigger 2> /dev/null
|
||||
iptables -w -t nat -X prerouting_porttrigger 2> /dev/null
|
||||
iptables -w -t nat -D prerouting_wan_rule -j prerouting_wan_porttrigger 2> /dev/null
|
||||
iptables -w -t nat -F prerouting_wan_porttrigger 2> /dev/null
|
||||
iptables -w -t nat -X prerouting_wan_porttrigger 2> /dev/null
|
||||
iptables -w -t filter -D forwarding_wan_rule -j forwarding_wan_porttrigger 2> /dev/null
|
||||
iptables -w -t filter -F forwarding_wan_porttrigger 2> /dev/null
|
||||
iptables -w -t filter -X forwarding_wan_porttrigger 2> /dev/null
|
||||
ip6tables -w -t nat -D PREROUTING -j prerouting_porttrigger 2> /dev/null
|
||||
ip6tables -w -t nat -F prerouting_porttrigger 2> /dev/null
|
||||
ip6tables -w -t nat -X prerouting_porttrigger 2> /dev/null
|
||||
ip6tables -w -t filter -D forwarding_wan_rule -j forwarding_wan_porttrigger 2> /dev/null
|
||||
ip6tables -w -t filter -F forwarding_wan_porttrigger 2> /dev/null
|
||||
ip6tables -w -t filter -X forwarding_wan_porttrigger 2> /dev/null
|
||||
}
|
||||
|
||||
5
fluent-bit/Config.in
Normal file
5
fluent-bit/Config.in
Normal file
@@ -0,0 +1,5 @@
|
||||
config FLUENT_BIT_SYSLOG_PREPEND_LENGTH
|
||||
bool "Enable syslog length prefix (RFC5424)"
|
||||
default y
|
||||
help
|
||||
If enabled, prepends the byte-length of the syslog message to the message output.
|
||||
@@ -1,18 +1,19 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS
|
||||
# Copyright (C) 2024-2025 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fluent-bit
|
||||
PKG_VERSION:=3.1.0
|
||||
PKG_VERSION:=4.0.2
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit/archive/v$(PKG_VERSION)
|
||||
PKG_HASH:=7a49e110cf3050b6c29c911063494b8081f3c743274d1d95e52562d0476ba1eb
|
||||
PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit/archive/refs/tags/
|
||||
PKG_HASH:=aa0577ba7251081c8d5398b2a905b5b0585bb657ca13b39a5e12931437516f08
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
@@ -23,7 +24,7 @@ include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/fluent-bit
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:= +libyaml +libopenssl +libcurl +libatomic +musl-fts +flex +bison
|
||||
DEPENDS:= +libyaml +libopenssl +libcurl +libatomic +musl-fts +flex +bison +libstdcpp +@OPENSSL_WITH_NPN
|
||||
TITLE:=Fluent-Bit
|
||||
URL:=https://fluentbit.io/
|
||||
endef
|
||||
@@ -32,6 +33,10 @@ define Package/fluent-bit/description
|
||||
Fluent Bit is a super fast, lightweight, and highly scalable logging and metrics processor and forwarder.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ./fluent-bit/* $(PKG_BUILD_DIR)/
|
||||
@@ -45,16 +50,23 @@ CMAKE_OPTIONS+= \
|
||||
-DFLB_RELEASE=Yes \
|
||||
-DFLB_SMALL=No \
|
||||
-DEXCLUDE_FROM_ALL=true \
|
||||
-DFLB_SHARED_LIBS=Yes \
|
||||
-DFLB_SHARED_LIB=Yes \
|
||||
-DFLB_DEBUG=Yes \
|
||||
-DFLB_ALL=No \
|
||||
-DFLB_JEMALLOC=No \
|
||||
-DFLB_EXAMPLES=No \
|
||||
-DFLB_CHUNK_TRACE=No \
|
||||
-DFLB_BACKTRACE=No \
|
||||
-DFLB_KAFKA=No \
|
||||
-DFLB_WASM=No \
|
||||
-DFLB_LUAJIT=No
|
||||
|
||||
ifeq ($(CONFIG_FLUENT_BIT_SYSLOG_PREPEND_LENGTH),y)
|
||||
CMAKE_OPTIONS += -DFLUENT_BIT_SYSLOG_PREPEND_LENGTH=Yes
|
||||
else
|
||||
CMAKE_OPTIONS += -DFLUENT_BIT_SYSLOG_PREPEND_LENGTH=No
|
||||
endif
|
||||
|
||||
# In plugins
|
||||
CMAKE_OPTIONS += \
|
||||
-DFLB_IN_SYSLOG=Yes \
|
||||
@@ -100,7 +112,7 @@ CMAKE_OPTIONS += \
|
||||
|
||||
|
||||
# Filter options
|
||||
CMAKE_OPTIONS +=
|
||||
CMAKE_OPTIONS += \
|
||||
-DFLB_FILTER_AWS=No \
|
||||
-DFLB_FILTER_ECS=No \
|
||||
-DFLB_FILTER_KUBERNETES=No \
|
||||
@@ -138,6 +150,7 @@ CMAKE_OPTIONS += \
|
||||
-DFLB_OUT_ES=No \
|
||||
-DFLB_OUT_GELF=No \
|
||||
-DFLB_OUT_INFLUXDB=No \
|
||||
-DFLB_OUT_KAFKA=No \
|
||||
-DFLB_OUT_NRLOGS=No \
|
||||
-DFLB_OUT_OPENSEARCH=No \
|
||||
-DFLB_OUT_TD=No \
|
||||
@@ -167,6 +180,7 @@ CMAKE_OPTIONS += \
|
||||
define Package/fluent-bit/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/fluent-bit
|
||||
$(INSTALL_DIR) $(1)/etc/fluent-bit/conf.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/fluent-bit $(1)/usr/sbin/
|
||||
$(INSTALL_DATA) ./files/fluent-bit.conf $(1)/etc/fluent-bit/fluent-bit.conf
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/parsers.conf $(1)/etc/fluent-bit/parsers.conf
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 72b950e7b..58e76b349 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -205,6 +205,9 @@ option(FLB_CUSTOM_CALYPTIA "Enable Calyptia Support" Yes)
|
||||
# Config formats
|
||||
option(FLB_CONFIG_YAML "Enable YAML config format" Yes)
|
||||
|
||||
+# out syslog message format
|
||||
+option(FLUENT_BIT_SYSLOG_PREPEND_LENGTH "Enable prepending of length to syslog message" Yes)
|
||||
+
|
||||
# List of plugins available and defaults for each option
|
||||
include(cmake/plugins_options.cmake)
|
||||
|
||||
diff --git a/plugins/out_syslog/CMakeLists.txt b/plugins/out_syslog/CMakeLists.txt
|
||||
index 556d8e1a4..a848020e9 100644
|
||||
--- a/plugins/out_syslog/CMakeLists.txt
|
||||
+++ b/plugins/out_syslog/CMakeLists.txt
|
||||
@@ -1,3 +1,7 @@
|
||||
+if(FLUENT_BIT_SYSLOG_PREPEND_LENGTH)
|
||||
+ add_definitions(-DFLUENT_BIT_SYSLOG_PREPEND_LENGTH)
|
||||
+endif()
|
||||
+
|
||||
set(src
|
||||
syslog.c
|
||||
syslog_conf.c)
|
||||
diff --git a/plugins/out_syslog/syslog.c b/plugins/out_syslog/syslog.c
|
||||
index 4ecc7c4ac..f85c38b51 100644
|
||||
--- a/plugins/out_syslog/syslog.c
|
||||
+++ b/plugins/out_syslog/syslog.c
|
||||
@@ -156,7 +156,7 @@ static flb_sds_t syslog_rfc5424(flb_sds_t *s, struct flb_time *tms,
|
||||
return NULL;
|
||||
}
|
||||
*s = tmp;
|
||||
- return *s;
|
||||
+ goto finalize;
|
||||
}
|
||||
|
||||
prival = (msg->facility << 3) + msg->severity;
|
||||
@@ -291,6 +291,31 @@ static flb_sds_t syslog_rfc5424(flb_sds_t *s, struct flb_time *tms,
|
||||
*s = tmp;
|
||||
}
|
||||
|
||||
+finalize:
|
||||
+#ifdef FLUENT_BIT_SYSLOG_PREPEND_LENGTH
|
||||
+ // Create new SDS with length prefix
|
||||
+ // Allocate enough space for "%u "
|
||||
+ flb_sds_t prefix = flb_sds_create_size(32);
|
||||
+ if (!prefix) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ unsigned int msg_len = flb_sds_len(*s);
|
||||
+ prefix = flb_sds_printf(&prefix, "%u ", msg_len);
|
||||
+ if (!prefix) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ flb_sds_t new_s = flb_sds_cat(prefix, *s, msg_len);
|
||||
+ if (!new_s) {
|
||||
+ flb_sds_destroy(prefix);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ flb_sds_destroy(*s);
|
||||
+ *s = new_s;
|
||||
+#endif
|
||||
+
|
||||
return *s;
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gateway-info
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/gateway-info.git
|
||||
PKG_SOURCE_VERSION:=26e407a25b156da75e3941d54ddd74294cd9eae8
|
||||
PKG_SOURCE_VERSION:=dd15893a8291e556a8c49ff9e143c763db0379b5
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -28,8 +28,8 @@ include ../bbfdm/bbfdm.mk
|
||||
define Package/gateway-info
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=GatewayInfo Data Model Support
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +umdns
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service +iputils-arping
|
||||
endef
|
||||
|
||||
define Package/gateway-info/description
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
config global 'global'
|
||||
option enable '1'
|
||||
option wan_interface 'wan'
|
||||
option lan_interface 'lan'
|
||||
|
||||
@@ -210,7 +210,6 @@ enable_dhcp_option125() {
|
||||
local newsendopts=""
|
||||
local req125_present=0
|
||||
local send125_present=0
|
||||
local network_uci_update=0
|
||||
local opt125="125:"
|
||||
|
||||
for ropt in $reqopts; do
|
||||
@@ -231,18 +230,12 @@ enable_dhcp_option125() {
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
|
||||
if [ ${send125_present} -eq 0 ]; then
|
||||
configure_send_op125 "${sendopts}" "${wan}" "network"
|
||||
network_uci_update=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${network_uci_update} -eq 1 ]; then
|
||||
uci commit network
|
||||
fi
|
||||
}
|
||||
|
||||
enable_dnsmasq_option125() {
|
||||
@@ -266,7 +259,6 @@ enable_dnsmasq_option125() {
|
||||
if [ ${send125_present} -eq 0 ]; then
|
||||
uci -q del_list dhcp."${lan}".dhcp_option="${base_opt}"
|
||||
configure_send_op125 "${base_opt}" "${lan}" "dhcp"
|
||||
uci commit dhcp
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -276,9 +268,14 @@ configure_gateway_device_info() {
|
||||
lan_intf=""
|
||||
|
||||
config_load gateway
|
||||
config_get_bool enable global enable '1'
|
||||
config_get wan_intf global wan_interface "wan"
|
||||
config_get lan_intf global lan_interface "lan"
|
||||
|
||||
if [ "${enable}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Set dhcp_option 125 for device info if not already configured
|
||||
enable_dhcp_option125 "${wan_intf}"
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
CLASS=""
|
||||
OUI=""
|
||||
SERIAL=""
|
||||
GW_DISCOVERED=0
|
||||
_json_no_warning=1
|
||||
|
||||
get_vivsoi() {
|
||||
# opt125 environment variable has data in below format
|
||||
@@ -86,11 +89,17 @@ get_vivsoi() {
|
||||
|
||||
# assign the value found in sub option
|
||||
case "${sub_opt_id}" in
|
||||
"4") OUI=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
"4")
|
||||
OUI=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
GW_DISCOVERED=1
|
||||
;;
|
||||
"5") SERIAL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
"5")
|
||||
SERIAL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
GW_DISCOVERED=1
|
||||
;;
|
||||
"6") CLASS=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
"6")
|
||||
CLASS=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
GW_DISCOVERED=1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -110,15 +119,192 @@ get_vivsoi() {
|
||||
done
|
||||
}
|
||||
|
||||
send_host_query() {
|
||||
intf="${1}"
|
||||
resp=1
|
||||
loop=3
|
||||
usp_serv_found=0
|
||||
sent_host=" "
|
||||
|
||||
ubus call umdns update
|
||||
while [ "${loop}" -ne 0 ]; do
|
||||
sleep 5
|
||||
|
||||
json_load "$(ubus call umdns browse)"
|
||||
json_select discovered_services
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
json_cleanup
|
||||
loop=$(( loop - 1 ))
|
||||
continue
|
||||
fi
|
||||
|
||||
json_select _usp-agt-mqtt._tcp
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
json_cleanup
|
||||
loop=$(( loop - 1 ))
|
||||
continue
|
||||
fi
|
||||
|
||||
usp_serv_found=1
|
||||
break
|
||||
done
|
||||
|
||||
if [ "${usp_serv_found}" -eq 0 ]; then
|
||||
echo "${resp}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_get_keys keys
|
||||
for key in $keys; do
|
||||
json_select $key
|
||||
json_get_var _host host ""
|
||||
|
||||
if [ -z "${_host}" ] || [[ "${sent_host}" =~ " ${_host}" ]]; then
|
||||
json_select ..
|
||||
continue
|
||||
fi
|
||||
|
||||
sent_host="${sent_host} ${_host}"
|
||||
cmd="ubus call umdns query '{\"question\":\"$_host\",\"interface\":\"$intf\"}'"
|
||||
eval $cmd
|
||||
resp=0
|
||||
json_select ..
|
||||
done
|
||||
|
||||
json_cleanup
|
||||
echo "${resp}"
|
||||
}
|
||||
|
||||
get_usp_agent_id() {
|
||||
dhcp_ip="${1}"
|
||||
family="ipv4"
|
||||
ID=""
|
||||
|
||||
if [[ "${dhcp_ip}" =~ ":" ]]; then
|
||||
family="ipv6"
|
||||
fi
|
||||
|
||||
json_load "$(ubus call umdns browse)"
|
||||
json_select discovered_services
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
json_cleanup
|
||||
echo ${ID}
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_select _usp-agt-mqtt._tcp
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
json_cleanup
|
||||
echo ${ID}
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_get_keys keys
|
||||
for key in $keys; do
|
||||
json_select $key
|
||||
json_select $family
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
json_select ..
|
||||
continue
|
||||
fi
|
||||
|
||||
json_get_keys ips
|
||||
for ip in $ips; do
|
||||
json_get_var ip_val $ip
|
||||
if [ "${ip_val}" != "${dhcp_ip}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
json_select ..
|
||||
json_select txt
|
||||
json_get_keys txts
|
||||
for _txt in $txts; do
|
||||
json_get_var text_val $_txt
|
||||
if [[ "${text_val:0:3}" == "ID=" ]]; then
|
||||
ID="${text_val:3}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
break
|
||||
done
|
||||
|
||||
json_select ..
|
||||
json_select ..
|
||||
|
||||
if [ -n "${ID}" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
json_cleanup
|
||||
echo ${ID}
|
||||
}
|
||||
|
||||
get_mac_address() {
|
||||
ip="${1}"
|
||||
device="${2}"
|
||||
|
||||
mac="$(cat /proc/net/arp | grep $ip | awk '{print $4}')"
|
||||
if [ -z "${mac}" ]; then
|
||||
arp_resp="$(arping -b -f -c 5 -I $device $ip | grep 'Unicast reply from' | awk '{print $5}')"
|
||||
if [ -n "${arp_resp}" ]; then
|
||||
mac=${arp_resp:1:-1}
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "${mac}"
|
||||
}
|
||||
|
||||
send_unknown_gw_event() {
|
||||
mac="${1}"
|
||||
|
||||
cmd="ubus -t 5 send gateway-info.gateway.unknown '{\"hwaddr\":\"$mac\"}'"
|
||||
eval $cmd
|
||||
}
|
||||
|
||||
send_cwmp_gw_event() {
|
||||
oui="${1}"
|
||||
class="${2}"
|
||||
serial="${3}"
|
||||
|
||||
cmd="ubus -t 5 send gateway-info.gateway.cwmp '{\"oui\":\"$oui\",\"class\":\"$class\",\"serial\":\"$serial\"}'"
|
||||
eval $cmd
|
||||
}
|
||||
|
||||
send_usp_gw_event() {
|
||||
endpoint="${1}"
|
||||
|
||||
cmd="ubus -t 5 send gateway-info.gateway.usp '{\"endpoint\":\"$endpoint\"}'"
|
||||
eval $cmd
|
||||
}
|
||||
|
||||
config_load gateway
|
||||
config_get_bool enable global enable '1'
|
||||
config_get wan_intf global wan_interface "wan"
|
||||
|
||||
if [ "${enable}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
if [ -n "$opt125" ]; then
|
||||
len=$(printf "$opt125"|wc -c)
|
||||
get_vivsoi "$opt125" "$len"
|
||||
if [ "${1}" == "deconfig" ]; then
|
||||
rm -rf /var/state/gwinfo
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_load "$(ifstatus ${INTERFACE})"
|
||||
json_get_var dev_name device ""
|
||||
json_select data
|
||||
json_get_var dhcp_ip dhcpserver ""
|
||||
json_cleanup
|
||||
|
||||
if [ -z "${dhcp_ip}" ] || [ -z "${dev_name}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
MAC="$(get_mac_address $dhcp_ip $dev_name)"
|
||||
|
||||
mkdir -p /var/state
|
||||
touch /var/state/gwinfo
|
||||
sec=$(uci -q -c /var/state get gwinfo.gatewayinfo)
|
||||
@@ -127,8 +313,55 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
uci -q -c /var/state rename gwinfo."${sec}"="gatewayinfo"
|
||||
fi
|
||||
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.hwaddr="$MAC"
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.endpoint=""
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.class=""
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.oui=""
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.serial=""
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.proto=""
|
||||
uci -q -c /var/state commit gwinfo
|
||||
|
||||
if [ -z "$opt125" ]; then
|
||||
send_unknown_gw_event "${MAC}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
len=$(printf "$opt125"|wc -c)
|
||||
get_vivsoi "$opt125" "$len"
|
||||
|
||||
if [ "${GW_DISCOVERED}" -eq 0 ]; then
|
||||
send_unknown_gw_event "${MAC}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.class="$CLASS"
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.oui="$OUI"
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.serial="$SERIAL"
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.proto="CWMP"
|
||||
uci -q -c /var/state commit gwinfo
|
||||
|
||||
# Check for USP parameters
|
||||
ubus -t 15 wait_for umdns
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
send_cwmp_gw_event "${OUI}" "${CLASS}" "${SERIAL}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
resp=$(send_host_query $dev_name)
|
||||
if [ "${resp}" -ne 0 ]; then
|
||||
send_cwmp_gw_event "${OUI}" "${CLASS}" "${SERIAL}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
ID="$(get_usp_agent_id $dhcp_ip)"
|
||||
if [ -z "${ID}" ]; then
|
||||
send_cwmp_gw_event "${OUI}" "${CLASS}" "${SERIAL}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.endpoint="$ID"
|
||||
uci -q -c /var/state set gwinfo.gatewayinfo.proto="USP"
|
||||
uci -q -c /var/state commit gwinfo
|
||||
|
||||
send_usp_gw_event "${ID}"
|
||||
fi
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostmngr
|
||||
PKG_VERSION:=1.2.15
|
||||
PKG_VERSION:=1.2.20
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=3b50823da3f2904191332634c1e45d46090def1d
|
||||
PKG_SOURCE_VERSION:=3948618fa8fa23a0ddc51632b0036dbd08e27696
|
||||
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
|
||||
@@ -77,7 +77,7 @@ define Package/hostmngr/install
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/bbf_plugin/libhostmngr.so $(1) $(PKG_NAME)
|
||||
|
||||
ifeq ($(CONFIG_HOSTMNGR_DATAMODEL_EXT),y)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/bbf_plugin/libhostext.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/bbf_plugin/libhostext.so $(1) $(PKG_NAME) 10
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
@@ -7,4 +7,16 @@ config ICWMP_MGMT_FROM_USP
|
||||
config ICWMP_BACKUP_EVENTS
|
||||
bool "Create backup of session events to persistent storage after each successful session"
|
||||
default y
|
||||
|
||||
config ICWMP_ENABLE_VENDOR_EXTN
|
||||
bool "Enable datamodel vendor extension"
|
||||
default y
|
||||
|
||||
config ICWMP_VENDOR_PREFIX
|
||||
string "Package specific datamodel Vendor Prefix for TR181 extensions"
|
||||
default ""
|
||||
|
||||
config ICWMP_ENABLE_SMM_SUPPORT
|
||||
bool "Enable software module management support"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.8.33
|
||||
PKG_VERSION:=9.9.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
|
||||
PKG_SOURCE_VERSION:=6e80cefd0056f2d13122ad22b73895ea7fb5e438
|
||||
PKG_SOURCE_VERSION:=5dba542b280495730176da468bc45ed5dcc8c94e
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -52,6 +52,21 @@ ifeq ($(CONFIG_ICWMP_BACKUP_EVENTS),y)
|
||||
EXTRA_CFLAGS += -DPERSIST_BACKUP_SESSION_EVENTS
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ICWMP_ENABLE_VENDOR_EXTN),y)
|
||||
EXTRA_CFLAGS += -DICWMP_ENABLE_VENDOR_EXTN
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ICWMP_ENABLE_SMM_SUPPORT),y)
|
||||
EXTRA_CFLAGS += -DICWMP_ENABLE_SMM_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ICWMP_VENDOR_PREFIX),"")
|
||||
CMAKE_OPTIONS += -DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)"
|
||||
else
|
||||
CMAKE_OPTIONS += -DBBF_VENDOR_PREFIX:String="$(CONFIG_ICWMP_VENDOR_PREFIX)"
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/icwmp/* $(PKG_BUILD_DIR)/
|
||||
@@ -72,13 +87,14 @@ define Package/icwmp/install
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
|
||||
$(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/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
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/libcwmpdm.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1) $(PKG_NAME) 20
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,icwmp))
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
},
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "XMPP"
|
||||
"object": "XMPP",
|
||||
"proto": "cwmp"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
config acs 'acs'
|
||||
option userid '' #$OUI-$SER
|
||||
option passwd 'iopsys'
|
||||
option passwd ''
|
||||
option periodic_inform_enable 'true'
|
||||
option periodic_inform_interval '1800'
|
||||
option periodic_inform_time '0001-01-01T00:00:00Z'
|
||||
@@ -14,11 +14,14 @@ config acs 'acs'
|
||||
option retry_interval_multiplier '2000'
|
||||
option skip_dhcp_boot_options '0'
|
||||
option insecure_enable '0'
|
||||
option get_rpc_methods '0'
|
||||
|
||||
config cpe 'cpe'
|
||||
option enable '1'
|
||||
option default_wan_interface 'wan'
|
||||
option default_lan_interface 'lan'
|
||||
#option client_cert_path '/etc/icwmpd/client.pem'
|
||||
#option client_key_path '/etc/icwmpd/client.key'
|
||||
option log_to_console 'disable'
|
||||
option log_to_file 'disable'
|
||||
# log_severity possible configs: EMERG, ALERT, CRITIC ,ERROR, WARNING, NOTICE, INFO, DEBUG
|
||||
@@ -26,7 +29,7 @@ config cpe 'cpe'
|
||||
option log_file_name '/var/log/icwmpd.log'
|
||||
option log_max_size '102400'
|
||||
option userid '' #$OUI-$SER
|
||||
option passwd 'iopsys'
|
||||
option passwd ''
|
||||
option port '7547'
|
||||
option provisioning_code ''
|
||||
option amd_version '5'
|
||||
@@ -39,10 +42,10 @@ config cpe 'cpe'
|
||||
option periodic_notify_interval '10'
|
||||
option incoming_rule 'Port_Only'
|
||||
option active_notif_throttle '0'
|
||||
option disable_gatewayinfo '0'
|
||||
option fw_upgrade_keep_settings '1'
|
||||
option clock_sync_timeout '128'
|
||||
option disable_datatype_check '0'
|
||||
#list allowed_cr_ip '10.5.1.0/24'
|
||||
|
||||
config lwn 'lwn'
|
||||
option enable '0'
|
||||
|
||||
@@ -6,19 +6,24 @@ log() {
|
||||
}
|
||||
|
||||
get_firewall_zone() {
|
||||
zone="$(uci show firewall|grep network|grep -w ${1}|cut -d. -f 2)"
|
||||
zone="$(uci show firewall|grep network|grep -w "${1}"|cut -d. -f 2)"
|
||||
zone="${zone:-wan}" # defaults to wan zone
|
||||
echo "$zone"
|
||||
}
|
||||
|
||||
cleanup_exiting_rules() {
|
||||
while iptables -w 1 -nL zone_"${1}"_input --line-numbers 2>/dev/null | grep "Open_ACS_port"; do
|
||||
cleanup_upstream_rules() {
|
||||
if [ -z "${1}" ]; then
|
||||
log "Rule can not be cleaned without zone name"
|
||||
return
|
||||
fi
|
||||
|
||||
while iptables -w 1 -nL zone_"${1}"_input --line-numbers 2>/dev/null | grep "Open_ACS_port"; do
|
||||
rule_num="$(iptables -w 1 -nL zone_"${1}"_input --line-numbers | grep "Open_ACS_port" | head -1|awk '{print $1}')"
|
||||
if [ -n "${rule_num}" ]; then
|
||||
iptables -w 1 -D zone_"${1}"_input "${rule_num}";
|
||||
fi
|
||||
done
|
||||
while ip6tables -w 1 -nL zone_"${1}"_input --line-numbers 2>/dev/null | grep "Open_ACS_port"; do
|
||||
while ip6tables -w 1 -nL zone_"${1}"_input --line-numbers 2>/dev/null | grep "Open_ACS_port"; do
|
||||
rule_num="$(ip6tables -w 1 -nL zone_"${1}"_input --line-numbers | grep "Open_ACS_port" | head -1|awk '{print $1}')"
|
||||
if [ -n "${rule_num}" ]; then
|
||||
ip6tables -w 1 -D zone_"${1}"_input "${rule_num}";
|
||||
@@ -26,76 +31,142 @@ cleanup_exiting_rules() {
|
||||
done
|
||||
}
|
||||
|
||||
enable="$(uci -q get cwmp.cpe.enable)"
|
||||
enable="${enable:-1}"
|
||||
|
||||
if [ "$enable" -eq 0 ]; then
|
||||
log "CWMP not enabled"
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
wan="$(uci -q get cwmp.cpe.default_wan_interface)"
|
||||
wan="${wan:-wan}"
|
||||
|
||||
zone_name="$(get_firewall_zone $wan)"
|
||||
|
||||
port=$(uci -q get cwmp.cpe.port)
|
||||
port="${port:-7547}"
|
||||
|
||||
incoming_rule=$(uci -q get cwmp.cpe.incoming_rule|awk '{print tolower($0)}')
|
||||
incoming_rule="${incoming_rule:-port_only}"
|
||||
|
||||
ipaddr=$(uci -c /var/state -q get icwmp.acs.ip)
|
||||
ip6addr=$(uci -c /var/state -q get icwmp.acs.ip6)
|
||||
|
||||
cmd="iptables -w 1 -I zone_${zone_name}_input -p tcp"
|
||||
cmd6="ip6tables -w 1 -I zone_${zone_name}_input -p tcp"
|
||||
|
||||
# default incoming rule is Port only
|
||||
if [ "${incoming_rule}" = "ip_only" ]; then
|
||||
if [ -n "${ipaddr}" ]; then
|
||||
cmd="${cmd} -s ${ipaddr}"
|
||||
fi
|
||||
if [ -n "${ip6addr}" ]; then
|
||||
cmd6="${cmd6} -s ${ip6addr}"
|
||||
fi
|
||||
elif [ "${incoming_rule}" = "port_only" ]; then
|
||||
if [ -n "${port}" ]; then
|
||||
cmd="${cmd} --dport ${port}"
|
||||
cmd6="${cmd6} --dport ${port}"
|
||||
fi
|
||||
else
|
||||
if [ -n "${ipaddr}" ]; then
|
||||
cmd="${cmd} -s ${ipaddr}"
|
||||
cleanup_downstream_rules() {
|
||||
if [ -z "${1}" ]; then
|
||||
log "Rule can not be cleaned without zone name"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "${ip6addr}" ]; then
|
||||
cmd6="${cmd6} -s ${ip6addr}"
|
||||
while iptables -w 1 -nL zone_"${1}"_input --line-numbers 2>/dev/null | grep "Close_ACS_port"; do
|
||||
rule_num="$(iptables -w 1 -nL zone_"${1}"_input --line-numbers | grep "Close_ACS_port" | head -1|awk '{print $1}')"
|
||||
if [ -n "${rule_num}" ]; then
|
||||
iptables -w 1 -D zone_"${1}"_input "${rule_num}";
|
||||
fi
|
||||
done
|
||||
while ip6tables -w 1 -nL zone_"${1}"_input --line-numbers 2>/dev/null | grep "Close_ACS_port"; do
|
||||
rule_num="$(ip6tables -w 1 -nL zone_"${1}"_input --line-numbers | grep "Close_ACS_port" | head -1|awk '{print $1}')"
|
||||
if [ -n "${rule_num}" ]; then
|
||||
ip6tables -w 1 -D zone_"${1}"_input "${rule_num}";
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
close_downstream_acs_port() {
|
||||
lan="${1}"
|
||||
port="${2}"
|
||||
zone_name="$(get_firewall_zone $lan)"
|
||||
|
||||
if [ -z "${zone_name}" ]; then
|
||||
log "Rule can not be added without zone name"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "${port}" ]; then
|
||||
cmd="${cmd} --dport ${port}"
|
||||
cmd6="${cmd6} --dport ${port}"
|
||||
fi
|
||||
fi
|
||||
|
||||
cleanup_exiting_rules "${zone_name}"
|
||||
|
||||
echo "${cmd}"|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -eq 0 ]; then
|
||||
cmd="${cmd} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
cmd="iptables -w 1 -I zone_${zone_name}_input -p tcp --dport ${port} -j DROP -m comment --comment=Close_ACS_port"
|
||||
${cmd}
|
||||
log "Applied [${cmd}]"
|
||||
fi
|
||||
|
||||
echo "${cmd6}"|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -eq 0 ]; then
|
||||
cmd6="${cmd6} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
${cmd6}
|
||||
log "Applied [${cmd6}]"
|
||||
fi
|
||||
cmd="ip6tables -w 1 -I zone_${zone_name}_input -p tcp --dport ${port} -j DROP -m comment --comment=Close_ACS_port"
|
||||
${cmd}
|
||||
log "Applied [${cmd}]"
|
||||
}
|
||||
|
||||
if [ -f "/var/state/icwmp" ]; then
|
||||
uci -c /var/state -q set icwmp.cpe.firewall_restart="init"
|
||||
uci -c /var/state -q commit icwmp
|
||||
fi
|
||||
add_firewall_rule() {
|
||||
version="${1}"
|
||||
ipaddr="${2}"
|
||||
port="${3}"
|
||||
zone_name="${4}"
|
||||
cmd=""
|
||||
|
||||
if [ -z "${zone_name}" ]; then
|
||||
log "Rule can not be added without zone name"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "${version}" = "ipv6" ]; then
|
||||
cmd="ip6tables -w 1 -I zone_${zone_name}_input -p tcp"
|
||||
else
|
||||
cmd="iptables -w 1 -I zone_${zone_name}_input -p tcp"
|
||||
fi
|
||||
|
||||
if [ -n "${ipaddr}" ]; then
|
||||
cmd="${cmd} -s ${ipaddr}"
|
||||
fi
|
||||
|
||||
if [ -n "${port}" ]; then
|
||||
cmd="${cmd} --dport ${port}"
|
||||
fi
|
||||
|
||||
if echo "${cmd}"|grep -q "\-\-dport \|\-s "; then
|
||||
cmd="${cmd} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
${cmd}
|
||||
log "Applied [${cmd}]"
|
||||
fi
|
||||
}
|
||||
|
||||
configure_connection_req_rules() {
|
||||
app="${1}"
|
||||
|
||||
wan="$(uci -q get cwmp.cpe.default_wan_interface)"
|
||||
wan="${wan:-wan}"
|
||||
|
||||
wan_zone_name="$(get_firewall_zone $wan)"
|
||||
|
||||
cleanup_upstream_rules "${wan_zone_name}"
|
||||
|
||||
lan="$(uci -q get cwmp.cpe.default_lan_interface)"
|
||||
lan="${lan:-lan}"
|
||||
|
||||
if [ "${lan}" != "${wan}" ]; then
|
||||
lan_zone_name="$(get_firewall_zone $lan)"
|
||||
cleanup_downstream_rules "${lan_zone_name}"
|
||||
fi
|
||||
|
||||
enable="$(uci -q get cwmp.cpe.enable)"
|
||||
enable="${enable:-1}"
|
||||
|
||||
if [ "$enable" -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
url="$(uci -q get cwmp.acs.url)"
|
||||
if [ -z "${url}" ]; then
|
||||
url="$(uci -q get cwmp.acs.dhcp_url)"
|
||||
fi
|
||||
|
||||
# no need to apply firewall rule, acs url not configured
|
||||
if [ -z "${url}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${app}" ]; then
|
||||
if ! ubus -t 1 list tr069 2>/dev/null; then
|
||||
log "cwmp client not running"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
port=$(uci -q get cwmp.cpe.port)
|
||||
port="${port:-7547}"
|
||||
|
||||
ipaddr=$(uci -q get cwmp.cpe.allowed_cr_ip)
|
||||
if [ -n "${ipaddr}" ]; then
|
||||
for ip in $ipaddr; do
|
||||
if echo "${ip}" | grep -q ":"; then
|
||||
add_firewall_rule "ipv6" "${ip}" "${port}" "${wan_zone_name}"
|
||||
else
|
||||
add_firewall_rule "ipv4" "${ip}" "${port}" "${wan_zone_name}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
# Port-only
|
||||
add_firewall_rule "ipv6" "" "${port}" "${wan_zone_name}"
|
||||
add_firewall_rule "ipv4" "" "${port}" "${wan_zone_name}"
|
||||
fi
|
||||
|
||||
if [ "${lan}" != "${wan}" ]; then
|
||||
# Close the ACS port at Lan side
|
||||
close_downstream_acs_port "${lan}" "${port}"
|
||||
fi
|
||||
}
|
||||
|
||||
configure_connection_req_rules "$@"
|
||||
|
||||
@@ -263,7 +263,14 @@ start_service() {
|
||||
|
||||
stop_service()
|
||||
{
|
||||
local switch_bank
|
||||
|
||||
copy_cwmp_varstate_files_to_etc
|
||||
|
||||
switch_bank=$(uci -q -c /var/state/ get icwmp.cpe.switch_bank)
|
||||
if [ -n "$switch_bank" ] && [ "$switch_bank" = "1" ]; then
|
||||
[ -x /etc/sysmngr/fwbank ] && /etc/sysmngr/fwbank call copy_config
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
# Copy defaults by the factory to the cwmp UCI user section.
|
||||
config_load cwmp
|
||||
|
||||
if [ -f "/lib/functions/iopsys-environment.sh" ]; then
|
||||
. /lib/functions/iopsys-environment.sh
|
||||
fi
|
||||
|
||||
# Get Manufacturer OUI.
|
||||
config_get oui cpe manufacturer_oui ""
|
||||
if [ -z "${oui}" ]; then
|
||||
@@ -38,4 +42,14 @@ if [ -z "${enable_cwmp}" ]; then
|
||||
uci -q set cwmp.cpe.enable="1"
|
||||
fi
|
||||
|
||||
default_password="$(get_acs_password)"
|
||||
config_get pass cpe passwd ""
|
||||
if [ -z "${pass}" ]; then
|
||||
uci -q set cwmp.cpe.passwd="${default_password:-iopsys}"
|
||||
fi
|
||||
|
||||
config_get pass acs passwd ""
|
||||
if [ -z "${pass}" ]; then
|
||||
uci -q set cwmp.acs.passwd="${default_password:-iopsys}"
|
||||
fi
|
||||
# No need for commit here, it is done by uci_apply_defaults().
|
||||
|
||||
14
icwmp/files/etc/uci-defaults/85-migrate-gw-info
Normal file
14
icwmp/files/etc/uci-defaults/85-migrate-gw-info
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Script to migrate gateway-info options to gateway uci
|
||||
if [ ! -f "/etc/config/cwmp" ] && [ ! -f "/etc/config/gateway" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
val="$(uci -q get cwmp.cpe.disable_gatewayinfo)"
|
||||
|
||||
if [ -n "$val" ] && [ "$val" -eq 1 ]; then
|
||||
uci -q set gateway.global.enable=0
|
||||
fi
|
||||
|
||||
uci -q set cwmp.cpe.disable_gatewayinfo=""
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=8.7.3
|
||||
PKG_VERSION:=8.7.8
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=f3f4dbaac6b2ff6cfd38852e8625625d24996a53
|
||||
PKG_SOURCE_VERSION:=9c507bfb7f45fad81097262f05dc7cd11760e6b0
|
||||
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
|
||||
|
||||
@@ -18,5 +18,3 @@ mac=$(uci -q get ieee1905.ieee1905.macaddress)
|
||||
[ "$mac" != "" ] && exit 0
|
||||
|
||||
uci set ieee1905.ieee1905.macaddress="$LMAC"
|
||||
uci commit ieee1905
|
||||
|
||||
|
||||
13
ieee1905/files/etc/uci-defaults/32-ieee1905-device-info
Normal file
13
ieee1905/files/etc/uci-defaults/32-ieee1905-device-info
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
set_val() {
|
||||
uci -q get "$1" > /dev/null || uci set "${1}=${2:-${3}}"
|
||||
}
|
||||
|
||||
set_val ieee1905.ieee1905.manufacturer "$OPENWRT_DEVICE_MANUFACTURER" IOPSYS
|
||||
set_val ieee1905.ieee1905.model_name "$(cat /tmp/sysinfo/model)" 1905-SampleDev
|
||||
set_val ieee1905.ieee1905.device_name "$NAME" 1905Device
|
||||
|
||||
exit 0
|
||||
@@ -31,7 +31,7 @@ define Package/$(PKG_NAME)
|
||||
+@PACKAGE_COLLECTD_ENCRYPTED_NETWORK \
|
||||
# remote syslog
|
||||
DEPENDS+= \
|
||||
+syslog-ng \
|
||||
+@FLUENT_BIT_SYSLOG_PREPEND_LENGTH \
|
||||
+@SYSLOGNG_LOGROTATE \
|
||||
|
||||
endef
|
||||
@@ -44,7 +44,12 @@ endef
|
||||
Build/Compile=
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(CP) -r $(PKG_BUILD_DIR)/files/* $(1)/
|
||||
$(CP) -r ./files/common/* $(1)/
|
||||
ifneq ($(CONFIG_PACKAGE_fluent-bit),)
|
||||
$(CP) -r ./files/fluent-bit/* $(1)/
|
||||
else
|
||||
$(CP) -r ./files/syslog-ng/* $(1)/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDJTCCAg0CAQEwDQYJKoZIhvcNAQELBQAwRTELMAkGA1UEBhMCU0UxEzARBgNV
|
||||
BAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0
|
||||
ZDAeFw0yMjExMjIxMjM1MDNaFw0zMjExMTkxMjM1MDNaMGwxCzAJBgNVBAYTAlVT
|
||||
MREwDwYDVQQIDAhJbnRlcm5ldDEMMAoGA1UEBwwDRFVUMQwwCgYDVQQKDAMuLi4x
|
||||
DDAKBgNVBAsMAy4uLjEMMAoGA1UEAwwDLi4uMRIwEAYJKoZIhvcNAQkBFgMuLi4w
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDleMMuJ8AO1DeRmOyE2k2D
|
||||
DWUKB4yiRQhKxnRyRcF1s+mHcySS1NRlLwyZUuOFvBYHUhE3AfNMN5ywKazl4FwG
|
||||
MNtx0iUfHmHc0MQ04KZk1ifkS5WPUMksEJDQyM06ZH3gcIhGDlSkprnMsp9q5HlG
|
||||
umopBlihLTI+WM+8kliFbT7iOICDi9qRHPS+WTT/RClX12ISAejVFMFdpf8aQOGn
|
||||
klu7mcGyOBij0axcfd2QlHybvkSSksvny19I1/Be7MdtO3fxJODuUy8sHd9HqaOJ
|
||||
TbjcwWNWFJIR4+Gsz2DeqIPxpaqUjEZgJfUD5FSTOL3ZgtjMmzjYZj8IEf5BD7st
|
||||
AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAK+WvRYkkM+11ljo1pKwyTtcyz9fiQ9Z
|
||||
zGAed6UViEPhJNIchFEFukMMqNaWL3Pi0MkvkAiJvyJbGW0YiPm7r0sf2sOD4PPI
|
||||
UqDskApA9P1aL1uF/CBvP7kViVVVcNDSHq+Hc+6Jrg+Ufycq2kE9KrU/zI2Z0kEd
|
||||
70k+YNLWTZNjekXfrxlniw7ycmALJuYkw1GXSZ4pph+VXYPJ7c/sm4J3MKDXonTQ
|
||||
tEI4wTTkfOHUBDppNX/b9gw0A4jL5nAga/6Q2PPNoaTrgLZS0o03GO3HES24iHlG
|
||||
TBrIW9q2HRcDOfj5oNaoSasOyARFT0owJdcBFlzp7Pe1lMN+bRLz5h0=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDleMMuJ8AO1DeR
|
||||
mOyE2k2DDWUKB4yiRQhKxnRyRcF1s+mHcySS1NRlLwyZUuOFvBYHUhE3AfNMN5yw
|
||||
Kazl4FwGMNtx0iUfHmHc0MQ04KZk1ifkS5WPUMksEJDQyM06ZH3gcIhGDlSkprnM
|
||||
sp9q5HlGumopBlihLTI+WM+8kliFbT7iOICDi9qRHPS+WTT/RClX12ISAejVFMFd
|
||||
pf8aQOGnklu7mcGyOBij0axcfd2QlHybvkSSksvny19I1/Be7MdtO3fxJODuUy8s
|
||||
Hd9HqaOJTbjcwWNWFJIR4+Gsz2DeqIPxpaqUjEZgJfUD5FSTOL3ZgtjMmzjYZj8I
|
||||
Ef5BD7stAgMBAAECggEATmdMiOCcBnUL53tQlLPh9/0DoMGjk23yv1m/P6wFxamL
|
||||
CPSWcnS1fTzuGRTxGCiDfkzUBO9tqYT2zFnw8ToPNy5KTEF43YEL/t51q3t2Xs2t
|
||||
I5uPpj/7/EpMsIlrVaAwQhcw+H68/OTaZs5BGcymgzv+ObYpYiiHGjZOBCgchrl+
|
||||
/FyUyrS1M11VcamJ8H6GqNDEy5zvwOX3VjIwHvbONrN6zjNvMRIMzCQC59hEeBDG
|
||||
j6AYMw2/UJ4sPLpmqObnPvYO4D6qsEuKxQDGFwaPGSulOs5+OHMqTcTLRtktR5qJ
|
||||
Mjq5C2axy3TvxpbZ5Ou2jRB/zaXWNkK26UP5Iv2MAQKBgQD/4J5lcFBkrZArR5XL
|
||||
FiAfN4yfBAPcveRP7Zgqb7nlLzzouqz7vyH8Hhnk+XbA9CiKVOMc2Fbe82/exuft
|
||||
DvsoW5+Ds31SU52q5vWjtnPXeuK0kT6lm+qBbtmsFSAnfCRZUQcF8PhERLfzOEA6
|
||||
Uln0xr2EFR3D/UaBjsN3aTKMzQKBgQDllOe+QAf4CZGgCyAF1DDakuZF+iAfsCNz
|
||||
83dlb6N2ggJinOLs3ExfT0oJSUp4KPAIOQ+QgY01Itk0py2HEfYCgvXim7RrZ1P7
|
||||
5Sx++fi48ar3aqgLqg0hur0Yd1kFPjVRWj2/jM6qvLC8nEehNQH1VOh847FcwTrY
|
||||
UWWMKOnn4QKBgFnApE7Ykpp99u/3cCeIX0QT7BNrCR/Iy+jtYk6gWgh2BVts/3he
|
||||
lsEkndifWHReMEo1dGSNzgruQPNXucqBUr/ZQ56iuvbBtbBYyxjdysxuok7ME7lr
|
||||
c1prU5b04g53kRhzP49p8uufXxbFSGIsuLkPbTKDZal1keGn/hBIqh6RAoGAT9pS
|
||||
HMdSvkA9yaf09HIQqAXOWGqef8cZHbyCO+LvvUmNINWmzHH3knMWslIut8qtan7G
|
||||
XiHhhqjfWcQIPuHNaqQ4eCBmSbE/8e6NYoD5tQJB0Brl5mC4fpHgMcFZUkyH6Qr1
|
||||
TUnhnFtTMdc9xuGUE8v7rWzZBQUkvZbaNj0I1qECgYAesALh2u0r/ayEYjWAcqu8
|
||||
XXhQWRhg7fXm0cCODNeK5rhkaqxlw64hSY29tgEKPg/F66jXMDXcsvsBwnPoGN35
|
||||
lD6CQlWKR3g2LtRCAHLICQ5aODNL9B321syoIHF1Cdlw78V3uMsQ7av/IWaIX4BL
|
||||
EEWtDICxzN37PaGuYVSRSQ==
|
||||
-----END PRIVATE KEY-----
|
||||
93
iopsys-analytics/files/common/etc/collectd.conf
Normal file
93
iopsys-analytics/files/common/etc/collectd.conf
Normal file
@@ -0,0 +1,93 @@
|
||||
BaseDir "/var/lib/collectd"
|
||||
PIDFile "/var/run/collectd.pid"
|
||||
Interval 60
|
||||
ReadThreads 2
|
||||
WriteQueueLimitHigh 10000
|
||||
WriteQueueLimitLow 8000
|
||||
|
||||
LoadPlugin "load"
|
||||
LoadPlugin "network"
|
||||
LoadPlugin "memory"
|
||||
LoadPlugin "processes"
|
||||
LoadPlugin "cpu"
|
||||
LoadPlugin "exec"
|
||||
|
||||
<Plugin "network">
|
||||
<Server "analytics.iopsys.eu" "25827">
|
||||
SecurityLevel "encrypt"
|
||||
Username "iopsys"
|
||||
Password "kffJDv3CMVO9WHO4CIP8CGM3ZXN4EQv"
|
||||
</Server>
|
||||
</Plugin>
|
||||
|
||||
<Plugin "network">
|
||||
<Server "analytics.iopsys.eu" "25825">
|
||||
SecurityLevel "encrypt"
|
||||
Username "iopsys"
|
||||
Password "6rgVOHWq9BPCbZFlLVB854jD8WCv4EvK"
|
||||
</Server>
|
||||
</Plugin>
|
||||
|
||||
<Plugin "memory">
|
||||
ValuesPercentage true
|
||||
</Plugin>
|
||||
|
||||
<Plugin "processes">
|
||||
CollectFileDescriptor true
|
||||
CollectContextSwitch true
|
||||
CollectMemoryMaps true
|
||||
|
||||
ProcessMatch "mapagent_instances" "mapagent"
|
||||
ProcessMatch "wifimngr_instances" "wifimngr"
|
||||
ProcessMatch "ieee1905d_instances" "ieee1905d"
|
||||
ProcessMatch "topologyd_topologyd" "topologyd"
|
||||
ProcessMatch "uspd_instances" "uspd"
|
||||
ProcessMatch "mapcontroller_instances" "mapcontroller"
|
||||
ProcessMatch "obuspa_instances" "(.*)obuspa"
|
||||
ProcessMatch "hostapd_instances" "hostapd"
|
||||
ProcessMatch "swmodd_instances" "swmodd"
|
||||
ProcessMatch "ruleng_instances" "rulengd"
|
||||
ProcessMatch "wpa_supplicant_instances" "wpa_supplicant"
|
||||
ProcessMatch "dm_bulkdata" "bbfdmd -m bulkdata"
|
||||
ProcessMatch "dm_ddnsmngr" "bbfdmd -m ddnsmngr"
|
||||
ProcessMatch "dm_dnsmngr" "bbfdmd -m dnsmngr"
|
||||
ProcessMatch "dm_ethmngr" "bbfdmd -m ethmngr"
|
||||
ProcessMatch "dm_hostmngr" "bbfdmd -m hostmngr"
|
||||
ProcessMatch "dm_icwmp" "bbfdmd -m icwmp"
|
||||
ProcessMatch "dm_mcastmngr" "bbfdmd -m mcastmngr"
|
||||
ProcessMatch "dm_periodicstat" "bbfdmd -m periodicstats"
|
||||
ProcessMatch "dm_portmapping" "bbfdmd -m portmapping"
|
||||
ProcessMatch "dm_qosmngr" "bbfdmd -m qosmngr"
|
||||
ProcessMatch "dm_sshmngr" "bbfdmd -m sshmngr"
|
||||
ProcessMatch "dm_swmodd" "bbfdmd -m swmodd"
|
||||
ProcessMatch "dm_timemngr" "bbfdmd -m timemngr"
|
||||
ProcessMatch "dm_tr104" "bbfdmd -m tr104"
|
||||
ProcessMatch "dm_urlfilter" "bbfdmd -m urlfilter"
|
||||
ProcessMatch "dm_userinterfac" "bbfdmd -m userinterface"
|
||||
ProcessMatch "dm_usermngr" "bbfdmd -m usermngr"
|
||||
ProcessMatch "bbfdmd" "bbfdmd"
|
||||
ProcessMatch "decollector" "decollector"
|
||||
ProcessMatch "collectd" "collectd"
|
||||
ProcessMatch "uwsgi" "uwsgi"
|
||||
ProcessMatch "syslog-ng" "syslog-ng"
|
||||
ProcessMatch "mosquitto" "mosquitto"
|
||||
ProcessMatch "nginx" "nginx"
|
||||
ProcessMatch "hostmngr" "hostmngr"
|
||||
ProcessMatch "asterisk" "asterisk"
|
||||
ProcessMatch "voicemngr" "voicemngr"
|
||||
|
||||
|
||||
</Plugin>
|
||||
|
||||
<Plugin "cpu">
|
||||
ReportByState true
|
||||
ReportByCpu true
|
||||
ValuesPercentage true
|
||||
</Plugin>
|
||||
|
||||
<Plugin "exec">
|
||||
Exec "nobody" "/sbin/get-sn"
|
||||
</Plugin>
|
||||
|
||||
<Plugin "load">
|
||||
</Plugin>
|
||||
3
iopsys-analytics/files/common/etc/config/core-watcher
Normal file
3
iopsys-analytics/files/common/etc/config/core-watcher
Normal file
@@ -0,0 +1,3 @@
|
||||
config core-watcher 'globals'
|
||||
option api_key '1JH7ZKGDtJXKeLt4CfeJt4y'
|
||||
option url 'https://analytics.iopsys.eu:1337/crash_upload_file'
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"forced_inform": [
|
||||
"Device.DeviceInfo.ModelName"
|
||||
]
|
||||
}
|
||||
|
||||
38
iopsys-analytics/files/common/etc/init.d/core-watcher
Executable file
38
iopsys-analytics/files/common/etc/init.d/core-watcher
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
export USE_PROCD=1
|
||||
|
||||
export START=95
|
||||
export STOP=01
|
||||
|
||||
LOG="logger -t core-watcher[$$] -p"
|
||||
|
||||
start_service() {
|
||||
|
||||
[ -f /etc/config/core-watcher ] || {
|
||||
$LOG error "UCI config not found"
|
||||
return 1
|
||||
}
|
||||
|
||||
firmware_version=$(db get device.deviceinfo.SoftwareVersion || echo "unknown")
|
||||
product_class=$(db get device.deviceinfo.ProductClass | awk '{print tolower($0)}')
|
||||
serial=$(db get device.deviceinfo.SerialNumber || echo "unknown")
|
||||
config_load core-watcher
|
||||
|
||||
url=""
|
||||
config_get url "globals" "url"
|
||||
api_key=""
|
||||
config_get api_key "globals" "api_key"
|
||||
|
||||
if [ -z "$url" ] || [ -z "$api_key" ]; then
|
||||
$LOG error "URL or API Key not found in config"
|
||||
return 2
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param env API_KEY="$api_key" SERIAL="$serial" FIRMWARE_VERSION="$firmware_version" PRODUCT_CLASS="$product_class"
|
||||
procd_set_param command /usr/bin/core-watcher -u "$url"
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
26
iopsys-analytics/files/common/etc/init.d/ubus-monitor
Executable file
26
iopsys-analytics/files/common/etc/init.d/ubus-monitor
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=15
|
||||
STOP=20
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
|
||||
echo "Starting ubus monitor..."
|
||||
|
||||
procd_set_param respawn # Enable automatic restart on failure
|
||||
procd_set_param stdout 1 # Redirect stdout to procd
|
||||
procd_set_param stderr 1 # Redirect stderr to procd
|
||||
procd_set_param command /bin/sh "/usr/sbin/ubus-monitor"
|
||||
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service(){
|
||||
echo "Explicitly restarting service, are you sure you need this?"
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
uci set cwmp.cpe.forced_inform_json='/etc/icwmpd/force_inform.json'
|
||||
uci commit cwmp
|
||||
@@ -0,0 +1,5 @@
|
||||
set_core_unlimited() {
|
||||
prlimit --core=unlimited: -p 1
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main set_core_unlimited
|
||||
11
iopsys-analytics/files/common/sbin/get-sn
Executable file
11
iopsys-analytics/files/common/sbin/get-sn
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
INTERVAL="${COLLECTD_INTERVAL:-60}"
|
||||
|
||||
while sleep "$INTERVAL"; do
|
||||
SN=$(db get device.deviceinfo.SerialNumber)
|
||||
HOSTNAME=$(uname -n)
|
||||
FORMATTED_RESULT=$(echo "1337")
|
||||
echo "PUTVAL \"$HOSTNAME/exec-$SN/gauge-INFO\" interval=$INTERVAL N:\"$FORMATTED_RESULT\""
|
||||
|
||||
done
|
||||
150
iopsys-analytics/files/common/usr/bin/core-watcher
Executable file
150
iopsys-analytics/files/common/usr/bin/core-watcher
Executable file
@@ -0,0 +1,150 @@
|
||||
#!/bin/sh
|
||||
|
||||
# shellcheck shell=busybox
|
||||
|
||||
# This shell script watches for *.core files created in
|
||||
# /tmp and uploads them
|
||||
|
||||
CORE_DIR="/tmp"
|
||||
|
||||
LOG="logger -t core-watcher[$$] -p"
|
||||
POLL_INTERVAL="5"
|
||||
|
||||
upload_file() {
|
||||
FILEPATH=$1
|
||||
$LOG info "Uploading $UPLOAD_TYPE $FILEPATH"
|
||||
|
||||
curl -s --fail -X "POST" \
|
||||
"$API_URL" \
|
||||
-H "accept: application/json" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "api_key=$API_KEY" \
|
||||
-F "dump_md5=$COREDUMP_MD5" \
|
||||
-F "device_serial=$SERIAL" \
|
||||
-F "upload_type=$UPLOAD_TYPE" \
|
||||
-F "incoming_file=@$FILEPATH;type=text/plain"
|
||||
|
||||
status=$?
|
||||
|
||||
if [ "$status" != "0" ]; then
|
||||
$LOG error "$UPLOAD_TYPE upload failed. curl returned status $status"
|
||||
else
|
||||
$LOG info "$UPLOAD_TYPE upload success"
|
||||
if [ $UPLOAD_TYPE = "core" ]; then
|
||||
$LOG info "Renaming core $ORIGINAL_CORE_FILEPATH"
|
||||
mv "$ORIGINAL_CORE_FILEPATH" "$ORIGINAL_CORE_FILEPATH"_UPLOADED
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<EOM
|
||||
Usage:
|
||||
$0 [OPTIONS]
|
||||
Options:
|
||||
-h help
|
||||
-u <URL> API Gateway URL (required)
|
||||
EOM
|
||||
exit 1
|
||||
}
|
||||
|
||||
main() {
|
||||
if [ -z "$API_KEY" ]; then
|
||||
$LOG error "API_KEY env variable not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$SERIAL" ]; then
|
||||
$LOG error "SERIAL env variable not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$FIRMWARE_VERSION" ]; then
|
||||
$LOG error "FIRMWARE_VERSION env variable not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while getopts "u:" opt; do
|
||||
case $opt in
|
||||
u)
|
||||
API_URL=${OPTARG}
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$API_URL" ]; then
|
||||
usage
|
||||
fi
|
||||
# Source system information from /etc/os-release
|
||||
. /etc/os-release
|
||||
|
||||
# Convert OPENWRT_DEVICE_PRODUCT to uppercase and use it as the board name
|
||||
BOARD_NAME=$(echo "$OPENWRT_DEVICE_PRODUCT" | tr 'a-z' 'A-Z')
|
||||
BASE_MAC="$(db get device.deviceinfo.BaseMACAddress)"
|
||||
|
||||
while true; do
|
||||
if ping -c1 -4 analytics.iopsys.eu; then
|
||||
CORES=$(find "$CORE_DIR" -type f -name "*.core")
|
||||
for core in $CORES; do
|
||||
$LOG error "Core found: $core"
|
||||
|
||||
COREDUMP_MD5="$(md5sum "$core" | cut -f1 -d' ')"
|
||||
|
||||
UPLOAD_TYPE="file"
|
||||
|
||||
if [ -e /tmp/ctfw.meta ]; then
|
||||
. /tmp/ctfw.meta
|
||||
fi
|
||||
|
||||
echo "$CTFW_TEST_CASE" > /tmp/ctfw-test-case.txt
|
||||
upload_file "/tmp/ctfw-test-case.txt"
|
||||
|
||||
echo "$CTFW_TAG" > /tmp/ctfw-job-tag.txt
|
||||
upload_file "/tmp/ctfw-job-tag.txt"
|
||||
|
||||
echo "$CTFW_LOCK_USERNAME" > /tmp/ctfw-lock-username.txt
|
||||
upload_file "/tmp/ctfw-lock-username.txt"
|
||||
|
||||
opkg list > /tmp/opkg-list.txt
|
||||
upload_file "/tmp/opkg-list.txt"
|
||||
|
||||
free > /tmp/free-mem.txt
|
||||
upload_file "/tmp/free-mem.txt"
|
||||
|
||||
cat /proc/slabinfo > /tmp/slabinfo.txt
|
||||
upload_file "/tmp/slabinfo.txt"
|
||||
|
||||
echo "$BOARD_NAME" > /tmp/board-name.txt
|
||||
upload_file "/tmp/board-name.txt"
|
||||
|
||||
echo "$BASE_MAC" > /tmp/base-mac.txt
|
||||
upload_file "/tmp/base-mac.txt"
|
||||
|
||||
uname -n > /tmp/hostname.txt
|
||||
upload_file "/tmp/hostname.txt"
|
||||
|
||||
echo "$FIRMWARE_VERSION" > /tmp/fw-version.txt
|
||||
upload_file "/tmp/fw-version.txt"
|
||||
|
||||
cp "$(strings "$core" | grep ^/ | head -1 | cut -d' ' -f1)" /tmp/binary
|
||||
upload_file /tmp/binary
|
||||
|
||||
UPLOAD_TYPE="core"
|
||||
ORIGINAL_CORE_FILEPATH="$core"
|
||||
cp "$core" /tmp/core
|
||||
upload_file /tmp/core
|
||||
rm /tmp/core
|
||||
done
|
||||
fi
|
||||
|
||||
sleep $POLL_INTERVAL
|
||||
done
|
||||
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
231
iopsys-analytics/files/common/usr/sbin/system-report
Executable file
231
iopsys-analytics/files/common/usr/sbin/system-report
Executable file
@@ -0,0 +1,231 @@
|
||||
#!/bin/sh
|
||||
# shellcheck shell=dash
|
||||
|
||||
# Location of system report temporary directory
|
||||
SRDIR="/tmp/system-report"
|
||||
|
||||
|
||||
configure() {
|
||||
local preconf_path
|
||||
preconf_path="$(realpath "$0")"
|
||||
|
||||
if ! cmp -s /usr/sbin/system-report "${preconf_path}" >/dev/null; then
|
||||
echo "iopsys-test system-report differs from included with firmware, symlinking"
|
||||
ln -sf "${preconf_path}" /usr/sbin/system-report
|
||||
fi
|
||||
|
||||
if ! cmp -s /rom/usr/sbin/system-report /usr/sbin/system-report >/dev/null && ! grep -Fq "/usr/sbin/system-report" /etc/sysupgrade.conf; then
|
||||
echo "iopsys-test system-report differs from included with firmware, adding to sysupgrade.conf"
|
||||
echo "/usr/sbin/system-report" >>/etc/sysupgrade.conf
|
||||
fi
|
||||
}
|
||||
|
||||
run() {
|
||||
set -x
|
||||
|
||||
# Alias ubus to have a smaller 5-second timeout on all subsequent calls
|
||||
ubus() { command ubus -t 5 "$@"; }
|
||||
|
||||
mkdir -p "$SRDIR"
|
||||
|
||||
SRCF="$SRDIR/config"
|
||||
SRSY="$SRDIR/system"
|
||||
SRNT="$SRDIR/network"
|
||||
SRTR="$SRDIR/tr069"
|
||||
SRMD="$SRDIR/mem_dump"
|
||||
|
||||
# Config
|
||||
echo "Gathering configuration data"
|
||||
{
|
||||
cat /etc/banner
|
||||
|
||||
echo "Installed Packages"
|
||||
opkg list-installed
|
||||
|
||||
echo "Database"
|
||||
db show
|
||||
|
||||
echo "Configuration"
|
||||
uci show
|
||||
} > "$SRCF"
|
||||
|
||||
# System
|
||||
echo "Gathering system information"
|
||||
{
|
||||
echo "System Info"
|
||||
ubus call system info
|
||||
|
||||
echo "Board Info"
|
||||
ubus call system board
|
||||
|
||||
echo "Running Processes"
|
||||
top -b -n 1
|
||||
|
||||
echo "Kernel Parameters"
|
||||
sysctl -A 2>/dev/null
|
||||
|
||||
echo "System Log"
|
||||
timeout 5 logread -l 1000
|
||||
|
||||
echo "Driver Message"
|
||||
timeout 5 dmesg
|
||||
|
||||
echo "PCI Devices"
|
||||
lspci -k
|
||||
|
||||
echo "Installed Modules"
|
||||
lsmod
|
||||
|
||||
echo "CPU Info"
|
||||
cat /proc/cpuinfo
|
||||
|
||||
echo "Memory Info"
|
||||
cat /proc/meminfo
|
||||
|
||||
echo "Slab Info"
|
||||
cat /proc/slabinfo
|
||||
|
||||
echo "Firmware banks"
|
||||
ubus call fwbank dump
|
||||
} > "$SRSY"
|
||||
|
||||
# Network
|
||||
echo "Gathering network state"
|
||||
{
|
||||
echo "Device Status"
|
||||
ubus call network.device status
|
||||
|
||||
echo "Hosts Status"
|
||||
ubus call hosts show
|
||||
|
||||
echo "Topology"
|
||||
ubus call ieee1905.topology dump
|
||||
|
||||
echo "Network Status"
|
||||
ubus call network.interface dump
|
||||
|
||||
if [ -d /sys/class/ieee80211 ]; then
|
||||
echo "Wireless Status"
|
||||
ubus call network.wireless status
|
||||
|
||||
echo "Wireless Radio Status"
|
||||
ubus call wifi status
|
||||
|
||||
echo "Get radio scan"
|
||||
for radio_if in $(ubus list 'wifi.radio.*'); do
|
||||
ubus call "${radio_if}" scan
|
||||
sleep 2
|
||||
ubus call "${radio_if}" scanresults
|
||||
done
|
||||
|
||||
echo "Get Assoc List"
|
||||
interfaces=$(uci show wireless | grep "ifname=" | awk -F'[.,=]' '{print$2}')
|
||||
for int in $interfaces; do
|
||||
mode=$(uci get "wireless.${int}.mode")
|
||||
if [ "$mode" = "ap" ] ; then
|
||||
ap_int=$(uci get "wireless.${int}.ifname")
|
||||
echo "Get assoc list"
|
||||
ubus call "wifi.ap.${ap_int}" assoclist
|
||||
echo "Get station info"
|
||||
ubus call "wifi.ap.${ap_int}" stations
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
if [ "$(db get hw.board.hasVoice)" = 1 ]; then
|
||||
echo "voice status"
|
||||
ubus call voice.asterisk status
|
||||
fi
|
||||
|
||||
echo "IPv4 Routes"
|
||||
ip -d r
|
||||
|
||||
echo "IPv6 Routes"
|
||||
ip -d -6 r
|
||||
|
||||
echo "Neighbor Table"
|
||||
ip n
|
||||
|
||||
echo "ARP Table"
|
||||
cat /proc/net/arp
|
||||
|
||||
echo "IGMP Snooping Table"
|
||||
ubus call mcast stats
|
||||
|
||||
echo "Conntrack Table"
|
||||
cat /proc/net/nf_conntrack
|
||||
|
||||
echo "Network Interface Status"
|
||||
ip -d a
|
||||
|
||||
echo "IPv4 Firewall Status"
|
||||
iptables -xvnL
|
||||
|
||||
echo "IPv6 Firewall Status"
|
||||
ip6tables -xvnL
|
||||
|
||||
echo "Bridge Info"
|
||||
brctl show
|
||||
|
||||
if [ -f /tmp/multiap.backhaul ]; then
|
||||
echo "Multi-AP Backhaul status"
|
||||
cat /tmp/multiap.backhaul
|
||||
fi
|
||||
|
||||
echo "TCP/UDP listened ports"
|
||||
netstat -tlnp
|
||||
netstat -ulnp
|
||||
|
||||
echo "MAC layer firewall status"
|
||||
ebtables -t broute -L
|
||||
|
||||
echo "MAC layer firewall status list"
|
||||
ebtables -L
|
||||
|
||||
echo "IEEE1905 info"
|
||||
ubus call ieee1905 info
|
||||
|
||||
if [ -f /usr/bin/iwinfo ]; then
|
||||
echo "iwinfo interface details"
|
||||
/usr/bin/iwinfo
|
||||
fi
|
||||
|
||||
} > "$SRNT"
|
||||
|
||||
# TR-069
|
||||
echo "Gathering TR-069 state"
|
||||
{
|
||||
echo "TR-069 status"
|
||||
ubus call tr069 status
|
||||
|
||||
echo "get all TR-181 Parameters"
|
||||
ubus call bbfdm get '{"path":"Device."}'
|
||||
|
||||
echo "TR-069 Option 43 URL"
|
||||
uci -P /var/state -q get cwmp.acs.url
|
||||
|
||||
echo "TR-069 Logs"
|
||||
[ -f /var/log/icwmp ] && cat /var/log/icwmp
|
||||
} > "$SRTR"
|
||||
|
||||
# Firmware RAM dump (IOP-8118)
|
||||
if [ -f /tmp/mem_dump ]; then
|
||||
mv /tmp/mem_dump "$SRMD"
|
||||
fi
|
||||
|
||||
REPORT_PATH="$(dirname "${SRDIR}")"
|
||||
REPORT_DIRNAME="$(basename "${SRDIR}")"
|
||||
FILENAME="${REPORT_PATH}/system-report-$(date +%Y-%m-%d).tar.gz"
|
||||
tar -cz -C "${REPORT_PATH}" -f "${FILENAME}" "${REPORT_DIRNAME}"
|
||||
echo "Report is located at ${FILENAME}"
|
||||
|
||||
#ubus send "system-report" "{ \"filename\" : \"$FILENAME\" }"
|
||||
|
||||
rm -r "$SRDIR"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
configure) configure ;;
|
||||
*) run ;;
|
||||
esac
|
||||
7
iopsys-analytics/files/common/usr/sbin/ubus-monitor
Executable file
7
iopsys-analytics/files/common/usr/sbin/ubus-monitor
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/ash
|
||||
|
||||
rm -f /tmp/ubus-calls-pipe
|
||||
|
||||
mkfifo /tmp/ubus-calls-pipe || echo "Pipe wasn't created" >&2
|
||||
logger -t ubus-logging "Pipe created sucessfully"
|
||||
/bin/ubus listen > /tmp/ubus-calls-pipe
|
||||
@@ -0,0 +1,42 @@
|
||||
[INPUT]
|
||||
name syslog
|
||||
tag logs
|
||||
path /dev/log
|
||||
parser syslog-rfc3164-local
|
||||
|
||||
[INPUT]
|
||||
Name head
|
||||
Tag ubus_listen
|
||||
file /tmp/ubus-calls-pipe
|
||||
Interval_Sec 1
|
||||
|
||||
[OUTPUT]
|
||||
name syslog
|
||||
match logs
|
||||
host analytics.iopsys.eu
|
||||
port 6514
|
||||
mode tcp
|
||||
tls on
|
||||
tls.verify off
|
||||
tls.key_file /etc/analytics-cert/clientkey.pem
|
||||
tls.crt_file /etc/analytics-cert/clientcert.pem
|
||||
syslog_format rfc5424
|
||||
syslog_appname_preset dummy
|
||||
syslog_message_key message
|
||||
syslog_hostname_key hostname
|
||||
syslog_hostname_preset dummy
|
||||
|
||||
[OUTPUT]
|
||||
name syslog
|
||||
match ubus_listen
|
||||
host analytics.iopsys.eu
|
||||
port 6515
|
||||
mode tcp
|
||||
tls on
|
||||
tls.verify off
|
||||
tls.key_file /etc/analytics-cert/clientkey.pem
|
||||
tls.crt_file /etc/analytics-cert/clientcert.pem
|
||||
syslog_format rfc5424
|
||||
syslog_appname_preset dummy
|
||||
syslog_message_key head
|
||||
syslog_hostname_preset dummy
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check if fluent-bit is installed
|
||||
if command -v fluent-bit >/dev/null 2>&1; then
|
||||
conf_file="/etc/fluent-bit/conf.d/analytics.conf"
|
||||
|
||||
# Check if the configuration file exists
|
||||
if [ -f "$conf_file" ]; then
|
||||
# Get hostname and serial number
|
||||
hostname="$(db -q get device.deviceinfo.ModelName)"
|
||||
serialnum="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
|
||||
# Replace syslog_hostname_preset line
|
||||
sed -i "s/^.*syslog_hostname_preset.*/ syslog_hostname_preset ${hostname}/" "$conf_file"
|
||||
|
||||
# Replace syslog_appname_preset line
|
||||
sed -i "s/^.*syslog_appname_preset.*/ syslog_appname_preset ${serialnum}/" "$conf_file"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clear logs periodically
|
||||
grep -q 'logrotate' /etc/crontabs/root || echo '*/15 * * * * /usr/sbin/logrotate /etc/logrotate.conf' >> /etc/crontabs/root
|
||||
|
||||
# Exit successfully
|
||||
exit 0
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
/var/log/messages {
|
||||
missingok
|
||||
rotate 1
|
||||
size 1M
|
||||
postrotate
|
||||
/usr/sbin/syslog-ng-ctl reopen
|
||||
endscript
|
||||
}
|
||||
46
iopsys-analytics/files/syslog-ng/etc/syslog-ng.d/analytics
Normal file
46
iopsys-analytics/files/syslog-ng/etc/syslog-ng.d/analytics
Normal file
@@ -0,0 +1,46 @@
|
||||
source s_file {
|
||||
file("/var/log/messages" program_override("`ENV_VAR_SYSLOG_NG_DUT_SERIAL_NUMBER`"));
|
||||
};
|
||||
|
||||
source ubus_calls {
|
||||
pipe("/tmp/ubus-calls-pipe"
|
||||
flags(no-parse)
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
destination d_tls_syslog {
|
||||
syslog(
|
||||
"analytics.iopsys.eu"
|
||||
transport("tls")
|
||||
port(6514)
|
||||
tls(
|
||||
key-file("/etc/analytics-cert/clientkey.pem")
|
||||
cert-file("/etc/analytics-cert/clientcert.pem")
|
||||
peer-verify(no)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
destination d_tls_ubus {
|
||||
syslog(
|
||||
"analytics.iopsys.eu"
|
||||
transport("tls")
|
||||
port(6515)
|
||||
tls(
|
||||
key-file("/etc/analytics-cert/clientkey.pem")
|
||||
cert-file("/etc/analytics-cert/clientcert.pem")
|
||||
peer-verify(no)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
log {
|
||||
source(s_file);
|
||||
destination(d_tls_syslog);
|
||||
};
|
||||
|
||||
log {
|
||||
source(ubus_calls);
|
||||
destination(d_tls_ubus);
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
sed -i '/procd_open_instance.*/a \\tprocd_set_param env ENV_VAR_SYSLOG_NG_DUT_SERIAL_NUMBER="$(db get hw.board.serial_number)"' /etc/init.d/syslog-ng
|
||||
|
||||
# Clear logs periodically
|
||||
grep -q 'logrotate' /etc/crontabs/root || echo '*/15 * * * * /usr/sbin/logrotate /etc/logrotate.conf' >> /etc/crontabs/root
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libeasy
|
||||
PKG_VERSION:=7.4.5
|
||||
PKG_VERSION:=7.4.6
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=67e6b91b8aca4c068a71f097f5f0576b47ec1d2e
|
||||
PKG_SOURCE_VERSION:=ca7b20068c9d373e41045a2e899a9c697576262c
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libeasy.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-airoha
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.2
|
||||
PKG_VERSION:=1.1.3
|
||||
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:=1ded9a4bb0f2f8a5f3989799b5500e328e086c99
|
||||
PKG_SOURCE_VERSION:=f4ffa38b77e20f9e2a6b6ffd5b2bf83cddb6bffc
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -1,17 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
hasVoice=$(db -q get hw.board.hasVoice)
|
||||
|
||||
[ "$hasVoice" = "1" ] || exit 0
|
||||
|
||||
SLIC=`cat /proc/device-tree/airoha-voice/slic-type`
|
||||
[ "${SLIC#pef}" != "${SLIC}" ] || exit 0
|
||||
SLIC=$(cat /proc/device-tree/airoha-voice/slic-type)
|
||||
[ "${SLIC#pef}" != "${SLIC}" ] && {
|
||||
echo Configure TxGain and RxGain for MXL SLIC $SLIC
|
||||
|
||||
echo Configure TxGain and RxGain for MXL SLIC $SLIC
|
||||
ports=$(db -q get hw.board.VoicePorts)
|
||||
for p in $(seq 0 $((ports-1))); do
|
||||
uci set asterisk.extension${p}.txgain='10'
|
||||
uci set asterisk.extension${p}.rxgain='-15'
|
||||
done
|
||||
}
|
||||
|
||||
ports=$(db -q get hw.board.VoicePorts)
|
||||
for p in $(seq 0 $((ports-1))); do
|
||||
uci set asterisk.extension${p}.txgain='10'
|
||||
uci set asterisk.extension${p}.rxgain='-15'
|
||||
done
|
||||
uci commit asterisk
|
||||
hasDect=$(db -q get hw.board.hasDect)
|
||||
[ "$hasDect" = "1" ] || exit 0
|
||||
|
||||
# Set the DECT RFPI
|
||||
. /lib/functions/iopsys-environment.sh
|
||||
db set hw.board.dect_rfpi=$(get_dect_rfpi)
|
||||
db commit
|
||||
|
||||
# configure the PCM for DECT/DCX81
|
||||
[ -f "/proc/device-tree/aliases/dcx81-uart" ] && {
|
||||
uci set dect.global.pcm_fsync='SHORT_LF'
|
||||
uci set dect.global.pcm_slot_start='8'
|
||||
uci set dect.global.dect_channel_start='3'
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libwifi
|
||||
PKG_VERSION:=7.10.0
|
||||
PKG_VERSION:=7.12.10
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=1339c8a04ace73086832534a0f06835df67b8bca
|
||||
PKG_SOURCE_VERSION:=2bd3a37cc5c14af93d0af1643610285d8d382fba
|
||||
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
|
||||
|
||||
38
linux-pam/Makefile
Normal file
38
linux-pam/Makefile
Normal file
@@ -0,0 +1,38 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=linux-pam
|
||||
PKG_VERSION:=1.7.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/linux-pam/linux-pam.git
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/meson.mk
|
||||
|
||||
define Package/linux-pam
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Linux PAM Module
|
||||
DEPENDS:=+libpam
|
||||
endef
|
||||
|
||||
MESON_ARGS += \
|
||||
-Dprefix=/usr \
|
||||
-Ddefault_library=shared \
|
||||
-Ddocs=disabled \
|
||||
-Deconf=disabled \
|
||||
-Dselinux=disabled \
|
||||
-Dnis=disabled \
|
||||
-Dexamples=false \
|
||||
-Dxtests=false
|
||||
|
||||
define Package/linux-pam/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/security
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/pam_faillock.uci_default $(1)/etc/uci-defaults/99-add_pam_faillock
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,linux-pam))
|
||||
43
linux-pam/files/pam_faillock.uci_default
Normal file
43
linux-pam/files/pam_faillock.uci_default
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
|
||||
create_faillock_files()
|
||||
{
|
||||
# also create files needed by pam_faillock
|
||||
touch /var/log/faillock
|
||||
chmod 700 /var/log/faillock
|
||||
touch /var/log/btmp
|
||||
chmod 700 /var/log/btmp
|
||||
}
|
||||
|
||||
update_pam_common_auth()
|
||||
{
|
||||
local file="/etc/pam.d/common-auth"
|
||||
local deny=6
|
||||
local unlock_time=300
|
||||
|
||||
# update pam_unix.so line
|
||||
sed -i -E 's|^.*pam_unix\.so.*|auth\t sufficient\tpam_unix.so nullok_secure|' "$file"
|
||||
|
||||
# Insert pam_faillock lines before and after pam_unix.so
|
||||
sed -i -E "/pam_unix.so nullok_secure/i auth required pam_faillock.so preauth deny=$deny even_deny_root unlock_time=$unlock_time" "$file"
|
||||
sed -i -E "/pam_unix.so nullok_secure/a auth [default=die] pam_faillock.so authfail audit deny=$deny even_deny_root unlock_time=$unlock_time" "$file"
|
||||
}
|
||||
|
||||
update_pam_common_account()
|
||||
{
|
||||
# update account file
|
||||
sed -i "/pam_unix.so/ i account required pam_faillock.so" /etc/pam.d/common-account
|
||||
}
|
||||
|
||||
if [ -f "/usr/lib/security/pam_faillock.so" ]; then
|
||||
update_pam_common_auth
|
||||
update_pam_common_account
|
||||
create_faillock_files
|
||||
fi
|
||||
|
||||
if [ -f /etc/config/sshd ]; then
|
||||
uci -q set sshd.@sshd[0].UsePAM=1
|
||||
uci commit sshd
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=logmngr
|
||||
PKG_VERSION:=1.0.9
|
||||
PKG_VERSION:=1.0.15
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/system/logmngr.git
|
||||
PKG_SOURCE_VERSION:=e2ffe2b9e7722ce19dff7db6e47e62a305dc568b
|
||||
PKG_SOURCE_VERSION:=1561b71a2225af737db9f091204247ab4e141abb
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -28,9 +28,12 @@ define Package/logmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Logging Manager
|
||||
DEPENDS:=+LOGMNGR_BACKEND_FLUENTBIT:fluent-bit +LOGMNGR_LOGROTATE:logrotate
|
||||
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
|
||||
CONFLICTS:=logd
|
||||
endef
|
||||
|
||||
define Package/logmngr/description
|
||||
@@ -52,27 +55,28 @@ define Package/logmngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/logmngr.init $(1)/etc/init.d/logmngr
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/10-logmngr_config_generate $(1)/etc/uci-defaults/
|
||||
|
||||
$(INSTALL_DIR) $(1)/lib/logmngr
|
||||
ifeq ($(CONFIG_LOGMNGR_BACKEND_FLUENTBIT),y)
|
||||
$(INSTALL_DATA) ./files/lib/logmngr/fluent-bit.sh $(1)/lib/logmngr/
|
||||
$(INSTALL_BIN) ./files/logread $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) ./files/logmngr-klogd $(1)/usr/libexec/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/logread $(1)/sbin/
|
||||
endif
|
||||
ifeq ($(CONFIG_LOGMNGR_BACKEND_SYSLOG_NG),y)
|
||||
$(INSTALL_DATA) ./files/lib/logmngr/syslog-ng.sh $(1)/lib/logmngr/
|
||||
endif
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbfsyslog.so $(1) core
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbfsyslog.so $(1) core 10
|
||||
ifeq ($(CONFIG_LOGMNGR_LOGROTATE),y)
|
||||
$(INSTALL_BIN) ./files/11-logmngr_logrotate_config_generate $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DATA) ./files/lib/logmngr/logrotate.sh $(1)/lib/logmngr/
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbflogrotate.so $(1) sysmngr
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbflogrotate.so $(1) sysmngr 11
|
||||
endif
|
||||
ifeq ($(CONFIG_LOGMNGR_VENDOR_LOG_FILE),y)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbfvendorlog.so $(1) sysmngr
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbfvendorlog.so $(1) sysmngr 12
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -s "/etc/config/logmngr" ]; then
|
||||
if uci -q get logmngr.@globals[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
else
|
||||
rm -f /etc/config/logmngr
|
||||
fi
|
||||
if uci -q get logmngr.@globals[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit 0
|
||||
else
|
||||
rm -f /etc/config/logmngr
|
||||
fi
|
||||
|
||||
touch /etc/config/logmngr
|
||||
|
||||
uci set logmngr.globals=globals
|
||||
@@ -25,4 +24,3 @@ uci set logmngr.lr1=log_remote
|
||||
uci set logmngr.lr1.enable=0
|
||||
uci set logmngr.lr1.action="ac1"
|
||||
uci set logmngr.lr1.port="514"
|
||||
uci commit logmngr
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -s "/etc/config/logmngr" ]; then
|
||||
if uci -q get logmngr.@log_rotate[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
fi
|
||||
uci set logmngr.lro1=log_rotate
|
||||
uci set logmngr.lro1.enable=1
|
||||
uci set logmngr.lro1.file_name="/var/log/messages"
|
||||
uci set logmngr.lro1.file_count=1
|
||||
uci set logmngr.lro1.max_file_size=1000000
|
||||
uci commit logmngr
|
||||
# Adds a default log rotate policy if none exists
|
||||
if uci -q get logmngr.@log_rotate[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit 0
|
||||
fi
|
||||
|
||||
uci set logmngr.lro1=log_rotate
|
||||
uci set logmngr.lro1.enable=1
|
||||
uci set logmngr.lro1.file_name="/var/log/messages"
|
||||
uci set logmngr.lro1.file_count=1
|
||||
uci set logmngr.lro1.max_file_size=1000000
|
||||
|
||||
@@ -5,11 +5,24 @@
|
||||
|
||||
CONF_FILE=/etc/fluent-bit/fluent-bit.conf
|
||||
TMP_CONF_FILE=/tmp/fluent-bit/fluent-bit.conf
|
||||
CONF_DIR=/etc/fluent-bit/conf.d
|
||||
|
||||
append_conf() {
|
||||
echo "$*" >> ${TMP_CONF_FILE}
|
||||
}
|
||||
|
||||
create_config_file() {
|
||||
mkdir -p /tmp/fluent-bit
|
||||
rm -f ${TMP_CONF_FILE}
|
||||
touch ${TMP_CONF_FILE}
|
||||
# include all files placed in analytics 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}
|
||||
fi
|
||||
echo "" >> ${TMP_CONF_FILE}
|
||||
}
|
||||
|
||||
create_service_section() {
|
||||
@@ -19,11 +32,14 @@ create_service_section() {
|
||||
echo " flush 1" >> ${TMP_CONF_FILE}
|
||||
echo " daemon off" >> ${TMP_CONF_FILE}
|
||||
echo " log_level info" >> ${TMP_CONF_FILE}
|
||||
echo " coro_stack_size 24576" >> ${TMP_CONF_FILE}
|
||||
echo " parsers_file /etc/fluent-bit/parsers.conf" >> ${TMP_CONF_FILE}
|
||||
echo "" >> ${TMP_CONF_FILE}
|
||||
}
|
||||
|
||||
create_input_section() {
|
||||
local tag="$1"
|
||||
|
||||
# the input in our case is always syslog, hence, this section of the
|
||||
# fluent-bit.conf file has hardcoded values as well that do not depend
|
||||
# on any uci value
|
||||
@@ -31,6 +47,7 @@ create_input_section() {
|
||||
echo " name syslog" >> ${TMP_CONF_FILE}
|
||||
echo " tag $tag" >> ${TMP_CONF_FILE}
|
||||
echo " path /dev/log" >> ${TMP_CONF_FILE}
|
||||
echo "" >> ${TMP_CONF_FILE}
|
||||
}
|
||||
|
||||
generate_facility_regex() {
|
||||
@@ -55,7 +72,6 @@ generate_facility_regex() {
|
||||
echo " regex pri $pri" >> ${TMP_CONF_FILE}
|
||||
done
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
generate_severity_regex() {
|
||||
@@ -205,7 +221,6 @@ handle_log_remote() {
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
local address
|
||||
config_get address $section log_ip
|
||||
if [ -z "$address" ]; then
|
||||
@@ -216,9 +231,17 @@ handle_log_remote() {
|
||||
echo " name syslog" >> ${TMP_CONF_FILE}
|
||||
echo " match $match" >> ${TMP_CONF_FILE}
|
||||
echo " host $address" >> ${TMP_CONF_FILE}
|
||||
append_conf " syslog_appname_key ident"
|
||||
append_conf " syslog_procid_key pid"
|
||||
append_conf " syslog_message_key message"
|
||||
|
||||
local hostname="$(uci -q get 'system.@system[0].hostname')"
|
||||
if [ -n "${hostname}" ]; then
|
||||
append_conf " syslog_hostname_preset ${hostname}"
|
||||
fi
|
||||
|
||||
local proto # holds value tcp or udp
|
||||
config_get proto $section proto
|
||||
config_get proto ${section} proto
|
||||
if [ -n "$proto" ]; then
|
||||
if [ "$proto" == "tls" ]; then
|
||||
echo " mode tcp" >> ${TMP_CONF_FILE}
|
||||
@@ -281,41 +304,44 @@ handle_action() {
|
||||
# with this and action and setup output accordingly.
|
||||
config_foreach handle_log_file log_file "$tag"
|
||||
config_foreach handle_log_remote log_remote "$tag"
|
||||
|
||||
|
||||
}
|
||||
|
||||
handle_action_section() {
|
||||
config_foreach handle_action action
|
||||
}
|
||||
|
||||
apply_config_file() {
|
||||
cp ${TMP_CONF_FILE} ${CONF_FILE}
|
||||
}
|
||||
|
||||
PROG=/usr/sbin/fluent-bit
|
||||
logmngr_init() {
|
||||
create_config_file
|
||||
local enabled
|
||||
|
||||
config_load logmngr
|
||||
local enabled
|
||||
config_get enabled globals enable
|
||||
|
||||
if [ "$enabled" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
config_get_bool enabled globals enable "1"
|
||||
|
||||
create_config_file
|
||||
create_service_section
|
||||
handle_action_section
|
||||
apply_config_file
|
||||
|
||||
if [ -f /lib/logmngr/logrotate.sh ]; then
|
||||
logrotate_init
|
||||
fi
|
||||
|
||||
if [ "$enabled" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
procd_open_instance logmngr
|
||||
procd_set_param command $PROG -c $CONF_FILE
|
||||
procd_set_param file $CONF_FILE
|
||||
if [ -s "${TMP_CONF_FILE}" ]; then
|
||||
procd_set_param command $PROG -c ${TMP_CONF_FILE}
|
||||
procd_set_param file ${TMP_CONF_FILE}
|
||||
elif [ -s "${CONF_FILE}" ]; then
|
||||
procd_set_param command $PROG -c ${CONF_FILE}
|
||||
procd_set_param file ${CONF_FILE}
|
||||
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
|
||||
}
|
||||
|
||||
@@ -8,10 +8,9 @@ LOGROTATE_TMP_FILE=/tmp/logrotate/logrotate.conf
|
||||
create_logrotate_file() {
|
||||
mkdir -p /tmp/logrotate
|
||||
rm -f ${LOGROTATE_TMP_FILE}
|
||||
touch ${LOGROTATE_FILE}
|
||||
touch ${LOGROTATE_TMP_FILE}
|
||||
}
|
||||
|
||||
|
||||
handle_logrotate() {
|
||||
local section="$1"
|
||||
|
||||
|
||||
7
logmngr/files/logmngr-klogd
Normal file
7
logmngr/files/logmngr-klogd
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
until [ -S /dev/log ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exec /sbin/klogd -n
|
||||
@@ -89,13 +89,13 @@ else
|
||||
exit 0
|
||||
;;
|
||||
-f)
|
||||
tail -f "${logfile}"
|
||||
tail -F "${logfile}"
|
||||
exit 0
|
||||
;;
|
||||
-fe)
|
||||
shift
|
||||
pattern="${1}"
|
||||
tail -f "${logfile}" | grep -E "${pattern}"
|
||||
tail -F "${logfile}" | grep -E "${pattern}"
|
||||
exit 0
|
||||
;;
|
||||
-h|*)
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2008-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ltq-nand
|
||||
PKG_VERSION:=1.0
|
||||
|
||||
PKG_SOURCE:=v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/merbanan/ltq-nand/archive/
|
||||
#PKG_SOURCE_PROTO:=git
|
||||
#PKG_SOURCE_URL:=https://github.com/merbanan/ltq-nand/releases/download/v$(PKG_VERSION)/
|
||||
#PKG_SOURCE_URL:=https://github.com/merbanan/ltq-nand.git
|
||||
#PKG_SOURCE_VERSION:=07b5b0331af6de4174dab2c02bf260ee9625452a
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
|
||||
define Host/Compile
|
||||
$(MAKE) -C $(HOST_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(CP) \
|
||||
$(HOST_BUILD_DIR)/ltq-nand \
|
||||
$(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
||||
@@ -62,5 +62,9 @@ config AGENT_CHECK_PARTIAL_WIFI_RELOAD
|
||||
config DYNBHD_DYNAMICALLY_PERSIST_CONTROLLER
|
||||
bool "Let dynbhd through AP-Autoconfiguration Search and DHCP Discovery determine the controller or agent role"
|
||||
|
||||
config AGENT_UNASSOC_STA_CONT_MONITOR
|
||||
bool "Enable continuos monitoring of unassociated clients"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=6.3.3.2
|
||||
PKG_VERSION:=6.3.5.4
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=43779ec4dac50780a6807aad7da22bc255694331
|
||||
PKG_SOURCE_VERSION:=2ed08bae7f22d08dc868d03c28777a44fc637093
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -115,6 +115,10 @@ ifeq ($(CONFIG_DYNBHD_DYNAMICALLY_PERSIST_CONTROLLER),y)
|
||||
TARGET_CFLAGS += -DPERSIST_CONTROLLER
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AGENT_UNASSOC_STA_CONT_MONITOR),y)
|
||||
TARGET_CFLAGS += -DUNASSOC_STA_CONT_MONITOR
|
||||
endif
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/map-agent/install
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
conn_ports_file="/var/run/multiap/map.connected.ports"
|
||||
map_bh_file="/var/run/multiap/multiap.backhaul"
|
||||
|
||||
# Exit if AL Bridge is not configured to be a bridge device
|
||||
al_bridge="$(uci -q get mapagent.agent.al_bridge)"
|
||||
[ "${al_bridge:0:3}" = "br-" ] || exit 0
|
||||
|
||||
# Get all sections where the port appears in 'ports' list
|
||||
port_bridge_sec_list="$(uci show network | grep -w $PORT | grep '\.ports' | cut -d'.' -f2)"
|
||||
|
||||
# Find the first section with type='bridge' and get its name
|
||||
for port_bridge_sec in $port_bridge_sec_list; do
|
||||
if [ "$(uci -q get network.$port_bridge_sec.type)" = "bridge" ]; then
|
||||
port_bridge_name="$(uci -q get network.$port_bridge_sec.name)"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Exit if the PORT Bridge Name is empty
|
||||
[ -z "$port_bridge_name" ] && exit 0
|
||||
|
||||
# Exit if the PORT is not member of the AL Bridge
|
||||
port_bridge_sec="$(uci show network | grep -w $PORT | grep '\.ports' | cut -d'.' -f2)"
|
||||
port_bridge_name="$(uci -q get network.$port_bridge_sec.name)"
|
||||
[ "$port_bridge_name" = "$al_bridge" ] || exit 0
|
||||
|
||||
# Exit if the device is not operating in extender/repeater mode
|
||||
@@ -18,30 +29,6 @@ al_brnet="${al_bridge:3}"
|
||||
|
||||
############## Dynamic Backhaul Daemon ##############
|
||||
if [ -n "$(which dynbhd)" ]; then
|
||||
pidof dynbhd >/dev/null && exit 0 # dynbhd is managing the links
|
||||
|
||||
if [ ! -f $conn_ports_file ]; then
|
||||
mkdir -p /var/run/multiap
|
||||
touch $conn_ports_file
|
||||
if [ "$LINK" = "up" ]; then
|
||||
touch $conn_ports_file
|
||||
echo "$PORT" > $conn_ports_file
|
||||
brctl delif $al_bridge $PORT
|
||||
#ubus call network.interface.lan remove_device "{\"name\":\"$PORT\"}"
|
||||
fi
|
||||
else
|
||||
if [ "$LINK" = "up" ]; then
|
||||
brctl delif $al_bridge $PORT
|
||||
echo "$PORT" >> $conn_ports_file
|
||||
#ubus call network.interface.lan remove_device "{\"name\":\"$PORT\"}"
|
||||
else
|
||||
sed -i -E "/(^|:)${PORT}(:|$)/d" $conn_ports_file
|
||||
#ubus call network.interface.lan add_device "{\"name\":\"$PORT\"}"
|
||||
brctl addif $al_bridge $PORT
|
||||
[ "$(cat $conn_ports_file | wc -c)" = "0" ] && rm -f $conn_ports_file
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
########################################################
|
||||
|
||||
@@ -15,6 +15,11 @@ config CONTROLLER_PROVISION_DISABLED_AP
|
||||
bool "Enable vendor extension that provisions disabled APs to agents"
|
||||
default n
|
||||
|
||||
config CONTROLLER_PROVISION_BRIDGE
|
||||
depends on CONTROLLER_EASYMESH_VENDOR_EXT
|
||||
bool "Enable vendor extension that provisions custom bridge for APs to agents, if configured"
|
||||
default n
|
||||
|
||||
config CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
hex "Vendor OUI default"
|
||||
default 0xB456FA
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=6.3.0.0
|
||||
PKG_VERSION:=6.3.0.18
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=db9966487d40b8eef75fcf5fa3277d2e2907a46e
|
||||
PKG_SOURCE_VERSION:=b76714a5254756a66f2a8663b70d07dbe7818aaa
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@genexis.eu>
|
||||
|
||||
LOCAL_DEV=0
|
||||
@@ -65,6 +65,9 @@ TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT
|
||||
ifeq ($(CONFIG_CONTROLLER_PROVISION_DISABLED_AP),y)
|
||||
TARGET_CFLAGS += -DPROVISION_DISABLED_AP
|
||||
endif
|
||||
ifeq ($(CONFIG_CONTROLLER_PROVISION_BRIDGE),y)
|
||||
TARGET_CFLAGS += -DPROVISION_BRIDGE
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CONTROLLER_PROPAGATE_PROBE_REQ),y)
|
||||
|
||||
@@ -33,27 +33,27 @@ config sta_steering
|
||||
|
||||
config ap
|
||||
option band '2'
|
||||
option ssid '$DEVICE_MANUFACTURER-$BASEMAC_ADDR'
|
||||
option encryption 'sae-mixed'
|
||||
option key '$WIFI_FH_KEY'
|
||||
option ssid '$WIFI_FH_2G_SSID'
|
||||
option encryption '$WIFI_FH_2G_ENCRYPTION'
|
||||
option key '$WIFI_FH_2G_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
|
||||
config ap
|
||||
option band '5'
|
||||
option ssid '$DEVICE_MANUFACTURER-$BASEMAC_ADDR'
|
||||
option encryption 'sae-mixed'
|
||||
option key '$WIFI_FH_KEY'
|
||||
option ssid '$WIFI_FH_5G_SSID'
|
||||
option encryption '$WIFI_FH_5G_ENCRYPTION'
|
||||
option key '$WIFI_FH_5G_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
|
||||
config ap
|
||||
option band '6'
|
||||
option ssid '$DEVICE_MANUFACTURER-$BASEMAC_ADDR'
|
||||
option encryption 'sae'
|
||||
option key '$WIFI_FH_KEY'
|
||||
option ssid '$WIFI_FH_6G_SSID'
|
||||
option encryption '$WIFI_FH_6G_ENCRYPTION'
|
||||
option key '$WIFI_FH_6G_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
@@ -87,8 +87,8 @@ config ap
|
||||
|
||||
config mld
|
||||
option id '1'
|
||||
option ssid '$DEVICE_MANUFACTURER-$BASEMAC_ADDR'
|
||||
option key '$WIFI_FH_KEY'
|
||||
option ssid '$WIFI_FH_ALL_SSID'
|
||||
option key '$WIFI_FH_ALL_KEY'
|
||||
# option vid '1'
|
||||
option type 'fronthaul'
|
||||
|
||||
|
||||
@@ -1,18 +1,95 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/system.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
CFG=/etc/board.json
|
||||
. /etc/device_info
|
||||
|
||||
WIFI_BH_KEY=$(openssl rand -rand /dev/urandom -hex 64 2>/dev/null | openssl dgst -hex -sha256 | cut -d " " -f 2)
|
||||
WIFI_BH_KEY=${WIFI_BH_KEY::-1}
|
||||
|
||||
BASEMAC_ADDR="$(fw_printenv -n ethaddr | tr -d ':' | tr 'a-z' 'A-Z')"
|
||||
[ ${#BASEMAC_ADDR} -eq 12 ] || BASEMAC_ADDR="$(db -q get device.deviceinfo.BaseMACAddress | tr -d ':')"
|
||||
BASEMAC_ADDR="$(get_mac_label | tr -d ':' | tr 'a-z' 'A-Z')"
|
||||
|
||||
WIFI_FH_KEY="$(db get hw.board.wpa_key)"
|
||||
WIFI_FH_KEY="${WIFI_FH_KEY:-1234567890}"
|
||||
FALLBACK_SSID="$DEVICE_MANUFACTURER-$BASEMAC_ADDR"
|
||||
FALLBACK_KEY="1234567890"
|
||||
FALLBACK_2G_ENCRYPTION="sae-mixed"
|
||||
FALLBACK_5G_ENCRYPTION="sae-mixed"
|
||||
FALLBACK_6G_ENCRYPTION="sae"
|
||||
FALLBACK_ALL_ENCRYPTION="sae-mixed"
|
||||
|
||||
set_per_band_callback() {
|
||||
local band="$2"
|
||||
json_select "$band" || return
|
||||
local ssid encryption key
|
||||
json_get_vars ssid encryption key
|
||||
case "$band" in
|
||||
all|2g|5g|6g)
|
||||
local band_upper="$(printf "%s" "$band" | tr 'a-z' 'A-Z')"
|
||||
eval "WIFI_FH_${band_upper}_SSID=\$ssid"
|
||||
eval "WIFI_FH_${band_upper}_ENCRYPTION=\$encryption"
|
||||
eval "WIFI_FH_${band_upper}_KEY=\$key"
|
||||
;;
|
||||
esac
|
||||
json_select ..
|
||||
}
|
||||
|
||||
set_vars_from_board_json() {
|
||||
json_init
|
||||
json_load_file "$CFG"
|
||||
if json_select wlan && json_select defaults && json_is_a ssids object; then
|
||||
json_for_each_item set_per_band_callback ssids
|
||||
fi
|
||||
json_cleanup
|
||||
}
|
||||
|
||||
set_in_priority() {
|
||||
local destination="$1"
|
||||
local alternative value
|
||||
shift
|
||||
for alternative in "$@"; do
|
||||
eval "value=\${${alternative}}"
|
||||
if [ -n "$value" ]; then
|
||||
echo "Setting $destination to '$value' from \$$alternative"
|
||||
eval "${destination}=\$value"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
set_missing_vars_from_fallback() {
|
||||
local band what
|
||||
for band in ALL 2G 5G 6G; do
|
||||
for what in SSID KEY; do
|
||||
set_in_priority \
|
||||
WIFI_FH_${band}_${what} \
|
||||
WIFI_FH_${band}_${what} \
|
||||
WIFI_FH_ALL_${what} \
|
||||
FALLBACK_${what}
|
||||
done
|
||||
# Per band fallback variables for encryption because SAE is mandatory on 6 GHz
|
||||
set_in_priority \
|
||||
WIFI_FH_${band}_ENCRYPTION \
|
||||
WIFI_FH_${band}_ENCRYPTION \
|
||||
FALLBACK_${band}_ENCRYPTION
|
||||
done
|
||||
}
|
||||
|
||||
set_vars_from_board_json
|
||||
set_missing_vars_from_fallback
|
||||
|
||||
sed -i -e "s/\$BASEMAC_ADDR/$BASEMAC_ADDR/g" \
|
||||
-e "s/\$WIFI_FH_KEY/$WIFI_FH_KEY/g" \
|
||||
-e "s/\$WIFI_FH_2G_KEY/$WIFI_FH_2G_KEY/g" \
|
||||
-e "s/\$WIFI_FH_5G_KEY/$WIFI_FH_5G_KEY/g" \
|
||||
-e "s/\$WIFI_FH_6G_KEY/$WIFI_FH_6G_KEY/g" \
|
||||
-e "s/\$WIFI_FH_ALL_KEY/$WIFI_FH_ALL_KEY/g" \
|
||||
-e "s/\$WIFI_FH_2G_SSID/$WIFI_FH_2G_SSID/g" \
|
||||
-e "s/\$WIFI_FH_5G_SSID/$WIFI_FH_5G_SSID/g" \
|
||||
-e "s/\$WIFI_FH_6G_SSID/$WIFI_FH_6G_SSID/g" \
|
||||
-e "s/\$WIFI_FH_ALL_SSID/$WIFI_FH_ALL_SSID/g" \
|
||||
-e "s/\$WIFI_FH_2G_ENCRYPTION/$WIFI_FH_2G_ENCRYPTION/g" \
|
||||
-e "s/\$WIFI_FH_5G_ENCRYPTION/$WIFI_FH_5G_ENCRYPTION/g" \
|
||||
-e "s/\$WIFI_FH_6G_ENCRYPTION/$WIFI_FH_6G_ENCRYPTION/g" \
|
||||
-e "s/\$WIFI_FH_ALL_ENCRYPTION/$WIFI_FH_ALL_ENCRYPTION/g" \
|
||||
-e "s/\$WIFI_BH_KEY/$WIFI_BH_KEY/g" \
|
||||
-e "s/\$DEVICE_MANUFACTURER/$DEVICE_MANUFACTURER/g" \
|
||||
/etc/config/mapcontroller 2>/dev/null
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
cfg=mapcontroller
|
||||
|
||||
config_load $cfg
|
||||
|
||||
adapt_sta_steering() {
|
||||
steer_module=$(uci -q get $cfg.@sta_steering[0].steer_module)
|
||||
bandsteer=$(uci -q get $cfg.@sta_steering[0].bandsteer)
|
||||
enabled=$(uci -q get $cfg.@sta_steering[0].enabled)
|
||||
diffsnr=$(uci -q get $cfg.@sta_steering[0].diffsnr)
|
||||
stri=$(uci -q get $cfg.@sta_steering[0].steer_retry_int)
|
||||
sti=$(uci -q get $cfg.@sta_steering[0].steer_int)
|
||||
stdi=$(uci -q get $cfg.@sta_steering[0].steer_disable_int)
|
||||
|
||||
uci -q del $cfg.@sta_steering[0].enabled
|
||||
uci -q del $cfg.@sta_steering[0].steer_module
|
||||
uci -q del $cfg.@sta_steering[0].use_bcn_metrics
|
||||
uci -q del $cfg.@sta_steering[0].use_usta_metrics
|
||||
uci -q del $cfg.@sta_steering[0].bandsteer
|
||||
uci -q del $cfg.@sta_steering[0].diffsnr
|
||||
|
||||
uci del_list $cfg.@sta_steering[0].plugins="rcpi"
|
||||
uci add_list $cfg.@sta_steering[0].plugins="rcpi"
|
||||
uci -q set $cfg.@sta_steering[0].plugins_enabled="1"
|
||||
uci -q set $cfg.@sta_steering[0].plugins_policy="any"
|
||||
|
||||
# re-apply any custom legacy value(s) in 'sta-steer' section
|
||||
if [ -n "${enabled}" -o -n "${bandsteer}" -o -n "${diffsnr}" -o -n "${sti}" -o -n "${stri}" -o -n "${stdi}" ]; then
|
||||
# create 'rcpi' named 'sta-steer' section if there is none
|
||||
[ $(uci -q get mapcontroller.rcpi) ] || uci set $cfg.rcpi=sta-steer
|
||||
|
||||
# set custom value(s)
|
||||
[ -z "${enabled}" ] || uci -q set $cfg.rcpi.enabled="${enabled}"
|
||||
[ -z "${bandsteer}" ] || uci -q set $cfg.rcpi.bandsteer="${bandsteer}"
|
||||
[ -z "${diffsnr}" ] || uci -q set $cfg.rcpi.diffsnr="${diffsnr}"
|
||||
[ -z "${sti}" ] || uci -q set $cfg.rcpi.steer_int="${sti}"
|
||||
[ -z "${stri}" ] || uci -q set $cfg.rcpi.steer_retry_int="${stri}"
|
||||
[ -z "${stdi}" ] || uci -q set $cfg.rcpi.steer_disable_int="${stdi}"
|
||||
uci reorder $cfg.rcpi=2
|
||||
fi
|
||||
}
|
||||
|
||||
adapt_sta_steering
|
||||
@@ -16,8 +16,6 @@ generate_igmp_global_params(){
|
||||
uci set mcast.@mld[-1].mldv2_unsolicited_report_interval="1"
|
||||
uci set mcast.@mld[-1].qrv="2"
|
||||
uci set mcast.@mld[-1].force_version="0"
|
||||
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
generate_mld_proxy_config(){
|
||||
@@ -73,8 +71,6 @@ generate_mcast_config(){
|
||||
|
||||
generate_igmp_proxy_config "$up_itf"
|
||||
generate_mld_proxy_config "$up_itf"
|
||||
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
interfaces_ok(){
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netmngr
|
||||
PKG_VERSION:=1.1.4
|
||||
PKG_VERSION:=1.1.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/netmngr.git
|
||||
PKG_SOURCE_VERSION:=34b7163a759038edbbc0304be36abad05b9bc9b4
|
||||
PKG_SOURCE_VERSION:=f1422e4de76990f7037ca265431d5f1031621c93
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netmode
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_VERSION:=1.1.2
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
define Package/netmode
|
||||
CATEGORY:=Utilities
|
||||
@@ -23,11 +24,29 @@ define Package/netmode/description
|
||||
Network Modes and Utils
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
config NETMODE_VENDOR_PREFIX
|
||||
depends on PACKAGE_netmode
|
||||
string "Vendor Extension used for netmode datamodel"
|
||||
default ""
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_NETMODE_VENDOR_PREFIX),"")
|
||||
VENDOR_PREFIX = $(CONFIG_BBF_VENDOR_PREFIX)
|
||||
else
|
||||
VENDOR_PREFIX = $(CONFIG_NETMODE_VENDOR_PREFIX)
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/netmode/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) ./files/etc/* $(1)/etc/
|
||||
$(CP) ./files/lib/* $(1)/lib/
|
||||
$(BBFDM_REGISTER_SERVICES) -v ${VENDOR_PREFIX} ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_DM) -v ${VENDOR_PREFIX} ./files/datamodel.json $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,netmode))
|
||||
|
||||
16
netmode/bbfdm_service.json
Normal file
16
netmode/bbfdm_service.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"daemon": {
|
||||
"enable": "1",
|
||||
"service_name": "netmode",
|
||||
"unified_daemon": false,
|
||||
"services": [
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
"object": "{BBF_VENDOR_PREFIX}NetMode"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"loglevel": "3"
|
||||
}
|
||||
}
|
||||
}
|
||||
267
netmode/files/datamodel.json
Normal file
267
netmode/files/datamodel.json
Normal file
@@ -0,0 +1,267 @@
|
||||
{
|
||||
"json_plugin_version": 2,
|
||||
"Device.{BBF_VENDOR_PREFIX}NetMode.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Datamodel vendor extension to support easy switching between wan types, a reboot is required in some cases after switching the mode",
|
||||
"access": false,
|
||||
"array": false,
|
||||
"dependency": "file:/etc/config/netmode",
|
||||
"Enable": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"description": "Enable/Disable WAN switching using netmode",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "netmode",
|
||||
"section": {
|
||||
"name": "global"
|
||||
},
|
||||
"option": {
|
||||
"name": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Mode": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"description": "Current configured netmode value",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"flags": [
|
||||
"Reference"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "netmode",
|
||||
"section": {
|
||||
"name": "global"
|
||||
},
|
||||
"option": {
|
||||
"name": "mode"
|
||||
}
|
||||
},
|
||||
"linker_obj": "Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.[Name==@key]."
|
||||
}
|
||||
]
|
||||
},
|
||||
"SupportedModesNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"description": "SupportedModes Number of entries in the current config",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "netmode",
|
||||
"section": {
|
||||
"type": "supported_modes"
|
||||
},
|
||||
"option": {
|
||||
"name": "@Count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"description": "Object to list supported wan modes",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "netmode",
|
||||
"section": {
|
||||
"type": "supported_modes"
|
||||
},
|
||||
"dmmapfile": "dmmap_netmode"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Name": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"description": "Name of the wan mode, it has to be unique and in sync with /etc/netmodes/",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"flags": [
|
||||
"Linker",
|
||||
"Unique"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci_sec",
|
||||
"data": "@Parent",
|
||||
"key": "name"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Description": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"description": "Human readable description for this mode",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci_sec",
|
||||
"data": "@Parent",
|
||||
"key": "description"
|
||||
}
|
||||
]
|
||||
},
|
||||
"SupportedArgumentsNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"description": "SupportedModes Number of entries in the current config",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "netmode",
|
||||
"section": {
|
||||
"type": "supported_args"
|
||||
},
|
||||
"option": {
|
||||
"name": "@Count"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.{i}.SupportedArguments.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"description": "Extra arguments for this Mode",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "netmode",
|
||||
"section": {
|
||||
"type": "supported_args"
|
||||
},
|
||||
"dmmapfile": "dmmap_netmode"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Name": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"description": "Name of the argument",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci_sec",
|
||||
"data": "@Parent",
|
||||
"key": "name"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Description": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"description": "Human readable description for this Argument",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci_sec",
|
||||
"data": "@Parent",
|
||||
"key": "description"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Required": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"description": "If Required is true, then Name and Value is mandatory for mode to apply",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci_sec",
|
||||
"data": "@Parent",
|
||||
"key": "required"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Value": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"description": "Value for this SupportedArguments Name, get on this parameter result into empty output",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"flags": [
|
||||
"Secure"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci_sec",
|
||||
"data": "@Parent",
|
||||
"key": "value"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,2 @@
|
||||
config netmode global
|
||||
option enabled 0
|
||||
# option mode 'router'
|
||||
|
||||
@@ -6,28 +6,119 @@ USE_PROCD=1
|
||||
. /lib/functions.sh
|
||||
|
||||
MODEDIR="/etc/netmodes"
|
||||
SUPP_MODES_SEC=""
|
||||
|
||||
_log() {
|
||||
logger -s -p user.info -t "netmode" "$*"
|
||||
}
|
||||
|
||||
libnetmode_exec() {
|
||||
when="$1"
|
||||
# Execute /lib/netmode scripts
|
||||
if [ -d /lib/netmode/$when ]; then
|
||||
logger -s -p user.info -t "netmode" "Executing /lib/netmode/$when scripts"
|
||||
_log "Executing /lib/netmode/$when scripts"
|
||||
for script in $(ls /lib/netmode/$when/); do
|
||||
sh /lib/netmode/$when/$script
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_get_modes_sec_name() {
|
||||
local sec mode name
|
||||
|
||||
sec="${1}"
|
||||
mode="${2}"
|
||||
|
||||
config_get name ${1} name ""
|
||||
if [ "${name}" = "${mode}" ]; then
|
||||
SUPP_MODES_SEC="${sec}"
|
||||
break;
|
||||
fi
|
||||
}
|
||||
|
||||
_set_env_args() {
|
||||
local sec name value required dm_parent
|
||||
|
||||
sec="${1}"
|
||||
|
||||
config_get_bool required ${sec} required "0"
|
||||
config_get name ${sec} name ""
|
||||
config_get value ${sec} value ""
|
||||
config_get dm_parent ${sec} dm_parent ""
|
||||
|
||||
if [ -z "${dm_parent}" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
if [ "${dm_parent}" != "${SUPP_MODES_SEC}" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
if [ "${required}" -eq "1" ]; then
|
||||
if [ -z "${name}" -o -z "${value}" ]; then
|
||||
_log "Can't apply mode, name[${name}] or value[${value}] is missing"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${name}" -a -n "${value}" ]; then
|
||||
export NETMODE_${name}="${value}"
|
||||
fi
|
||||
}
|
||||
|
||||
configure_env_vars() {
|
||||
local mode
|
||||
|
||||
mode="${1}"
|
||||
if [ -z "${mode}" ]; then
|
||||
_log "mode info missing"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SUPP_MODES_SEC=""
|
||||
config_load "netmode"
|
||||
config_foreach _get_modes_sec_name supported_modes "${mode}"
|
||||
|
||||
if [ -z "${SUPP_MODES_SEC}" ]; then
|
||||
_log "mode ${mode} not found in uci"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
config_foreach _set_env_args supported_args
|
||||
}
|
||||
|
||||
cleanup_arg_values() {
|
||||
local dm_parent
|
||||
|
||||
config_get dm_parent ${1} dm_parent ""
|
||||
if [ "${dm_parent}" = "${SUPP_MODES_SEC}" ]; then
|
||||
uci -q set netmode.${1}.value=""
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup_env_vars() {
|
||||
for e in $(env); do
|
||||
if echo ${e} |grep -q "^NETMODE_"; then
|
||||
unset ${e}
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${SUPP_MODES_SEC}" ]; then
|
||||
config_load "netmode"
|
||||
config_foreach cleanup_arg_values supported_args
|
||||
uci commit netmode
|
||||
fi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
[ -f /etc/config/netmode ] || return
|
||||
|
||||
config_load netmode
|
||||
|
||||
config_get_bool enabled global enabled '0'
|
||||
[ $enabled -eq 0 ] && return
|
||||
|
||||
# Get the desired netmode from config
|
||||
config_get mode global mode
|
||||
config_get mode global mode ""
|
||||
# Check if netmode is set as boot environment parameter
|
||||
[ -n "$mode" ] || mode="$(fw_printenv -n netmode 2>/dev/null)"
|
||||
# Return if mode is not set
|
||||
@@ -38,18 +129,16 @@ start_service() {
|
||||
# Return if desired mode is same as last saved mode
|
||||
[ "$mode" == "$lastmode" ] && return
|
||||
|
||||
# Save mode as last mode
|
||||
[ -d $MODEDIR ] || mkdir -p $MODEDIR
|
||||
echo "$mode" > $MODEDIR/.last_mode
|
||||
|
||||
logger -s -p user.info -t "netmode" "Switching to $mode Mode" >/dev/console
|
||||
_log "Switching to [${mode}] Mode" >/dev/console
|
||||
|
||||
# Configure env variables
|
||||
configure_env_vars ${mode}
|
||||
# Execute netmode generic pre-mode-switch scripts
|
||||
libnetmode_exec "pre"
|
||||
|
||||
# Copy netmode UCI config files
|
||||
if [ -d $MODEDIR/$mode/uci ]; then
|
||||
logger -s -p user.info -t "netmode" "Copying $MODEDIR/$mode/uci/* to /etc/config/"
|
||||
_log "Copying $MODEDIR/$mode/uci/* to /etc/config/"
|
||||
cp $MODEDIR/$mode/uci/* /etc/config/ 2>/dev/null
|
||||
fi
|
||||
|
||||
@@ -58,7 +147,7 @@ start_service() {
|
||||
|
||||
# Execute mode specific scripts
|
||||
if [ -d $MODEDIR/$mode/scripts ]; then
|
||||
logger -s -p user.info -t "netmode" "Executing $MODEDIR/$mode/scripts/* scripts"
|
||||
_log "Executing $MODEDIR/$mode/scripts/* scripts"
|
||||
for script in $(ls $MODEDIR/$mode/scripts/); do
|
||||
sh $MODEDIR/$mode/scripts/$script
|
||||
done
|
||||
@@ -66,6 +155,12 @@ start_service() {
|
||||
|
||||
# Execute netmode generic post-mode-switch scripts
|
||||
libnetmode_exec "post"
|
||||
cleanup_env_vars "${mode}"
|
||||
|
||||
# Save mode as last mode
|
||||
[ -d $MODEDIR ] || mkdir -p $MODEDIR
|
||||
echo "$mode" > $MODEDIR/.last_mode
|
||||
_log "Switching to Mode [${mode}] done, last mode updated" >/dev/console
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
0
netmode/files/etc/netmodes/bridged/.keep
Normal file
0
netmode/files/etc/netmodes/bridged/.keep
Normal file
0
netmode/files/etc/netmodes/routed-dhcp/.keep
Normal file
0
netmode/files/etc/netmodes/routed-dhcp/.keep
Normal file
0
netmode/files/etc/netmodes/routed-pppoe/.keep
Normal file
0
netmode/files/etc/netmodes/routed-pppoe/.keep
Normal file
31
netmode/files/etc/netmodes/supported_modes.json
Normal file
31
netmode/files/etc/netmodes/supported_modes.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"#mode": "routed-pppoe",
|
||||
"supported_modes": [
|
||||
{
|
||||
"name": "routed-dhcp",
|
||||
"description": "WAN with DHCP proto (Layer 3)"
|
||||
},
|
||||
{
|
||||
"name": "routed-pppoe",
|
||||
"description": "WAN with PPPoE (Layer 3)",
|
||||
"supported_args": [
|
||||
{
|
||||
"name": "username",
|
||||
"description": "PPoE username",
|
||||
"required": true,
|
||||
"#value": "TestUser"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"description": "PPoE password",
|
||||
"required": true,
|
||||
"#value": "TestPassword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "bridged",
|
||||
"description": "Bridged mode (Layer 2)"
|
||||
}
|
||||
]
|
||||
}
|
||||
104
netmode/files/etc/uci-defaults/40_supported_mode
Normal file
104
netmode/files/etc/uci-defaults/40_supported_mode
Normal file
@@ -0,0 +1,104 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
COUNT=1
|
||||
SUPP_ARGS=1
|
||||
SUPPORTED_MODE="/etc/netmodes/supported_modes.json"
|
||||
|
||||
if [ ! -f "/etc/config/netmode" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f "${SUPPORTED_MODE}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
configure_supp_modes_args()
|
||||
{
|
||||
local obj inst name description required value parent
|
||||
|
||||
obj="${1}"
|
||||
inst="${2}"
|
||||
parent="${3}"
|
||||
|
||||
if [ -z "${inst}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_select ${inst}
|
||||
json_get_var name name
|
||||
json_get_var description description
|
||||
json_get_var value value
|
||||
json_get_var required required
|
||||
|
||||
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}.dm_parent="${parent}"
|
||||
|
||||
json_select ..
|
||||
SUPP_ARGS="$((SUPP_ARGS + 1))"
|
||||
}
|
||||
|
||||
configure_supp_modes()
|
||||
{
|
||||
local obj inst name description args
|
||||
|
||||
obj="${1}"
|
||||
inst="${2}"
|
||||
|
||||
if [ -z "${inst}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_select ${inst}
|
||||
json_get_var name name
|
||||
json_get_var description description
|
||||
|
||||
if [ -d "/etc/netmodes/${name}" ]; then
|
||||
uci -q set netmode.mode_${COUNT}=supported_modes
|
||||
uci -q set netmode.mode_${COUNT}.name="${name}"
|
||||
uci -q set netmode.mode_${COUNT}.description="${description}"
|
||||
fi
|
||||
|
||||
SUPP_ARGS=1
|
||||
json_for_each_item configure_supp_modes_args supported_args mode_${COUNT}
|
||||
|
||||
json_select ..
|
||||
COUNT="$((COUNT + 1))"
|
||||
}
|
||||
|
||||
remove_mode()
|
||||
{
|
||||
uci -q delete netmode.${1}
|
||||
}
|
||||
|
||||
cleanup_modes()
|
||||
{
|
||||
config_load "netmode"
|
||||
config_foreach remove_mode supported_modes
|
||||
}
|
||||
|
||||
update_modes()
|
||||
{
|
||||
local mode
|
||||
|
||||
json_init
|
||||
json_load_file "${SUPPORTED_MODE}"
|
||||
json_get_var mode mode ""
|
||||
|
||||
if [ -n "${mode}" ]; then
|
||||
uci -q set netmode.global.mode="${mode}"
|
||||
fi
|
||||
|
||||
|
||||
json_for_each_item configure_supp_modes supported_modes
|
||||
|
||||
}
|
||||
|
||||
cleanup_modes
|
||||
update_modes
|
||||
2
netmode/files/etc/uci-defaults/62-netmode.l2mode
Normal file → Executable file
2
netmode/files/etc/uci-defaults/62-netmode.l2mode
Normal file → Executable file
@@ -109,7 +109,7 @@ l2_network_config() {
|
||||
}
|
||||
|
||||
network_mode="$(fw_printenv -n netmode 2>/dev/null)"
|
||||
|
||||
|
||||
case "$network_mode" in
|
||||
layer2|extender)
|
||||
l2_network_config
|
||||
|
||||
0
netmode/files/lib/netmode/post/.keep
Normal file
0
netmode/files/lib/netmode/post/.keep
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user