mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-06 16:43:08 +08:00
Compare commits
376 Commits
CodecsCap_
...
ponmngr_do
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2575f33e57 | ||
|
|
51b2ffd607 | ||
|
|
091c4b81f9 | ||
|
|
c68554a42c | ||
|
|
10de78cd1a | ||
|
|
6bd995e445 | ||
|
|
087e0e3750 | ||
|
|
c3f5c269aa | ||
|
|
4ef1ac4703 | ||
|
|
b9c58a99a5 | ||
|
|
4bec432070 | ||
|
|
e2556a0f3d | ||
|
|
f265b9fe7b | ||
|
|
c2bf977fb6 | ||
|
|
44030e710a | ||
|
|
e0028e8079 | ||
|
|
9c14d21609 | ||
|
|
d690e1a7a5 | ||
|
|
bfacccba18 | ||
|
|
8b93d6ce3a | ||
|
|
69d12b567d | ||
|
|
4fbede4cb2 | ||
|
|
e758208a17 | ||
|
|
a5f04ddb5f | ||
|
|
48913ed4bf | ||
|
|
a8e8d4b109 | ||
|
|
3a968d1914 | ||
|
|
58f4ad8e5a | ||
|
|
549d681fab | ||
|
|
5313770972 | ||
|
|
9046c71d00 | ||
|
|
87a71c7389 | ||
|
|
834bab34ab | ||
|
|
a04593f02d | ||
|
|
f7456c22f9 | ||
|
|
34e5487f75 | ||
|
|
a49e91f18e | ||
|
|
ff55ae40f9 | ||
|
|
3bdc11c5c4 | ||
|
|
2cd976f5b9 | ||
|
|
cc306932e8 | ||
|
|
d3927168b2 | ||
|
|
96ede99d63 | ||
|
|
86e90969e3 | ||
|
|
99024c3111 | ||
|
|
93777c899c | ||
|
|
d4bf893482 | ||
|
|
9da34a4fff | ||
|
|
f7e6238928 | ||
|
|
9192b863ea | ||
|
|
0ef4d4e6b1 | ||
|
|
af22e1abc3 | ||
|
|
b9e6f56110 | ||
|
|
d8454fab29 | ||
|
|
8abeee9d23 | ||
|
|
1164e33371 | ||
|
|
15a65a071e | ||
|
|
ecddbb5992 | ||
|
|
4dbf7ac1da | ||
|
|
f071d28911 | ||
|
|
16e834d0f6 | ||
|
|
881711bb11 | ||
|
|
6961bbb4a7 | ||
|
|
591f9d9dde | ||
|
|
d942f2c606 | ||
|
|
01819a7f72 | ||
|
|
c8969996c7 | ||
|
|
0bb0ade1ec | ||
|
|
52c338366b | ||
|
|
0dae8c3786 | ||
|
|
cbbe02096f | ||
|
|
fae6a213ac | ||
|
|
5e57b31c45 | ||
|
|
eb5437892d | ||
|
|
12e2a84ad1 | ||
|
|
0b11d79816 | ||
|
|
56fffd6b9c | ||
|
|
0c28e45434 | ||
|
|
72f48f9230 | ||
|
|
787810e8ab | ||
|
|
15f2cd62e6 | ||
|
|
6153f47f95 | ||
|
|
1ec4f0f0da | ||
|
|
c0e5dfae7f | ||
|
|
d3766ede6c | ||
|
|
f03743634f | ||
|
|
5419eb07d2 | ||
|
|
34c0b3bb9e | ||
|
|
d664b70bf6 | ||
|
|
dd674c2d93 | ||
|
|
19ff43afe2 | ||
|
|
2f80620644 | ||
|
|
67555eed9f | ||
|
|
8e7738a153 | ||
|
|
5ca4dabf49 | ||
|
|
e6042743cb | ||
|
|
7353a6bfe7 | ||
|
|
deef704d42 | ||
|
|
a1e93540c5 | ||
|
|
d37e6944f5 | ||
|
|
794c6f09b4 | ||
|
|
39f2dab3f2 | ||
|
|
a53706b95b | ||
|
|
53e13bc58c | ||
|
|
9ed7feed87 | ||
|
|
4b05713ae7 | ||
|
|
08a31cccad | ||
|
|
5ed51849bb | ||
|
|
677c712117 | ||
|
|
04fb03e1f4 | ||
|
|
d6cddef202 | ||
|
|
c4a417a4b0 | ||
|
|
8e6d97453d | ||
|
|
60d606e0fb | ||
|
|
5c1afe5b78 | ||
|
|
aefcd070d6 | ||
|
|
2a8316d7a1 | ||
|
|
cf16fa7a6f | ||
|
|
ee58c5e429 | ||
|
|
a17b91452c | ||
|
|
185fd76b46 | ||
|
|
07eb27b1dd | ||
|
|
548ae9605b | ||
|
|
a4f4add21b | ||
|
|
fe8f39cd5a | ||
|
|
77626b51b0 | ||
|
|
d10ca5330e | ||
|
|
c2e77a5fbe | ||
|
|
93b9aa8312 | ||
|
|
937ad7c0fc | ||
|
|
cb6d5bdc36 | ||
|
|
df3d450671 | ||
|
|
16951b9c31 | ||
|
|
cd9149efad | ||
|
|
c4965c9c05 | ||
|
|
d439066686 | ||
|
|
826aeb477e | ||
|
|
63b776f97d | ||
|
|
a7383806cd | ||
|
|
81d15db29c | ||
|
|
07bf2de658 | ||
|
|
5c94394a6b | ||
|
|
224a40f7b4 | ||
|
|
f7bc58530b | ||
|
|
c11bf82271 | ||
|
|
4bf446929a | ||
|
|
85c916aa6d | ||
|
|
a142950c90 | ||
|
|
0f28109363 | ||
|
|
e2c593662d | ||
|
|
749713615c | ||
|
|
e6ff986010 | ||
|
|
7f8869cdae | ||
|
|
9a5658fa23 | ||
|
|
9874a26de2 | ||
|
|
ee54c28426 | ||
|
|
71d8a2ac30 | ||
|
|
b35cc044b4 | ||
|
|
8d80e4d38f | ||
|
|
55afb62ba0 | ||
|
|
07a8753149 | ||
|
|
5d3027c777 | ||
|
|
8c2421018a | ||
|
|
a4f7d4650b | ||
|
|
ab92e503bc | ||
|
|
f0f3560789 | ||
|
|
a7577d8975 | ||
|
|
243e034156 | ||
|
|
ea242d4e4d | ||
|
|
2c154d09e6 | ||
|
|
62166c5465 | ||
|
|
89264fa175 | ||
|
|
6091b22937 | ||
|
|
e0f2f11174 | ||
|
|
1df0c1472f | ||
|
|
cc5348a282 | ||
|
|
d18a1b6788 | ||
|
|
8553a5c00f | ||
|
|
67d2e0fe01 | ||
|
|
423c7e7f7a | ||
|
|
ff6a0e67da | ||
|
|
65f8a28962 | ||
|
|
ccd154cfa5 | ||
|
|
7b987fa396 | ||
|
|
3f4a439de4 | ||
|
|
a1cc37d3a6 | ||
|
|
8af85b8883 | ||
|
|
55b69db576 | ||
|
|
07f2cc555e | ||
|
|
6b6383c237 | ||
|
|
03344e0df5 | ||
|
|
75ed0c7a18 | ||
|
|
0d076595f8 | ||
|
|
1ba2d5ab89 | ||
|
|
ec6533707f | ||
|
|
f868713ed9 | ||
|
|
1ef8245cf9 | ||
|
|
0385a0b715 | ||
|
|
5dd35e99e2 | ||
|
|
43dd5bf8c7 | ||
|
|
98ea973e61 | ||
|
|
f7d0cc8dbd | ||
|
|
0afb94dc77 | ||
|
|
3835cc0bc9 | ||
|
|
7b766ea7f1 | ||
|
|
4efacdaee5 | ||
|
|
fb91a7f70f | ||
|
|
47f47ac097 | ||
|
|
b4cb466f4e | ||
|
|
9a1cd147d0 | ||
|
|
c67e429387 | ||
|
|
a5e6d08394 | ||
|
|
a37729d885 | ||
|
|
2efa706f67 | ||
|
|
1911881b94 | ||
|
|
8c9f390b89 | ||
|
|
9dacae709b | ||
|
|
363fb57b3e | ||
|
|
99ed84be4d | ||
|
|
930611301b | ||
|
|
e06e0a6599 | ||
|
|
9de5fe3362 | ||
|
|
c9fded45b7 | ||
|
|
545a54eb9f | ||
|
|
b979bf4891 | ||
|
|
d2111b2bad | ||
|
|
ffb839b1d0 | ||
|
|
360e48a3cf | ||
|
|
71198a83de | ||
|
|
87eb713593 | ||
|
|
5fbc3e9efb | ||
|
|
6140efcb5a | ||
|
|
108c98c8bb | ||
|
|
887fb46dbd | ||
|
|
1b65330af4 | ||
|
|
cf709c995f | ||
|
|
6a1b7d91a1 | ||
|
|
a1bbf877a1 | ||
|
|
ac24516ec0 | ||
|
|
aab79b15f1 | ||
|
|
39fd5323b0 | ||
|
|
ba6f732628 | ||
|
|
ada4e7cfd5 | ||
|
|
c9d73a6bcb | ||
|
|
e91fc5169c | ||
|
|
452b1e548a | ||
|
|
630c3ec7ba | ||
|
|
c808bb188d | ||
|
|
dce4728377 | ||
|
|
38d77bcf5c | ||
|
|
e99cdc434f | ||
|
|
225bf15ae7 | ||
|
|
dd69c0b4b1 | ||
|
|
cc7d076dc8 | ||
|
|
1d1c621821 | ||
|
|
d70db5ef94 | ||
|
|
656ead95cb | ||
|
|
d13ee35789 | ||
|
|
0534b9c616 | ||
|
|
db3147076e | ||
|
|
3c67fbf70b | ||
|
|
49d6c61a8a | ||
|
|
549746bffd | ||
|
|
bc73d859a2 | ||
|
|
998ea1fa85 | ||
|
|
020606132e | ||
|
|
d693cb2fbb | ||
|
|
9cf572e22e | ||
|
|
1759f36740 | ||
|
|
c3666a7b40 | ||
|
|
c691dd210a | ||
|
|
d3c5f0d78a | ||
|
|
62dc66831a | ||
|
|
1ba9025809 | ||
|
|
da2a5a6a9d | ||
|
|
da9bd48dd5 | ||
|
|
56a49d4628 | ||
|
|
152a15d147 | ||
|
|
47f938f0fd | ||
|
|
56f653c84b | ||
|
|
5527f66c11 | ||
|
|
aadc11e7f4 | ||
|
|
15e7f35459 | ||
|
|
8569ef77fc | ||
|
|
e3c1e47040 | ||
|
|
c722f70f10 | ||
|
|
e6a6703b73 | ||
|
|
dddd927d30 | ||
|
|
f9a31cd9dc | ||
|
|
abeedffa94 | ||
|
|
bda286a27d | ||
|
|
3039f3725e | ||
|
|
21d63db2f8 | ||
|
|
6ec7d8c06b | ||
|
|
09949f6823 | ||
|
|
e870ac2161 | ||
|
|
2415a92f08 | ||
|
|
f3be07599e | ||
|
|
2593f9d472 | ||
|
|
7d8396f21c | ||
|
|
84c8f673c5 | ||
|
|
e3ed5f9581 | ||
|
|
e904e57bc8 | ||
|
|
3fcb150330 | ||
|
|
928cde7e3c | ||
|
|
f2aa11ba83 | ||
|
|
dd18b4ff9a | ||
|
|
875ed0fc12 | ||
|
|
affdd43f7a | ||
|
|
9de9248d5a | ||
|
|
31a89052f8 | ||
|
|
0248cd1e38 | ||
|
|
6f21f9bb4b | ||
|
|
0f87f89b71 | ||
|
|
ab65dba802 | ||
|
|
6c40e135e9 | ||
|
|
893deb57d0 | ||
|
|
c3b450a679 | ||
|
|
62573f47dc | ||
|
|
71bf9943b7 | ||
|
|
d0fe5d68e3 | ||
|
|
612ea61b0e | ||
|
|
53b6001a51 | ||
|
|
ad8cee56df | ||
|
|
ae8c079e8c | ||
|
|
68d1b91701 | ||
|
|
3389378868 | ||
|
|
6a6c123a63 | ||
|
|
64c0fa39a0 | ||
|
|
c19fd6cd11 | ||
|
|
6dd17390d7 | ||
|
|
59e724dcf2 | ||
|
|
cc71eb3ef5 | ||
|
|
d4ac43a3bf | ||
|
|
56fa7db0a7 | ||
|
|
1b58259562 | ||
|
|
23d564116c | ||
|
|
a5aeba560e | ||
|
|
58688bd436 | ||
|
|
3682edfe7b | ||
|
|
feb1932e25 | ||
|
|
696dc1f798 | ||
|
|
4ad3a464fe | ||
|
|
b75f473a5a | ||
|
|
26023599c1 | ||
|
|
5f276201b3 | ||
|
|
f9072e9a21 | ||
|
|
3638e0efa2 | ||
|
|
fa613814d5 | ||
|
|
9b673e44dc | ||
|
|
44f0bc818e | ||
|
|
5d64b987aa | ||
|
|
da4f911bd9 | ||
|
|
8c0ae77797 | ||
|
|
613656d485 | ||
|
|
570f421c3d | ||
|
|
1c538249ea | ||
|
|
2b94cae86b | ||
|
|
c2d92def50 | ||
|
|
32628e4165 | ||
|
|
2501484ac2 | ||
|
|
87b565d552 | ||
|
|
56af686410 | ||
|
|
90fd7508b6 | ||
|
|
5f8cbe5393 | ||
|
|
94433b4502 | ||
|
|
e311e64900 | ||
|
|
973b11e33b | ||
|
|
fd3f544210 | ||
|
|
078bcd16c1 | ||
|
|
4c5073ad03 | ||
|
|
2660d8ad2e | ||
|
|
588478e981 | ||
|
|
0f9326cff6 | ||
|
|
e01fc47ab6 | ||
|
|
a35893a722 |
42
bbf/Makefile
42
bbf/Makefile
@@ -5,11 +5,11 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=libbbfdm
|
PKG_NAME:=libbbfdm
|
||||||
PKG_VERSION:=6.8.33
|
PKG_VERSION:=6.8.19
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||||
PKG_SOURCE_VERSION:=9bdcb1ac188c44fc2274bf01dd9dce46f572b967
|
PKG_SOURCE_VERSION:=4e82190d88f73494dbc6d261e6eb507e348e10e3
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
|
|
||||||
@@ -25,7 +25,8 @@ define Package/libbbf_api
|
|||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
SUBMENU:=TRx69
|
SUBMENU:=TRx69
|
||||||
TITLE:=Library for libbbfdm API
|
TITLE:=BBF datamodel library, provides API to extend datamodel using DotSO plugins
|
||||||
|
ABI_VERSION:=1.0
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm/default
|
define Package/libbbfdm/default
|
||||||
@@ -33,7 +34,7 @@ define Package/libbbfdm/default
|
|||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
SUBMENU:=TRx69
|
SUBMENU:=TRx69
|
||||||
TITLE:=Library for broadband forum data model support
|
TITLE:=Library for broadband forum data model support
|
||||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libtrace +libcurl
|
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl +libbbf_api
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm
|
define Package/libbbfdm
|
||||||
@@ -66,6 +67,17 @@ define Package/libbbfdm-wolfssl
|
|||||||
VARIANT:=wolfssl
|
VARIANT:=wolfssl
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/userinterface
|
||||||
|
SECTION:=utils
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
SUBMENU:=TRx69
|
||||||
|
TITLE:=Package to add Device.UserInterface. datamodel support
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/userinterface/description
|
||||||
|
Package to add Device.UserInterface. datamodel support using libbbf JSON Plugin
|
||||||
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm/config
|
define Package/libbbfdm/config
|
||||||
source "$(SOURCE)/Config_bbfdm.in"
|
source "$(SOURCE)/Config_bbfdm.in"
|
||||||
endef
|
endef
|
||||||
@@ -137,13 +149,19 @@ endef
|
|||||||
|
|
||||||
define Package/libbbfdm/default/install
|
define Package/libbbfdm/default/install
|
||||||
$(INSTALL_DIR) $(1)/lib
|
$(INSTALL_DIR) $(1)/lib
|
||||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
|
||||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||||
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
|
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
|
||||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||||
|
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||||
|
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/lib/
|
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/lib/
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
|
||||||
|
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||||
|
ifeq ($(CONFIG_PACKAGE_mosquitto-ssl),y)
|
||||||
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
|
$(INSTALL_BIN) ./files/etc/uci-defaults/01-mosquitto-config $(1)/etc/uci-defaults/
|
||||||
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm/default/prerm
|
define Package/libbbfdm/default/prerm
|
||||||
@@ -152,6 +170,18 @@ define Package/libbbfdm/default/prerm
|
|||||||
exit 0
|
exit 0
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/userinterface/install
|
||||||
|
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_DATA) ./files/etc/bbfdm/json/UserInterface.json $(1)/etc/bbfdm/json/
|
||||||
|
$(INSTALL_DATA) ./files/etc/config/userinterface $(1)/etc/config/userinterface
|
||||||
|
$(INSTALL_BIN) ./files/etc/init.d/userinterface $(1)/etc/init.d/userinterface
|
||||||
|
$(INSTALL_BIN) ./files/etc/uci-defaults/93-userinterface-firewall $(1)/etc/uci-defaults/93-userinterface-firewall
|
||||||
|
$(INSTALL_BIN) ./files/etc/firewall.userinterface $(1)/etc/firewall.userinterface
|
||||||
|
endef
|
||||||
|
|
||||||
Package/libbbfdm-openssl/prerm = $(Package/libbbfdm/default/prerm)
|
Package/libbbfdm-openssl/prerm = $(Package/libbbfdm/default/prerm)
|
||||||
Package/libbbfdm-wolfssl/prerm = $(Package/libbbfdm/default/prerm)
|
Package/libbbfdm-wolfssl/prerm = $(Package/libbbfdm/default/prerm)
|
||||||
Package/libbbfdm-mbedtls/prerm = $(Package/libbbfdm/default/prerm)
|
Package/libbbfdm-mbedtls/prerm = $(Package/libbbfdm/default/prerm)
|
||||||
@@ -169,9 +199,9 @@ define Build/InstallDev
|
|||||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
|
||||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbf_api/*.h $(1)/usr/include/libbbf_api/
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbf_api/*.h $(1)/usr/include/libbbf_api/
|
||||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/usr/lib/
|
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/usr/lib/
|
||||||
touch $(1)/usr/lib/libbbf_api.so
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,userinterface))
|
||||||
$(eval $(call BuildPackage,libbbf_api))
|
$(eval $(call BuildPackage,libbbf_api))
|
||||||
$(eval $(call BuildPackage,libbbfdm))
|
$(eval $(call BuildPackage,libbbfdm))
|
||||||
$(eval $(call BuildPackage,libbbfdm-openssl))
|
$(eval $(call BuildPackage,libbbfdm-openssl))
|
||||||
|
|||||||
117
bbf/files/etc/bbfdm/json/UserInterface.json
Normal file
117
bbf/files/etc/bbfdm/json/UserInterface.json
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
{
|
||||||
|
"Device.UserInterface.": {
|
||||||
|
"type": "object",
|
||||||
|
"version": "2.0",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": false,
|
||||||
|
"Device.UserInterface.RemoteAccess.": {
|
||||||
|
"type": "object",
|
||||||
|
"version": "2.0",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": false,
|
||||||
|
"Enable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"read": true,
|
||||||
|
"write": true,
|
||||||
|
"version": "2.0",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "uci",
|
||||||
|
"uci": {
|
||||||
|
"file": "userinterface",
|
||||||
|
"section": {
|
||||||
|
"name": "remote_access"
|
||||||
|
},
|
||||||
|
"option": {
|
||||||
|
"name": "enable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Port": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": true,
|
||||||
|
"version": "2.0",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"range": [
|
||||||
|
{
|
||||||
|
"max": 65535
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "uci",
|
||||||
|
"uci": {
|
||||||
|
"file": "userinterface",
|
||||||
|
"section": {
|
||||||
|
"name": "remote_access"
|
||||||
|
},
|
||||||
|
"option": {
|
||||||
|
"name": "port"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SupportedProtocols": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"version": "2.0",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"list": {
|
||||||
|
"datatype": "string",
|
||||||
|
"enumerations": [
|
||||||
|
"HTTP",
|
||||||
|
"HTTPS"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"default": "HTTP"
|
||||||
|
},
|
||||||
|
"Protocol": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": true,
|
||||||
|
"version": "2.0",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "uci",
|
||||||
|
"uci": {
|
||||||
|
"file": "userinterface",
|
||||||
|
"section": {
|
||||||
|
"name": "remote_access"
|
||||||
|
},
|
||||||
|
"option": {
|
||||||
|
"name": "protocol"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6
bbf/files/etc/config/userinterface
Normal file
6
bbf/files/etc/config/userinterface
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
config userinterface 'remote_access'
|
||||||
|
option enable '0'
|
||||||
|
option interface 'wan'
|
||||||
|
option port '80'
|
||||||
|
option protocol 'HTTP'
|
||||||
|
|
||||||
88
bbf/files/etc/firewall.userinterface
Executable file
88
bbf/files/etc/firewall.userinterface
Executable file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
IDENTIFIER="REMOTE-ACCESS-WAN"
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo "${@}"|logger -t firewall.userinterface -p info
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -f "/etc/config/userinterface" ]; then
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
function exec_cmd()
|
||||||
|
{
|
||||||
|
if ! $@; then
|
||||||
|
log "Failed to run [$@]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function configure_firewall_rule()
|
||||||
|
{
|
||||||
|
local enable port protocol gui_port
|
||||||
|
local zone interface
|
||||||
|
|
||||||
|
config_load userinterface
|
||||||
|
config_get_bool enable remote_access enable 1
|
||||||
|
config_get port remote_access port
|
||||||
|
config_get interface remote_access interface
|
||||||
|
|
||||||
|
if [ "${enable}" -eq "0" -o -z "${port}" -o -z "${interface}" ]; then
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
zone="zone_${interface}_input"
|
||||||
|
iptables -w 1 -t filter -nL ${zone} 2>/dev/null 1>&2
|
||||||
|
if [ "$?" -eq 0 ]; then
|
||||||
|
iptables -w 1 -I ${zone} -p tcp -m multiport --dports ${port} -m conntrack --ctstate NEW,ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
|
||||||
|
fi
|
||||||
|
|
||||||
|
zone="zone_${interface}_output"
|
||||||
|
iptables -w 1 -t filter -nL ${zone} 2>/dev/null 1>&2
|
||||||
|
if [ "$?" -eq 0 ]; then
|
||||||
|
iptables -w 1 -I ${zone} -p tcp -m multiport --dports ${port} -m conntrack --ctstate ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_firewall_rule()
|
||||||
|
{
|
||||||
|
local zone interface
|
||||||
|
local CMD
|
||||||
|
|
||||||
|
config_load userinterface
|
||||||
|
config_get interface remote_access interface
|
||||||
|
|
||||||
|
# Clean remote interface rules
|
||||||
|
if [ -z "${interface}" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
zone="zone_${interface}_input"
|
||||||
|
CMD="iptables -w 1 -t filter -L ${zone} --line-numbers"
|
||||||
|
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
|
||||||
|
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
|
||||||
|
if [ -n "${rule_num}" ]; then
|
||||||
|
exec_cmd iptables -w 1 -t filter -D ${zone} ${rule_num};
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
zone="zone_${interface}_output"
|
||||||
|
CMD="iptables -w 1 -t filter -L ${zone} --line-numbers"
|
||||||
|
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
|
||||||
|
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
|
||||||
|
if [ -n "${rule_num}" ]; then
|
||||||
|
exec_cmd iptables -w 1 -t filter -D ${zone} ${rule_num};
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Delete existing remote access rules
|
||||||
|
delete_firewall_rule
|
||||||
|
|
||||||
|
# Configure the User Interface rule
|
||||||
|
configure_firewall_rule
|
||||||
27
bbf/files/etc/init.d/userinterface
Normal file
27
bbf/files/etc/init.d/userinterface
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=99
|
||||||
|
STOP=01
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
local enable
|
||||||
|
|
||||||
|
procd_open_instance usp
|
||||||
|
|
||||||
|
config_load userinterface
|
||||||
|
config_get_bool enable global enable 1
|
||||||
|
|
||||||
|
# Inject firewall rules
|
||||||
|
if [ "${enable}" -eq "1" ]; then
|
||||||
|
/etc/firewall.userinterface
|
||||||
|
fi
|
||||||
|
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers()
|
||||||
|
{
|
||||||
|
procd_add_reload_trigger "userinterface"
|
||||||
|
}
|
||||||
46
bbf/files/etc/uci-defaults/01-mosquitto-config
Normal file
46
bbf/files/etc/uci-defaults/01-mosquitto-config
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
config_mosquitto_owrt() {
|
||||||
|
sec=$(uci -q get mosquitto.owrt)
|
||||||
|
if [ -z "${sec}" ]; then
|
||||||
|
sec=$(uci -q add mosquitto owrt)
|
||||||
|
uci -q rename mosquitto."${sec}"="owrt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
uci -q set mosquitto.owrt.use_uci="1"
|
||||||
|
uci -q set mosquitto.owrt.write_pid="1"
|
||||||
|
uci -q commit mosquitto
|
||||||
|
}
|
||||||
|
|
||||||
|
config_mosquitto_general() {
|
||||||
|
sec=$(uci -q get mosquitto.mosquitto)
|
||||||
|
if [ -z "${sec}" ]; then
|
||||||
|
sec=$(uci -q add mosquitto mosquitto)
|
||||||
|
uci -q rename mosquitto."${sec}"="mosquitto"
|
||||||
|
fi
|
||||||
|
|
||||||
|
uci -q set mosquitto.mosquitto.log_dest="syslog"
|
||||||
|
uci -q set mosquitto.mosquitto.log_facility="5"
|
||||||
|
uci -q set mosquitto.mosquitto.log_timestamp="1"
|
||||||
|
uci -q set mosquitto.mosquitto.log_types="error warning notice"
|
||||||
|
uci -q set mosquitto.mosquitto.per_listener_settings="1"
|
||||||
|
uci -q commit mosquitto
|
||||||
|
}
|
||||||
|
|
||||||
|
config_mosquitto_persistence() {
|
||||||
|
sec=$(uci -q get mosquitto.persistence)
|
||||||
|
if [ -z "${sec}" ]; then
|
||||||
|
sec=$(uci -q add mosquitto persistence)
|
||||||
|
uci -q rename mosquitto."${sec}"="persistence"
|
||||||
|
fi
|
||||||
|
|
||||||
|
uci -q set mosquitto.persistence.persistence="0"
|
||||||
|
uci -q set mosquitto.persistence.location="/var/run"
|
||||||
|
uci -q commit mosquitto
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -f "/etc/config/mosquitto" ]; then
|
||||||
|
config_mosquitto_owrt
|
||||||
|
config_mosquitto_general
|
||||||
|
config_mosquitto_persistence
|
||||||
|
fi
|
||||||
12
bbf/files/etc/uci-defaults/93-userinterface-firewall
Executable file
12
bbf/files/etc/uci-defaults/93-userinterface-firewall
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci -q batch <<-EOT
|
||||||
|
delete firewall.userinterface
|
||||||
|
set firewall.userinterface=include
|
||||||
|
set firewall.userinterface.path=/etc/firewall.userinterface
|
||||||
|
set firewall.userinterface.reload=1
|
||||||
|
commit firewall
|
||||||
|
EOT
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
@@ -8,13 +8,13 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=bulkdata
|
PKG_NAME:=bulkdata
|
||||||
PKG_VERSION:=2.0.5
|
PKG_VERSION:=2.0.9
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bulkdata.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bulkdata.git
|
||||||
PKG_SOURCE_VERSION:=33a6648de9ee0af33c44518656b56b0a30b6c1ab
|
PKG_SOURCE_VERSION:=6e85d2032e66df581fae7c72cd83cc89367b8fc8
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
endif
|
endif
|
||||||
@@ -25,8 +25,6 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
|||||||
PKG_LICENSE:=GPL-2.0-only
|
PKG_LICENSE:=GPL-2.0-only
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
||||||
PKG_BUILD_DEPENDS:=bbf
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
define Package/$(PKG_NAME)
|
define Package/$(PKG_NAME)
|
||||||
@@ -50,8 +48,8 @@ endif
|
|||||||
define Package/$(PKG_NAME)/install
|
define Package/$(PKG_NAME)/install
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbf_plugin/*.so $(1)/usr/lib/bbfdm
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbf_plugin/*.json $(1)/etc/bbfdm/json
|
||||||
$(CP) ./files/* $(1)/
|
$(CP) ./files/* $(1)/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@@ -7,22 +7,19 @@ USE_PROCD=1
|
|||||||
PROG="/usr/sbin/bulkdatad"
|
PROG="/usr/sbin/bulkdatad"
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
local enable=$(uci -q get bulkdata.bulkdata.enable)
|
local enable
|
||||||
|
|
||||||
[ "$enable" != "1" ] && {
|
config_load bulkdata
|
||||||
return 0
|
config_get_bool enable bulkdata enable 1
|
||||||
|
|
||||||
|
procd_open_instance bulkdata
|
||||||
|
[ "$enable" -eq "1" ] && {
|
||||||
|
procd_set_param command "$PROG"
|
||||||
|
procd_set_param respawn "3" "7" "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
procd_open_instance
|
|
||||||
procd_set_param command "$PROG"
|
|
||||||
procd_set_param respawn "3" "7" "0"
|
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
boot() {
|
|
||||||
start
|
|
||||||
}
|
|
||||||
|
|
||||||
reload_service() {
|
reload_service() {
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=dectmngr
|
PKG_NAME:=dectmngr
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=3
|
||||||
PKG_VERSION:=3.5.5
|
PKG_VERSION:=3.5.6
|
||||||
|
|
||||||
LOCAL_DEV=0
|
LOCAL_DEV=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_VERSION:=c5695bc92f7f22089c9a85d3e1f4dac7c12ca900
|
PKG_SOURCE_VERSION:=81450033d98fcdb68911e2148f48d190492090a6
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=dslmngr
|
PKG_NAME:=dslmngr
|
||||||
PKG_VERSION:=1.1.2
|
PKG_VERSION:=1.2.0
|
||||||
|
|
||||||
LOCAL_DEV=0
|
LOCAL_DEV=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
@@ -26,7 +26,7 @@ PKG_LICENSE_FILES:=LICENSE
|
|||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||||
TARGET_PLATFORM=BROADCOM
|
TARGET_PLATFORM=BROADCOM
|
||||||
else
|
else
|
||||||
$(info Unexpected CONFIG_TARGET)
|
$(info Unexpected CONFIG_TARGET)
|
||||||
@@ -68,6 +68,10 @@ define Build/Compile
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/dslmngr/install
|
define Package/dslmngr/install
|
||||||
|
$(CP) ./files/common/* $(1)/
|
||||||
|
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||||
|
$(CP) ./files/broadcom/* $(1)/
|
||||||
|
endif
|
||||||
$(INSTALL_DIR) $(1)/sbin
|
$(INSTALL_DIR) $(1)/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dslmngr $(1)/sbin/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dslmngr $(1)/sbin/
|
||||||
endef
|
endef
|
||||||
|
|||||||
311
dslmngr/files/broadcom/lib/dsl/broadcom.sh
Normal file
311
dslmngr/files/broadcom/lib/dsl/broadcom.sh
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
# ATM #
|
||||||
|
check_pvc() {
|
||||||
|
local vpi=$1
|
||||||
|
local vci=$2
|
||||||
|
local ret
|
||||||
|
|
||||||
|
ret=$(xtmctl operate conn --show | awk -v test="$vpi/$vci" '{if ($3==test ) print $5 }')
|
||||||
|
|
||||||
|
case $ret in
|
||||||
|
''|*[!0-9]*) return 0 ;;
|
||||||
|
*) return $ret ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
check_xtm_list() {
|
||||||
|
local qclass=$1
|
||||||
|
local pcr scr mbs
|
||||||
|
local ret
|
||||||
|
|
||||||
|
case $# in
|
||||||
|
1)
|
||||||
|
pcr=0
|
||||||
|
scr=0
|
||||||
|
mbs=0
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
pcr=$2
|
||||||
|
scr=0
|
||||||
|
mbs=0
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
pcr=$2
|
||||||
|
scr=$3
|
||||||
|
mbs=$4
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ret=$(xtmctl operate tdte --show | awk -v test="$qclass" -v pcr="$pcr" -v scr="$scr" -v mbs="$mbs" '{if ($2==test && $3==pcr && $4==scr && $5==mbs ) print $1 }')
|
||||||
|
|
||||||
|
case $ret in
|
||||||
|
''|*[!0-9]*) return 0 ;;
|
||||||
|
*) return $ret ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_atm_device() {
|
||||||
|
local name vpi vci device link_type encapsulation qos_class pcr mbs scr i
|
||||||
|
|
||||||
|
config_get name $1 name "ATM"
|
||||||
|
config_get vpi $1 vpi "8"
|
||||||
|
config_get vci $1 vci "35"
|
||||||
|
config_get device $1 device "atm0"
|
||||||
|
config_get link_type $1 link_type "eoa"
|
||||||
|
config_get encapsulation $1 encapsulation "llc"
|
||||||
|
config_get qos_class $1 qos_class "ubr"
|
||||||
|
config_get pcr $1 pcr
|
||||||
|
config_get mbs $1 mbs
|
||||||
|
config_get scr $1 scr
|
||||||
|
|
||||||
|
check_pvc $vpi $vci
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
if [ "$ret" -eq 0 ]; then
|
||||||
|
check_xtm_list $qos_class $pcr $scr $mbs
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
if [ "$ret" -eq 0 ]; then
|
||||||
|
case $qos_class in # ubr, cbr, gfr, vbr-nrt, vbr-rt, ubr+, abr
|
||||||
|
ubr)
|
||||||
|
xtmctl operate tdte --add "$qos_class"
|
||||||
|
;;
|
||||||
|
ubr_pcr|ubr+)
|
||||||
|
xtmctl operate tdte --add "$qos_class" $pcr
|
||||||
|
;;
|
||||||
|
cbr)
|
||||||
|
xtmctl operate tdte --add "$qos_class" $pcr
|
||||||
|
;;
|
||||||
|
nrtvbr|vbr-nrt)
|
||||||
|
xtmctl operate tdte --add "$qos_class" $pcr $scr $mbs
|
||||||
|
;;
|
||||||
|
rtvbr|vbr-rt)
|
||||||
|
xtmctl operate tdte --add "$qos_class" $pcr $scr $mbs
|
||||||
|
;;
|
||||||
|
gfr)
|
||||||
|
;;
|
||||||
|
abr)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $link_type in # EoA, IPoA, PPPoA, CIP
|
||||||
|
EoA|eoa)
|
||||||
|
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_eth" || encapsulation="llcsnap_eth"
|
||||||
|
;;
|
||||||
|
PPPoA|pppoa)
|
||||||
|
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_pppoa" || encapsulation="llcencaps_ppp"
|
||||||
|
;;
|
||||||
|
IPoA|ipoa)
|
||||||
|
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_ipoa" || encapsulation="llcsnap_rtip"
|
||||||
|
;;
|
||||||
|
CIP|cip)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
check_xtm_list $qos_class $pcr $scr $mbs
|
||||||
|
ret="$?"
|
||||||
|
|
||||||
|
xtmctl operate conn --add 1.$vpi.$vci aal5 $encapsulation 0 1 $ret
|
||||||
|
for i in `seq 0 7`; do
|
||||||
|
xtmctl operate conn --addq 1.$vpi.$vci $i wrr 1 dt # queue priority 0-7
|
||||||
|
done
|
||||||
|
xtmctl operate conn --createnetdev 1.$vpi.$vci $device
|
||||||
|
xtmctl operate intf --state 1 enable
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_atm_devices() {
|
||||||
|
local vpi vci rest
|
||||||
|
local vpivci=`xtmctl operate conn --show | grep "ATM\|mode" | awk '{if (NR!=1 && $1!="PTM") {print $3}}'`
|
||||||
|
|
||||||
|
for i in $vpivci
|
||||||
|
do
|
||||||
|
rest=${i#\/}
|
||||||
|
vpi=${rest%%\/*}
|
||||||
|
vci=${rest#*\/}
|
||||||
|
echo "xtmctl operate conn --delete 1.$vpi.$vci"
|
||||||
|
xtmctl operate conn --delete 1.$vpi.$vci
|
||||||
|
echo "xtmctl operate conn --deletenetdev 1.$vpi.$vci"
|
||||||
|
xtmctl operate conn --deletenetdev 1.$vpi.$vci
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
create_atm_devices() {
|
||||||
|
echo "Creating ATM Device(s)"
|
||||||
|
config_load dsl
|
||||||
|
config_foreach configure_atm_device atm-device
|
||||||
|
}
|
||||||
|
# ATM END #
|
||||||
|
|
||||||
|
# PTM #
|
||||||
|
check_ptm() {
|
||||||
|
local ret
|
||||||
|
local ptmprio=$1
|
||||||
|
local dslat=$2
|
||||||
|
|
||||||
|
if [ "$ptmprio" -eq 2 ]; then
|
||||||
|
ptmprio="high"
|
||||||
|
else
|
||||||
|
ptmprio="low"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ret=$(xtmctl operate conn --show | awk -v dslat="$dslat" -v ptmprio="$ptmprio" '{if ($2 == dslat && $3 == ptmprio ) print $2 }')
|
||||||
|
|
||||||
|
case $ret in
|
||||||
|
''|*[!0-9]*) return 0 ;;
|
||||||
|
*) return $ret ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_ptm_device() {
|
||||||
|
local name device priority portid i
|
||||||
|
|
||||||
|
config_get name $1 name "PTM"
|
||||||
|
config_get device $1 device "ptm0"
|
||||||
|
config_get priority $1 priority 1
|
||||||
|
config_get portid $1 portid 1
|
||||||
|
|
||||||
|
check_ptm $priority $portid
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
if [ "$ret" -eq 0 ]; then
|
||||||
|
xtmctl operate conn --add $portid.$priority
|
||||||
|
|
||||||
|
for i in `seq 0 7`; do
|
||||||
|
xtmctl operate conn --addq $portid.$priority $i wrr 1 dt -1 -1 3000 # queue priority 0-7
|
||||||
|
done
|
||||||
|
echo "xtmctl operate conn --createnetdev $portid.$priority $device"
|
||||||
|
xtmctl operate conn --createnetdev $portid.$priority $device
|
||||||
|
xtmctl operate intf --state 1 enable
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_ptm_devices() {
|
||||||
|
local delptm
|
||||||
|
local x=0
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
for i in `xtmctl operate conn --show | grep "PTM\|mode"`
|
||||||
|
do
|
||||||
|
if [ $x -eq 1 ]; then
|
||||||
|
delptm=$(echo $i | awk '{if ($1!="ATM") print $2"."$11}')
|
||||||
|
echo "xtmctl operate conn --delete $delptm"
|
||||||
|
xtmctl operate conn --delete $delptm
|
||||||
|
xtmctl operate conn --deletenetdev $delptm
|
||||||
|
fi
|
||||||
|
x=1
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
}
|
||||||
|
|
||||||
|
create_ptm_devices() {
|
||||||
|
echo "Creating PTM Device(s)"
|
||||||
|
config_load dsl
|
||||||
|
config_foreach configure_ptm_device ptm-device
|
||||||
|
}
|
||||||
|
# PTM END #
|
||||||
|
|
||||||
|
prioritize_arp()
|
||||||
|
{
|
||||||
|
ebtables -t nat -D POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||||
|
ebtables -t nat -A POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
xtm_remove_devices() {
|
||||||
|
remove_atm_devices
|
||||||
|
remove_ptm_devices
|
||||||
|
}
|
||||||
|
|
||||||
|
xtm_create_devices() {
|
||||||
|
local tpstc="$(xdslctl info --show | grep TPS-TC)"
|
||||||
|
if echo "$tpstc" | grep -q "ATM Mode"; then
|
||||||
|
create_atm_devices
|
||||||
|
elif echo "$tpstc" | grep -q "PTM Mode"; then
|
||||||
|
create_ptm_devices
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
xdsl_configure() {
|
||||||
|
local VDSL=0
|
||||||
|
local GFAST=0
|
||||||
|
local mod=""
|
||||||
|
local modes=""
|
||||||
|
local profile=""
|
||||||
|
|
||||||
|
config_load dsl
|
||||||
|
|
||||||
|
# Modes
|
||||||
|
config_get mode line mode
|
||||||
|
for mod in $mode; do
|
||||||
|
[ $mod == "gdmt" ] && modes="${modes}d"
|
||||||
|
[ $mod == "glite" ] && modes="${modes}l"
|
||||||
|
[ $mod == "t1413" ] && modes="${modes}t"
|
||||||
|
[ $mod == "adsl2" ] && modes="${modes}2"
|
||||||
|
[ $mod == "adsl2p" ] && modes="${modes}p"
|
||||||
|
[ $mod == "annexl" ] && modes="${modes}e"
|
||||||
|
[ $mod == "annexm" ] && modes="${modes}m"
|
||||||
|
[ $mod == "vdsl2" ] && modes="${modes}v" && VDSL=1
|
||||||
|
[ $mod == "gfast" ] && modes="${modes}f" && GFAST=1
|
||||||
|
done
|
||||||
|
|
||||||
|
# VDSL Profiles
|
||||||
|
config_get profile line profile
|
||||||
|
# Capabilities
|
||||||
|
config_get_bool bitswap line bitswap 1
|
||||||
|
[ $bitswap -eq 1 ] && bitswap="on" || bitswap="off"
|
||||||
|
config_get_bool sra line sra 1
|
||||||
|
[ $sra -eq 1 ] && sra="on" || sra="off"
|
||||||
|
# config_get_bool trellis line trellis 1
|
||||||
|
config_get_bool sesdrop line sesdrop 0
|
||||||
|
[ $sesdrop -eq 1 ] && sesdrop="on" || sesdrop="off"
|
||||||
|
# VDSL2 only
|
||||||
|
config_get_bool us0 line us0 1
|
||||||
|
[ $us0 -eq 1 ] && us0="on" || us0="off"
|
||||||
|
# config_get_bool dynamicd line dynamicd 1
|
||||||
|
# config_get_bool dynamicf line dynamicf 1
|
||||||
|
config_get_bool sos line sos 0
|
||||||
|
[ $sos -eq 1 ] && sos="on" || sos="off"
|
||||||
|
|
||||||
|
config_get_bool phyReXmtUs line phyReXmtUs 0
|
||||||
|
config_get_bool phyReXmtDs line phyReXmtDs 1
|
||||||
|
phyReXmt=$(( $((phyReXmtUs<<1)) + phyReXmtDs))
|
||||||
|
|
||||||
|
if [ $VDSL -eq 1 -o $GFAST -eq 1 ]; then
|
||||||
|
echo "xdslctl start --up --mod $modes --profile "$profile" --sra $sra --bitswap $bitswap --us0 $us0 --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt"
|
||||||
|
xdslctl start --up --mod $modes --profile "$profile" --sra $sra --bitswap $bitswap --us0 $us0 --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt
|
||||||
|
# G.Fast hardware to VDSL hardware, to set the driver bit kPhyCfg2EnableGfastVdslMMTimeOut0.
|
||||||
|
# Enable V43 tone for GFAST.
|
||||||
|
echo "xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400"
|
||||||
|
xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400
|
||||||
|
else
|
||||||
|
echo "xdslctl start --up --mod $modes --sra $sra --bitswap $bitswap --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt"
|
||||||
|
xdslctl start --up --mod $modes --sra $sra --bitswap $bitswap --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $GFAST -eq 1 ]; then
|
||||||
|
# G.Fast hardware to VDSL hardware, to set the driver bit kPhyCfg2EnableGfastVdslMMTimeOut0.
|
||||||
|
# Enable V43 tone for GFAST.
|
||||||
|
echo "xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400"
|
||||||
|
xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
xdsl_stop() {
|
||||||
|
# echo "Stopping DSL"
|
||||||
|
# stop causes IRQ issues
|
||||||
|
# xdslctl stop
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
xdsl_init() {
|
||||||
|
prioritize_arp
|
||||||
|
|
||||||
|
echo "Starting DSL"
|
||||||
|
|
||||||
|
xtmctl start
|
||||||
|
xtmctl operate intf --state 1 enable
|
||||||
|
}
|
||||||
53
dslmngr/files/common/etc/config/dsl
Normal file
53
dslmngr/files/common/etc/config/dsl
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# OEM specific parameters
|
||||||
|
config oem-parameters 'oem'
|
||||||
|
# option country_code "0000" # 2 bytes hex
|
||||||
|
# option vendor_id "IO" # 4 bytes string
|
||||||
|
# option vendor_suffix "0000" # 2 bytes hex
|
||||||
|
# option sw_version "iopsys" # 16 bytes string
|
||||||
|
# option serial_nr "00000000" # 32 bytes string
|
||||||
|
|
||||||
|
# DSL Modes
|
||||||
|
config dsl-line line
|
||||||
|
list mode gdmt
|
||||||
|
list mode glite
|
||||||
|
list mode t1413
|
||||||
|
list mode adsl2
|
||||||
|
list mode adsl2p
|
||||||
|
list mode annexl
|
||||||
|
list mode annexm
|
||||||
|
list mode vdsl2
|
||||||
|
# VDSL2 profiles
|
||||||
|
list profile 8a
|
||||||
|
list profile 8b
|
||||||
|
list profile 8c
|
||||||
|
list profile 8d
|
||||||
|
list profile 12a
|
||||||
|
list profile 12b
|
||||||
|
list profile 17a
|
||||||
|
list profile 30a
|
||||||
|
option bitswap 1
|
||||||
|
option sra 1
|
||||||
|
option us0 1 # VDSL2 only
|
||||||
|
option sesdrop 0
|
||||||
|
option sos 0
|
||||||
|
option phyReXmtUs 0
|
||||||
|
option phyReXmtDs 1
|
||||||
|
|
||||||
|
config atm-device atm0
|
||||||
|
option name 'ATM'
|
||||||
|
option vpi '8'
|
||||||
|
option vci '35'
|
||||||
|
option device atm0
|
||||||
|
option link_type 'eoa' # EoA, IPoA, PPPoA, CIP
|
||||||
|
option encapsulation 'llc' # llc, vcmux
|
||||||
|
option qos_class 'ubr' # ubr, cbr, gfr, vbr-nrt, vbr-rt, ubr+, abr
|
||||||
|
# option pcr '512'
|
||||||
|
# option scr '256'
|
||||||
|
# option mbs '1024'
|
||||||
|
|
||||||
|
config ptm-device ptm0
|
||||||
|
option name 'PTM'
|
||||||
|
option device 'ptm0'
|
||||||
|
option priority '1'
|
||||||
|
option portid '1'
|
||||||
|
|
||||||
7
dslmngr/files/common/etc/hotplug.d/dsl/10-devices
Normal file
7
dslmngr/files/common/etc/hotplug.d/dsl/10-devices
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[ "$STATUS" == "up" -o "$STATUS" == "down" ] || exit 0
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
include /lib/dsl
|
||||||
|
|
||||||
|
xtm_remove_devices
|
||||||
|
xtm_create_devices
|
||||||
7
dslmngr/files/common/etc/hotplug.d/dsl/20-leds
Normal file
7
dslmngr/files/common/etc/hotplug.d/dsl/20-leds
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
if [ "$STATUS" == "up" ]; then
|
||||||
|
ubus call led.dsl set '{"state":"ok"}'
|
||||||
|
elif [ "$STATUS" == "down" ]; then
|
||||||
|
ubus call led.dsl set '{"state":"off"}'
|
||||||
|
elif [ "$STATUS" == "training" ]; then
|
||||||
|
ubus call led.dsl set '{"state":"alert"}'
|
||||||
|
fi
|
||||||
48
dslmngr/files/common/etc/init.d/dsl
Executable file
48
dslmngr/files/common/etc/init.d/dsl
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
include /lib/dsl
|
||||||
|
|
||||||
|
START=20
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
DSLMNGR=$(which dslmngr)
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
[ -n "$DSLMNGR" ] && {
|
||||||
|
procd_open_instance
|
||||||
|
procd_set_param command "$DSLMNGR"
|
||||||
|
procd_set_param respawn
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
xdsl_configure
|
||||||
|
xtm_create_devices
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_service() {
|
||||||
|
[ -n "$DSLMNGR" ] && service_stop $DSLMNGR
|
||||||
|
|
||||||
|
xtm_remove_devices
|
||||||
|
xdsl_stop
|
||||||
|
}
|
||||||
|
|
||||||
|
boot() {
|
||||||
|
local HASADSL="$(db -q get hw.board.hasAdsl)"
|
||||||
|
local HASVDSL="$(db -q get hw.board.hasVdsl)"
|
||||||
|
[ "$HASADSL" == "1" -o "$HASVDSL" == "1" ] || return
|
||||||
|
|
||||||
|
xdsl_init
|
||||||
|
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger dsl
|
||||||
|
}
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ define Package/easy-qos
|
|||||||
SECTION:=net
|
SECTION:=net
|
||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
TITLE:=Easy QoS
|
TITLE:=Easy QoS
|
||||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet)
|
DEPENDS:=@(TARGET_brcmbca||TARGET_airoha)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/easy-qos/description
|
define Package/easy-qos/description
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ include $(INCLUDE_DIR)/package.mk
|
|||||||
|
|
||||||
-include $(TOPDIR)/.config
|
-include $(TOPDIR)/.config
|
||||||
|
|
||||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||||
LINUX_DIR=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.1
|
LINUX_DIR=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.1
|
||||||
LINUX_VERSION := 4.1.52
|
LINUX_VERSION := 4.1.52
|
||||||
LINUXINCLUDE=-Iarch/$(LINUX_KARCH)/mach-bcm963xx/include
|
LINUXINCLUDE=-Iarch/$(LINUX_KARCH)/mach-bcm963xx/include
|
||||||
@@ -85,7 +85,7 @@ define Build/Compile
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||||
define KernelPackage/easy-soc-events/install-extra
|
define KernelPackage/easy-soc-events/install-extra
|
||||||
cp $(PKG_BUILD_DIR)/easyevent.ko $(FS_DIR)/lib/modules/$(LINUX_VERSION)/extra
|
cp $(PKG_BUILD_DIR)/easyevent.ko $(FS_DIR)/lib/modules/$(LINUX_VERSION)/extra
|
||||||
endef
|
endef
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=easy-soc-libs
|
PKG_NAME:=easy-soc-libs
|
||||||
PKG_VERSION:=6.6.0
|
PKG_VERSION:=7.2.7
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
LOCAL_DEV=0
|
LOCAL_DEV=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_VERSION:=c8c406568822b170e373a54fbf32323e960259ff
|
PKG_SOURCE_VERSION:=3d6d1347668408e77c327ddf81602e70af8b3d98
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||||
@@ -36,7 +36,7 @@ define Package/easy-soc-libs
|
|||||||
MENU:=1
|
MENU:=1
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||||
TARGET_PLATFORM=BROADCOM
|
TARGET_PLATFORM=BROADCOM
|
||||||
TARGET_WIFI_TYPE=BROADCOM
|
TARGET_WIFI_TYPE=BROADCOM
|
||||||
CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
|
CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
|
||||||
@@ -55,10 +55,14 @@ else ifeq ($(CONFIG_TARGET_iopsys_armvirt),y)
|
|||||||
TARGET_PLATFORM=TEST
|
TARGET_PLATFORM=TEST
|
||||||
TARGET_WIFI_TYPE=TEST
|
TARGET_WIFI_TYPE=TEST
|
||||||
TARGET_CFLAGS +=-DIOPSYS_TEST
|
TARGET_CFLAGS +=-DIOPSYS_TEST
|
||||||
else ifeq ($(CONFIG_TARGET_iopsys_econet),y)
|
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||||
TARGET_PLATFORM=ECONET
|
TARGET_PLATFORM=ECONET
|
||||||
TARGET_WIFI_TYPE=MAC80211
|
TARGET_WIFI_TYPE=MAC80211
|
||||||
TARGET_CFLAGS +=-DIOPSYS_ECONET
|
TARGET_CFLAGS +=-DIOPSYS_ECONET
|
||||||
|
else ifeq ($(CONFIG_TARGET_ipq95xx),y)
|
||||||
|
TARGET_PLATFORM=IPQ95XX
|
||||||
|
TARGET_WIFI_TYPE=MAC80211
|
||||||
|
TARGET_CFLAGS +=-DIPQ95XX
|
||||||
else
|
else
|
||||||
$(info Unexpected CONFIG_TARGET, use default MAC80211)
|
$(info Unexpected CONFIG_TARGET, use default MAC80211)
|
||||||
TARGET_PLATFORM=MAC80211
|
TARGET_PLATFORM=MAC80211
|
||||||
@@ -71,13 +75,27 @@ export TARGET_WIFI_TYPE
|
|||||||
|
|
||||||
subdirs := \
|
subdirs := \
|
||||||
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
|
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
|
||||||
|
$(if $(CONFIG_PACKAGE_libwifiutils),libwifi) \
|
||||||
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
|
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
|
||||||
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
|
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
|
||||||
$(if $(CONFIG_PACKAGE_libethernet),libethernet) \
|
$(if $(CONFIG_PACKAGE_libethernet),libethernet) \
|
||||||
$(if $(CONFIG_PACKAGE_libqos),libqos)
|
$(if $(CONFIG_PACKAGE_libqos),libqos)
|
||||||
|
|
||||||
EASY_SOC_LIBS := \
|
ifneq ($(CONFIG_PACKAGE_libwifi),)
|
||||||
|
TARGET_CFLAGS +=-DHAS_WIFI
|
||||||
|
endif
|
||||||
|
|
||||||
|
esl-pkgs := \
|
||||||
|
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
|
||||||
|
$(if $(CONFIG_PACKAGE_libwifiutils),libwifiutils) \
|
||||||
|
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
|
||||||
|
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
|
||||||
|
$(if $(CONFIG_PACKAGE_libethernet),libethernet) \
|
||||||
|
$(if $(CONFIG_PACKAGE_libqos),libqos)
|
||||||
|
|
||||||
|
esl-pkgs-all := \
|
||||||
libeasy \
|
libeasy \
|
||||||
|
libwifiutils \
|
||||||
libwifi \
|
libwifi \
|
||||||
libdsl \
|
libdsl \
|
||||||
libethernet \
|
libethernet \
|
||||||
@@ -127,15 +145,15 @@ define Build/Compile
|
|||||||
$(Build/Compile/rebuild)
|
$(Build/Compile/rebuild)
|
||||||
touch $(PKG_BUILD_DIR)/.config_$(CONFIG_TARGET_PROFILE)
|
touch $(PKG_BUILD_DIR)/.config_$(CONFIG_TARGET_PROFILE)
|
||||||
$(call Build/Compile/Default)
|
$(call Build/Compile/Default)
|
||||||
$(foreach dir,$(subdirs),$(call Build/Compile/$(dir)))
|
$(foreach dir,$(esl-pkgs),$(call Build/Compile/$(dir)))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/InstallDev
|
define Build/InstallDev
|
||||||
$(foreach dir,$(subdirs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
$(foreach dir,$(esl-pkgs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/easy-soc-libs/install
|
define Package/easy-soc-libs/install
|
||||||
:
|
:
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(foreach e,$(EASY_SOC_LIBS),$(call BuildPackage,$(e))))
|
$(eval $(foreach e,$(esl-pkgs-all),$(call BuildPackage,$(e))))
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
define Package/libethernet
|
define Package/libethernet
|
||||||
$(call Package/easy-soc-libs)
|
$(call Package/easy-soc-libs)
|
||||||
TITLE:= Ethernet library (libethernet)
|
TITLE:= Ethernet library (libethernet)
|
||||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_ramips:swconfig +TARGET_iopsys_econet:ecnt_api
|
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_ramips:swconfig +TARGET_airoha:ecnt_api
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libethernet/config
|
define Package/libethernet/config
|
||||||
|
|||||||
@@ -1,29 +1,49 @@
|
|||||||
|
|
||||||
|
define Package/libwifiutils
|
||||||
|
$(call Package/easy-soc-libs)
|
||||||
|
TITLE:= WiFi utility library (libwifiutils.so)
|
||||||
|
DEPENDS+=+libnl +libnl-route +libeasy
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/InstallDev/libwifiutils
|
||||||
|
$(INSTALL_DIR) $(1)/usr/include
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/libwifi/wifidefs.h $(1)/usr/include/
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/libwifi/wifiutils.h $(1)/usr/include/
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifiutils*.so* $(1)/usr/lib/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/libwifiutils/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifiutils*.so* $(1)/usr/lib/
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
define Package/libwifi
|
define Package/libwifi
|
||||||
$(call Package/easy-soc-libs)
|
$(call Package/easy-soc-libs)
|
||||||
TITLE:= WiFi library (libwifi)
|
TITLE:= WiFi library (libwifi)
|
||||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_brcm63xx_arm:bcmkernel
|
DEPENDS+=+libnl +libnl-route +libeasy +libwifiutils +TARGET_brcmbca:bcmkernel
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libwifi/config
|
define Package/libwifi/config
|
||||||
if PACKAGE_libdsl
|
if PACKAGE_libwifi
|
||||||
config LIBWIFI_DEBUG
|
config LIBWIFI_DEBUG
|
||||||
depends on PACKAGE_libwifi
|
depends on PACKAGE_libwifi
|
||||||
bool "Enable wifi debugging"
|
bool "Enable wifi debugging"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
define Build/InstallDev/libwifi
|
define Build/InstallDev/libwifi
|
||||||
$(INSTALL_DIR) $(1)/usr/include
|
$(INSTALL_DIR) $(1)/usr/include
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/libwifi/wifiops.h $(1)/usr/include/
|
||||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifi.h $(1)/usr/include/
|
$(CP) $(PKG_BUILD_DIR)/libwifi/wifi.h $(1)/usr/include/
|
||||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
|
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi-7*.so* $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libwifi/install
|
define Package/libwifi/install
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
|
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi-7*.so* $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ LOCAL_DEV=0
|
|||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/endptmngr.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/endptmngr.git
|
||||||
PKG_SOURCE_VERSION:=0901382048bb7ce01fc1767fef75e54692f56743
|
PKG_SOURCE_VERSION:=fb85081443c19b5062bede49c80b1802c0f05d34
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ethmngr
|
PKG_NAME:=ethmngr
|
||||||
PKG_VERSION:=2.0.1
|
PKG_VERSION:=2.1.0
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_VERSION:=5a0ff3bc7c49dcb05129f423ef8e0c4929f6aa03
|
PKG_SOURCE_VERSION:=5a0ff3bc7c49dcb05129f423ef8e0c4929f6aa03
|
||||||
@@ -23,7 +23,7 @@ define Package/ethmngr
|
|||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
TITLE:=Ethernet status and configration utility
|
TITLE:=Ethernet status and configration utility
|
||||||
DEPENDS:=+libethernet +libuci +libubox +ubus +libpthread +libnl-genl
|
DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx):libethernet +libuci +libubox +ubus +libpthread +libnl-genl
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/ethmngr/description
|
define Package/ethmngr/description
|
||||||
@@ -37,10 +37,24 @@ TARGET_CFLAGS += \
|
|||||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||||
-D_GNU_SOURCE
|
-D_GNU_SOURCE
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx),)
|
||||||
|
define Build/Compile
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
define Package/ethmngr/install
|
define Package/ethmngr/install
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
|
$(CP) ./files/common/* $(1)/
|
||||||
$(INSTALL_BIN) ./files/ethmngr.init $(1)/etc/init.d/ethmngr
|
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||||
|
$(CP) ./files/broadcom/* $(1)/
|
||||||
|
else ifneq ($(CONFIG_TARGET_airoha),)
|
||||||
|
$(CP) ./files/airoha/* $(1)/
|
||||||
|
else
|
||||||
|
$(CP) ./files/linux/* $(1)/
|
||||||
|
endif
|
||||||
|
ifneq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx),)
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethmngr $(1)/usr/sbin/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethmngr $(1)/usr/sbin/
|
||||||
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,ethmngr))
|
$(eval $(call BuildPackage,ethmngr))
|
||||||
|
|||||||
208
ethmngr/files/airoha/lib/ethernet/airoha.sh
Normal file
208
ethmngr/files/airoha/lib/ethernet/airoha.sh
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
unset -f switchmgr
|
||||||
|
# alias for switchmgr
|
||||||
|
switchmgr() {
|
||||||
|
"/userfs/bin/switchmgr" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
unset -f tc3162_get_lan_port
|
||||||
|
# get lan port port by ifname
|
||||||
|
# arg1: port ifname, ex: eth0.1
|
||||||
|
tc3162_get_lan_port() {
|
||||||
|
[[ -z "$1" ]] && return 255
|
||||||
|
|
||||||
|
local ifname="$1"
|
||||||
|
local if_idx=255
|
||||||
|
|
||||||
|
# only for tc3162 eth switch ports (eth0.x, 0 < x < 7)
|
||||||
|
case "${ifname}" in
|
||||||
|
eth0.*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
logger -t "port-management" \
|
||||||
|
"unsupported - ${ifname} is not tc3162 switch port"
|
||||||
|
return 255
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
let "if_idx=$(echo "${ifname}" | cut -f2 -d'.')"
|
||||||
|
[[ -z "${if_idx}" ]] && return 255
|
||||||
|
[[ ${if_idx} -lt 1 || ${if_idx} -gt 6 ]] && {
|
||||||
|
logger -t "port-management" \
|
||||||
|
"incorrect tc3162 lan port index ${if_idx} picked from ifname ${ifname}"
|
||||||
|
return 255
|
||||||
|
}
|
||||||
|
let "if_idx=${if_idx}-1"
|
||||||
|
return ${if_idx}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unset -f tc3162_get_mapped_port
|
||||||
|
# get mapped switch port by ifname
|
||||||
|
# arg1: port ifname, ex: eth0.1
|
||||||
|
tc3162_get_mapped_port() {
|
||||||
|
[[ -z "$1" ]] && return 255
|
||||||
|
|
||||||
|
local ifname="$1"
|
||||||
|
local if_idx=255
|
||||||
|
local prtmap_procfile="/proc/tc3162/eth_portmap"
|
||||||
|
local lan_prt=255
|
||||||
|
local port=255
|
||||||
|
local prtmap_out_line_num=4
|
||||||
|
local prtmap_out_line=""
|
||||||
|
|
||||||
|
# check "lan port map" marker in portmap output string
|
||||||
|
prtmap_out_line="$(sed -n "${prtmap_out_line_num}p" ${prtmap_procfile})"
|
||||||
|
[[ ${prtmap_out_line} != "lan_port_map" ]] && return 255
|
||||||
|
|
||||||
|
tc3162_get_lan_port "${ifname}"
|
||||||
|
let "if_idx=$?"
|
||||||
|
[[ -z "${if_idx}" || ${if_idx} -eq 255 ]] && return
|
||||||
|
|
||||||
|
# get lan portmapping string "lan_port mapped_port" for ifname by it's index
|
||||||
|
let "prtmap_out_line_num=${prtmap_out_line_num}+1+${if_idx}"
|
||||||
|
prtmap_out_line="$(sed -n "${prtmap_out_line_num}p" ${prtmap_procfile})"
|
||||||
|
|
||||||
|
# get and check lan port index from lan portmapping string
|
||||||
|
lan_prt=$(echo "${prtmap_out_line}" | cut -f 1 -d' ')
|
||||||
|
[[ -z "${lan_prt}" || "${if_idx}" != "${lan_prt}" ]] && return 255
|
||||||
|
|
||||||
|
# get and check mapped port from lan portmapping string
|
||||||
|
let "port=$(echo "${prtmap_out_line}" | cut -f 2 -d' ')"
|
||||||
|
[[ ${port} -lt 0 || ${port} -gt 255 ]] && return 255
|
||||||
|
|
||||||
|
return ${port}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset -f get_max_port_speed
|
||||||
|
# arg1: port ifname, ex: eth0.1
|
||||||
|
get_max_port_speed() {
|
||||||
|
[[ -z "$1" ]] && { echo 0; return; }
|
||||||
|
|
||||||
|
local ifname="$1"
|
||||||
|
local port=255
|
||||||
|
local speed=0
|
||||||
|
|
||||||
|
[[ -d "/sys/class/net/${ifname}" ]] || {
|
||||||
|
logger -t "port-management" "interface ${ifname} is not found"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
tc3162_get_lan_port "${ifname}"
|
||||||
|
let "port=$?"
|
||||||
|
[[ -z "${port}" || ${port} -eq 255 ]] && return
|
||||||
|
|
||||||
|
# tc3162 capability for all ports is 1Gbps
|
||||||
|
speed=1000
|
||||||
|
|
||||||
|
echo $speed
|
||||||
|
}
|
||||||
|
|
||||||
|
unset -f power_updown
|
||||||
|
# arg1: port ifname, ex: eth0.1
|
||||||
|
# arg2: port enabled, ex: 0/1/off/on/..
|
||||||
|
power_updown() {
|
||||||
|
[[ -z "$1" ]] && return
|
||||||
|
[[ -z "$2" ]] && return
|
||||||
|
|
||||||
|
local ifname="$1"
|
||||||
|
local enabled="$2"
|
||||||
|
local port=255
|
||||||
|
|
||||||
|
[[ -d "/sys/class/net/${ifname}" ]] || {
|
||||||
|
logger -t "port-management" "interface ${ifname} is not found"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let "enabled=$(get_bool "${enabled}" "-1")"
|
||||||
|
[[ ${enabled} -eq -1 ]] && return
|
||||||
|
|
||||||
|
tc3162_get_lan_port "${ifname}"
|
||||||
|
let "port=$?"
|
||||||
|
[[ -z "${port}" || ${port} -eq 255 ]] && return
|
||||||
|
|
||||||
|
switchmgr phy admin "${port}" "${enabled}"
|
||||||
|
}
|
||||||
|
|
||||||
|
unset -f set_port_settings
|
||||||
|
# arg1: port ifname, ex: eth0.1
|
||||||
|
# arg2: port enabled, ex: 0/1/off/on/..
|
||||||
|
# arg3: port speed, ex: 1000
|
||||||
|
# arg4: port duplex, ex: full
|
||||||
|
# arg5: port autoneg, ex: 0/1/off/on/..
|
||||||
|
# arg6: port eee, ex: 0/1/off/on/..
|
||||||
|
# arg7: port pause, ex: 0/1/off/on/..
|
||||||
|
set_port_settings() {
|
||||||
|
[[ -z "$1" ]] && return
|
||||||
|
[[ -z "$2" ]] && return
|
||||||
|
[[ -z "$3" ]] && return
|
||||||
|
[[ -z "$4" ]] && return
|
||||||
|
[[ -z "$5" ]] && return
|
||||||
|
[[ -z "$6" ]] && return
|
||||||
|
[[ -z "$7" ]] && return
|
||||||
|
|
||||||
|
local ifname="$1"
|
||||||
|
local enabled="$2"
|
||||||
|
local speed="$3"
|
||||||
|
local duplex="$4"
|
||||||
|
local autoneg=$5
|
||||||
|
local eee="$6"
|
||||||
|
local pause="$7"
|
||||||
|
local port=255
|
||||||
|
local speedmode=1
|
||||||
|
local last_speed=0
|
||||||
|
|
||||||
|
[[ -d "/sys/class/net/${ifname}" ]] || {
|
||||||
|
logger -t "port-management" "interface ${ifname} is not found"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let "enabled=$(get_bool "${enabled}" "-1")"
|
||||||
|
[[ ${enabled} -eq -1 ]] && return
|
||||||
|
|
||||||
|
let "autoneg=$(get_bool "${autoneg}" "-1")"
|
||||||
|
[[ ${autoneg} -eq -1 ]] && return
|
||||||
|
|
||||||
|
let "eee=$(get_bool "${eee}" "-1")"
|
||||||
|
[[ ${eee} -eq -1 ]] && return
|
||||||
|
|
||||||
|
let "pause=$(get_bool "${pause}" "-1")"
|
||||||
|
[[ ${pause} -eq -1 ]] && return
|
||||||
|
|
||||||
|
duplex="$(echo "${duplex}" | awk '{print tolower($0)}')"
|
||||||
|
[[ "${duplex}" != "half" && "${duplex}" != "full" ]] && return
|
||||||
|
|
||||||
|
tc3162_get_lan_port "${ifname}"
|
||||||
|
let "port=$?"
|
||||||
|
[[ -z "${port}" || ${port} -eq 255 ]] && return
|
||||||
|
|
||||||
|
last_speed="$(switchmgr phy maxspeed "${port}" | cut -f2 -d':')"
|
||||||
|
[[ -z "${last_speed}" || "${last_speed}" == "*Down*" ]] \
|
||||||
|
&& last_speed=${speed}
|
||||||
|
|
||||||
|
switchmgr phy pause "${port}" "${pause}"
|
||||||
|
|
||||||
|
# set speedmode: speed+duplex+autoneg
|
||||||
|
# FIXME: switchmgr has no separate setting for 1Gbps speed - use autoneg instead
|
||||||
|
if [[ ${autoneg} -eq 1 || ${speed} -gt 100 ]]; then
|
||||||
|
switchmgr phy speedmode ${port} "1"
|
||||||
|
else
|
||||||
|
[[ ${speed} -gt 10 ]] && let "speedmode=2" || let "speedmode=4"
|
||||||
|
[[ "${duplex}" == "half" ]] && let "speedmode=${speedmode}+1"
|
||||||
|
switchmgr phy speedmode "${port}" "${speedmode}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO: implement MAC control register manipulations (mapped ports used) for
|
||||||
|
# eee settings change
|
||||||
|
# separate (tx/rx) pause (flow control) settings change
|
||||||
|
# set speed to 1Gbps separately from autoneg mode
|
||||||
|
|
||||||
|
# FIXME: workaround for duplex/pause settings being not applied if speed is unchanged
|
||||||
|
[[ ${last_speed} -eq ${speed} ]] && power_updown "${ifname}" 0
|
||||||
|
|
||||||
|
power_updown "${ifname}" ${enabled}
|
||||||
|
|
||||||
|
}
|
||||||
140
ethmngr/files/broadcom/lib/ethernet/broadcom.sh
Normal file
140
ethmngr/files/broadcom/lib/ethernet/broadcom.sh
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
# arg1: port ifname, ex: eth0
|
||||||
|
get_max_port_speed() {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo 0
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ifname="$1"
|
||||||
|
local phycap="$(ethctl $ifname media-type 2>/dev/null | grep 'PHY Capabilities' | awk '{print$NF}' | cut -d'|' -f1)"
|
||||||
|
local speed=1000
|
||||||
|
|
||||||
|
case "$phycap" in
|
||||||
|
10GFD) speed=10000 ;;
|
||||||
|
5GFD) speed=5000 ;;
|
||||||
|
2.5GFD) speed=2500 ;;
|
||||||
|
1GFD|1GHD) speed=1000 ;;
|
||||||
|
100MFD|100MHD) speed=100 ;;
|
||||||
|
10MFD|10MHD) speed=10 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo $speed
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg1: port name, ex: eth0
|
||||||
|
get_port_number() {
|
||||||
|
[ -z "$1" ] && return
|
||||||
|
local ports="0 1 2 3 4 5 6 7"
|
||||||
|
local units="0 1"
|
||||||
|
local port="$1"
|
||||||
|
local ifname
|
||||||
|
|
||||||
|
for unit in $units; do
|
||||||
|
for prt in $ports; do
|
||||||
|
ifname="$(ethswctl getifname $unit $prt 2>/dev/null | awk '{print$NF}')"
|
||||||
|
if [ "$ifname" == "$port" ]; then
|
||||||
|
echo "$unit $prt"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg1: port ifname, ex: eth0
|
||||||
|
# arg2: port enabled, ex: 1
|
||||||
|
power_updown() {
|
||||||
|
local ifname="$1"
|
||||||
|
local enabled=$2
|
||||||
|
|
||||||
|
local updown="up"
|
||||||
|
[ $enabled -eq 0 ] && updown="down"
|
||||||
|
ethctl $ifname phy-power $updown >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg1: port ifname, ex: eth0
|
||||||
|
# arg2: port enabled, ex: 1
|
||||||
|
# arg3: port speed, ex: 1000
|
||||||
|
# arg4: port duplex, ex: full
|
||||||
|
# arg5: port autoneg, ex: on
|
||||||
|
# arg6: port eee, ex: 0
|
||||||
|
# arg7: port pause, ex: 0
|
||||||
|
set_port_settings() {
|
||||||
|
local ifname="$1"
|
||||||
|
local enabled=$2
|
||||||
|
local speed="$3"
|
||||||
|
local duplex=$4
|
||||||
|
local autoneg=$5
|
||||||
|
local eee=$6
|
||||||
|
local pause=$7
|
||||||
|
|
||||||
|
[ -d /sys/class/net/$ifname ] || return
|
||||||
|
|
||||||
|
local unitport="$(get_port_number $ifname)"
|
||||||
|
local unit=$(echo $unitport | cut -d ' ' -f 1)
|
||||||
|
local port=$(echo $unitport | cut -d ' ' -f 2)
|
||||||
|
|
||||||
|
[ $autoneg -eq 1 ] && autoneg="on" || autoneg="off"
|
||||||
|
[ "$duplex" == "half" ] && duplex=0 || duplex=1
|
||||||
|
[ "$duplex" == 0 ] && dplx="HD" || dplx="FD"
|
||||||
|
[ "$autoneg" == "on" ] && media_type="auto" || media_type="$speed$dplx"
|
||||||
|
|
||||||
|
phycrossbar="$(ethctl $ifname phy-crossbar | head -1)"
|
||||||
|
crossbartype="$(echo $phycrossbar | awk '{print$2$3}')"
|
||||||
|
# Take only the last PHY Endpoint (non-Serdes) into account as Serdes port number precedes
|
||||||
|
[ "$crossbartype" == "oncrossbar" ] && pyhendpoint="$(echo $phycrossbar | awk '{print$NF}')"
|
||||||
|
|
||||||
|
phycaps="$(ethctl $ifname media-type ${pyhendpoint:+ port $pyhendpoint} | awk -F'PHY Capabilities: ' '{print$2}')"
|
||||||
|
numofcaps="$(echo $phycaps | tr '|' ' ' | wc -w)"
|
||||||
|
|
||||||
|
if [ "$numofcaps" == "1" ]; then
|
||||||
|
logger -t "port-management" "$ifname is capable of $phycaps only; not setting speed/duplex"
|
||||||
|
else
|
||||||
|
logger -t "port-management" "$ifname is capable of $phycaps; setting speed/duplex to $media_type"
|
||||||
|
ethctl $ifname media-type $media_type ${pyhendpoint:+ port $pyhendpoint} &>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ $eee -eq 1 ] && eee="on" || eee="off"
|
||||||
|
ethtool --set-eee $ifname eee $eee 2>/dev/null
|
||||||
|
|
||||||
|
case $pause in
|
||||||
|
off|0)
|
||||||
|
pause=0x0
|
||||||
|
auto=off
|
||||||
|
rx=off
|
||||||
|
tx=off
|
||||||
|
;;
|
||||||
|
on|1)
|
||||||
|
pause=0x2
|
||||||
|
auto=off
|
||||||
|
rx=on
|
||||||
|
tx=on
|
||||||
|
;;
|
||||||
|
auto)
|
||||||
|
pause=0x1
|
||||||
|
auto=on
|
||||||
|
rx=on
|
||||||
|
tx=on
|
||||||
|
;;
|
||||||
|
tx)
|
||||||
|
pause=0x3
|
||||||
|
auto=off
|
||||||
|
rx=off
|
||||||
|
tx=on
|
||||||
|
;;
|
||||||
|
rx)
|
||||||
|
pause=0x4
|
||||||
|
auto=off
|
||||||
|
rx=on
|
||||||
|
tx=off
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ "$auto" == "on" ]; then
|
||||||
|
# Use ethswctl utility to set pause autoneg
|
||||||
|
# as ethtool is not setting it properly
|
||||||
|
ethswctl -c pause -n $unit -p $port -v $pause 2>&1 >/dev/null
|
||||||
|
else
|
||||||
|
ethtool --pause $ifname autoneg $auto rx $rx tx $tx 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
power_updown $ifname $enabled
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
START=15
|
START=15
|
||||||
|
STOP=90
|
||||||
|
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
|
PROG=/usr/sbin/ethmngr
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
include /lib/network
|
include /lib/ethernet
|
||||||
|
|
||||||
configure_ports(){
|
configure_ethernet_port(){
|
||||||
local cfg=$1
|
local cfg=$1
|
||||||
local ifname enabled speed duplex autoneg eee pause
|
local ifname enabled speed duplex autoneg eee pause
|
||||||
|
|
||||||
@@ -24,11 +27,22 @@ configure_ports(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
[ -f /lib/network/port.sh ] || return
|
if [ -s /etc/config/ports ]; then
|
||||||
|
config_load ports
|
||||||
|
config_foreach configure_ethernet_port ethport
|
||||||
|
fi
|
||||||
|
|
||||||
config_load ports
|
if [ -f $PROG ]; then
|
||||||
config_foreach configure_ports ethport
|
procd_open_instance
|
||||||
config_foreach configure_ports sfpport
|
procd_set_param command ${PROG}
|
||||||
|
procd_set_param respawn
|
||||||
|
procd_close_instance
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
populate_config_from_db() {
|
populate_config_from_db() {
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
include /lib/network
|
. /lib/network/utils.sh
|
||||||
|
include /lib/ethernet
|
||||||
|
|
||||||
portorder="$(db -q get hw.board.ethernetPortOrder)"
|
portorder="$(db -q get hw.board.ethernetPortOrder)"
|
||||||
for port in $portorder; do
|
for port in $portorder; do
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
|
||||||
|
|
||||||
START=95
|
|
||||||
STOP=10
|
|
||||||
|
|
||||||
USE_PROCD=1
|
|
||||||
PROG=/usr/sbin/ethmngr
|
|
||||||
|
|
||||||
start_service() {
|
|
||||||
procd_open_instance
|
|
||||||
procd_set_param command ${PROG}
|
|
||||||
procd_set_param respawn
|
|
||||||
procd_close_instance
|
|
||||||
}
|
|
||||||
|
|
||||||
reload_service() {
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
}
|
|
||||||
95
ethmngr/files/linux/lib/ethernet/linux.sh
Normal file
95
ethmngr/files/linux/lib/ethernet/linux.sh
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
# arg1: port ifname, ex: eth0
|
||||||
|
get_max_port_speed() {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo 0
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ifname="$1"
|
||||||
|
local phycap="$(ethtool $ifname | grep -A 10 "Supported link modes" | grep 000 | tail -n 1 | awk '{print$NF}')"
|
||||||
|
local speed=1000
|
||||||
|
|
||||||
|
case "$phycap" in
|
||||||
|
10000*) speed=10000 ;;
|
||||||
|
5000*) speed=5000 ;;
|
||||||
|
2500*) speed=2500 ;;
|
||||||
|
1000*) speed=1000 ;;
|
||||||
|
100*) speed=100 ;;
|
||||||
|
10*) speed=10 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo $speed
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg1: port ifname, ex: eth0
|
||||||
|
# arg2: port enabled, ex: 1
|
||||||
|
power_updown() {
|
||||||
|
local ifname="$1"
|
||||||
|
local enabled=$2
|
||||||
|
|
||||||
|
local updown="up"
|
||||||
|
[ $enabled -eq 0 ] && updown="down"
|
||||||
|
ip link set dev $ifname $updown
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg1: port ifname, ex: eth0
|
||||||
|
# arg2: port enabled, ex: 1
|
||||||
|
# arg3: port speed, ex: 1000
|
||||||
|
# arg4: port duplex, ex: full
|
||||||
|
# arg5: port autoneg, ex: on
|
||||||
|
# arg6: port eee, ex: 0
|
||||||
|
# arg7: port pause, ex: 0
|
||||||
|
set_port_settings() {
|
||||||
|
local ifname="$1"
|
||||||
|
local enabled=$2
|
||||||
|
local speed="$3"
|
||||||
|
local duplex=$4
|
||||||
|
local autoneg=$5
|
||||||
|
local eee=$6
|
||||||
|
local pause=$7
|
||||||
|
|
||||||
|
[ -d /sys/class/net/$ifname ] || return
|
||||||
|
|
||||||
|
[ $autoneg -eq 1 ] && autoneg="on" || autoneg="off"
|
||||||
|
ethtool --change $ifname speed $speed duplex $duplex autoneg $autoneg
|
||||||
|
|
||||||
|
[ $eee -eq 1 ] && eee="on" || eee="off"
|
||||||
|
ethtool --set-eee $ifname eee $eee 2>/dev/null
|
||||||
|
|
||||||
|
case $pause in
|
||||||
|
off|0)
|
||||||
|
pause=0x0
|
||||||
|
auto=off
|
||||||
|
rx=off
|
||||||
|
tx=off
|
||||||
|
;;
|
||||||
|
on|1)
|
||||||
|
pause=0x2
|
||||||
|
auto=off
|
||||||
|
rx=on
|
||||||
|
tx=on
|
||||||
|
;;
|
||||||
|
auto)
|
||||||
|
pause=0x1
|
||||||
|
auto=on
|
||||||
|
rx=on
|
||||||
|
tx=on
|
||||||
|
;;
|
||||||
|
tx)
|
||||||
|
pause=0x3
|
||||||
|
auto=off
|
||||||
|
rx=off
|
||||||
|
tx=on
|
||||||
|
;;
|
||||||
|
rx)
|
||||||
|
pause=0x4
|
||||||
|
auto=off
|
||||||
|
rx=on
|
||||||
|
tx=off
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ethtool --pause $ifname autoneg $auto rx $rx tx $tx 2>/dev/null
|
||||||
|
|
||||||
|
power_updown $ifname $enabled
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=evoice
|
PKG_NAME:=evoice
|
||||||
PKG_VERSION:=0.2.29
|
PKG_VERSION:=0.2.39
|
||||||
|
|
||||||
LOCAL_DEV=0
|
LOCAL_DEV=0
|
||||||
LOCAL_DEV_EVOICE_DIR=~/voip/evoice
|
LOCAL_DEV_EVOICE_DIR=~/voip/evoice
|
||||||
@@ -13,7 +13,7 @@ LOCAL_DEV_EVOICE_DIR=~/voip/evoice
|
|||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/evoice.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/evoice.git
|
||||||
PKG_SOURCE_VERSION:=ee4e9e00ec1c54b41e15a3de38f6a733634622dd
|
PKG_SOURCE_VERSION:=30d65330de0368f73ecf4a2e804c39a2ee280454
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
endif
|
endif
|
||||||
@@ -21,8 +21,6 @@ endif
|
|||||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
||||||
PKG_BUILD_DEPENDS:=bbf
|
|
||||||
|
|
||||||
# All config variable that are passed to the make invocation, directly or
|
# All config variable that are passed to the make invocation, directly or
|
||||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||||
#PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
#PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||||
@@ -34,10 +32,10 @@ define Package/$(PKG_NAME)
|
|||||||
SUBMENU:=Telephony
|
SUBMENU:=Telephony
|
||||||
TITLE:=Ensemble Voice
|
TITLE:=Ensemble Voice
|
||||||
URL:=
|
URL:=
|
||||||
DEPENDS:= +libubox +libubus +libpicoevent +libuci +libstdcpp +libopenssl\
|
DEPENDS:= +libubox +libubus +libpicoevent +libuci +libstdcpp +libopenssl +libjson-c +libblobmsg-json\
|
||||||
+TARGET_iopsys_brcm63xx_arm:bcmkernel\
|
+TARGET_brcmbca:bcmkernel\
|
||||||
+TARGET_iopsys_econet:kmod-voip_driver\
|
+TARGET_airoha:kmod-voip_driver\
|
||||||
+TARGET_iopsys_econet:voip_app
|
+TARGET_airoha:voip_app +libbbf_api
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/description
|
define Package/$(PKG_NAME)/description
|
||||||
@@ -58,17 +56,19 @@ endif
|
|||||||
IDIR = $(STAGING_DIR)/usr/include
|
IDIR = $(STAGING_DIR)/usr/include
|
||||||
TONES_INI_REQUIRED=
|
TONES_INI_REQUIRED=
|
||||||
|
|
||||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||||
TARGET_PLATFORM=BROADCOM
|
TARGET_PLATFORM=BROADCOM
|
||||||
BDIR = bcm963xx/userspace/private/apps/voice
|
BDIR = bcm963xx/userspace/private/apps/voice
|
||||||
CC_FLAGS = -I$(IDIR) -I$(IDIR)/$(BDIR)/inc\
|
CC_FLAGS = -I$(IDIR) -I$(IDIR)/$(BDIR)/inc\
|
||||||
-I$(IDIR)/bcm963xx/xchg/bos/publicInc\
|
-I$(IDIR)/bcm963xx/xchg/bos/publicInc\
|
||||||
-I$(IDIR)/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
-I$(IDIR)/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
||||||
TRG=SVrgBcmFxs
|
TRG=SVrgBcmFxs
|
||||||
else ifeq ($(CONFIG_TARGET_iopsys_econet),y)
|
JSONFILE=codecs_brcm.json
|
||||||
|
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||||
TARGET_PLATFORM=ECONET
|
TARGET_PLATFORM=ECONET
|
||||||
TONES_INI_REQUIRED=y
|
TONES_INI_REQUIRED=y
|
||||||
TRG=SVrgMtekOwrt
|
TRG=SVrgMtekOwrt
|
||||||
|
JSONFILE=codecs_airoha.json
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# disable temporarily some not important warnings, force PIC
|
# disable temporarily some not important warnings, force PIC
|
||||||
@@ -95,6 +95,9 @@ define Package/evoice/install
|
|||||||
$(CP) ./files/* $(1)/
|
$(CP) ./files/* $(1)/
|
||||||
$(if $(TONES_INI_REQUIRED),,$(RM) $(1)/etc/evoice/tones.ini)
|
$(if $(TONES_INI_REQUIRED),,$(RM) $(1)/etc/evoice/tones.ini)
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
|
$(CP) $(1)/lib/voice/$(JSONFILE) $(1)/lib/voice/codecs_evoice.json
|
||||||
|
$(RM) $(1)/lib/voice/codecs_brcm.json
|
||||||
|
$(RM) $(1)/lib/voice/codecs_airoha.json
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/_bin/a_openwrt/evoice $(1)/usr/sbin/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/_bin/a_openwrt/evoice $(1)/usr/sbin/
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/_bin/a_openwrt/libvoiceservice.so $(1)/usr/lib/bbfdm/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/_bin/a_openwrt/libvoiceservice.so $(1)/usr/lib/bbfdm/
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ config SIPClient 'Client2'
|
|||||||
config SIPNetwork 'Network1'
|
config SIPNetwork 'Network1'
|
||||||
option Enable '1'
|
option Enable '1'
|
||||||
option ProxyServer 'sip-proxy.iopsys.eu'
|
option ProxyServer 'sip-proxy.iopsys.eu'
|
||||||
|
option AcceptFromProxyOnly '0'
|
||||||
option ProxyServerPort '5060'
|
option ProxyServerPort '5060'
|
||||||
option ProxyServerTransport 'UDP'
|
option ProxyServerTransport 'UDP'
|
||||||
option RegistrarServer 'sip-proxy.iopsys.eu'
|
option RegistrarServer 'sip-proxy.iopsys.eu'
|
||||||
@@ -33,6 +34,12 @@ config SIPNetwork 'Network1'
|
|||||||
option TimerRegistrationFailed '120'
|
option TimerRegistrationFailed '120'
|
||||||
option TimerT1 '500'
|
option TimerT1 '500'
|
||||||
option VoIPProfile 'VoIPProfile1'
|
option VoIPProfile 'VoIPProfile1'
|
||||||
|
option SIPSessionTimerEnable '0'
|
||||||
|
option SIPSessionExpireInterval '1800'
|
||||||
|
option SIPSessionMinimumTimer '90'
|
||||||
|
option SIPSessionRefresher 'NONE'
|
||||||
|
option SIPSessionTimerMode 'REQUEST'
|
||||||
|
option SIPSessionRefreshRequest 'UPDATE'
|
||||||
list CodecList '1CodecProfile1'
|
list CodecList '1CodecProfile1'
|
||||||
list CodecList '1CodecProfile2'
|
list CodecList '1CodecProfile2'
|
||||||
list CodecList '1CodecProfile3'
|
list CodecList '1CodecProfile3'
|
||||||
|
|||||||
@@ -48,16 +48,23 @@ config account 'map_account'
|
|||||||
# Network stuff associated with an account.
|
# Network stuff associated with an account.
|
||||||
# All parameters in this table are written to internal configuration
|
# All parameters in this table are written to internal configuration
|
||||||
config network 'map_net'
|
config network 'map_net'
|
||||||
option Enable 'voice.Network@.Enable'
|
option Enable 'voice.Network@.Enable'
|
||||||
option Registration_Server 'voice.Network@.RegistrarServer'
|
option Registration_Server 'voice.Network@.RegistrarServer'
|
||||||
option Outbound_Proxy 'voice.Network@.ProxyServer'
|
option Outbound_Proxy 'voice.Network@.ProxyServer'
|
||||||
option SIP_Port 'voice.Network@.RegistrarServerPort'
|
option Accept_From_Registered 'voice.Network@.AcceptFromProxyOnly'
|
||||||
option SIP_Transport 'voice.Network@.RegistrarServerTransport'
|
option SIP_Port 'voice.Network@.RegistrarServerPort'
|
||||||
option RegistrationPeriod 'voice.Network@.RegistrationPeriod'
|
option SIP_Transport 'voice.Network@.RegistrarServerTransport'
|
||||||
|
option RegistrationPeriod 'voice.Network@.RegistrationPeriod'
|
||||||
option Registration_Interval 'voice.Network@.RegisterExpires'
|
option Registration_Interval 'voice.Network@.RegisterExpires'
|
||||||
option Reg_Failure_Interval 'voice.Network@.TimerRegistrationFailed'
|
option Reg_Failure_Interval 'voice.Network@.TimerRegistrationFailed'
|
||||||
option T1 'voice.Network@.TimerT1'
|
option T1 'voice.Network@.TimerT1'
|
||||||
option UserAgentDomain 'voice.Network@.UserAgentDomain'
|
option UserAgentDomain 'voice.Network@.UserAgentDomain'
|
||||||
|
option SIP_SessTmrEnable 'voice.Network@.SIPSessionTimerEnable'
|
||||||
|
option SIP_SessTmrMode 'voice.Network@.SIPSessionTimerMode'
|
||||||
|
option SIP_SessTmrMsg 'voice.Network@.SIPSessionRefreshRequest'
|
||||||
|
option SIP_SessTmrRefresher 'voice.Network@.SIPSessionRefresher'
|
||||||
|
option SIP_MinSE 'voice.Network@.SIPSessionMinimumTimer'
|
||||||
|
option SIP_SessInterval 'voice.Network@.SIPSessionExpireInterval'
|
||||||
|
|
||||||
config VoIPProfile 'map_voip'
|
config VoIPProfile 'map_voip'
|
||||||
option Enable 'voice.VoIPProfile@.Enable'
|
option Enable 'voice.VoIPProfile@.Enable'
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ config static_prm 'defaults'
|
|||||||
option Tone_On_Hangup '1'
|
option Tone_On_Hangup '1'
|
||||||
option BusyTone_On_Hangup '1'
|
option BusyTone_On_Hangup '1'
|
||||||
option Enable_Analouge_Conf '0'
|
option Enable_Analouge_Conf '0'
|
||||||
option SIP_SessTmrEnable '0'
|
|
||||||
option PrackUsage '1'
|
option PrackUsage '1'
|
||||||
option SIP_SupportedPath '0'
|
option SIP_SupportedPath '0'
|
||||||
option IMS_Access_Network_Info ' '
|
option IMS_Access_Network_Info ' '
|
||||||
|
|||||||
50
evoice/files/lib/voice/codecs_airoha.json
Normal file
50
evoice/files/lib/voice/codecs_airoha.json
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"G.711ALaw": [
|
||||||
|
{
|
||||||
|
"BitRate": 64000,
|
||||||
|
"PacketizationPeriod": "20",
|
||||||
|
"SilenceSuppression": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.711MuLaw": [
|
||||||
|
{
|
||||||
|
"BitRate": 64000,
|
||||||
|
"PacketizationPeriod": "20",
|
||||||
|
"SilenceSuppression": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.722": [
|
||||||
|
{
|
||||||
|
"BitRate": 64000,
|
||||||
|
"PacketizationPeriod": "20",
|
||||||
|
"SilenceSuppression": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.726": [
|
||||||
|
{
|
||||||
|
"BitRate": 32000,
|
||||||
|
"PacketizationPeriod": "20",
|
||||||
|
"SilenceSuppression": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 24000,
|
||||||
|
"PacketizationPeriod": "20",
|
||||||
|
"SilenceSuppression": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.729": [
|
||||||
|
{
|
||||||
|
"BitRate": 8000,
|
||||||
|
"PacketizationPeriod": "20",
|
||||||
|
"SilenceSuppression": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"AMR": [
|
||||||
|
{
|
||||||
|
"BitRate": 7400,
|
||||||
|
"PacketizationPeriod": "20",
|
||||||
|
"SilenceSuppression": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
140
evoice/files/lib/voice/codecs_brcm.json
Normal file
140
evoice/files/lib/voice/codecs_brcm.json
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
{
|
||||||
|
"G.711MuLaw": [
|
||||||
|
{
|
||||||
|
"BitRate": 64000,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.711ALaw": [
|
||||||
|
{
|
||||||
|
"BitRate": 64000,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.726": [
|
||||||
|
{
|
||||||
|
"BitRate": 16000,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 24000,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 32000,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 40000,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.723.1": [
|
||||||
|
{
|
||||||
|
"BitRate": 5300,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 6300,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.729": [
|
||||||
|
{
|
||||||
|
"BitRate": 8000,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"iLBC": [
|
||||||
|
{
|
||||||
|
"BitRate": 15200,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 13300,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"G.722": [
|
||||||
|
{
|
||||||
|
"BitRate": 64000,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"AMR": [
|
||||||
|
{
|
||||||
|
"BitRate": 12200,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 10200,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 7950,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 7400,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 6700,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 5900,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 5150,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BitRate": 4750,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GSM-EFR": [
|
||||||
|
{
|
||||||
|
"BitRate": 12200,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GSM-FR": [
|
||||||
|
{
|
||||||
|
"BitRate": 13200,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GSM-HR": [
|
||||||
|
{
|
||||||
|
"BitRate": 5600,
|
||||||
|
"PacketizationPeriod": "10-30",
|
||||||
|
"SilenceSuppression": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ define KernelPackage/$(PKG_NAME)
|
|||||||
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
|
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
|
||||||
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
|
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
|
||||||
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
|
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
|
||||||
DEPENDS:= +(TARGET_iopsys_brcm63xx_arm):bcmkernel
|
DEPENDS:= +(TARGET_brcmbca):bcmkernel
|
||||||
PKG_LICENSE:=GPLv2
|
PKG_LICENSE:=GPLv2
|
||||||
PKG_LICENSE_URL:=
|
PKG_LICENSE_URL:=
|
||||||
endef
|
endef
|
||||||
@@ -42,7 +42,7 @@ EXTRA_KCONFIG:= CONFIG_RGB_LED=m
|
|||||||
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
|
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||||
LINUX_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.19
|
LINUX_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.19
|
||||||
# This assumes that the MODULES_SUBDIR set by OpenWrt is of the form
|
# This assumes that the MODULES_SUBDIR set by OpenWrt is of the form
|
||||||
# lib/modules/4.19.235-abcdef where 4.19.235 is the version of our fake bcmlinux kernel
|
# lib/modules/4.19.235-abcdef where 4.19.235 is the version of our fake bcmlinux kernel
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=icwmp
|
PKG_NAME:=icwmp
|
||||||
PKG_VERSION:=9.0.3
|
PKG_VERSION:=9.1.6
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||||
PKG_SOURCE_VERSION:=304db5eb064d89cf4e4df0bb81fa22b88933d602
|
PKG_SOURCE_VERSION:=79284d1f4e16cf6077a7394f0c04a894b83a8a41
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ define Package/icwmp/default
|
|||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
SUBMENU:=TRx69
|
SUBMENU:=TRx69
|
||||||
TITLE:=TR069 CWMP client
|
TITLE:=TR069 CWMP client
|
||||||
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml
|
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml +libuuid
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/icwmp-openssl
|
define Package/icwmp-openssl
|
||||||
@@ -83,6 +83,7 @@ define Package/icwmp/default/install
|
|||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json/
|
$(INSTALL_DIR) $(1)/etc/bbfdm/json/
|
||||||
|
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
|
||||||
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
|
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
|
||||||
$(INSTALL_BIN) ./files/etc/firewall.cwmp $(1)/etc/firewall.cwmp
|
$(INSTALL_BIN) ./files/etc/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||||
@@ -92,6 +93,8 @@ define Package/icwmp/default/install
|
|||||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
|
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
|
||||||
$(INSTALL_BIN) ./files/etc/icwmpd/update.sh $(1)/etc/icwmpd/update.sh
|
$(INSTALL_BIN) ./files/etc/icwmpd/update.sh $(1)/etc/icwmpd/update.sh
|
||||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1)/etc/bbfdm/json/
|
$(INSTALL_DATA) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1)/etc/bbfdm/json/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
|
||||||
endef
|
endef
|
||||||
|
|
||||||
Package/icwmp-openssl/install = $(Package/icwmp/default/install)
|
Package/icwmp-openssl/install = $(Package/icwmp/default/install)
|
||||||
|
|||||||
@@ -14,15 +14,18 @@ handle_icwmp_update() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status="$(ubus call tr069 status |jsonfilter -qe '@.last_session.status')"
|
ret=$(ubus call service list '{"name":"icwmpd"}' | jsonfilter -qe '@.icwmpd.instances.icwmp.running')
|
||||||
if [ "$status" != "running" ]; then
|
|
||||||
log "Trigger out of bound inform, since last inform status was failure"
|
if [ "$ret" == "true" ]; then
|
||||||
ubus -t 10 call tr069 inform >/dev/null 2>&1
|
# read status from var/state/cwmp
|
||||||
# Handle timeout or tr069 object not found
|
status=$(uci -q -c /var/state get cwmp.sess_status.current_status)
|
||||||
if [ "$?" -eq 7 ] || [ "$?" -eq 4 ]; then
|
if [ "$status" != "running" ]; then
|
||||||
log "Restarting icwmp tr069 object"
|
log "Trigger out of bound inform, since last inform status was failure"
|
||||||
/etc/init.d/icwmpd restart
|
ubus -t 10 call tr069 inform >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
log "Restarting icwmp tr069 object"
|
||||||
|
/etc/init.d/icwmpd restart
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ convert_to_hex() {
|
|||||||
OPTIND=1
|
OPTIND=1
|
||||||
while getopts ":" opt "-$optval"
|
while getopts ":" opt "-$optval"
|
||||||
do
|
do
|
||||||
temp=$(printf "%X" "'${OPTARG:-:}")
|
temp=$(printf "%02X" "'${OPTARG:-:}")
|
||||||
val="${val}:${temp}"
|
val="${val}:${temp}"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -133,14 +133,14 @@ configure_send_op125() {
|
|||||||
opt125_len=$((opt125_len + 4))
|
opt125_len=$((opt125_len + 4))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hex_opt125_len=$(printf "%X" "${opt125_len}")
|
hex_opt125_len=$(printf "%02X" "${opt125_len}")
|
||||||
opt125="${opt125}:${hex_opt125_len}"
|
opt125="${opt125}:${hex_opt125_len}"
|
||||||
hex_oui=$(convert_to_hex "${oui}")
|
hex_oui=$(convert_to_hex "${oui}")
|
||||||
if [ -z "${hex_oui}" ]; then
|
if [ -z "${hex_oui}" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hex_oui_len=$(printf "%X" "${oui_len}")
|
hex_oui_len=$(printf "%02X" "${oui_len}")
|
||||||
if [ "${uci}" = "network" ]; then
|
if [ "${uci}" = "network" ]; then
|
||||||
opt125="${opt125}:01:${hex_oui_len}${hex_oui}"
|
opt125="${opt125}:01:${hex_oui_len}${hex_oui}"
|
||||||
else
|
else
|
||||||
@@ -152,7 +152,7 @@ configure_send_op125() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hex_serial_len=$(printf "%X" "${serial_len}")
|
hex_serial_len=$(printf "%02X" "${serial_len}")
|
||||||
if [ "${uci}" = "network" ]; then
|
if [ "${uci}" = "network" ]; then
|
||||||
opt125="${opt125}:02:${hex_serial_len}${hex_serial}"
|
opt125="${opt125}:02:${hex_serial_len}${hex_serial}"
|
||||||
else
|
else
|
||||||
@@ -165,7 +165,7 @@ configure_send_op125() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hex_class_len=$(printf "%X" "${class_len}")
|
hex_class_len=$(printf "%02X" "${class_len}")
|
||||||
if [ "${uci}" = "network" ]; then
|
if [ "${uci}" = "network" ]; then
|
||||||
opt125="${opt125}:03:${hex_class_len}${hex_class}"
|
opt125="${opt125}:03:${hex_class_len}${hex_class}"
|
||||||
else
|
else
|
||||||
@@ -205,6 +205,16 @@ enable_dnsmasq_option125() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_vendor_id() {
|
||||||
|
local wan="${1}"
|
||||||
|
local proto="$(uci -q get network.$wan.proto)"
|
||||||
|
|
||||||
|
if [ "${proto}" == "dhcp" ]; then
|
||||||
|
uci -q set network.$wan.vendorid="dslforum.org"
|
||||||
|
ubus call uci commit '{"config":"network"}'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
enable_disable_dhcp_option125() {
|
enable_disable_dhcp_option125() {
|
||||||
local wan="${1}"
|
local wan="${1}"
|
||||||
local action="${2}"
|
local action="${2}"
|
||||||
@@ -240,7 +250,7 @@ enable_disable_dhcp_option125() {
|
|||||||
uci -q set network.$wan.reqopts="$newreqopts"
|
uci -q set network.$wan.reqopts="$newreqopts"
|
||||||
network_uci_update=1
|
network_uci_update=1
|
||||||
fi
|
fi
|
||||||
|
.
|
||||||
if [ ${send125_present} -eq 0 ]; then
|
if [ ${send125_present} -eq 0 ]; then
|
||||||
configure_send_op125 "${sendopts}" "${wan}" "network"
|
configure_send_op125 "${sendopts}" "${wan}" "network"
|
||||||
network_uci_update=1
|
network_uci_update=1
|
||||||
@@ -290,8 +300,9 @@ copy_cwmp_etc_files_to_varstate() {
|
|||||||
|
|
||||||
if [ -f /etc/icwmpd/cwmp ]; then
|
if [ -f /etc/icwmpd/cwmp ]; then
|
||||||
uci -q -c /etc/icwmpd delete cwmp.acs
|
uci -q -c /etc/icwmpd delete cwmp.acs
|
||||||
|
uci -q -c /etc/icwmpd delete cwmp.gatewayinfo
|
||||||
uci -q -c /etc/icwmpd commit cwmp
|
uci -q -c /etc/icwmpd commit cwmp
|
||||||
cp -f /etc/icwmpd/cwmp /var/state/cwmp
|
cat /etc/icwmpd/cwmp >> /var/state/cwmp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/icwmpd/icwmpd_backup_session.xml ]; then
|
if [ -f /etc/icwmpd/icwmpd_backup_session.xml ]; then
|
||||||
@@ -313,6 +324,8 @@ copy_cwmp_varstate_files_to_etc() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /var/state/cwmp ]; then
|
if [ -f /var/state/cwmp ]; then
|
||||||
|
uci -q -c /var/state delete cwmp.sess_status
|
||||||
|
uci -q -c /var/state commit cwmp
|
||||||
cp -f /var/state/cwmp /etc/icwmpd/
|
cp -f /var/state/cwmp /etc/icwmpd/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -392,15 +405,23 @@ validate_defaults() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boot() {
|
boot() {
|
||||||
|
local enable_cwmp="0"
|
||||||
local dhcp_discovery="0"
|
local dhcp_discovery="0"
|
||||||
|
|
||||||
config_load cwmp
|
config_load cwmp
|
||||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
config_get_bool enable_cwmp cpe enable 1
|
||||||
|
if [ "$enable_cwmp" = "0" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||||
config_get wan_interface cpe default_wan_interface "wan"
|
config_get wan_interface cpe default_wan_interface "wan"
|
||||||
|
|
||||||
if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then
|
if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then
|
||||||
# Set dhcp option 43 if not already configured
|
# Set dhcp option 43 if not already configured
|
||||||
enable_dhcp_option43 "${wan_interface}"
|
enable_dhcp_option43 "${wan_interface}"
|
||||||
|
# Set dhcp option 60
|
||||||
|
set_vendor_id "${wan_interface}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_get lan_interface cpe default_lan_interface ""
|
config_get lan_interface cpe default_lan_interface ""
|
||||||
@@ -419,6 +440,9 @@ boot() {
|
|||||||
regenerate_ssl_link "${ssl_capath}"
|
regenerate_ssl_link "${ssl_capath}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Copy backup data so that if it restart latter on, it gets the info
|
||||||
|
copy_cwmp_etc_files_to_varstate
|
||||||
|
|
||||||
start
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,9 +465,6 @@ start_service() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copy backup data so that if it restart latter on it gets the info
|
|
||||||
copy_cwmp_etc_files_to_varstate
|
|
||||||
|
|
||||||
procd_open_instance icwmp
|
procd_open_instance icwmp
|
||||||
procd_set_param command "$PROG"
|
procd_set_param command "$PROG"
|
||||||
procd_append_param command -b
|
procd_append_param command -b
|
||||||
@@ -460,6 +481,11 @@ service_stopped()
|
|||||||
copy_cwmp_varstate_files_to_etc
|
copy_cwmp_varstate_files_to_etc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop_service()
|
||||||
|
{
|
||||||
|
copy_cwmp_varstate_files_to_etc
|
||||||
|
}
|
||||||
|
|
||||||
reload_service() {
|
reload_service() {
|
||||||
local ret
|
local ret
|
||||||
|
|
||||||
@@ -473,7 +499,14 @@ reload_service() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status="$(ubus -t 1 call tr069 status |jsonfilter -qe '@.cwmp.status')"
|
tr069_status="$(ubus -t 1 call tr069 status)"
|
||||||
|
ret="$?"
|
||||||
|
if [ "$ret" = "7" ]; then
|
||||||
|
# ubus timed out may be due to uloop is busy in some task so returning
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
status="$(echo $tr069_status | jsonfilter -qe '@.cwmp.status')"
|
||||||
ret="$?"
|
ret="$?"
|
||||||
if [ "$status" = "up" ]; then
|
if [ "$status" = "up" ]; then
|
||||||
ubus -t 1 call tr069 command '{"command":"reload"}'
|
ubus -t 1 call tr069 command '{"command":"reload"}'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
if (PACKAGE_ieee1905)
|
if (PACKAGE_ieee1905)
|
||||||
|
|
||||||
menu "Configurations"
|
menu "Configuration"
|
||||||
|
|
||||||
config IEEE1905_EXTENSION_ALLOWED
|
config IEEE1905_EXTENSION_ALLOWED
|
||||||
bool "Allow plugins to extend 1905 CMDUs and/or TLVs"
|
bool "Allow plugins to extend 1905 CMDUs and/or TLVs"
|
||||||
@@ -10,5 +10,18 @@ config IEEE1905_PLATFORM_HAS_WIFI
|
|||||||
bool "Platform has WiFi"
|
bool "Platform has WiFi"
|
||||||
default y if PACKAGE_libwifi
|
default y if PACKAGE_libwifi
|
||||||
|
|
||||||
|
config IEEE1905_CMDU_SA_IS_ALMAC
|
||||||
|
bool "Send CMDUs with SA set to 1905 AL-macaddress instead of interface macaddress"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config IEEE1905_WIFI_EASYMESH
|
||||||
|
bool "Include WiFi-Alliance's Easymesh updates"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config IEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY
|
||||||
|
bool "Fragment large CMDU frame at TLV boundary instead of octet boundary"
|
||||||
|
default y
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
if (PACKAGE_map-plugin)
|
|
||||||
|
|
||||||
menu "Configurations"
|
|
||||||
|
|
||||||
config MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG
|
|
||||||
bool "Sync configuration between dynamic controllers in the network"
|
|
||||||
default n
|
|
||||||
|
|
||||||
config MULTIAP_FUZZ_1905_CMDUS
|
|
||||||
bool "Include support to fuzz 1905 CMDUs for testing purpose"
|
|
||||||
default n
|
|
||||||
|
|
||||||
endmenu
|
|
||||||
endif
|
|
||||||
@@ -5,12 +5,12 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ieee1905
|
PKG_NAME:=ieee1905
|
||||||
PKG_VERSION:=4.10.7
|
PKG_VERSION:=7.0.2
|
||||||
|
|
||||||
LOCAL_DEV=0
|
LOCAL_DEV=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_VERSION:=b50f79061a95840d89a6129aa0a95aff82b5a1b7
|
PKG_SOURCE_VERSION:=47c04c502edf441fef9f14307be5f07541614049
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
@@ -35,31 +35,21 @@ define Package/ieee1905/config
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libieee1905
|
define Package/libieee1905
|
||||||
$(call Package/ieee1905/Default,$(1))
|
$(call Package/ieee1905/Default)
|
||||||
TITLE+= (library for CMDU and TLV handling)
|
TITLE:=libieee1905.so (library for CMDU and TLV handling)
|
||||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||||
+libjson-c +libblobmsg-json
|
+libjson-c +libblobmsg-json
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/ieee1905
|
define Package/ieee1905
|
||||||
$(call Package/ieee1905/Default,$(1))
|
$(call Package/ieee1905/Default)
|
||||||
TITLE+= ieee1905d (daemon implementing 1905.1 and provides cli)
|
TITLE:=ieee1905d (daemon implementing 1905.1 and provides cli)
|
||||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||||
+libjson-c +libblobmsg-json +ubus +libpthread \
|
+libjson-c +libblobmsg-json +ubus +libpthread \
|
||||||
+libieee1905 +IEEE1905_PLATFORM_HAS_WIFI:libwifi
|
+libieee1905 +IEEE1905_PLATFORM_HAS_WIFI:libwifi
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
include $(wildcard plugins/*.mk)
|
||||||
define Package/map-plugin
|
|
||||||
$(call Package/ieee1905/Default,$(1))
|
|
||||||
TITLE:=Multi-AP (Easymesh) plugin
|
|
||||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
|
||||||
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/map-plugin/config
|
|
||||||
source "$(SOURCE)/Config.map-plugin.in"
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/ieee1905/description
|
define Package/ieee1905/description
|
||||||
This package provides IEEE Std 1905.1 stack.
|
This package provides IEEE Std 1905.1 stack.
|
||||||
@@ -69,8 +59,16 @@ define Package/libieee1905/description
|
|||||||
This package provides library functions for IEEE Std 1905.1 stack.
|
This package provides library functions for IEEE Std 1905.1 stack.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
plugins := \
|
||||||
|
$(if $(CONFIG_PACKAGE_map-plugin),map) \
|
||||||
|
$(if $(CONFIG_PACKAGE_snoop-plugin),snoop) \
|
||||||
|
$(if $(CONFIG_PACKAGE_topology-plugin),topology)
|
||||||
|
|
||||||
|
|
||||||
|
ppkg:=$(patsubst plugins/%.mk,%-plugin,$(wildcard plugins/*.mk))
|
||||||
|
|
||||||
|
|
||||||
TARGET_CFLAGS += \
|
TARGET_CFLAGS += \
|
||||||
-Wno-error=deprecated-declarations \
|
|
||||||
-I$(STAGING_DIR)/usr/include \
|
-I$(STAGING_DIR)/usr/include \
|
||||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||||
-D_GNU_SOURCE
|
-D_GNU_SOURCE
|
||||||
@@ -79,10 +77,20 @@ ifeq ($(CONFIG_IEEE1905_PLATFORM_HAS_WIFI),y)
|
|||||||
TARGET_CFLAGS += -DHAS_WIFI
|
TARGET_CFLAGS += -DHAS_WIFI
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG),y)
|
ifeq ($(CONFIG_IEEE1905_CMDU_SA_IS_ALMAC),y)
|
||||||
TARGET_CFLAGS += -DDYNAMIC_CNTLR_SYNC_CONFIG
|
TARGET_CFLAGS += -DCMDU_SA_IS_ALMAC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_IEEE1905_WIFI_EASYMESH),y)
|
||||||
|
TARGET_CFLAGS += -DWIFI_EASYMESH
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_IEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY),y)
|
||||||
|
TARGET_CFLAGS += -DIEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY
|
||||||
|
endif
|
||||||
|
|
||||||
|
MAKE_FLAGS += \
|
||||||
|
extmod_subdirs="$(patsubst %,extensions/%,$(plugins))"
|
||||||
|
|
||||||
MAKE_PATH:=src
|
MAKE_PATH:=src
|
||||||
|
|
||||||
@@ -101,25 +109,6 @@ define Package/libieee1905/install
|
|||||||
$(CP) $(PKG_BUILD_DIR)/src/libmidgen.so $(1)/usr/lib/
|
$(CP) $(PKG_BUILD_DIR)/src/libmidgen.so $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/map-plugin/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
|
||||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
|
||||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/InstallDev/map-plugin
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(INSTALL_DIR) $(1)/usr/include
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
|
||||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map2.h $(1)/usr/include/map2.h
|
|
||||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map_module.h $(1)/usr/include/map_module.h
|
|
||||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/cntlrsync.h $(1)/usr/include/cntlrsync.h
|
|
||||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
|
|
||||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
|
||||||
endef
|
|
||||||
|
|
||||||
|
|
||||||
define Build/InstallDev/libieee1905
|
define Build/InstallDev/libieee1905
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(INSTALL_DIR) $(1)/usr/include
|
$(INSTALL_DIR) $(1)/usr/include
|
||||||
@@ -137,7 +126,7 @@ endef
|
|||||||
|
|
||||||
define Build/InstallDev
|
define Build/InstallDev
|
||||||
$(call Build/InstallDev/libieee1905,$(1),$(2))
|
$(call Build/InstallDev/libieee1905,$(1),$(2))
|
||||||
$(call Build/InstallDev/map-plugin,$(1),$(2))
|
$(foreach p,$(ppkg),$(call Build/InstallDev/$(p),$(1),$(2)))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ifeq ($(LOCAL_DEV),1)
|
ifeq ($(LOCAL_DEV),1)
|
||||||
@@ -148,4 +137,4 @@ endif
|
|||||||
|
|
||||||
$(eval $(call BuildPackage,ieee1905))
|
$(eval $(call BuildPackage,ieee1905))
|
||||||
$(eval $(call BuildPackage,libieee1905))
|
$(eval $(call BuildPackage,libieee1905))
|
||||||
$(eval $(call BuildPackage,map-plugin))
|
$(eval $(foreach p,$(ppkg),$(call BuildPackage,$(p))))
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ validate_ap_section() {
|
|||||||
uci_validate_section ieee1905 $section "${1}" \
|
uci_validate_section ieee1905 $section "${1}" \
|
||||||
'band:or("2", "5", "60", "6")' \
|
'band:or("2", "5", "60", "6")' \
|
||||||
'ssid:string' \
|
'ssid:string' \
|
||||||
'encryption:or("psk2", "sae-mixed", "sae", string)' \
|
'encryption:or("psk2", "sae-mixed", "sae",
|
||||||
|
"psk", "psk-mixed", "none", string)' \
|
||||||
'key:string' \
|
'key:string' \
|
||||||
'uuid:string' \
|
'uuid:string' \
|
||||||
'manufacturer:string' \
|
'manufacturer:string' \
|
||||||
@@ -82,8 +83,10 @@ start_service() {
|
|||||||
validate_ieee1905_config || return 1;
|
validate_ieee1905_config || return 1;
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
procd_set_param command "/usr/sbin/ieee1905d"
|
procd_set_param command "/usr/sbin/ieee1905d" "-o" "/tmp/ieee1905.log" "-f"
|
||||||
procd_set_param respawn
|
procd_set_param respawn
|
||||||
|
procd_set_param limits core="unlimited"
|
||||||
|
# procd_set_param env IEEE1905_LOG_CMDU=1
|
||||||
# procd_set_param stdout 1
|
# procd_set_param stdout 1
|
||||||
# procd_set_param stderr 1
|
# procd_set_param stderr 1
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
|
|||||||
18
ieee1905/files/etc/uci-defaults/31-ifname-option-to-list
Normal file
18
ieee1905/files/etc/uci-defaults/31-ifname-option-to-list
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
config_load ieee1905
|
||||||
|
|
||||||
|
ifname_to_list() {
|
||||||
|
local section=$1
|
||||||
|
|
||||||
|
config_get ifname $section ifname # get list or option as space separated values
|
||||||
|
ifname=${ifname//,/\ } # convert csv with space separation
|
||||||
|
uci del ieee1905.${section}.ifname # delete entry
|
||||||
|
for i in ${ifname}; do
|
||||||
|
uci add_list ieee1905.${section}.ifname="$i" # writeback entry as list
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
config_foreach ifname_to_list al-iface
|
||||||
51
ieee1905/plugins/map.mk
Normal file
51
ieee1905/plugins/map.mk
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
define Package/map-plugin
|
||||||
|
$(call Package/ieee1905/Default)
|
||||||
|
TITLE:=Multi-AP plugin supporting WiFi-Alliance Easymesh standard
|
||||||
|
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||||
|
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/map-plugin/config
|
||||||
|
if (PACKAGE_map-plugin)
|
||||||
|
|
||||||
|
menu "Configuration"
|
||||||
|
|
||||||
|
config MULTIAP_EASYMESH_VERSION
|
||||||
|
int "Easymesh version"
|
||||||
|
default 2
|
||||||
|
|
||||||
|
config MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG
|
||||||
|
bool "Sync configuration between dynamic controllers in the network"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config MULTIAP_FUZZ_1905_CMDUS
|
||||||
|
bool "Include support to fuzz 1905 CMDUs for testing purpose"
|
||||||
|
default n
|
||||||
|
|
||||||
|
endmenu
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
|
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_MULTIAP_EASYMESH_VERSION)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG),y)
|
||||||
|
TARGET_CFLAGS += -DDYNAMIC_CNTLR_SYNC_CONFIG
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Build/InstallDev/map-plugin
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(INSTALL_DIR) $(1)/usr/include
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/easymesh.h $(1)/usr/include/easymesh.h
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map_module.h $(1)/usr/include/map_module.h
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/cntlrsync.h $(1)/usr/include/cntlrsync.h
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/map-plugin/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
|
||||||
|
endef
|
||||||
12
ieee1905/plugins/snoop.mk
Normal file
12
ieee1905/plugins/snoop.mk
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
define Package/snoop-plugin
|
||||||
|
$(call Package/ieee1905/Default)
|
||||||
|
TITLE:=Show all received 1905 CMDUs over UBUS
|
||||||
|
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||||
|
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/snoop-plugin/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/snoop/snoop.so $(1)/usr/lib/ieee1905/snoop.so
|
||||||
|
endef
|
||||||
12
ieee1905/plugins/topology.mk
Normal file
12
ieee1905/plugins/topology.mk
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
define Package/topology-plugin
|
||||||
|
$(call Package/ieee1905/Default)
|
||||||
|
TITLE:=Build full network topology of the 1905 nodes only
|
||||||
|
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||||
|
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/topology-plugin/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/extensions/topology/topology.so $(1)/usr/lib/ieee1905/topology.so
|
||||||
|
endef
|
||||||
24
iop/config
24
iop/config
@@ -18,8 +18,21 @@ CONFIG_TARGET_ROOTFS_TARGZ=y
|
|||||||
# /etc/banner and /etc/device_info #
|
# /etc/banner and /etc/device_info #
|
||||||
CONFIG_IMAGEOPT=y
|
CONFIG_IMAGEOPT=y
|
||||||
CONFIG_VERSIONOPT=y
|
CONFIG_VERSIONOPT=y
|
||||||
CONFIG_VERSION_MANUFACTURER="iopsysWrt"
|
CONFIG_VERSION_MANUFACTURER="IOPSYS"
|
||||||
CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/"
|
CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/"
|
||||||
|
CONFIG_VERSION_DIST="IOWRT"
|
||||||
|
|
||||||
|
# OpenWrt is given by CONFIG_VERSION_NUMBER which we do not want to override.
|
||||||
|
# disabling CONFIG_VERSION_FILENAMES will hide the OpenWrt version from the image filename
|
||||||
|
# CONFIG_VERSION_FILENAMES is not set
|
||||||
|
|
||||||
|
# CONFIG_VERSION_CODE is set to the IOWRT version instead by the genconfig-script and
|
||||||
|
# CONFIG_VERSION_CODE_FILENAMES will put it into the image filename.
|
||||||
|
CONFIG_VERSION_CODE_FILENAMES=y
|
||||||
|
|
||||||
|
CONFIG_VERSION_HOME_URL="https://iopsys.eu"
|
||||||
|
CONFIG_VERSION_BUG_URL="https://iopsys.eu"
|
||||||
|
CONFIG_VERSION_SUPPORT_URL="https://iopsys.eu"
|
||||||
|
|
||||||
# /lib/preinit #
|
# /lib/preinit #
|
||||||
CONFIG_PREINITOPT=y
|
CONFIG_PREINITOPT=y
|
||||||
@@ -43,9 +56,8 @@ CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/"
|
|||||||
|
|
||||||
# EasySoC HAL #
|
# EasySoC HAL #
|
||||||
CONFIG_PACKAGE_inbd=y
|
CONFIG_PACKAGE_inbd=y
|
||||||
CONFIG_PACKAGE_libwifi=y
|
CONFIG_PACKAGE_qosmngr=y
|
||||||
CONFIG_PACKAGE_peripheral_manager=y
|
CONFIG_PACKAGE_libwifiutils=y
|
||||||
CONFIG_PACKAGE_port-management=y
|
|
||||||
CONFIG_PACKAGE_wifimngr=y
|
CONFIG_PACKAGE_wifimngr=y
|
||||||
|
|
||||||
# Multi-AP #
|
# Multi-AP #
|
||||||
@@ -64,6 +76,7 @@ CONFIG_PACKAGE_urlfilter=y
|
|||||||
CONFIG_PACKAGE_imonitor=m
|
CONFIG_PACKAGE_imonitor=m
|
||||||
CONFIG_PACKAGE_questd=y
|
CONFIG_PACKAGE_questd=y
|
||||||
CONFIG_PACKAGE_rulengd=y
|
CONFIG_PACKAGE_rulengd=y
|
||||||
|
CONFIG_PACKAGE_usermngr=y
|
||||||
|
|
||||||
# TR-x69 #
|
# TR-x69 #
|
||||||
CONFIG_PACKAGE_uspd-mbedtls=y
|
CONFIG_PACKAGE_uspd-mbedtls=y
|
||||||
@@ -140,7 +153,8 @@ CONFIG_PACKAGE_ip-bridge=y
|
|||||||
CONFIG_PACKAGE_ip-full=y
|
CONFIG_PACKAGE_ip-full=y
|
||||||
CONFIG_PACKAGE_iperf3=y
|
CONFIG_PACKAGE_iperf3=y
|
||||||
CONFIG_PACKAGE_ipset=y
|
CONFIG_PACKAGE_ipset=y
|
||||||
CONFIG_PACKAGE_iptables-legacy=y
|
CONFIG_PACKAGE_ip6tables-zz-legacy=y
|
||||||
|
CONFIG_PACKAGE_iptables-zz-legacy=y
|
||||||
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
|
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
|
||||||
CONFIG_PACKAGE_iptables-mod-filter=y
|
CONFIG_PACKAGE_iptables-mod-filter=y
|
||||||
CONFIG_PACKAGE_iptables-mod-ipopt=y
|
CONFIG_PACKAGE_iptables-mod-ipopt=y
|
||||||
|
|||||||
@@ -13,12 +13,13 @@ function genconfig {
|
|||||||
export DEVELOPER=0
|
export DEVELOPER=0
|
||||||
target="bogus"
|
target="bogus"
|
||||||
target_config_path=""
|
target_config_path=""
|
||||||
brcm63xx_arm="target/linux/feeds/iopsys-brcm63xx-arm"
|
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||||
ramips="target/linux/feeds/iopsys-ramips"
|
ramips_feed="target/linux/feeds/iopsys-ramips"
|
||||||
econet="target/linux/feeds/iopsys-econet"
|
airoha_feed="target/linux/feeds/airoha"
|
||||||
x86="target/linux/feeds/iopsys-x86"
|
x86_feed="target/linux/feeds/iopsys-x86"
|
||||||
armvirt="target/linux/feeds/iopsys-armvirt"
|
armvirt_feed="target/linux/feeds/iopsys-armvirt"
|
||||||
mediatek="target/linux/feeds/iopsys-mediatek"
|
mediatek_feed="target/linux/feeds/iopsys-mediatek"
|
||||||
|
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||||
|
|
||||||
Red='\033[0;31m' # Red
|
Red='\033[0;31m' # Red
|
||||||
Color_Off='\033[0m' # Text Reset
|
Color_Off='\033[0m' # Text Reset
|
||||||
@@ -108,21 +109,23 @@ function genconfig {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -e $brcm63xx_arm/genconfig ] &&
|
[ -e $brcmbca_feed/genconfig ] &&
|
||||||
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
|
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||||
[ -e $ramips/genconfig ] &&
|
[ -e $ramips_feed/genconfig ] &&
|
||||||
iopsys_ramips=$(cd $ramips; ./genconfig)
|
iopsys_ramips=$(cd $ramips_feed; ./genconfig)
|
||||||
[ -e $econet/genconfig ] &&
|
[ -e $airoha_feed/genconfig ] &&
|
||||||
iopsys_econet=$(cd $econet; ./genconfig)
|
airoha=$(cd $airoha_feed; ./genconfig)
|
||||||
[ -e $x86/genconfig ] &&
|
[ -e $x86_feed/genconfig ] &&
|
||||||
iopsys_x86=$(cd $x86; ./genconfig)
|
iopsys_x86=$(cd $x86_feed; ./genconfig)
|
||||||
[ -e $armvirt/genconfig ] &&
|
[ -e $armvirt_feed/genconfig ] &&
|
||||||
iopsys_armvirt=$(cd $armvirt; ./genconfig)
|
iopsys_armvirt=$(cd $armvirt_feed; ./genconfig)
|
||||||
[ -e $mediatek/genconfig ] &&
|
[ -e $mediatek_feed/genconfig ] &&
|
||||||
iopsys_mediatek=$(cd $mediatek; ./genconfig)
|
iopsys_mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||||
|
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||||
|
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||||
|
|
||||||
if [ "$profile" == "LIST" ]; then
|
if [ "$profile" == "LIST" ]; then
|
||||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt iopsys_mediatek; do
|
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||||
echo "$list based boards:"
|
echo "$list based boards:"
|
||||||
for b in ${!list}; do
|
for b in ${!list}; do
|
||||||
echo -e "\t$b"
|
echo -e "\t$b"
|
||||||
@@ -131,10 +134,10 @@ function genconfig {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for p in $iopsys_brcm63xx_arm; do
|
for p in $brcmbca; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_brcm63xx_arm"
|
target="brcmbca"
|
||||||
target_config_path="$brcm63xx_arm/config"
|
target_config_path="$brcmbca_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -142,15 +145,15 @@ function genconfig {
|
|||||||
for p in $iopsys_ramips; do
|
for p in $iopsys_ramips; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_ramips"
|
target="iopsys_ramips"
|
||||||
target_config_path="$ramips/config"
|
target_config_path="$ramips_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for p in $iopsys_econet; do
|
for p in $airoha; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_econet"
|
target="airoha"
|
||||||
target_config_path="$econet/config"
|
target_config_path="$airoha_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -158,7 +161,7 @@ function genconfig {
|
|||||||
for p in $iopsys_x86; do
|
for p in $iopsys_x86; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_x86"
|
target="iopsys_x86"
|
||||||
target_config_path="$x86/config"
|
target_config_path="$x86_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -166,7 +169,7 @@ function genconfig {
|
|||||||
for p in $iopsys_armvirt; do
|
for p in $iopsys_armvirt; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_armvirt"
|
target="iopsys_armvirt"
|
||||||
target_config_path="$armvirt/config"
|
target_config_path="$armvirt_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -174,7 +177,15 @@ function genconfig {
|
|||||||
for p in $iopsys_mediatek; do
|
for p in $iopsys_mediatek; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_mediatek"
|
target="iopsys_mediatek"
|
||||||
target_config_path="$mediatek/config"
|
target_config_path="$mediatek_feed/config"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for p in $ipq95xx; do
|
||||||
|
if [ $p == $profile ]; then
|
||||||
|
target="ipq95xx"
|
||||||
|
target_config_path="$qualcomm_ipq95xx_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -265,11 +276,22 @@ function genconfig {
|
|||||||
setup_dirs()
|
setup_dirs()
|
||||||
{
|
{
|
||||||
git remote -v | grep -q http || {
|
git remote -v | grep -q http || {
|
||||||
|
CUSTBRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
if git ls-remote $CUSTREPO -q 2>/dev/null; then
|
if git ls-remote $CUSTREPO -q 2>/dev/null; then
|
||||||
if [ ! -d "$CUSTPATH" ]; then
|
if [ ! -d "$CUSTPATH" ]; then
|
||||||
git clone "$CUSTREPO" "$CUSTPATH"
|
echo "Cloning $CUSTBRANCH branch of $CUSTREPO"
|
||||||
|
git clone -b "$CUSTBRANCH" "$CUSTREPO" "$CUSTPATH" 2>/dev/null || {
|
||||||
|
DEFBRANCH="$(git remote show $CUSTREPO | grep 'HEAD branch' | cut -d' ' -f5)"
|
||||||
|
echo "$CUSTBRANCH branch is not found, cloning $DEFBRANCH branch of $CUSTREPO"
|
||||||
|
git clone "$CUSTREPO" "$CUSTPATH"
|
||||||
|
}
|
||||||
elif [ $IMPORT -eq 1 ]; then
|
elif [ $IMPORT -eq 1 ]; then
|
||||||
cd $CUSTPATH
|
cd $CUSTPATH
|
||||||
|
echo "Checking out $CUSTBRANCH branch in $CUSTPATH"
|
||||||
|
git checkout "$CUSTBRANCH" 2>/dev/null || {
|
||||||
|
DEFBRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | cut -d '/' -f4)"
|
||||||
|
echo "Checking out $CUSTBRANCH branch has failed, using $DEFBRANCH branch in $CUSTPATH"
|
||||||
|
}
|
||||||
v "git pull"
|
v "git pull"
|
||||||
git pull
|
git pull
|
||||||
cd - >/dev/null #go back
|
cd - >/dev/null #go back
|
||||||
@@ -329,9 +351,9 @@ function genconfig {
|
|||||||
echo "" >> .config
|
echo "" >> .config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Special handling for targets which use TARGET_DEVICES
|
# Special handling for targets which use TARGET_DEVICES
|
||||||
case "$target" in
|
case "$target" in
|
||||||
iopsys_ramips | iopsys_econet | iopsys_mediatek | iopsys_brcm63xx_arm)
|
iopsys_ramips | airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||||
# This assumes the device name to be unique within one target,
|
# This assumes the device name to be unique within one target,
|
||||||
# which is a fair assumption to make.
|
# which is a fair assumption to make.
|
||||||
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
||||||
@@ -377,12 +399,15 @@ function genconfig {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set target version
|
# Set target version
|
||||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
local git_version
|
||||||
local GIT_REV=$(git rev-parse --short HEAD)
|
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||||
local GIT_VER="$GIT_TAG"
|
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||||
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
|
return 1
|
||||||
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
|
fi
|
||||||
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
|
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||||
|
local version_lower="${version,,}"
|
||||||
|
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||||
|
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||||
|
|
||||||
# Enable Package source tree override if selected
|
# Enable Package source tree override if selected
|
||||||
|
|||||||
@@ -12,12 +12,13 @@ function genconfig_min {
|
|||||||
export DEVELOPER=0
|
export DEVELOPER=0
|
||||||
target="bogus"
|
target="bogus"
|
||||||
target_config_path=""
|
target_config_path=""
|
||||||
brcm63xx_arm="target/linux/feeds/iopsys-brcm63xx-arm"
|
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||||
ramips="target/linux/feeds/iopsys-ramips"
|
ramips_feed="target/linux/feeds/iopsys-ramips"
|
||||||
econet="target/linux/feeds/iopsys-econet"
|
airoha_feed="target/linux/feeds/airoha"
|
||||||
x86="target/linux/feeds/iopsys-x86"
|
x86_feed="target/linux/feeds/iopsys-x86"
|
||||||
armvirt="target/linux/feeds/iopsys-armvirt"
|
armvirt_feed="target/linux/feeds/iopsys-armvirt"
|
||||||
mediatek="target/linux/feeds/iopsys-mediatek"
|
mediatek_feed="target/linux/feeds/iopsys-mediatek"
|
||||||
|
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||||
|
|
||||||
Red='\033[0;31m' # Red
|
Red='\033[0;31m' # Red
|
||||||
Color_Off='\033[0m' # Text Reset
|
Color_Off='\033[0m' # Text Reset
|
||||||
@@ -107,21 +108,23 @@ function genconfig_min {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -e $brcm63xx_arm/genconfig ] &&
|
[ -e $brcmbca_feed/genconfig ] &&
|
||||||
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
|
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||||
[ -e $ramips/genconfig ] &&
|
[ -e $ramips_feed/genconfig ] &&
|
||||||
iopsys_ramips=$(cd $ramips; ./genconfig)
|
iopsys_ramips=$(cd $ramips_feed; ./genconfig)
|
||||||
[ -e $econet/genconfig ] &&
|
[ -e $airoha_feed/genconfig ] &&
|
||||||
iopsys_econet=$(cd $econet; ./genconfig)
|
airoha=$(cd $airoha_feed; ./genconfig)
|
||||||
[ -e $x86/genconfig ] &&
|
[ -e $x86_feed/genconfig ] &&
|
||||||
iopsys_x86=$(cd $x86; ./genconfig)
|
iopsys_x86=$(cd $x86_feed; ./genconfig)
|
||||||
[ -e $armvirt/genconfig ] &&
|
[ -e $armvirt_feed/genconfig ] &&
|
||||||
iopsys_armvirt=$(cd $armvirt; ./genconfig)
|
iopsys_armvirt=$(cd $armvirt_feed; ./genconfig)
|
||||||
[ -e $mediatek/genconfig ] &&
|
[ -e $mediatek_feed/genconfig ] &&
|
||||||
iopsys_mediatek=$(cd $mediatek; ./genconfig)
|
iopsys_mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||||
|
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||||
|
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||||
|
|
||||||
if [ "$profile" == "LIST" ]; then
|
if [ "$profile" == "LIST" ]; then
|
||||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt iopsys_mediatek; do
|
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||||
echo "$list based boards:"
|
echo "$list based boards:"
|
||||||
for b in ${!list}; do
|
for b in ${!list}; do
|
||||||
echo -e "\t$b"
|
echo -e "\t$b"
|
||||||
@@ -130,10 +133,10 @@ function genconfig_min {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for p in $iopsys_brcm63xx_arm; do
|
for p in $brcmbca; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_brcm63xx_arm"
|
target="brcmbca"
|
||||||
target_config_path="$brcm63xx_arm/config"
|
target_config_path="$brcmbca_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -141,15 +144,15 @@ function genconfig_min {
|
|||||||
for p in $iopsys_ramips; do
|
for p in $iopsys_ramips; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_ramips"
|
target="iopsys_ramips"
|
||||||
target_config_path="$ramips/config"
|
target_config_path="$ramips_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for p in $iopsys_econet; do
|
for p in $airoha; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_econet"
|
target="airoha"
|
||||||
target_config_path="$econet/config"
|
target_config_path="$airoha_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -157,7 +160,7 @@ function genconfig_min {
|
|||||||
for p in $iopsys_x86; do
|
for p in $iopsys_x86; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_x86"
|
target="iopsys_x86"
|
||||||
target_config_path="$x86/config"
|
target_config_path="$x86_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -165,7 +168,7 @@ function genconfig_min {
|
|||||||
for p in $iopsys_armvirt; do
|
for p in $iopsys_armvirt; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_armvirt"
|
target="iopsys_armvirt"
|
||||||
target_config_path="$armvirt/config"
|
target_config_path="$armvirt_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -173,7 +176,15 @@ function genconfig_min {
|
|||||||
for p in $iopsys_mediatek; do
|
for p in $iopsys_mediatek; do
|
||||||
if [ $p == $profile ]; then
|
if [ $p == $profile ]; then
|
||||||
target="iopsys_mediatek"
|
target="iopsys_mediatek"
|
||||||
target_config_path="$mediatek/config"
|
target_config_path="$mediatek_feed/config"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for p in $ipq95xx; do
|
||||||
|
if [ $p == $profile ]; then
|
||||||
|
target="ipq95xx"
|
||||||
|
target_config_path="$qualcomm_ipq95xx_feed/config"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -181,12 +192,6 @@ function genconfig_min {
|
|||||||
|
|
||||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||||
DEVELOPER=1
|
DEVELOPER=1
|
||||||
|
|
||||||
bcmAllowed=0
|
|
||||||
endptAllowed=0
|
|
||||||
|
|
||||||
git ls-remote git@dev.iopsys.eu:broadcom/bcmcreator.git -q 2>/dev/null && bcmAllowed=1
|
|
||||||
git ls-remote git@dev.iopsys.eu:iopsys/endptmngr.git -q 2>/dev/null && endptAllowed=1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
v() {
|
v() {
|
||||||
@@ -322,7 +327,7 @@ function genconfig_min {
|
|||||||
|
|
||||||
# Special handling for targets which use TARGET_DEVICES
|
# Special handling for targets which use TARGET_DEVICES
|
||||||
case "$target" in
|
case "$target" in
|
||||||
iopsys_ramips | iopsys_econet | iopsys_mediatek | iopsys_brcm63xx_arm)
|
iopsys_ramips | airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||||
# This assumes the device name to be unique within one target,
|
# This assumes the device name to be unique within one target,
|
||||||
# which is a fair assumption to make.
|
# which is a fair assumption to make.
|
||||||
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
||||||
@@ -368,12 +373,15 @@ function genconfig_min {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set target version
|
# Set target version
|
||||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
local git_version
|
||||||
local GIT_REV=$(git rev-parse --short HEAD)
|
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||||
local GIT_VER="$GIT_TAG"
|
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||||
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
|
return 1
|
||||||
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
|
fi
|
||||||
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
|
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||||
|
local version_lower="${version,,}"
|
||||||
|
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||||
|
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||||
|
|
||||||
# Enable Package source tree override if selected
|
# Enable Package source tree override if selected
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ function ssh_install_key {
|
|||||||
local keys="$(get_ssh_public_keys)"
|
local keys="$(get_ssh_public_keys)"
|
||||||
echo "Adding the following keys to $DROPBEAR_AUTHORIZED_KEYS_FILE on $host:"
|
echo "Adding the following keys to $DROPBEAR_AUTHORIZED_KEYS_FILE on $host:"
|
||||||
echo "$keys"
|
echo "$keys"
|
||||||
ssh root@$host "echo '$keys' >> '$DROPBEAR_AUTHORIZED_KEYS_FILE'" && echo ok
|
ssh \
|
||||||
|
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
||||||
|
root@$host \
|
||||||
|
"echo '$keys' >> '$DROPBEAR_AUTHORIZED_KEYS_FILE'" && echo ok
|
||||||
}
|
}
|
||||||
|
|
||||||
register_command "ssh_install_key" "Install the users public ssh key on host running dropbear"
|
register_command "ssh_install_key" "Install the users public ssh key on host running dropbear"
|
||||||
|
|||||||
@@ -274,9 +274,10 @@ function ssh_upgrade {
|
|||||||
pv "$upd_fw" |
|
pv "$upd_fw" |
|
||||||
ssh \
|
ssh \
|
||||||
-o ConnectTimeout=60 \
|
-o ConnectTimeout=60 \
|
||||||
|
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
||||||
root@"$upd_host" \
|
root@"$upd_host" \
|
||||||
sh -c "cat > '/tmp/$upd_fw_base' && (set -x && sysupgrade -v $extra_args /tmp/$upd_fw_base)" ||
|
sh -c "cat > '/tmp/$upd_fw_base' && (set -x && sysupgrade -v $extra_args /tmp/$upd_fw_base)" ||
|
||||||
echo "Sysupgrade failed" >&2 && return 1
|
echo "Sysupgrade failed" >&2 && return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
register_command "ssh_upgrade" "-h <host> -f <file> [opts] Install firmware on remote host with SSH"
|
register_command "ssh_upgrade" "-t <host> -f <file> [opts] Install firmware on remote host with SSH"
|
||||||
|
|||||||
61
libvoice-broadcom/Makefile
Normal file
61
libvoice-broadcom/Makefile
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2022 IOPSYS Software Solutions AB
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=libvoice-broadcom
|
||||||
|
PKG_VERSION:=0.1
|
||||||
|
PKG_LICENSE:=PROPRIETARY
|
||||||
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
||||||
|
LOCAL_SRC_DIR:=~/git/voip/$(PKG_NAME)
|
||||||
|
LOCAL_DEV=0
|
||||||
|
ifneq ($(LOCAL_DEV),1)
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||||
|
PKG_SOURCE_VERSION:=d066c9d5c14757ab38e9ecb265ba24f5b33cdbce
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
|
PKG_MIRROR_HASH:=skip
|
||||||
|
endif
|
||||||
|
|
||||||
|
# All config variable that are passed to the make invocation, directly or
|
||||||
|
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||||
|
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||||
|
|
||||||
|
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||||
|
|
||||||
|
export CONFIG_BRCM_SDK_VER_504040
|
||||||
|
export CONFIG_BCM_CHIP_ID
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
TARGET_CFLAGS += -Wall -Werror
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
TITLE:=IOPSYS libvoice for Broadcom
|
||||||
|
URL:=
|
||||||
|
DEPENDS:=
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/description
|
||||||
|
Libvoice is a library that provides a uniform set of APIs and data types with hardware abstract layer for DSP/SLIC from different vendors
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifeq ($(LOCAL_DEV),1)
|
||||||
|
define Build/Prepare
|
||||||
|
rsync -av --exclude=.* $(LOCAL_SRC_DIR)/* $(PKG_BUILD_DIR)/
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/install
|
||||||
|
# Although there is nothing needs to be installed, but the install section must NOT be empty. Otherwise the package will be skipped as below.
|
||||||
|
# WARNING: skipping libvoice-broadcom -- package has no install section
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||||
|
|
||||||
58
libvoice-d2/Makefile
Normal file
58
libvoice-d2/Makefile
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2022 IOPSYS Software Solutions AB
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=libvoice-d2
|
||||||
|
PKG_VERSION:=0.1
|
||||||
|
PKG_LICENSE:=PROPRIETARY
|
||||||
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
||||||
|
LOCAL_SRC_DIR:=~/git/voip/$(PKG_NAME)
|
||||||
|
LOCAL_DEV=0
|
||||||
|
ifneq ($(LOCAL_DEV),1)
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||||
|
PKG_SOURCE_VERSION:=45e7d35f97f258f5e13c3afa0542db724bf59828
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
|
PKG_MIRROR_HASH:=skip
|
||||||
|
endif
|
||||||
|
|
||||||
|
# All config variable that are passed to the make invocation, directly or
|
||||||
|
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||||
|
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||||
|
|
||||||
|
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
TARGET_CFLAGS += -Wall -Werror
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
TITLE:=IOPSYS libvoice for D2 which is software DSP
|
||||||
|
URL:=
|
||||||
|
DEPENDS:=
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/description
|
||||||
|
Libvoice is a library that provides a uniform set of APIs and data types with hardware abstract layer for DSP/SLIC from different vendors
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifeq ($(LOCAL_DEV),1)
|
||||||
|
define Build/Prepare
|
||||||
|
rsync -av --exclude=.* $(LOCAL_SRC_DIR)/* $(PKG_BUILD_DIR)/
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/install
|
||||||
|
# Although there is nothing needs to be installed, but the install section must NOT be empty. Otherwise the package will be skipped as below.
|
||||||
|
# WARNING: skipping libvoice-d2 -- package has no install section
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||||
|
|
||||||
@@ -13,6 +13,9 @@ config AGENT_ISLAND_PREVENTION
|
|||||||
config AGENT_EASYMESH_R2_CERT
|
config AGENT_EASYMESH_R2_CERT
|
||||||
bool "Compile for WFA test bed"
|
bool "Compile for WFA test bed"
|
||||||
|
|
||||||
|
config AGENT_EASYMESH_VERSION
|
||||||
|
int "Support Easymesh version"
|
||||||
|
default 2
|
||||||
|
|
||||||
config AGENT_EASYMESH_VENDOR_EXT
|
config AGENT_EASYMESH_VENDOR_EXT
|
||||||
bool "Enable extra features through Easymesh vendor extension"
|
bool "Enable extra features through Easymesh vendor extension"
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=map-agent
|
PKG_NAME:=map-agent
|
||||||
PKG_VERSION:=2.10.3.15
|
PKG_VERSION:=4.1.0.1
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||||
PKG_SOURCE_VERSION:=075fb9f89722979d4622cbc575f34f74f19c1a91
|
PKG_SOURCE_VERSION:=c708092f56110637f04d87d309dcbce8fd389b89
|
||||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||||
|
|
||||||
PKG_LICENSE:=BSD-3-Clause
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
@@ -28,7 +28,7 @@ define Package/map-agent
|
|||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
TITLE:=WiFi multi-AP Agent (EasyMesh R2)
|
TITLE:=WiFi multi-AP Agent (EasyMesh R2)
|
||||||
DEPENDS:=+libwifi +libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 \
|
DEPENDS:=+libwifi +libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 \
|
||||||
+map-plugin
|
+map-plugin +ip-bridge
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
@@ -59,6 +59,8 @@ TARGET_CFLAGS += \
|
|||||||
-Wno-error=deprecated-declarations \
|
-Wno-error=deprecated-declarations \
|
||||||
-D_GNU_SOURCE
|
-D_GNU_SOURCE
|
||||||
|
|
||||||
|
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_AGENT_EASYMESH_VERSION)
|
||||||
|
|
||||||
ifeq ($(CONFIG_AGENT_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
ifeq ($(CONFIG_AGENT_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
||||||
TARGET_CFLAGS += -DAGENT_SYNC_DYNAMIC_CNTLR_CONFIG
|
TARGET_CFLAGS += -DAGENT_SYNC_DYNAMIC_CNTLR_CONFIG
|
||||||
endif
|
endif
|
||||||
@@ -73,6 +75,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CONFIG_AGENT_EASYMESH_VENDOR_EXT),y)
|
ifeq ($(CONFIG_AGENT_EASYMESH_VENDOR_EXT),y)
|
||||||
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT_OUI=\\\"$(CONFIG_AGENT_EASYMESH_VENDOR_EXT_OUI)\\\"
|
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT_OUI=\\\"$(CONFIG_AGENT_EASYMESH_VENDOR_EXT_OUI)\\\"
|
||||||
|
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ config agent 'agent'
|
|||||||
option island_prevention '0'
|
option island_prevention '0'
|
||||||
option eth_onboards_wifi_bhs '0'
|
option eth_onboards_wifi_bhs '0'
|
||||||
# option controller_macaddr '0a:1b:2c:3d:4e:50'
|
# option controller_macaddr '0a:1b:2c:3d:4e:50'
|
||||||
|
option scan_on_boot_only '0'
|
||||||
|
|
||||||
config dynamic_backhaul
|
config dynamic_backhaul
|
||||||
option missing_bh_timer '60'
|
option missing_bh_timer '60'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
. /lib/network/utils.sh
|
. /lib/network/utils.sh
|
||||||
|
|
||||||
conn_ports_file="/tmp/map.connected.ports"
|
conn_ports_file="/tmp/map.connected.ports"
|
||||||
map_bh_file="/tmp/multiap.backhaul"
|
map_bh_file="/var/run/multiap/multiap.backhaul"
|
||||||
al_bridge="$(uci -q get mapagent.agent.al_bridge)"
|
al_bridge="$(uci -q get mapagent.agent.al_bridge)"
|
||||||
[ "${al_bridge:0:3}" = "br-" ] || exit 0
|
[ "${al_bridge:0:3}" = "br-" ] || exit 0
|
||||||
al_brnet="${al_bridge:3}"
|
al_brnet="${al_bridge:3}"
|
||||||
|
|||||||
@@ -10,56 +10,9 @@ IS_CFG_VALID=1
|
|||||||
MAP_DEV="map_dev"
|
MAP_DEV="map_dev"
|
||||||
MAP_IF="map"
|
MAP_IF="map"
|
||||||
|
|
||||||
create_map() {
|
|
||||||
ip link add lei type veth peer name lei_map 2>/dev/null
|
|
||||||
ip link add link lei name lei_lan type vlan id 1 2>/dev/null
|
|
||||||
|
|
||||||
uci -q set network.${MAP_DEV}=device
|
|
||||||
uci -q set network.${MAP_DEV}.name=br-map
|
|
||||||
uci -q set network.${MAP_DEV}.type=bridge
|
|
||||||
|
|
||||||
uci -q show network.${MAP_DEV}.ports | grep -q lei_map || {
|
|
||||||
uci -q add_list network.${MAP_DEV}.ports='lei_map'
|
|
||||||
}
|
|
||||||
|
|
||||||
uci -q set network.${MAP_IF}=interface
|
|
||||||
uci -q set network.${MAP_IF}.device=br-map
|
|
||||||
uci -q set network.${MAP_IF}.is_lan=1
|
|
||||||
|
|
||||||
uci -q show network.br_lan.ports | grep -q lei_lan || {
|
|
||||||
uci -q add_list network.br_lan.ports="lei_lan"
|
|
||||||
}
|
|
||||||
|
|
||||||
uci -q set mapagent.agent.al_bridge=br-map
|
|
||||||
|
|
||||||
uci -q commit
|
|
||||||
|
|
||||||
ubus call network reload
|
|
||||||
ubus -t 5 wait_for network.interface.map
|
|
||||||
|
|
||||||
brctl addif br-map lei_map 2>/dev/null
|
|
||||||
brctl addif br-lan lei_lan 2>/dev/null
|
|
||||||
|
|
||||||
ip link set lei up 2>/dev/null
|
|
||||||
ip link set lei_map up 2>/dev/null
|
|
||||||
ip link set lei_lan up 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_map() {
|
|
||||||
ip link delete ${MAP_VETH} &>/dev/null
|
|
||||||
|
|
||||||
uci -q delete network.${MAP_DEV}
|
|
||||||
uci -q delete network.${MAP_IF}
|
|
||||||
|
|
||||||
uci -q set mapagent.agent.al_bridge=br-lan
|
|
||||||
|
|
||||||
uci -q commit
|
|
||||||
|
|
||||||
ubus call network reload
|
|
||||||
}
|
|
||||||
|
|
||||||
start_dynbhd_service() {
|
start_dynbhd_service() {
|
||||||
rm -f /tmp/multiap.backhaul
|
rm -f /var/run/multiap/multiap.backhaul
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
procd_set_param command "/usr/sbin/dynbhd"
|
procd_set_param command "/usr/sbin/dynbhd"
|
||||||
procd_set_param respawn
|
procd_set_param respawn
|
||||||
@@ -81,7 +34,8 @@ validate_agent_section() {
|
|||||||
'resend_num:uinteger:0' \
|
'resend_num:uinteger:0' \
|
||||||
'dyn_cntlr_sync:bool:true' \
|
'dyn_cntlr_sync:bool:true' \
|
||||||
'island_prevention:bool:false' \
|
'island_prevention:bool:false' \
|
||||||
'eth_onboards_wifi_bhs:bool:false'
|
'eth_onboards_wifi_bhs:bool:false' \
|
||||||
|
'scan_on_boot_only:bool:false'
|
||||||
|
|
||||||
|
|
||||||
[ "$?" -ne 0 ] && {
|
[ "$?" -ne 0 ] && {
|
||||||
@@ -138,7 +92,7 @@ validate_radio_section() {
|
|||||||
|
|
||||||
uci_validate_section mapagent $section "${1}" \
|
uci_validate_section mapagent $section "${1}" \
|
||||||
'device:string' \
|
'device:string' \
|
||||||
'band:or("2", "5")' \
|
'band:or("2", "5", "6")' \
|
||||||
'configured:bool:false' \
|
'configured:bool:false' \
|
||||||
'onboarded:bool:false' \
|
'onboarded:bool:false' \
|
||||||
'dedicated_backhaul:bool:false' \
|
'dedicated_backhaul:bool:false' \
|
||||||
@@ -150,7 +104,11 @@ validate_radio_section() {
|
|||||||
'include_sta_metric:bool:false' \
|
'include_sta_metric:bool:false' \
|
||||||
'rcpi_hysteresis_margin:range(0,255)' \
|
'rcpi_hysteresis_margin:range(0,255)' \
|
||||||
'report_util_threshold:range(0,255)' \
|
'report_util_threshold:range(0,255)' \
|
||||||
'encryption:or("sae", "psk2", "sae-mixed")'
|
'encryption:or("sae", "sae+aes", "psk2",
|
||||||
|
"psk2+aes", "sae-mixed", "sae-mixed+aes",
|
||||||
|
"none", "psk-mixed", "psk-mixed+aes",
|
||||||
|
"wpa", "wpa+aes", "wpa2", "wpa2+aes",
|
||||||
|
"psk", "psk+aes")' \
|
||||||
|
|
||||||
[ "$?" -ne 0 ] && {
|
[ "$?" -ne 0 ] && {
|
||||||
logger -s -t "mapagent" "Validation of radio section failed"
|
logger -s -t "mapagent" "Validation of radio section failed"
|
||||||
@@ -233,10 +191,6 @@ start_service() {
|
|||||||
config_get_bool enabled agent enabled 1
|
config_get_bool enabled agent enabled 1
|
||||||
[ "$enabled" -eq 0 ] && return 1
|
[ "$enabled" -eq 0 ] && return 1
|
||||||
|
|
||||||
local ts
|
|
||||||
config_get_bool ts agent vlan_segregation 0
|
|
||||||
[ "$ts" -eq 1 ] && create_map #|| remove_map
|
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
create_dir
|
create_dir
|
||||||
procd_set_param command "/usr/sbin/mapagent" "-d"
|
procd_set_param command "/usr/sbin/mapagent" "-d"
|
||||||
@@ -246,10 +200,6 @@ start_service() {
|
|||||||
procd_close_instance
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
#stop_service() {
|
|
||||||
# remove_map
|
|
||||||
#}
|
|
||||||
|
|
||||||
service_triggers()
|
service_triggers()
|
||||||
{
|
{
|
||||||
procd_add_reload_trigger "mapagent"
|
procd_add_reload_trigger "mapagent"
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ config CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
|||||||
string
|
string
|
||||||
default "\\\\x11\\\\x22\\\\x33"
|
default "\\\\x11\\\\x22\\\\x33"
|
||||||
|
|
||||||
|
config CONTROLLER_EASYMESH_VERSION
|
||||||
|
int "Support Easymesh version"
|
||||||
|
default 2
|
||||||
|
|
||||||
config CONTROLLER_EASYMESH_VENDOR_EXT_OUI
|
config CONTROLLER_EASYMESH_VENDOR_EXT_OUI
|
||||||
string "Vendor OUI in '\\\\xAB\\\\xCD\\\\xEF' format"
|
string "Vendor OUI in '\\\\xAB\\\\xCD\\\\xEF' format"
|
||||||
default CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
default CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=map-controller
|
PKG_NAME:=map-controller
|
||||||
PKG_VERSION:=2.11.0.4
|
PKG_VERSION:=4.1.0.2
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||||
PKG_SOURCE_VERSION:=a4a626539ede73c1c4eb1ad768331524a8ee9ce8
|
PKG_SOURCE_VERSION:=8b7bb003611247309b072350d7986e304b0d228b
|
||||||
|
|
||||||
LOCAL_DEV=0
|
LOCAL_DEV=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
@@ -26,7 +26,7 @@ define Package/map-controller
|
|||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
TITLE:=WiFi Multi-AP Controller (EasyMesh R2)
|
TITLE:=WiFi Multi-AP Controller (EasyMesh R2)
|
||||||
DEPENDS:=+libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 +map-plugin
|
DEPENDS:=+libuci +libubox +ubus +libeasy +libwifiutils +libieee1905 +ieee1905 +map-plugin
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/map-controller/description
|
define Package/map-controller/description
|
||||||
@@ -45,12 +45,15 @@ TARGET_CFLAGS += \
|
|||||||
|
|
||||||
MAKE_PATH:=src
|
MAKE_PATH:=src
|
||||||
|
|
||||||
|
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_CONTROLLER_EASYMESH_VERSION)
|
||||||
|
|
||||||
ifeq ($(CONFIG_CONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
ifeq ($(CONFIG_CONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
||||||
TARGET_CFLAGS += -DCONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG
|
TARGET_CFLAGS += -DCONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_CONTROLLER_EASYMESH_VENDOR_EXT),y)
|
ifeq ($(CONFIG_CONTROLLER_EASYMESH_VENDOR_EXT),y)
|
||||||
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT_OUI=\\\"$(CONFIG_CONTROLLER_EASYMESH_VENDOR_EXT_OUI)\\\"
|
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT_OUI=\\\"$(CONFIG_CONTROLLER_EASYMESH_VENDOR_EXT_OUI)\\\"
|
||||||
|
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define Package/map-controller/install
|
define Package/map-controller/install
|
||||||
@@ -58,6 +61,8 @@ define Package/map-controller/install
|
|||||||
$(CP) ./files/* $(1)/
|
$(CP) ./files/* $(1)/
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mapcontroller $(1)/usr/sbin/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mapcontroller $(1)/usr/sbin/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/mapcontroller
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/src/plugins/steer/rcpi/rcpi.so $(1)/usr/lib/mapcontroller/rcpi.so
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ifeq ($(LOCAL_DEV),1)
|
ifeq ($(LOCAL_DEV),1)
|
||||||
|
|||||||
@@ -2,15 +2,23 @@ config controller 'controller'
|
|||||||
option enabled '1'
|
option enabled '1'
|
||||||
option registrar '2 5'
|
option registrar '2 5'
|
||||||
option debug '0'
|
option debug '0'
|
||||||
option enable_sta_steer '0'
|
option bcn_metrics_max_num '10'
|
||||||
option enable_bsta_steer '0'
|
option initial_channel_scan '0'
|
||||||
option use_bcn_metrics '0'
|
|
||||||
option use_usta_metrics '0'
|
|
||||||
option primary_vid '0'
|
option primary_vid '0'
|
||||||
option primary_pcp '0'
|
option primary_pcp '0'
|
||||||
option allow_bgdfs '0'
|
option allow_bgdfs '0'
|
||||||
option channel_plan '0'
|
option channel_plan '0'
|
||||||
|
|
||||||
|
config sta_steering
|
||||||
|
option steer_module 'rcpi'
|
||||||
|
option enabled '1'
|
||||||
|
option enable_sta_steer '0'
|
||||||
|
option enable_bsta_steer '0'
|
||||||
|
option use_bcn_metrics '0'
|
||||||
|
option use_usta_metrics '0'
|
||||||
|
option bandsteer '0'
|
||||||
|
option diffsnr '8'
|
||||||
|
|
||||||
config ap
|
config ap
|
||||||
option band '2'
|
option band '2'
|
||||||
option encryption 'sae-mixed'
|
option encryption 'sae-mixed'
|
||||||
@@ -60,8 +68,8 @@ config ap
|
|||||||
# option report_sta_assocfails_rate '0'
|
# option report_sta_assocfails_rate '0'
|
||||||
# option report_metric_periodic '0'
|
# option report_metric_periodic '0'
|
||||||
# option report_scan '0'
|
# option report_scan '0'
|
||||||
# option steer_exclude '0'
|
# list steer_exclude 'e0:d4:e8:79:c4:ee'
|
||||||
# option steer_exclude_btm '0'
|
# list steer_exclude_btm 'e0:d4:e8:79:c4:11'
|
||||||
# option steer_disallow '0'
|
# option steer_disallow '0'
|
||||||
# option coordinated_cac '0'
|
# option coordinated_cac '0'
|
||||||
# option traffic_separation '0'
|
# option traffic_separation '0'
|
||||||
@@ -107,8 +115,8 @@ config ap
|
|||||||
# option report_sta_assocfails_rate '0'
|
# option report_sta_assocfails_rate '0'
|
||||||
# option report_metric_periodic '0'
|
# option report_metric_periodic '0'
|
||||||
# option report_scan '0'
|
# option report_scan '0'
|
||||||
# option steer_exclude '0'
|
# list steer_exclude 'e0:d4:e8:79:c4:ee'
|
||||||
# option steer_exclude_btm '0'
|
# list steer_exclude_btm 'e0:d4:e8:79:c4:11'
|
||||||
# option steer_disallow '0'
|
# option steer_disallow '0'
|
||||||
# option coordinated_cac '0'
|
# option coordinated_cac '0'
|
||||||
# option traffic_separation '0'
|
# option traffic_separation '0'
|
||||||
|
|||||||
@@ -19,11 +19,9 @@ validate_controller_section() {
|
|||||||
'enabled:bool:true' \
|
'enabled:bool:true' \
|
||||||
'registrar:string' \
|
'registrar:string' \
|
||||||
'debug:range(0,16)' \
|
'debug:range(0,16)' \
|
||||||
|
'bcn_metrics_max_num:range(1,256)' \
|
||||||
|
'initial_channel_scan:bool:true' \
|
||||||
'resend_num:uinteger:0' \
|
'resend_num:uinteger:0' \
|
||||||
'enable_sta_steer:bool:false' \
|
|
||||||
'enable_bsta_steer:bool:false' \
|
|
||||||
'use_bcn_metrics:bool:false' \
|
|
||||||
'use_usta_metrics:bool:false' \
|
|
||||||
'allow_bgdfs:range(0,2629744)' \
|
'allow_bgdfs:range(0,2629744)' \
|
||||||
'channel_plan:range(0,2629744)' \
|
'channel_plan:range(0,2629744)' \
|
||||||
'enable_ts:bool:false'
|
'enable_ts:bool:false'
|
||||||
@@ -36,6 +34,33 @@ validate_controller_section() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate_sta_steering_section() {
|
||||||
|
local section="$1"
|
||||||
|
|
||||||
|
uci_validate_section mapcontroller $section "${1}" \
|
||||||
|
'steer_module:string' \
|
||||||
|
'enabled:bool:true' \
|
||||||
|
'enable_sta_steer:bool:false' \
|
||||||
|
'enable_bsta_steer:bool:false' \
|
||||||
|
'use_bcn_metrics:bool:false' \
|
||||||
|
'use_usta_metrics:bool:false' \
|
||||||
|
'bandsteer:bool:false' \
|
||||||
|
'diffsnr:range(0,100)' \
|
||||||
|
'rcpi_threshold_2g:range(0,220)' \
|
||||||
|
'rcpi_threshold_5g:range(0,220)' \
|
||||||
|
'rcpi_threshold_6g:range(0,220)' \
|
||||||
|
'report_rcpi_threshold_2g:range(0,220)' \
|
||||||
|
'report_rcpi_threshold_5g:range(0,220)' \
|
||||||
|
'report_rcpi_threshold_6g:range(0,220)'
|
||||||
|
|
||||||
|
[ "$?" -ne 0 ] && {
|
||||||
|
logger -s -t "mapcontroller" "Validation of sta_steering section failed"
|
||||||
|
IS_CFG_VALID=0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
validate_ap_section() {
|
validate_ap_section() {
|
||||||
local section="$1"
|
local section="$1"
|
||||||
|
|
||||||
@@ -43,7 +68,10 @@ validate_ap_section() {
|
|||||||
'band:or("2", "5", "6")' \
|
'band:or("2", "5", "6")' \
|
||||||
'ssid:string' \
|
'ssid:string' \
|
||||||
'encryption:or("sae", "sae+aes", "psk2",
|
'encryption:or("sae", "sae+aes", "psk2",
|
||||||
"psk2+aes", "sae-mixed", "sae-mixed+aes")' \
|
"psk2+aes", "sae-mixed", "sae-mixed+aes",
|
||||||
|
"none", "psk-mixed", "psk-mixed+aes",
|
||||||
|
"wpa", "wpa+aes", "wpa2", "wpa2+aes",
|
||||||
|
"psk", "psk+aes")' \
|
||||||
'key:string' \
|
'key:string' \
|
||||||
'vid:range(1,65535):1' \
|
'vid:range(1,65535):1' \
|
||||||
'type:or("backhaul", "fronthaul", "combined")' \
|
'type:or("backhaul", "fronthaul", "combined")' \
|
||||||
@@ -93,7 +121,7 @@ validate_radio_section() {
|
|||||||
uci_validate_section mapcontroller $section "${1}" \
|
uci_validate_section mapcontroller $section "${1}" \
|
||||||
'agent_id:macaddr' \
|
'agent_id:macaddr' \
|
||||||
'macaddr:macaddr' \
|
'macaddr:macaddr' \
|
||||||
'band:or("2", "5")' \
|
'band:or("2", "5", "6")' \
|
||||||
'steer_policy:range(0,2)' \
|
'steer_policy:range(0,2)' \
|
||||||
'util_threshold:range(0,255)' \
|
'util_threshold:range(0,255)' \
|
||||||
'rcpi_threshold:range(0,255)' \
|
'rcpi_threshold:range(0,255)' \
|
||||||
@@ -116,6 +144,7 @@ validate_controller_config() {
|
|||||||
IS_CFG_VALID=1
|
IS_CFG_VALID=1
|
||||||
|
|
||||||
validate_controller_section &&
|
validate_controller_section &&
|
||||||
|
config_foreach validate_sta_steering_section sta_steering &&
|
||||||
config_foreach validate_ap_section ap &&
|
config_foreach validate_ap_section ap &&
|
||||||
config_foreach validate_node_section node &&
|
config_foreach validate_node_section node &&
|
||||||
config_foreach validate_radio_section radio
|
config_foreach validate_radio_section radio
|
||||||
@@ -170,7 +199,7 @@ reload_service() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pidof "mapcontroller" > /dev/null
|
pidof "/usr/sbin/mapcontroller" > /dev/null
|
||||||
if [[ $? -ne 0 ]] ; then
|
if [[ $? -ne 0 ]] ; then
|
||||||
start
|
start
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk
|
|||||||
include $(INCLUDE_DIR)/kernel.mk
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
PKG_NAME:=map-topology
|
PKG_NAME:=map-topology
|
||||||
PKG_VERSION:=2.5.1.4
|
PKG_VERSION:=2.5.1.15
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_VERSION:=488ce1ce576b57c9b3c4d7c034969bf65e66216f
|
PKG_SOURCE_VERSION:=14ff07452aec4ff6f2268ef7bea9ff417252b7be
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/map-topology.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/map-topology.git
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ config topology 'topology'
|
|||||||
option depth '8'
|
option depth '8'
|
||||||
option interval '60'
|
option interval '60'
|
||||||
option maxlog '32'
|
option maxlog '32'
|
||||||
|
option profile '2'
|
||||||
|
|||||||
126
map-topology/files/etc/firewall.hosts
Normal file
126
map-topology/files/etc/firewall.hosts
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
day=""
|
||||||
|
IP_RULE=""
|
||||||
|
|
||||||
|
process_ac_schedule() {
|
||||||
|
local acs_id="$1"
|
||||||
|
local is_enabled
|
||||||
|
local access_control
|
||||||
|
local start_time=""
|
||||||
|
local stop_time=""
|
||||||
|
local mac=""
|
||||||
|
|
||||||
|
handle_day_list() {
|
||||||
|
local value=$1
|
||||||
|
|
||||||
|
val=$(echo $value | cut -c 1-3)
|
||||||
|
if [ -z $day ]; then
|
||||||
|
day="$val"
|
||||||
|
else
|
||||||
|
day="$day,$val"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
config_list_foreach "$acs_id" "day" handle_day_list
|
||||||
|
config_get is_enabled "$acs_id" "enable" 1
|
||||||
|
config_get access_control "$acs_id" "dm_parent"
|
||||||
|
|
||||||
|
if [ "$is_enabled" == "0" ] || [ -z "$access_control" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
IP_RULE=""
|
||||||
|
|
||||||
|
mac=$(uci -q get hosts.$access_control.macaddr)
|
||||||
|
access_policy=$(uci -q get hosts.$access_control.access_policy)
|
||||||
|
|
||||||
|
config_get start_time "$acs_id" "start_time"
|
||||||
|
config_get duration "$acs_id" "duration"
|
||||||
|
|
||||||
|
if [ -z "$mac" ] && [ -z "$start_time" ] && [ -z "$duration" ] && [ -z "$day" ] && [ -z "$access_policy" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ -n "$mac" ]; then
|
||||||
|
IP_RULE="$IP_RULE -m mac --mac-source $mac"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# as per iptables manual default starttime is 00:00
|
||||||
|
# default stoptime is 23:59
|
||||||
|
if [ -z "$start_time" ]; then
|
||||||
|
start_time="0:0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$duration" ]; then
|
||||||
|
hh=$(echo $start_time | awk -F: '{ print $1 }')
|
||||||
|
mm=$(echo $start_time | awk -F: '{ print $2 }')
|
||||||
|
hh_s=`expr $hh \* 3600`
|
||||||
|
mm_s=`expr $mm \* 60`
|
||||||
|
ss=$(( hh_s + mm_s ))
|
||||||
|
|
||||||
|
stop_ss=$(( ss + duration ))
|
||||||
|
hh=$(( stop_ss / 3600 ))
|
||||||
|
if [ $hh -lt 24 ]; then
|
||||||
|
rem_ss=$(( stop_ss % 3600 ))
|
||||||
|
mm=$(( rem_ss / 60 ))
|
||||||
|
ss=$(( rem_ss % 60 ))
|
||||||
|
stop_time="$hh:$mm:$ss"
|
||||||
|
else
|
||||||
|
stop_time="23:59"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
stop_time="23:59"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# conversion to utc
|
||||||
|
zone=$(date +%z | cut -c 1)
|
||||||
|
utc_h=$(date -u -d @$(date "+%s" -d "$start_time") +%H)
|
||||||
|
local_h=$(echo $start_time | awk -F: '{ print $1 }')
|
||||||
|
if [ "$zone" == "+" ] && [ $utc_h -gt $local_h ]; then
|
||||||
|
start_utc="0:0"
|
||||||
|
else
|
||||||
|
start_utc=$(date -u -d @$(date "+%s" -d "$start_time") +%H:%M)
|
||||||
|
fi
|
||||||
|
|
||||||
|
utc_h=$(date -u -d @$(date "+%s" -d "$stop_time") +%H)
|
||||||
|
local_h=$(echo $stop_time | awk -F: '{ print $1 }')
|
||||||
|
if [ "$zone" == "-" ] && [ $utc_h -lt $local_h ]; then
|
||||||
|
stop_utc="23:59"
|
||||||
|
else
|
||||||
|
stop_utc=$(date -u -d @$(date "+%s" -d "$stop_time") +%H:%M)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
IP_RULE="$IP_RULE -m time --timestart $start_utc --timestop $stop_utc"
|
||||||
|
if [ -n "$day" ]; then
|
||||||
|
IP_RULE="$IP_RULE --weekdays $day"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$access_policy" == "Deny" ]; then
|
||||||
|
IP_RULE="$IP_RULE -j DROP"
|
||||||
|
else
|
||||||
|
IP_RULE="$IP_RULE -j ACCEPT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
iptables -w -A hosts_forward ${IP_RULE}
|
||||||
|
ip6tables -w -A hosts_forward ${IP_RULE}
|
||||||
|
|
||||||
|
day=""
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables -w -F hosts_forward
|
||||||
|
ip6tables -w -F hosts_forward
|
||||||
|
|
||||||
|
iptables -w -t filter -N hosts_forward
|
||||||
|
ret=$?
|
||||||
|
[ $ret -eq 0 ] && iptables -w -t filter -I FORWARD -j hosts_forward
|
||||||
|
ip6tables -w -t filter -N hosts_forward
|
||||||
|
ret=$?
|
||||||
|
[ $ret -eq 0 ] && ip6tables -w -t filter -I FORWARD -j hosts_forward
|
||||||
|
|
||||||
|
# Load /etc/config/hosts UCI file
|
||||||
|
config_load hosts
|
||||||
|
config_foreach process_ac_schedule ac_schedule
|
||||||
|
|
||||||
@@ -71,6 +71,10 @@ start_service() {
|
|||||||
config_load "hosts"
|
config_load "hosts"
|
||||||
validate_hosts_config || return 1;
|
validate_hosts_config || return 1;
|
||||||
|
|
||||||
|
if [ -f "/proc/sys/net/netfilter/nf_conntrack_timestamp" ]; then
|
||||||
|
echo 1 >/proc/sys/net/netfilter/nf_conntrack_timestamp
|
||||||
|
fi
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
procd_set_param command "/usr/sbin/topologyd"
|
procd_set_param command "/usr/sbin/topologyd"
|
||||||
procd_set_param respawn
|
procd_set_param respawn
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -f /etc/firewall.hosts ]; then
|
||||||
|
uci -q get firewall.hosts || {
|
||||||
|
uci -q set firewall.hosts=include
|
||||||
|
uci -q set firewall.hosts.path="/etc/firewall.hosts"
|
||||||
|
uci -q set firewall.hosts.reload=1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -20,7 +20,7 @@ config OBUSPA_MTP_ENABLE_STOMP
|
|||||||
|
|
||||||
config OBUSPA_MTP_ENABLE_COAP
|
config OBUSPA_MTP_ENABLE_COAP
|
||||||
bool "Enable CoAP as mtp protocol"
|
bool "Enable CoAP as mtp protocol"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config OBUSPA_CONTROLLER_MTP_VERIFY
|
config OBUSPA_CONTROLLER_MTP_VERIFY
|
||||||
bool "Enable verification of MQTT response topic before processing the message"
|
bool "Enable verification of MQTT response topic before processing the message"
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=obuspa
|
PKG_NAME:=obuspa
|
||||||
PKG_VERSION:=6.0.0.1
|
PKG_VERSION:=7.0.0.1
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/obuspa.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/obuspa.git
|
||||||
PKG_SOURCE_VERSION:=6372841ada18a4f577799fedb19f489ec1f28255
|
PKG_SOURCE_VERSION:=5d4bacd53a8ca27948108009bb48c2c6c9508c1d
|
||||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
@@ -91,6 +91,7 @@ endif
|
|||||||
ifeq ($(LOCAL_DEV),1)
|
ifeq ($(LOCAL_DEV),1)
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
|
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
|
||||||
|
$(Build/Patch)
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -109,6 +110,7 @@ define Package/obuspa/install
|
|||||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/USPAgent.json $(1)/etc/bbfdm/json/USPAgent.json
|
$(INSTALL_DATA) ./files/etc/bbfdm/json/USPAgent.json $(1)/etc/bbfdm/json/USPAgent.json
|
||||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/TransferComplete.json $(1)/etc/bbfdm/json/TransferComplete.json
|
$(INSTALL_DATA) ./files/etc/bbfdm/json/TransferComplete.json $(1)/etc/bbfdm/json/TransferComplete.json
|
||||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
|
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
|
||||||
|
$(INSTALL_BIN) ./files/etc/uci-defaults/50-add-mqtt-usp-test $(1)/etc/uci-defaults/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,obuspa))
|
$(eval $(call BuildPackage,obuspa))
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ config obuspa 'global'
|
|||||||
option enabled '1'
|
option enabled '1'
|
||||||
option debug '1'
|
option debug '1'
|
||||||
option log_level '1'
|
option log_level '1'
|
||||||
option prototrace '1'
|
option prototrace '0'
|
||||||
option db_file '/etc/obuspa/usp.db'
|
option db_file '/etc/obuspa/usp.db'
|
||||||
#option role_file '/etc/obuspa/roles.json'
|
#option role_file '/etc/obuspa/roles.json'
|
||||||
option dm_caching_exclude '/etc/obuspa/dmcaching_exclude.json'
|
option dm_caching_exclude '/etc/obuspa/dmcaching_exclude.json'
|
||||||
@@ -11,54 +11,22 @@ config obuspa 'global'
|
|||||||
#option log_dest '/var/log/obuspa'
|
#option log_dest '/var/log/obuspa'
|
||||||
|
|
||||||
# Adds Device.LocalAgent.MTP.
|
# Adds Device.LocalAgent.MTP.
|
||||||
config mtp 'agent_mtp'
|
config mtp 'test_mtp'
|
||||||
option Protocol 'MQTT'
|
option Protocol 'MQTT'
|
||||||
option ResponseTopicConfigured '/usp/endpoint'
|
option ResponseTopicConfigured '/usp/endpoint'
|
||||||
option mqtt 'localmqtt'
|
option mqtt 'testmqtt'
|
||||||
|
|
||||||
# Adds Device.MQTT.Client.
|
# Adds Device.MQTT.Client.
|
||||||
config mqtt 'localmqtt'
|
config mqtt 'testmqtt'
|
||||||
option BrokerAddress '127.0.0.1'
|
option BrokerAddress '127.0.0.1'
|
||||||
option BrokerPort '1883'
|
option BrokerPort '1883'
|
||||||
option TransportProtocol 'TCP/IP'
|
option TransportProtocol 'TCP/IP'
|
||||||
|
|
||||||
# Adds Device.LocalAgent.Controller.
|
# Adds Device.LocalAgent.Controller.
|
||||||
config controller 'localcontroller'
|
config controller 'testcontroller'
|
||||||
option EndpointID 'proto::interop-usp-controller'
|
option EndpointID 'proto::interop-usp-controller'
|
||||||
option Protocol 'MQTT'
|
option Protocol 'MQTT'
|
||||||
option Topic '/usp/controller'
|
option Topic '/usp/controller'
|
||||||
option mqtt 'localmqtt'
|
option mqtt 'testmqtt'
|
||||||
option assigned_role_name 'full_access'
|
option assigned_role_name 'full_access'
|
||||||
|
|
||||||
# Add Device.LocalAgent.Subscription.
|
|
||||||
#config subscription 'sub_event'
|
|
||||||
# option ID 'uci-sub-events'
|
|
||||||
# option NotifType 'Event'
|
|
||||||
# list ReferenceList 'Device.Boot!'
|
|
||||||
# list ReferenceList 'Device.LocalAgent.TransferComplete!'
|
|
||||||
# option Persistent 'true'
|
|
||||||
# option controller 'localcontroller'
|
|
||||||
|
|
||||||
#config subscription 'sub_op_comp'
|
|
||||||
# option ID 'uci-sub-op_complete'
|
|
||||||
# option NotifType 'OperationComplete'
|
|
||||||
# list ReferenceList 'Device.DeviceInfo.FirmwareImage.*.Download()'
|
|
||||||
# list ReferenceList 'Device.DeviceInfo.FirmwareImage.*.Activate()'
|
|
||||||
# option Persistent 'true'
|
|
||||||
# option controller 'localcontroller'
|
|
||||||
|
|
||||||
#config challenge 'admin'
|
|
||||||
# option Description 'Request to get Administrative access'
|
|
||||||
# option role_name 'full_access'
|
|
||||||
# option Enable '1'
|
|
||||||
# option Value 'YWRtaW4='
|
|
||||||
# option Retries 2
|
|
||||||
# option LockoutPeriod 60
|
|
||||||
|
|
||||||
#config challenge 'user'
|
|
||||||
# option Description 'Request to get User access'
|
|
||||||
# option role_name 'user'
|
|
||||||
# option Enable '1'
|
|
||||||
# option Value 'dXNlcg=='
|
|
||||||
# option Retries 3
|
|
||||||
# option LockoutPeriod 30
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
START=99
|
START=99
|
||||||
STOP=2
|
STOP=02
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
|
|
||||||
PROG=/usr/sbin/obuspa
|
PROG=/usr/sbin/obuspa
|
||||||
CONFIGURATION=obuspa
|
CONFIGURATION=obuspa
|
||||||
|
|
||||||
ENV_PROFILE="/root/.profile"
|
ENV_PROFILE="/root/.profile"
|
||||||
KEEP_FILES="/lib/upgrade/keep.d/obuspa"
|
KEEP_FILE="/lib/upgrade/keep.d/obuspa"
|
||||||
|
|
||||||
RESET_FILE="/tmp/obuspa/obuspa_param_reset.txt"
|
RESET_FILE="/tmp/obuspa/obuspa_param_reset.txt"
|
||||||
SQL_DB_FILE="/tmp/obuspa/usp.db"
|
SQL_DB_FILE="/tmp/obuspa/usp.db"
|
||||||
@@ -59,6 +59,17 @@ db_set_sql()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db_del_sql()
|
||||||
|
{
|
||||||
|
local param
|
||||||
|
|
||||||
|
param="${1}"
|
||||||
|
|
||||||
|
if [ -n "${param}" ]; then
|
||||||
|
${PROG} -f ${SQL_DB_FILE} -c dbdel "${param}" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
db_set()
|
db_set()
|
||||||
{
|
{
|
||||||
# if sql db present, update sql db
|
# if sql db present, update sql db
|
||||||
@@ -70,6 +81,14 @@ db_set()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_db_dump()
|
||||||
|
{
|
||||||
|
if [ -f "${DB_DUMP}" ]; then
|
||||||
|
rm ${DB_DUMP}
|
||||||
|
${PROG} -f ${SQL_DB_FILE} -c show database |sort > ${DB_DUMP}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# if db present then check if it matches with existing instances
|
# if db present then check if it matches with existing instances
|
||||||
# fallback to max instance present + 1
|
# fallback to max instance present + 1
|
||||||
# In case of no db get the count
|
# In case of no db get the count
|
||||||
@@ -112,8 +131,8 @@ get_refrence_path()
|
|||||||
value="${2}"
|
value="${2}"
|
||||||
path=""
|
path=""
|
||||||
|
|
||||||
if [ -f "${SQL_DB_FILE}" ]; then
|
if [ -f "${DB_DUMP}" ]; then
|
||||||
path=$(${PROG} -f ${SQL_DB_FILE} -c show database |grep "${dmref}\d.Alias "|grep -w "${value}")
|
path=$(grep "${dmref}\d.Alias " ${DB_DUMP}|grep -w "${value}")
|
||||||
elif [ -f "${RESET_FILE}" ]; then
|
elif [ -f "${RESET_FILE}" ]; then
|
||||||
path=$(grep "${dmref}\d.Alias " ${RESET_FILE}|grep -w "${value}")
|
path=$(grep "${dmref}\d.Alias " ${RESET_FILE}|grep -w "${value}")
|
||||||
fi
|
fi
|
||||||
@@ -123,14 +142,18 @@ get_refrence_path()
|
|||||||
|
|
||||||
update_keep()
|
update_keep()
|
||||||
{
|
{
|
||||||
keep_file=${1}
|
file=${1}
|
||||||
|
|
||||||
if [ -z "${keep_file}" ]; then
|
if [ -z "${file}" ]; then
|
||||||
return;
|
return;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "${keep_file}" ${KEEP_FILES}; then
|
if [ ! -f "${KEEP_FILE}" ]; then
|
||||||
echo "${keep_file}" >> ${KEEP_FILES}
|
touch "${KEEP_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -q "${file}" ${KEEP_FILE}; then
|
||||||
|
echo "${file}" >> ${KEEP_FILE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,13 +223,15 @@ validate_controller_section()
|
|||||||
'Enable:bool:1' \
|
'Enable:bool:1' \
|
||||||
'EndpointID:string' \
|
'EndpointID:string' \
|
||||||
'assigned_role_name:string' \
|
'assigned_role_name:string' \
|
||||||
|
'AssignedRole:string' \
|
||||||
'Protocol:or("STOMP","CoAP","MQTT", "WebSocket")' \
|
'Protocol:or("STOMP","CoAP","MQTT", "WebSocket")' \
|
||||||
'Destination:string' \
|
'Destination:string' \
|
||||||
'Topic:string' \
|
'Topic:string' \
|
||||||
'ParameterName:list(string)' \
|
'ParameterName:list(string)' \
|
||||||
|
'Reference:string' \
|
||||||
'mqtt:string' \
|
'mqtt:string' \
|
||||||
'stomp:string' \
|
'stomp:string' \
|
||||||
'Host:host' \
|
'Host:string' \
|
||||||
'Port:port' \
|
'Port:port' \
|
||||||
'Path:string' \
|
'Path:string' \
|
||||||
'EnableEncryption:bool'
|
'EnableEncryption:bool'
|
||||||
@@ -218,7 +243,7 @@ validate_subscription_section()
|
|||||||
'Enable:bool:1' \
|
'Enable:bool:1' \
|
||||||
'NotifType:or("ValueChange","ObjectCreation","ObjectDeletion","OperationComplete","Event")' \
|
'NotifType:or("ValueChange","ObjectCreation","ObjectDeletion","OperationComplete","Event")' \
|
||||||
'ReferenceList:list(string)' \
|
'ReferenceList:list(string)' \
|
||||||
'Persistent:bool:1' \
|
'Recipient:string' \
|
||||||
'controller:string'
|
'controller:string'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,6 +258,7 @@ validate_mtp_section()
|
|||||||
'Path:string' \
|
'Path:string' \
|
||||||
'mqtt:string' \
|
'mqtt:string' \
|
||||||
'stomp:string' \
|
'stomp:string' \
|
||||||
|
'Reference:string' \
|
||||||
'EnableEncryption:bool'
|
'EnableEncryption:bool'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +266,7 @@ validate_stomp_connection_section()
|
|||||||
{
|
{
|
||||||
uci_validate_section ${CONFIGURATION} stomp "${1}" \
|
uci_validate_section ${CONFIGURATION} stomp "${1}" \
|
||||||
'Enable:bool:1' \
|
'Enable:bool:1' \
|
||||||
'Host:host' \
|
'Host:string' \
|
||||||
'Port:port:61613' \
|
'Port:port:61613' \
|
||||||
'Username:string' \
|
'Username:string' \
|
||||||
'Password:string' \
|
'Password:string' \
|
||||||
@@ -253,7 +279,7 @@ validate_mqtt_client_section()
|
|||||||
{
|
{
|
||||||
uci_validate_section ${CONFIGURATION} mqtt "${1}" \
|
uci_validate_section ${CONFIGURATION} mqtt "${1}" \
|
||||||
'Enable:bool:1' \
|
'Enable:bool:1' \
|
||||||
'BrokerAddress:host' \
|
'BrokerAddress:string' \
|
||||||
'BrokerPort:port:1883' \
|
'BrokerPort:port:1883' \
|
||||||
'Username:string' \
|
'Username:string' \
|
||||||
'Password:string' \
|
'Password:string' \
|
||||||
@@ -288,8 +314,7 @@ publish_endpoint()
|
|||||||
{
|
{
|
||||||
local AgentEndpointID serial oui user pass
|
local AgentEndpointID serial oui user pass
|
||||||
|
|
||||||
if ! uci -q get obuspa.localmqtt; then
|
if ! uci -q get obuspa.testmqtt; then
|
||||||
log "Remote mqtt broker configured, skip publishing endpoint"
|
|
||||||
return 0;
|
return 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -305,11 +330,11 @@ publish_endpoint()
|
|||||||
if [ -z "${AgentEndpointID}" ]; then
|
if [ -z "${AgentEndpointID}" ]; then
|
||||||
serial=$(get_serial_from_db)
|
serial=$(get_serial_from_db)
|
||||||
oui=$(get_oui_from_db)
|
oui=$(get_oui_from_db)
|
||||||
AgentEndpointID="os::${oui}-${serial}"
|
AgentEndpointID="os::${oui}-${serial//+/%2B}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_get user localmqtt Username
|
config_get user testmqtt Username
|
||||||
config_get pass localmqtt Password
|
config_get pass testmqtt Password
|
||||||
|
|
||||||
# publish Agent's EndpointID in mosquito broker for discovery by usp-js
|
# publish Agent's EndpointID in mosquito broker for discovery by usp-js
|
||||||
# This is a work around till obuspa adds supports for mDNS discovery
|
# This is a work around till obuspa adds supports for mDNS discovery
|
||||||
@@ -335,6 +360,7 @@ configure_localagent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
db_set Device.LocalAgent.EndpointID "${EndpointID}"
|
db_set Device.LocalAgent.EndpointID "${EndpointID}"
|
||||||
|
update_db_dump
|
||||||
}
|
}
|
||||||
|
|
||||||
update_reset_reason()
|
update_reset_reason()
|
||||||
@@ -350,16 +376,18 @@ configure_controller()
|
|||||||
{
|
{
|
||||||
local EndpointID Enable
|
local EndpointID Enable
|
||||||
local Protocol Destination
|
local Protocol Destination
|
||||||
local Topic mqtt stomp assigned_role_name ParameterName
|
local Topic mqtt stomp assigned_role_name AssignedRole ParameterName
|
||||||
local Host Port Path EnableEncryption
|
local Host Port Path EnableEncryption Reference
|
||||||
local dm_ref
|
local dm_ref sec
|
||||||
|
|
||||||
|
sec="${1}"
|
||||||
validate_controller_section "${1}" || {
|
validate_controller_section "${1}" || {
|
||||||
log "Validation of controller section failed"
|
log "Validation of controller section failed"
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_base_path "Device.LocalAgent.Controller." "uci-${1}"
|
sec="${sec/controller_/cpe-}"
|
||||||
|
get_base_path "Device.LocalAgent.Controller." "${sec}"
|
||||||
if [ -z "${BASEPATH}" ]; then
|
if [ -z "${BASEPATH}" ]; then
|
||||||
log "Failed to get path [$BASEPATH]"
|
log "Failed to get path [$BASEPATH]"
|
||||||
return 1;
|
return 1;
|
||||||
@@ -371,21 +399,30 @@ configure_controller()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
dm_ref=""
|
dm_ref=""
|
||||||
if [ "${Protocol}" = "STOMP" ]; then
|
if [ -z "${Reference}" ]; then
|
||||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "uci-${stomp}")
|
if [ "${Protocol}" = "STOMP" ]; then
|
||||||
elif [ "${Protocol}" = "MQTT" ]; then
|
stomp="${stomp/stomp_/cpe-}"
|
||||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "uci-${mqtt}")
|
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||||
|
elif [ "${Protocol}" = "MQTT" ]; then
|
||||||
|
mqtt="${mqtt/mqtt_/cpe-}"
|
||||||
|
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
dm_ref="${Reference}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.Alias" "uci-${1}"
|
db_set "${BASEPATH}.Alias" "${sec}"
|
||||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||||
db_set "${BASEPATH}.EndpointID" "${EndpointID}"
|
db_set "${BASEPATH}.EndpointID" "${EndpointID}"
|
||||||
if [ -n "${assigned_role_name}" ]; then
|
if [ -n "${assigned_role_name}" ]; then
|
||||||
AssignedRole=$(get_role_index "${assigned_role_name}")
|
AssignedRole=$(get_role_index "${assigned_role_name}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${AssignedRole}" ]; then
|
||||||
db_set "${BASEPATH}.AssignedRole" "${AssignedRole}"
|
db_set "${BASEPATH}.AssignedRole" "${AssignedRole}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.MTP.1.Alias" "uci-${1}"
|
db_set "${BASEPATH}.MTP.1.Alias" "${sec}"
|
||||||
db_set "${BASEPATH}.MTP.1.Enable" "${Enable}"
|
db_set "${BASEPATH}.MTP.1.Enable" "${Enable}"
|
||||||
db_set "${BASEPATH}.MTP.1.Protocol" "${Protocol}"
|
db_set "${BASEPATH}.MTP.1.Protocol" "${Protocol}"
|
||||||
# only support configuration of one mtp path per controller using uci
|
# only support configuration of one mtp path per controller using uci
|
||||||
@@ -412,36 +449,41 @@ configure_controller()
|
|||||||
|
|
||||||
for param in ${ParameterName}
|
for param in ${ParameterName}
|
||||||
do
|
do
|
||||||
db_set "${BASEPATH}.BootParameter.${_pnum}.Alias" "uci-${1}-${_pnum}"
|
db_set "${BASEPATH}.BootParameter.${_pnum}.Alias" "${sec}_boot_${_pnum}"
|
||||||
db_set "${BASEPATH}.BootParameter.${_pnum}.Enable" "${Enable}"
|
db_set "${BASEPATH}.BootParameter.${_pnum}.Enable" "${Enable}"
|
||||||
db_set "${BASEPATH}.BootParameter.${_pnum}.ParameterName" "${param}"
|
db_set "${BASEPATH}.BootParameter.${_pnum}.ParameterName" "${param}"
|
||||||
_pnum=$(( _pnum + 1 ))
|
_pnum=$(( _pnum + 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
db_set
|
db_set
|
||||||
|
update_db_dump
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_subscription()
|
configure_subscription()
|
||||||
{
|
{
|
||||||
local Enable NotifType ReferenceList Persistent controller
|
local Enable NotifType ReferenceList controller
|
||||||
local dm_ref
|
local dm_ref
|
||||||
|
local sec
|
||||||
|
|
||||||
|
sec="${1}"
|
||||||
validate_subscription_section "${1}" || {
|
validate_subscription_section "${1}" || {
|
||||||
log "Validation of subscription section failed"
|
log "Validation of subscription section failed"
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_base_path "Device.LocalAgent.Subscription." "uci-${1}"
|
sec="${sec/sub_/cpe-}"
|
||||||
|
get_base_path "Device.LocalAgent.Subscription." "sub_${1}"
|
||||||
if [ -z "${BASEPATH}" ]; then
|
if [ -z "${BASEPATH}" ]; then
|
||||||
log "Failed to get path [$BASEPATH]"
|
log "Failed to get path [$BASEPATH]"
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${controller}" ]; then
|
if [ -n "${controller}" ]; then
|
||||||
dm_ref=$(get_refrence_path "Device.LocalAgent.Controller." "uci-${controller}")
|
controller="${controller/controller_/cpe-}"
|
||||||
|
dm_ref=$(get_refrence_path "Device.LocalAgent.Controller." "${controller}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.Alias" "uci-${1}"
|
db_set "${BASEPATH}.Alias" "${sec}"
|
||||||
db_set "${BASEPATH}.ID" "uci-${1}"
|
db_set "${BASEPATH}.ID" "uci-${1}"
|
||||||
db_set "${BASEPATH}.CreationDate" "$(date -I'seconds')"
|
db_set "${BASEPATH}.CreationDate" "$(date -I'seconds')"
|
||||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||||
@@ -450,8 +492,10 @@ configure_subscription()
|
|||||||
ReferenceList=${ReferenceList// /,}
|
ReferenceList=${ReferenceList// /,}
|
||||||
db_set "${BASEPATH}.ReferenceList" "${ReferenceList}"
|
db_set "${BASEPATH}.ReferenceList" "${ReferenceList}"
|
||||||
fi
|
fi
|
||||||
db_set "${BASEPATH}.Persistent" "${Persistent}"
|
db_set "${BASEPATH}.Persistent" "1"
|
||||||
db_set "${BASEPATH}.Recipient" "${dm_ref}"
|
db_set "${BASEPATH}.Recipient" "${dm_ref}"
|
||||||
|
# Entry updated in db, remove uci entry
|
||||||
|
uci_remove obuspa "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_json_load()
|
check_json_load()
|
||||||
@@ -488,8 +532,7 @@ get_role_index()
|
|||||||
*)
|
*)
|
||||||
local ji=0
|
local ji=0
|
||||||
|
|
||||||
check_json_load
|
if check_json_load; then
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
ji=$(get_role_index_from_json "${role_name}" "${role_def_file}")
|
ji=$(get_role_index_from_json "${role_name}" "${role_def_file}")
|
||||||
fi
|
fi
|
||||||
idx=$(( ji + 2 )) # Add predefined roles
|
idx=$(( ji + 2 )) # Add predefined roles
|
||||||
@@ -501,13 +544,16 @@ get_role_index()
|
|||||||
configure_challenges()
|
configure_challenges()
|
||||||
{
|
{
|
||||||
local Enable Description role_name Role Value Retries LockoutPeriod
|
local Enable Description role_name Role Value Retries LockoutPeriod
|
||||||
|
local sec
|
||||||
|
|
||||||
|
sec="${1}"
|
||||||
validate_challenge_section "${1}" || {
|
validate_challenge_section "${1}" || {
|
||||||
log "Validation of challenge section failed"
|
log "Validation of challenge section failed"
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_base_path "Device.LocalAgent.ControllerTrust.Challenge." "uci-${1}"
|
sec="${sec/challenge_/cpe-}"
|
||||||
|
get_base_path "Device.LocalAgent.ControllerTrust.Challenge." "${sec}"
|
||||||
if [ -z "${BASEPATH}" ]; then
|
if [ -z "${BASEPATH}" ]; then
|
||||||
log "Failed to get path [$BASEPATH]"
|
log "Failed to get path [$BASEPATH]"
|
||||||
return 1;
|
return 1;
|
||||||
@@ -518,7 +564,7 @@ configure_challenges()
|
|||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.Alias" "uci-${1}"
|
db_set "${BASEPATH}.Alias" "${sec}"
|
||||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||||
db_set "${BASEPATH}.Description" "${Description}"
|
db_set "${BASEPATH}.Description" "${Description}"
|
||||||
|
|
||||||
@@ -530,19 +576,22 @@ configure_challenges()
|
|||||||
db_set "${BASEPATH}.Value" "${Value}"
|
db_set "${BASEPATH}.Value" "${Value}"
|
||||||
db_set "${BASEPATH}.Retries" "${Retries}"
|
db_set "${BASEPATH}.Retries" "${Retries}"
|
||||||
db_set "${BASEPATH}.LockoutPeriod" "${LockoutPeriod}"
|
db_set "${BASEPATH}.LockoutPeriod" "${LockoutPeriod}"
|
||||||
|
# Entry updated in db, remove uci entry
|
||||||
|
uci_remove obuspa "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_mtp() {
|
configure_mtp() {
|
||||||
local Enable Protocol ResponseTopicConfigured
|
local Enable Protocol ResponseTopicConfigured
|
||||||
local Path Port EnableEncryption
|
local Path Port EnableEncryption
|
||||||
local stomp mqtt dm_ref
|
local stomp mqtt dm_ref sec
|
||||||
|
|
||||||
|
sec="${1}"
|
||||||
validate_mtp_section "${1}" || {
|
validate_mtp_section "${1}" || {
|
||||||
log "Validation of mtp section failed"
|
log "Validation of mtp section failed"
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
sec="${sec/mtp_/cpe-}"
|
||||||
get_base_path "Device.LocalAgent.MTP." "uci-${1}"
|
get_base_path "Device.LocalAgent.MTP." "${sec}"
|
||||||
if [ -z "${BASEPATH}" ]; then
|
if [ -z "${BASEPATH}" ]; then
|
||||||
log "Failed to get path [$BASEPATH]"
|
log "Failed to get path [$BASEPATH]"
|
||||||
return 1;
|
return 1;
|
||||||
@@ -554,13 +603,19 @@ configure_mtp() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
dm_ref=""
|
dm_ref=""
|
||||||
if [ "${Protocol}" = "STOMP" ]; then
|
if [ -z "${Reference}" ]; then
|
||||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "uci-${stomp}")
|
if [ "${Protocol}" = "STOMP" ]; then
|
||||||
elif [ "${Protocol}" = "MQTT" ]; then
|
stomp="${stomp/stomp_/cpe-}"
|
||||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "uci-${mqtt}")
|
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||||
|
elif [ "${Protocol}" = "MQTT" ]; then
|
||||||
|
mqtt="${mqtt/mqtt_/cpe-}"
|
||||||
|
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
dm_ref="${Reference}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.Alias" "uci-${1}"
|
db_set "${BASEPATH}.Alias" "${sec}"
|
||||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||||
db_set "${BASEPATH}.Protocol" "${Protocol}"
|
db_set "${BASEPATH}.Protocol" "${Protocol}"
|
||||||
if [ "${Protocol}" = "MQTT" ]; then
|
if [ "${Protocol}" = "MQTT" ]; then
|
||||||
@@ -578,24 +633,28 @@ configure_mtp() {
|
|||||||
db_set "${BASEPATH}.WebSocket.EnableEncryption" "${EnableEncryption}"
|
db_set "${BASEPATH}.WebSocket.EnableEncryption" "${EnableEncryption}"
|
||||||
fi
|
fi
|
||||||
db_set
|
db_set
|
||||||
|
update_db_dump
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_stomp_connection() {
|
configure_stomp_connection() {
|
||||||
local Host Username Password Enable Port VirtualHost
|
local Host Username Password Enable Port VirtualHost
|
||||||
local EnableEncryption EnableHeartbeats
|
local EnableEncryption EnableHeartbeats
|
||||||
|
local sec
|
||||||
|
|
||||||
|
sec="${1}"
|
||||||
validate_stomp_connection_section "${1}" || {
|
validate_stomp_connection_section "${1}" || {
|
||||||
log "Validation of stomp section failed"
|
log "Validation of stomp section failed"
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_base_path "Device.STOMP.Connection." "uci-${1}"
|
sec="${sec/stomp_/cpe-}"
|
||||||
|
get_base_path "Device.STOMP.Connection." "${sec}"
|
||||||
if [ -z "${BASEPATH}" ]; then
|
if [ -z "${BASEPATH}" ]; then
|
||||||
log "Failed to get path [$BASEPATH]"
|
log "Failed to get path [$BASEPATH]"
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.Alias" "uci-${1}"
|
db_set "${BASEPATH}.Alias" "${sec}"
|
||||||
db_set "${BASEPATH}.Host" "${Host}"
|
db_set "${BASEPATH}.Host" "${Host}"
|
||||||
db_set "${BASEPATH}.Username" "${Username}"
|
db_set "${BASEPATH}.Username" "${Username}"
|
||||||
db_set "${BASEPATH}.Password" "${Password}"
|
db_set "${BASEPATH}.Password" "${Password}"
|
||||||
@@ -606,24 +665,28 @@ configure_stomp_connection() {
|
|||||||
db_set "${BASEPATH}.EnableHeartbeats" "${EnableHeartbeats}"
|
db_set "${BASEPATH}.EnableHeartbeats" "${EnableHeartbeats}"
|
||||||
db_set "${BASEPATH}.VirtualHost" "${VirtualHost}"
|
db_set "${BASEPATH}.VirtualHost" "${VirtualHost}"
|
||||||
db_set
|
db_set
|
||||||
|
update_db_dump
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_mqtt_client(){
|
configure_mqtt_client() {
|
||||||
local BrokerAddress BrokerPort Enable Username Password ProtocolVersion
|
local BrokerAddress BrokerPort Enable Username Password ProtocolVersion
|
||||||
local TransportProtocol ClientID
|
local TransportProtocol ClientID
|
||||||
|
local sec
|
||||||
|
|
||||||
|
sec="${1}"
|
||||||
validate_mqtt_client_section "${1}" || {
|
validate_mqtt_client_section "${1}" || {
|
||||||
log "Validation of mqtt section failed"
|
log "Validation of mqtt section failed"
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_base_path "Device.MQTT.Client." "uci-${1}"
|
sec="${sec/mqtt_/cpe-}"
|
||||||
|
get_base_path "Device.MQTT.Client." "${sec}"
|
||||||
if [ -z "${BASEPATH}" ]; then
|
if [ -z "${BASEPATH}" ]; then
|
||||||
log "Failed to get path [$BASEPATH]"
|
log "Failed to get path [$BASEPATH]"
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.Alias" "uci-${1}"
|
db_set "${BASEPATH}.Alias" "${sec}"
|
||||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||||
db_set "${BASEPATH}.BrokerAddress" "${BrokerAddress}"
|
db_set "${BASEPATH}.BrokerAddress" "${BrokerAddress}"
|
||||||
db_set "${BASEPATH}.BrokerPort" "${BrokerPort}"
|
db_set "${BASEPATH}.BrokerPort" "${BrokerPort}"
|
||||||
@@ -634,6 +697,7 @@ configure_mqtt_client(){
|
|||||||
db_set "${BASEPATH}.ClientID" "${ClientID}"
|
db_set "${BASEPATH}.ClientID" "${ClientID}"
|
||||||
|
|
||||||
db_set
|
db_set
|
||||||
|
update_db_dump
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -705,21 +769,277 @@ configure_obuspa() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_instances_from_db_dump()
|
||||||
|
{
|
||||||
|
local obj inst
|
||||||
|
|
||||||
|
obj="${1}\d"
|
||||||
|
if [ ! -f "${DB_DUMP}" ]; then
|
||||||
|
echo ""
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
inst="$(grep -oe "${obj}" "${DB_DUMP}"|uniq)"
|
||||||
|
echo "$inst"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_param_value_from_dump()
|
||||||
|
{
|
||||||
|
local param value
|
||||||
|
|
||||||
|
param="${1}"
|
||||||
|
|
||||||
|
if [ -z "${param}" ] || [ ! -f "${DB_DUMP}" ]; then
|
||||||
|
log "error getting param"
|
||||||
|
echo ""
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
value="$(grep "^${param} " ${DB_DUMP}|awk '{print $3}')"
|
||||||
|
|
||||||
|
echo "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_uci_sec()
|
||||||
|
{
|
||||||
|
local sec tmp
|
||||||
|
|
||||||
|
sec="${1}"
|
||||||
|
stype="${2}"
|
||||||
|
if [ -z "$sec" ] || [ -z "$stype" ]; then
|
||||||
|
log "No section name, error"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp="$(uci_get obuspa "${sec}")"
|
||||||
|
if [ "$tmp" != "$stype" ]; then
|
||||||
|
uci_add obuspa "${stype}" "${sec}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
sync_db_controller()
|
||||||
|
{
|
||||||
|
local cntrs copts sec pvalue protocol
|
||||||
|
|
||||||
|
copts="Enable EndpointID AssignedRole"
|
||||||
|
popts="Destination Topic Reference Host Port Path EnableEncryption"
|
||||||
|
|
||||||
|
cntrs="$(get_instances_from_db_dump Device.LocalAgent.Controller.)"
|
||||||
|
for cntr in $cntrs; do
|
||||||
|
sec="$(get_param_value_from_dump "${cntr}".Alias)"
|
||||||
|
sec="${sec/cpe-/controller_}"
|
||||||
|
sec="${sec/-/_}"
|
||||||
|
|
||||||
|
update_uci_sec "${sec}" controller
|
||||||
|
for param in ${copts}; do
|
||||||
|
pvalue="$(get_param_value_from_dump "${cntr}"."${param}")"
|
||||||
|
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
||||||
|
done
|
||||||
|
uci_set obuspa "${sec}" "_sync" "1"
|
||||||
|
|
||||||
|
protocol="$(get_param_value_from_dump "${cntr}".MTP.1.Protocol)"
|
||||||
|
if [ -z "${protocol}" ]; then
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
uci_set obuspa "${sec}" "Protocol" "${protocol}"
|
||||||
|
for param in ${popts}; do
|
||||||
|
pvalue="$(get_param_value_from_dump "${cntr}".MTP.1."${protocol}"."${param}")"
|
||||||
|
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
sync_db_localagent_mtp()
|
||||||
|
{
|
||||||
|
local mtps opts popts sec pvalue protocol
|
||||||
|
|
||||||
|
opts="Enable"
|
||||||
|
popts="ResponseTopicConfigured Destination Port Path Reference EnableEncryption"
|
||||||
|
ropts="mqtt stomp"
|
||||||
|
|
||||||
|
mtps="$(get_instances_from_db_dump Device.LocalAgent.MTP.)"
|
||||||
|
for inst in $mtps; do
|
||||||
|
sec="$(get_param_value_from_dump "${inst}".Alias)"
|
||||||
|
sec="${sec/cpe-/mtp_}"
|
||||||
|
sec="${sec/-/_}"
|
||||||
|
update_uci_sec "${sec}" mtp
|
||||||
|
for param in ${opts}; do
|
||||||
|
pvalue="$(get_param_value_from_dump "${inst}"."${param}")"
|
||||||
|
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
||||||
|
done
|
||||||
|
uci_set obuspa "${sec}" "_sync" "1"
|
||||||
|
|
||||||
|
protocol="$(get_param_value_from_dump "${inst}".Protocol)"
|
||||||
|
if [ -z "${protocol}" ]; then
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
uci_set obuspa "${sec}" "Protocol" "${protocol}"
|
||||||
|
for param in ${popts}; do
|
||||||
|
pvalue="$(get_param_value_from_dump "${inst}"."${protocol}"."${param}")"
|
||||||
|
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
||||||
|
done
|
||||||
|
for param in ${ropts}; do
|
||||||
|
uci_set obuspa "${sec}" "${param}" ""
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sync_db_mqtt_client()
|
||||||
|
{
|
||||||
|
local mtps copts sec pvalue protocol
|
||||||
|
|
||||||
|
opts="Enable BrokerAddress BrokerPort Username ProtocolVersion TransportProtocol ClientID"
|
||||||
|
|
||||||
|
mtps="$(get_instances_from_db_dump Device.MQTT.Client.)"
|
||||||
|
for inst in $mtps; do
|
||||||
|
sec="$(get_param_value_from_dump "${inst}".Alias)"
|
||||||
|
sec="${sec/cpe-/mqtt_}"
|
||||||
|
sec="${sec/-/_}"
|
||||||
|
update_uci_sec "${sec}" mqtt
|
||||||
|
for param in ${opts}; do
|
||||||
|
pvalue="$(get_param_value_from_dump "${inst}"."${param}")"
|
||||||
|
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
||||||
|
done
|
||||||
|
uci_set obuspa "${sec}" "_sync" "1"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
sync_db_stomp_connection()
|
||||||
|
{
|
||||||
|
local mtps copts sec pvalue protocol
|
||||||
|
|
||||||
|
opts="Enable Host Port Username EnableEncryption EnableHeartbeats VirtualHost"
|
||||||
|
|
||||||
|
mtps="$(get_instances_from_db_dump Device.STOMP.Connection.)"
|
||||||
|
for inst in $mtps; do
|
||||||
|
sec="$(get_param_value_from_dump "${inst}".Alias)"
|
||||||
|
sec="${sec/cpe-/stomp_}"
|
||||||
|
sec="${sec/-/_}"
|
||||||
|
update_uci_sec "${sec}" stomp
|
||||||
|
for param in ${opts}; do
|
||||||
|
pvalue="$(get_param_value_from_dump "${inst}"."${param}")"
|
||||||
|
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
||||||
|
done
|
||||||
|
uci_set obuspa "${sec}" "_sync" "1"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
sync_update_sec()
|
||||||
|
{
|
||||||
|
local _sync
|
||||||
|
config_get _sync "${1}" _sync ""
|
||||||
|
if [ -z "${_sync}" ]; then
|
||||||
|
uci_remove obuspa "${1}"
|
||||||
|
else
|
||||||
|
uci_remove obuspa "${1}" _sync
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
sync_uci_with_db()
|
||||||
|
{
|
||||||
|
if [ ! -f "${DB_DUMP}" ]; then
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_load obuspa
|
||||||
|
sync_db_controller
|
||||||
|
sync_db_localagent_mtp
|
||||||
|
sync_db_mqtt_client
|
||||||
|
sync_db_stomp_connection
|
||||||
|
uci_commit obuspa
|
||||||
|
|
||||||
|
config_load obuspa
|
||||||
|
config_foreach sync_update_sec controller
|
||||||
|
config_foreach sync_update_sec mtp
|
||||||
|
config_foreach sync_update_sec mqtt
|
||||||
|
config_foreach sync_update_sec stomp
|
||||||
|
uci_commit obuspa
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_sql_db_entry_with_pattern()
|
||||||
|
{
|
||||||
|
local params pattern
|
||||||
|
|
||||||
|
pattern="${1}"
|
||||||
|
if [ ! -f "${DB_DUMP}" ]; then
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${#pattern}" -lt 7 ]; then
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
params="$(grep ${pattern} ${DB_DUMP}|awk '{print $1}')"
|
||||||
|
for p in ${params}; do
|
||||||
|
db_del_sql "${p}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
check_n_delete_db()
|
||||||
|
{
|
||||||
|
local sec t r path
|
||||||
|
|
||||||
|
sec="${1}"
|
||||||
|
if uci -q get obuspa.${sec} >/dev/null 2>&1; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
t="${2}"
|
||||||
|
r="${3}"
|
||||||
|
sec="${sec/${t}_/cpe-}"
|
||||||
|
|
||||||
|
path=$(grep "${r}\d.Alias => ${sec}" ${DB_DUMP})
|
||||||
|
path=${path%.*}
|
||||||
|
|
||||||
|
delete_sql_db_entry_with_pattern "${path}"
|
||||||
|
}
|
||||||
|
|
||||||
|
reverse_update_db_with_uci()
|
||||||
|
{
|
||||||
|
if [ ! -f "${DB_DUMP}" ]; then
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
export UCI_CONFIG_DIR="/tmp/obuspa"
|
||||||
|
config_load obuspa
|
||||||
|
config_foreach check_n_delete_db controller controller "Device.LocalAgent.Controller."
|
||||||
|
config_foreach check_n_delete_db mtp mtp "Device.LocalAgent.MTP."
|
||||||
|
config_foreach check_n_delete_db mqtt mqtt "Device.MQTT.Client."
|
||||||
|
config_foreach check_n_delete_db stomp stomp "Device.STOMP.Connection."
|
||||||
|
unset UCI_CONFIG_DIR
|
||||||
|
}
|
||||||
|
|
||||||
# Create factory reset file
|
# Create factory reset file
|
||||||
db_init()
|
db_init()
|
||||||
{
|
{
|
||||||
|
local reason
|
||||||
|
|
||||||
|
reason="${1}"
|
||||||
|
mkdir -p /tmp/obuspa/
|
||||||
# Load configuration
|
# Load configuration
|
||||||
config_load $CONFIGURATION
|
config_load $CONFIGURATION
|
||||||
config_get SQL_DB_FILE global db_file "/tmp/obuspa/usp.db"
|
config_get SQL_DB_FILE global db_file "/tmp/obuspa/usp.db"
|
||||||
|
|
||||||
# Dump datamodel parameters from DB
|
# Dump datamodel parameters from DB
|
||||||
if [ -f "${SQL_DB_FILE}" ]; then
|
if [ -f "${SQL_DB_FILE}" ]; then
|
||||||
${PROG} -f ${SQL_DB_FILE} -c show database > ${DB_DUMP}
|
${PROG} -f ${SQL_DB_FILE} -c show database |sort > ${DB_DUMP}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only sync uci with db in case of non service triggers
|
||||||
|
if [ -f "${DB_DUMP}" ] && [ "${reason}" != "update" ]; then
|
||||||
|
sync_uci_with_db
|
||||||
|
fi
|
||||||
|
|
||||||
|
# remove entries from db if deleted from uci
|
||||||
|
if [ -f "${DB_DUMP}" ] && [ "${reason}" == "update" ] && [ -f "/tmp/obuspa/obuspa" ]; then
|
||||||
|
reverse_update_db_with_uci
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove reset file if present
|
# Remove reset file if present
|
||||||
[ -f "${RESET_FILE}" ] && rm -f ${RESET_FILE}
|
[ -f "${RESET_FILE}" ] && rm -f ${RESET_FILE}
|
||||||
|
|
||||||
|
config_load $CONFIGURATION
|
||||||
global_init
|
global_init
|
||||||
config_foreach configure_localagent localagent
|
config_foreach configure_localagent localagent
|
||||||
global_init
|
global_init
|
||||||
@@ -736,6 +1056,9 @@ db_init()
|
|||||||
config_foreach configure_challenges challenge
|
config_foreach configure_challenges challenge
|
||||||
global_init
|
global_init
|
||||||
update_reset_reason
|
update_reset_reason
|
||||||
|
uci_commit ${CONFIGURATION}
|
||||||
|
|
||||||
|
cp /etc/config/obuspa /tmp/obuspa/
|
||||||
|
|
||||||
[ -f "${DB_DUMP}" ] && rm -f ${DB_DUMP}
|
[ -f "${DB_DUMP}" ] && rm -f ${DB_DUMP}
|
||||||
|
|
||||||
@@ -771,7 +1094,7 @@ start_service() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /tmp/obuspa/
|
mkdir -p /tmp/obuspa/
|
||||||
db_init
|
db_init "${1}"
|
||||||
register_service
|
register_service
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -781,7 +1104,7 @@ stop_service() {
|
|||||||
|
|
||||||
reload_service() {
|
reload_service() {
|
||||||
stop
|
stop
|
||||||
start
|
start update
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
@@ -801,7 +1124,7 @@ service_triggers() {
|
|||||||
json_add_array
|
json_add_array
|
||||||
json_add_string "" "run_script"
|
json_add_string "" "run_script"
|
||||||
json_add_string "" "/etc/init.d/obuspa"
|
json_add_string "" "/etc/init.d/obuspa"
|
||||||
json_add_string "" "reload"
|
json_add_string "" "restart"
|
||||||
json_close_array
|
json_close_array
|
||||||
json_close_array
|
json_close_array
|
||||||
json_add_int "" "2000"
|
json_add_int "" "2000"
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"dmcaching_exclude": [
|
"dmcaching_exclude": [
|
||||||
"Device.DeviceInfo.ProcessStatus.Process.",
|
"Device.InterfaceStack.",
|
||||||
"Device.Hosts.Host.",
|
"Device.Hosts.Host.",
|
||||||
|
"Device.IEEE1905.",
|
||||||
"Device.WiFi.DataElements."
|
"Device.WiFi.DataElements."
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
14
obuspa/files/etc/uci-defaults/50-add-mqtt-usp-test
Normal file
14
obuspa/files/etc/uci-defaults/50-add-mqtt-usp-test
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
add_usp_test()
|
||||||
|
{
|
||||||
|
if ! uci_get mosquitto usptest >/dev/null 2>&1; then
|
||||||
|
uci_add mosquitto listener usptest
|
||||||
|
uci_set mosquitto usptest enabled 1
|
||||||
|
uci_set mosquitto usptest port '9001'
|
||||||
|
uci_set mosquitto usptest protocol 'websockets'
|
||||||
|
uci_set mosquitto usptest require_certificates '0'
|
||||||
|
uci_set mosquitto usptest auth_plugin '/usr/lib/mosquitto_auth_shadow.so'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
uci_load mosquitto
|
||||||
|
add_usp_test
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
diff --git a/src/core/device.h b/src/core/device.h
|
|
||||||
index adf8fa6..072f953 100644
|
|
||||||
--- a/src/core/device.h
|
|
||||||
+++ b/src/core/device.h
|
|
||||||
@@ -111,6 +111,7 @@ typedef struct
|
|
||||||
// Following member variables only set if USP message was received over MQTT
|
|
||||||
int mqtt_instance;
|
|
||||||
char *mqtt_topic; // only set if reply_to was specified in the received MQTT packet
|
|
||||||
+ char *mqtt_topic_recv;
|
|
||||||
|
|
||||||
|
|
||||||
// Following member variables only set if USP message was received over CoAP
|
|
||||||
@@ -252,7 +253,7 @@ void DEVICE_MTP_NotifyMqttConnDeleted(int mqtt_instance);
|
|
||||||
int DEVICE_MTP_ValidateMqttReference(dm_req_t *req, char *value);
|
|
||||||
void DEVICE_CONTROLLER_SetRolesFromMqtt(int mqtt_instance, ctrust_role_t role);
|
|
||||||
char *DEVICE_CONTROLLER_GetControllerTopic(int mqtt_instance);
|
|
||||||
-
|
|
||||||
+int validate_controller_topic_by_endpointid(char *endpointid, mtp_protocol_t proto, char *recv_topic);
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Tables used to convert to/from an enumeration to/from a string
|
|
||||||
extern const enum_entry_t mtp_protocols[kMtpProtocol_Max];
|
|
||||||
diff --git a/src/core/device_controller.c b/src/core/device_controller.c
|
|
||||||
index 62c803f..103388d 100755
|
|
||||||
--- a/src/core/device_controller.c
|
|
||||||
+++ b/src/core/device_controller.c
|
|
||||||
@@ -239,6 +239,41 @@ int Async_E2ESessionReset(dm_req_t *req, kv_vector_t *input_args, int request);
|
|
||||||
extern const enum_entry_t e2e_session_modes[kE2EMode_Max];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+
|
|
||||||
+int validate_controller_topic_by_endpointid(char *endpointid, mtp_protocol_t proto, char *recv_topic)
|
|
||||||
+{
|
|
||||||
+ controller_t *cont = FindEnabledControllerByEndpointId(endpointid);
|
|
||||||
+ if (cont == NULL)
|
|
||||||
+ {
|
|
||||||
+ USP_LOG_Error("not able to find the controller from endpointid [%s]", endpointid);
|
|
||||||
+ return USP_ERR_PERMISSION_DENIED;
|
|
||||||
+ }
|
|
||||||
+#ifdef ENABLE_MQTT
|
|
||||||
+ if (proto == kMtpProtocol_MQTT)
|
|
||||||
+ {
|
|
||||||
+ controller_mtp_t *mtp = FindFirstEnabledMtp(cont, proto);
|
|
||||||
+
|
|
||||||
+ if (mtp == NULL) {
|
|
||||||
+ USP_LOG_Error("Not able to find mtp[%d] for endpointid [%s]", proto, endpointid);
|
|
||||||
+ return USP_ERR_REQUEST_DENIED;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (mtp->protocol != proto) {
|
|
||||||
+ USP_LOG_Error("No matching mtp[%d] for endpointid [%s]", proto, endpointid);
|
|
||||||
+ return USP_ERR_REQUEST_DENIED;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ char *response_topic = DEVICE_MTP_GetAgentMqttResponseTopic(mtp->mqtt_connection_instance);
|
|
||||||
+ if (response_topic && strcmp(response_topic, recv_topic) != 0 ) {
|
|
||||||
+ USP_LOG_Error("Controller response topic[%s] and recv topic[%s] mismatch, probably a spoof message", response_topic, recv_topic);
|
|
||||||
+ return USP_ERR_PERMISSION_DENIED;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ return USP_ERR_OK;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*********************************************************************//**
|
|
||||||
**
|
|
||||||
** DEVICE_CONTROLLER_Init
|
|
||||||
diff --git a/src/core/dm_exec.c b/src/core/dm_exec.c
|
|
||||||
index c0b95d8..6eb51e2 100755
|
|
||||||
--- a/src/core/dm_exec.c
|
|
||||||
+++ b/src/core/dm_exec.c
|
|
||||||
@@ -624,6 +624,7 @@ void DM_EXEC_PostUspRecord(unsigned char *pbuf, int pbuf_len, ctrust_role_t role
|
|
||||||
pur->mtp_reply_to.coap_encryption = mrt->coap_encryption;
|
|
||||||
pur->mtp_reply_to.coap_reset_session_hint = mrt->coap_reset_session_hint;
|
|
||||||
pur->mtp_reply_to.mqtt_topic = USP_STRDUP(mrt->mqtt_topic);
|
|
||||||
+ pur->mtp_reply_to.mqtt_topic_recv = USP_STRDUP(mrt->mqtt_topic_recv);
|
|
||||||
pur->mtp_reply_to.mqtt_instance = mrt->mqtt_instance;
|
|
||||||
pur->mtp_reply_to.wsclient_cont_instance = mrt->wsclient_cont_instance;
|
|
||||||
pur->mtp_reply_to.wsclient_mtp_instance = mrt->wsclient_mtp_instance;
|
|
||||||
@@ -1144,6 +1145,7 @@ void ProcessMessageQueueSocketActivity(socket_set_t *set)
|
|
||||||
USP_SAFE_FREE(mrt->coap_resource);
|
|
||||||
USP_SAFE_FREE(mrt->mqtt_topic);
|
|
||||||
USP_SAFE_FREE(mrt->cont_endpoint_id);
|
|
||||||
+ USP_SAFE_FREE(mrt->mqtt_topic_recv);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifndef DISABLE_STOMP
|
|
||||||
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
|
|
||||||
index 7dba9f4..3ee9c97 100644
|
|
||||||
--- a/src/core/mqtt.c
|
|
||||||
+++ b/src/core/mqtt.c
|
|
||||||
@@ -3141,6 +3141,7 @@ void ReceiveMqttMessage(mqtt_client_t *client, const struct mosquitto_message *m
|
|
||||||
mrt.mqtt_topic = response_topic;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ mrt.mqtt_topic_recv = message->topic;
|
|
||||||
// Message may not be valid USP
|
|
||||||
DM_EXEC_PostUspRecord(message->payload, message->payloadlen, client->role, &mrt);
|
|
||||||
}
|
|
||||||
diff --git a/src/core/msg_handler.c b/src/core/msg_handler.c
|
|
||||||
index ce67626..4af9ade 100644
|
|
||||||
--- a/src/core/msg_handler.c
|
|
||||||
+++ b/src/core/msg_handler.c
|
|
||||||
@@ -118,7 +118,7 @@ static enum_entry_t mtp_content_types[] = {
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Forward declarations. Note these are not static, because we need them in the symbol table for USP_LOG_Callstack() to show them
|
|
||||||
int HandleUspMessage(Usp__Msg *usp, char *controller_endpoint, mtp_reply_to_t *mrt);
|
|
||||||
-int ValidateUspRecord(UspRecord__Record *rec);
|
|
||||||
+int ValidateUspRecord(UspRecord__Record *rec, mtp_reply_to_t *mrt);
|
|
||||||
char *MtpSendItemToString(mtp_send_item_t *msi);
|
|
||||||
void CacheControllerRoleForCurMsg(char *endpoint_id, ctrust_role_t role, mtp_protocol_t protocol);
|
|
||||||
int QueueUspNoSessionRecord(usp_send_item_t *usi, char *endpoint_id, char *usp_msg_id, mtp_reply_to_t *mrt, time_t expiry_time);
|
|
||||||
@@ -172,7 +172,7 @@ int MSG_HANDLER_HandleBinaryRecord(unsigned char *pbuf, int pbuf_len, ctrust_rol
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Exit if USP record failed validation
|
|
||||||
- err = ValidateUspRecord(rec);
|
|
||||||
+ err = ValidateUspRecord(rec, mrt);
|
|
||||||
if (err != USP_ERR_OK)
|
|
||||||
{
|
|
||||||
goto exit;
|
|
||||||
@@ -725,7 +725,7 @@ exit:
|
|
||||||
** \return USP_ERR_OK if record is valid
|
|
||||||
**
|
|
||||||
**************************************************************************/
|
|
||||||
-int ValidateUspRecord(UspRecord__Record *rec)
|
|
||||||
+int ValidateUspRecord(UspRecord__Record *rec, mtp_reply_to_t *mrt)
|
|
||||||
{
|
|
||||||
char *endpoint_id;
|
|
||||||
|
|
||||||
@@ -806,6 +806,9 @@ int ValidateUspRecord(UspRecord__Record *rec)
|
|
||||||
return USP_ERR_REQUEST_DENIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if OBUSPA_CONTROLLER_MTP_VERIFY
|
|
||||||
+ return validate_controller_topic_by_endpointid(rec->from_id, mrt->protocol, mrt->mqtt_topic_recv);
|
|
||||||
+#endif
|
|
||||||
// If the code gets here, then the USP record passed validation, and the encapsulated USP message may be processed
|
|
||||||
return USP_ERR_OK;
|
|
||||||
}
|
|
||||||
49
obuspa/patches/0002-supress-group-get-error.patch
Normal file
49
obuspa/patches/0002-supress-group-get-error.patch
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
diff --git a/src/core/cli_server.c b/src/core/cli_server.c
|
||||||
|
index 701cbd9..103361e 100644
|
||||||
|
--- a/src/core/cli_server.c
|
||||||
|
+++ b/src/core/cli_server.c
|
||||||
|
@@ -733,10 +733,6 @@ int ExecuteCli_Get(char *arg1, char *arg2, char *usage)
|
||||||
|
USP_ASSERT(gge->value != NULL);
|
||||||
|
SendCliResponse("%s => %s\n", gge->path, gge->value);
|
||||||
|
}
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- SendCliResponse("ERROR: %d retrieving %s (%s)\n", gge->err_code, gge->path, gge->err_msg);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
GROUP_GET_VECTOR_Destroy(&ggv);
|
||||||
|
diff --git a/src/core/handle_get.c b/src/core/handle_get.c
|
||||||
|
index e1055e0..16b9ceb 100755
|
||||||
|
--- a/src/core/handle_get.c
|
||||||
|
+++ b/src/core/handle_get.c
|
||||||
|
@@ -260,26 +260,16 @@ void FormPathExprResponse(int get_expr_index, char *path_expr, get_expr_info_t *
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- // If there was an error in getting any of the parameters associated with the path expression,
|
||||||
|
- // then just add the first error, without any of the parameter values, for this path expression result
|
||||||
|
- for (i=0; i < gi->num_entries; i++)
|
||||||
|
- {
|
||||||
|
- gge = &ggv->vector[gi->index + i];
|
||||||
|
- if (gge->err_code != USP_ERR_OK)
|
||||||
|
- {
|
||||||
|
- (void)AddGetResp_ReqPathRes(resp, path_expr, gge->err_code, gge->err_msg);
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
// If the code gets here, then the value of all parameters were retrieved successfully, so add their values to the result_params
|
||||||
|
req_path_result = AddGetResp_ReqPathRes(resp, path_expr, USP_ERR_OK, "");
|
||||||
|
for (i=0; i < gi->num_entries; i++)
|
||||||
|
{
|
||||||
|
gge = &ggv->vector[gi->index + i];
|
||||||
|
|
||||||
|
- // Simple format contains a resolved_path_result for every object (and sub object)
|
||||||
|
- AddResolvedPathResult(req_path_result, gge->path, gge->value);
|
||||||
|
+ if (gge->err_code == USP_ERR_OK) {
|
||||||
|
+ // Simple format contains a resolved_path_result for every object (and sub object)
|
||||||
|
+ AddResolvedPathResult(req_path_result, gge->path, gge->value);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
43
obuspa/patches/0003-set-internal-role-fix.patch
Normal file
43
obuspa/patches/0003-set-internal-role-fix.patch
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
--- a/src/core/cli_server.c
|
||||||
|
+++ b/src/core/cli_server.c
|
||||||
|
@@ -787,6 +787,7 @@ int ExecuteCli_Set(char *arg1, char *arg
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ SetControllerRoleForInternal();
|
||||||
|
// Iterate over all objects to set
|
||||||
|
for (i=0; i < objects.num_entries; i++)
|
||||||
|
{
|
||||||
|
--- a/src/core/data_model.h
|
||||||
|
+++ b/src/core/data_model.h
|
||||||
|
@@ -324,6 +324,7 @@ void DATA_MODEL_DumpSchema(void);
|
||||||
|
void DATA_MODEL_DumpInstances(void);
|
||||||
|
char DATA_MODEL_GetJSONParameterType(char *path);
|
||||||
|
int DATA_MODEL_SetParameterInDatabase(char *path, char *value);
|
||||||
|
+void SetControllerRoleForInternal();
|
||||||
|
|
||||||
|
int DM_PRIV_InitSetRequest(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst, char *new_value);
|
||||||
|
void DM_PRIV_RequestInit(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst);
|
||||||
|
--- a/src/core/msg_handler.c
|
||||||
|
+++ b/src/core/msg_handler.c
|
||||||
|
@@ -839,6 +839,20 @@ char *MtpSendItemToString(mtp_send_item_
|
||||||
|
|
||||||
|
/*********************************************************************//**
|
||||||
|
**
|
||||||
|
+** SetControllerRoleForInternal
|
||||||
|
+**
|
||||||
|
+** Sets the role for internal user
|
||||||
|
+**
|
||||||
|
+**
|
||||||
|
+**************************************************************************/
|
||||||
|
+void SetControllerRoleForInternal()
|
||||||
|
+{
|
||||||
|
+ cur_msg_combined_role.inherited = kCTrustRole_Untrusted;
|
||||||
|
+ cur_msg_combined_role.assigned = kCTrustRole_FullAccess;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*********************************************************************//**
|
||||||
|
+**
|
||||||
|
** CacheControllerRoleForCurMsg
|
||||||
|
**
|
||||||
|
** Retrieves the role to use for the specified controller, and caches it locally, so that
|
||||||
@@ -5,12 +5,12 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=owsd
|
PKG_NAME:=owsd
|
||||||
PKG_VERSION:=1.1.4
|
PKG_VERSION:=1.1.5
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_PROTO=git
|
PKG_SOURCE_PROTO=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/owsd.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/owsd.git
|
||||||
PKG_SOURCE_VERSION:=e37c6f9d708c454c802eede814cc51fb89c919e9
|
PKG_SOURCE_VERSION:=d866ee2a96f5b75b3f45b0e1d655431184e8032d
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
PKG_SOURCE_SUBDIR:=${PKG_NAME}-${PKG_VERSION}
|
PKG_SOURCE_SUBDIR:=${PKG_NAME}-${PKG_VERSION}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=periodicstats
|
PKG_NAME:=periodicstats
|
||||||
PKG_VERSION:=1.2.0
|
PKG_VERSION:=1.2.1
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
@@ -20,15 +20,13 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
|||||||
PKG_LICENSE:=GPL-2.0-only
|
PKG_LICENSE:=GPL-2.0-only
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
||||||
PKG_BUILD_DEPENDS:=bbf
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
define Package/periodicstats
|
define Package/periodicstats
|
||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
TITLE:=Periodic Statistics Daemon
|
TITLE:=Periodic Statistics Daemon
|
||||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
|
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbf_api
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/periodicstats/description
|
define Package/periodicstats/description
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ include $(INCLUDE_DIR)/package.mk
|
|||||||
define Package/ponmngr
|
define Package/ponmngr
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
TITLE:=PON Manager
|
TITLE:=PON Manager
|
||||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet)
|
DEPENDS:=@(TARGET_brcmbca||TARGET_airoha)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/ponmngr/description
|
define Package/ponmngr/description
|
||||||
@@ -34,11 +34,13 @@ endef
|
|||||||
|
|
||||||
define Package/ponmngr/install
|
define Package/ponmngr/install
|
||||||
$(CP) ./files/common/* $(1)/
|
$(CP) ./files/common/* $(1)/
|
||||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||||
$(CP) ./files/broadcom/* $(1)/
|
$(CP) ./files/broadcom/* $(1)/
|
||||||
else ifneq ($(CONFIG_TARGET_iopsys_econet),)
|
else ifneq ($(CONFIG_TARGET_airoha),)
|
||||||
$(CP) ./files/airoha/* $(1)/
|
$(CP) ./files/airoha/* $(1)/
|
||||||
endif
|
endif
|
||||||
|
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||||
|
$(CP) ./files/etc/bbfdm/json/* $(1)/etc/bbfdm/json/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,ponmngr))
|
$(eval $(call BuildPackage,ponmngr))
|
||||||
|
|||||||
1139
ponmngr/docs/api/xpon.ubus.md
Normal file
1139
ponmngr/docs/api/xpon.ubus.md
Normal file
File diff suppressed because it is too large
Load Diff
1
ponmngr/docs/api/xpon.uci.md
Normal file
1
ponmngr/docs/api/xpon.uci.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<tbody><tr><td colspan="2"><div style="font-weight: bold">xpon</div><table style="width:100%"><tbody><tr><td><div style="font-weight: bold; font-size: 14px">section</div></td><td><div style="font-weight: bold; font-size: 14px">description</div></td><td><div style="font-weight: bold; font-size: 14px">multi</div></td><td><div style="font-weight: bold; font-size: 14px">options</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">ani</div></td><td class="td_row_even"><div class="td_row_even">xpon ani configuration</div></td><td class="td_row_even"><div class="td_row_even">false</div></td><td class="td_row_even"><table style="width:100%"><tbody><tr><td><div style="font-weight: bold; font-size: 14px">name</div></td><td><div style="font-weight: bold; font-size: 14px">type</div></td><td><div style="font-weight: bold; font-size: 14px">required</div></td><td><div style="font-weight: bold; font-size: 14px">default</div></td><td><div style="font-weight: bold; font-size: 14px">description</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">enable</div></td><td class="td_row_even"><div class="td_row_even">boolean</div></td><td class="td_row_even"><div class="td_row_even">yes</div></td><td class="td_row_even"><div class="td_row_even">false</div></td><td class="td_row_even"><div class="td_row_even">ONU is enabled as pon functionality.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">serial_number</div></td><td class="td_row_odd"><div class="td_row_odd">string</div></td><td class="td_row_odd"><div class="td_row_odd">yes</div></td><td class="td_row_odd"><div class="td_row_odd">null</div></td><td class="td_row_odd"><div class="td_row_odd">Serial number of ONU, Unique for each ONU.</div></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody>
|
||||||
143
ponmngr/docs/guide/quickstart.md
Normal file
143
ponmngr/docs/guide/quickstart.md
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
# Function Specification
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This will be a short description of how to setup ONU and enable ANI.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
ponmngr UCI Config
|
||||||
|
|
||||||
|
```
|
||||||
|
config ani 'ani'
|
||||||
|
option enable '1'
|
||||||
|
option serial_number 'IOPS18000001'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
* `serial_number` is the unique for each ONU, In case `serial_number` has not
|
||||||
|
* been set from production in that case `serial_number` is calculated using
|
||||||
|
* the combination of vendor "IOPS" and last 4 octet of device mac address.
|
||||||
|
* same serial number should avaibale in OLT for the corresponding ONU profile
|
||||||
|
|
||||||
|
After ubus starts the xpon methods can be invoked to get the status
|
||||||
|
|
||||||
|
For all available status the command can be used without parameters, such as
|
||||||
|
|
||||||
|
```
|
||||||
|
root@iopsys:~# ubus call xpon status
|
||||||
|
{
|
||||||
|
"ONU": [
|
||||||
|
{
|
||||||
|
"Enable": true,
|
||||||
|
"Version": "",
|
||||||
|
"EquipmentID": "BVM4K00BRA",
|
||||||
|
"softwareImage": [
|
||||||
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"Version": "7.2.0alpha0-5",
|
||||||
|
"IsValid": true,
|
||||||
|
"IsActive": false,
|
||||||
|
"IsCommitted": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 1,
|
||||||
|
"Version": "7.2.0alpha0-5",
|
||||||
|
"IsValid": true,
|
||||||
|
"IsActive": true,
|
||||||
|
"IsCommitted": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"EthernetUNI": [
|
||||||
|
{
|
||||||
|
"Enable": true,
|
||||||
|
"Status": "UP",
|
||||||
|
"ANIs": "gpon0.0",
|
||||||
|
"InterDomainID": "(VEIP,1025)",
|
||||||
|
"InterDomainName": "VEIP",
|
||||||
|
"Stats": {
|
||||||
|
"BytesSent": 39891,
|
||||||
|
"BytesReceived": 50296,
|
||||||
|
"PacketsSent": 314,
|
||||||
|
"PacketsReceived": 384
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Enable": true,
|
||||||
|
"Status": "UP",
|
||||||
|
"ANIs": "gpon0.0",
|
||||||
|
"InterDomainID": "(VEIP,1025)",
|
||||||
|
"InterDomainName": "VEIP",
|
||||||
|
"Stats": {
|
||||||
|
"BytesSent": 54499,
|
||||||
|
"BytesReceived": 47908,
|
||||||
|
"PacketsSent": 286,
|
||||||
|
"PacketsReceived": 273
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Enable": false,
|
||||||
|
"Status": "DOWN",
|
||||||
|
"ANIs": "gpon0.0",
|
||||||
|
"InterDomainID": "(VEIP,1025)",
|
||||||
|
"InterDomainName": "VEIP",
|
||||||
|
"Stats": {
|
||||||
|
"BytesSent": 0,
|
||||||
|
"BytesReceived": 0,
|
||||||
|
"PacketsSent": 0,
|
||||||
|
"PacketsReceived": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Enable": false,
|
||||||
|
"Status": "DOWN",
|
||||||
|
"ANIs": "gpon0.0",
|
||||||
|
"InterDomainID": "(VEIP,1025)",
|
||||||
|
"InterDomainName": "VEIP",
|
||||||
|
"Stats": {
|
||||||
|
"BytesSent": 0,
|
||||||
|
"BytesReceived": 0,
|
||||||
|
"PacketsSent": 0,
|
||||||
|
"PacketsReceived": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ANI": [
|
||||||
|
{
|
||||||
|
"Enable": true,
|
||||||
|
"Status": "Up",
|
||||||
|
"PONMode": "GPON",
|
||||||
|
"Stats": {
|
||||||
|
"BytesSent": 228,
|
||||||
|
"BytesReceived": 408394,
|
||||||
|
"PacketsSent": 2,
|
||||||
|
"PacketsReceived": 2328
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Transceiver": [
|
||||||
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"Identifier": 3,
|
||||||
|
"ModuleVendor": "MENTECHOPTO",
|
||||||
|
"ModuleName": "MSOG22-LDCC-ACCO",
|
||||||
|
"ModuleVersion": "MNC221K90309",
|
||||||
|
"ModuleFirmwareVersion": "1.0",
|
||||||
|
"PONMode": "GPON",
|
||||||
|
"TxPower": 16,
|
||||||
|
"RxPower": -240,
|
||||||
|
"Voltage": 3300,
|
||||||
|
"Bias": 15744,
|
||||||
|
"Temperature": 270
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
UCI to invoke pon manager to enable status of ani, such as
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
25
ponmngr/docs/schemas/xpon_uci.json
Normal file
25
ponmngr/docs/schemas/xpon_uci.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"xpon":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"section": "ani",
|
||||||
|
"description": "xpon ani configuration",
|
||||||
|
"multi": "false",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"name": "enable",
|
||||||
|
"type": "boolean",
|
||||||
|
"required": "yes",
|
||||||
|
"default": "false",
|
||||||
|
"description": "ONU is enabled as pon functionality."
|
||||||
|
},{
|
||||||
|
"name": "serial_number",
|
||||||
|
"type": "string",
|
||||||
|
"required": "yes",
|
||||||
|
"default": null,
|
||||||
|
"description": "Serial number of ONU, Unique for each ONU."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -10,6 +10,9 @@ set_serial_number() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init_xpon() {
|
init_xpon() {
|
||||||
|
# don't start pon daemons if xpon module is not loaded
|
||||||
|
[ -d /sys/module/xpon ] || return
|
||||||
|
|
||||||
procd_open_instance ponmgr_cfg
|
procd_open_instance ponmgr_cfg
|
||||||
procd_set_param command /userfs/bin/ponmgr_cfg
|
procd_set_param command /userfs/bin/ponmgr_cfg
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
|
|||||||
@@ -9,14 +9,16 @@ USE_PROCD=1
|
|||||||
include /lib/xpon
|
include /lib/xpon
|
||||||
|
|
||||||
configure_serial_number() {
|
configure_serial_number() {
|
||||||
|
# serial number generation is taken care in the uci defaults, so if
|
||||||
|
# serial number is not found here its a misconfig
|
||||||
serial_number="$(uci -q get xpon.ani.serial_number)"
|
serial_number="$(uci -q get xpon.ani.serial_number)"
|
||||||
if [ ${#serial_number} -eq 12 ]; then
|
if [ ${#serial_number} -eq 12 ]; then
|
||||||
vendor_id="${serial_number:0:4}"
|
vendor_id="${serial_number:0:4}"
|
||||||
vssn="${serial_number:4:8}"
|
vssn="${serial_number:4:8}"
|
||||||
else
|
else
|
||||||
macaddr="$(fw_printenv -n ethaddr | tr -d ':' | tr 'a-z' 'A-Z')"
|
logger -s -t "xpon" "Serial number not found in uci, ont will probably not be registered at the olt"
|
||||||
vendor_id="IOPS"
|
logger -s -t "xpon" "Please configure a valid serial number"
|
||||||
vssn="${macaddr:4:8}"
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set_serial_number $vendor_id $vssn
|
set_serial_number $vendor_id $vssn
|
||||||
|
|||||||
@@ -1,17 +1,34 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
configure_serial_number() {
|
||||||
|
# check if serial number is present in the production data
|
||||||
|
production_sn="$(fw_printenv -n gponsn)"
|
||||||
|
if [ ${#production_sn} -eq 12 ]; then
|
||||||
|
uci set xpon.ani.serial_number=$production_sn
|
||||||
|
else
|
||||||
|
macaddr="$(fw_printenv -n ethaddr | tr -d ':' | tr 'a-z' 'A-Z')"
|
||||||
|
vendor_id="IOPS"
|
||||||
|
vssn="${macaddr:4:8}"
|
||||||
|
uci set xpon.ani.serial_number=$vendor_id$vssn
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ -s "/etc/config/xpon" ]; then
|
if [ -s "/etc/config/xpon" ]; then
|
||||||
if uci -q get xpon.ani >/dev/null; then
|
if uci -q get xpon.ani >/dev/null; then
|
||||||
# return if there is any valid content
|
# generate serial number in case its not present and return
|
||||||
|
serial_number="$(uci -q get xpon.ani.serial_number)"
|
||||||
|
if [ ${#serial_number} -ne 12 ]; then
|
||||||
|
configure_serial_number
|
||||||
|
fi
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
rm -f /etc/config/xpon
|
rm -f /etc/config/xpon
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
touch /etc/config/xpon
|
touch /etc/config/xpon
|
||||||
|
|
||||||
|
|
||||||
uci set xpon.ani=ani
|
uci set xpon.ani=ani
|
||||||
uci set xpon.ani.enable="1"
|
uci set xpon.ani.enable="1"
|
||||||
|
configure_serial_number
|
||||||
uci commit xpon
|
|
||||||
|
|||||||
936
ponmngr/files/etc/bbfdm/json/xpon.json
Normal file
936
ponmngr/files/etc/bbfdm/json/xpon.json
Normal file
@@ -0,0 +1,936 @@
|
|||||||
|
{
|
||||||
|
"json_plugin_version": 1,
|
||||||
|
"Device.XPON.": {
|
||||||
|
"type": "object",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": false,
|
||||||
|
"dependency": "file:/etc/config/xpon",
|
||||||
|
"ONUNumberOfEntries": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU.@Count"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Device.XPON.ONU.{i}.": {
|
||||||
|
"type": "object",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": true,
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Enable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "boolean",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Enable"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Version": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"range": [
|
||||||
|
{
|
||||||
|
"max": 14
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Version"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"EquipmentID": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"range": [
|
||||||
|
{
|
||||||
|
"max": 20
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "EquipmentID"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SoftwareImageNumberOfEntries": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU[@index].softwareImage.@Count"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"EthernetUNINumberOfEntries": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU[@index].EthernetUNI.@Count"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ANINumberOfEntries": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU[@index].ANI.@Count"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TransceiverNumberOfEntries": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU[@index].Transceiver.@Count"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Device.XPON.ONU.{i}.SoftwareImage.{i}.": {
|
||||||
|
"type": "object",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": true,
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU[@index].softwareImage"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ID": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"range": [
|
||||||
|
{
|
||||||
|
"min": 0,
|
||||||
|
"max": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "ID"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Version": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"range": [
|
||||||
|
{
|
||||||
|
"max": 14
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Version"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"IsCommitted": {
|
||||||
|
"type": "boolean",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "boolean",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "IsCommitted"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"IsActive": {
|
||||||
|
"type": "boolean",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "boolean",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "IsActive"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"IsValid": {
|
||||||
|
"type": "boolean",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "boolean",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "IsValid"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Device.XPON.ONU.{i}.EthernetUNI.{i}.": {
|
||||||
|
"type": "object",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": true,
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU[@index].EthernetUNI"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Enable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "boolean",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Enable"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Status": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"enumerations": [
|
||||||
|
"Up",
|
||||||
|
"Down",
|
||||||
|
"unknown",
|
||||||
|
"Dormant",
|
||||||
|
"NotPresent",
|
||||||
|
"LowerLayerDown",
|
||||||
|
"Error"
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Status"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ANIs": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"range": [
|
||||||
|
{
|
||||||
|
"max": 1024
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "ANIs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"InterdomainID": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"range": [
|
||||||
|
{
|
||||||
|
"max": 256
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "InterDomainID"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"InterdomainName": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"range": [
|
||||||
|
{
|
||||||
|
"max": 25
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "InterDomainName"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Device.XPON.ONU.{i}.EthernetUNI.{i}.Stats.": {
|
||||||
|
"type": "object",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": false,
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"BytesSent": {
|
||||||
|
"type": "unsignedLong",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedLong",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats.BytesSent"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"BytesReceived": {
|
||||||
|
"type": "unsignedLong",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedLong",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats.BytesReceived"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PacketsSent": {
|
||||||
|
"type": "unsignedLong",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedLong",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats.PacketsSent"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PacketsReceived": {
|
||||||
|
"type": "unsignedLong",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedLong",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats.PacketsReceived"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Device.XPON.ONU.{i}.ANI.{i}.": {
|
||||||
|
"type": "object",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": true,
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU[@index].ANI"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Enable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"read": true,
|
||||||
|
"write": true,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "boolean",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"rpc": "get",
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Enable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rpc": "set",
|
||||||
|
"type": "uci",
|
||||||
|
"uci": {
|
||||||
|
"file": "xpon",
|
||||||
|
"section": {
|
||||||
|
"name": "ani"
|
||||||
|
},
|
||||||
|
"option": {
|
||||||
|
"name": "enable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Status": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"enumerations": [
|
||||||
|
"Up",
|
||||||
|
"Down",
|
||||||
|
"Dormant",
|
||||||
|
"Unknown",
|
||||||
|
"NotPresent",
|
||||||
|
"Error"
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Status"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PONMode": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"enumerations": [
|
||||||
|
"GPON",
|
||||||
|
"XG-PON",
|
||||||
|
"NG-PON2",
|
||||||
|
"XGS-PON"
|
||||||
|
],
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "PONMode"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Device.XPON.ONU.{i}.ANI.{i}.Stats.": {
|
||||||
|
"type": "object",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": false,
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"BytesSent": {
|
||||||
|
"type": "unsignedLong",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedLong",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats.BytesSent"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"BytesReceived": {
|
||||||
|
"type": "unsignedLong",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedLong",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats.BytesReceived"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PacketsSent": {
|
||||||
|
"type": "unsignedLong",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedLong",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats.PacketsSent"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PacketsReceived": {
|
||||||
|
"type": "unsignedLong",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedLong",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Stats.PacketsReceived"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Device.XPON.ONU.{i}.Transceiver.{i}.": {
|
||||||
|
"type": "object",
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"access": false,
|
||||||
|
"array": true,
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"type": "ubus",
|
||||||
|
"ubus": {
|
||||||
|
"object": "xpon",
|
||||||
|
"method": "status",
|
||||||
|
"args": {},
|
||||||
|
"key": "ONU[@index].Transceiver"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ID": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "ID"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Identifier": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Identifier"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ModuleVendor": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "ModuleVendor"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ModuleName": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "ModuleName"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ModuleVersion": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "ModuleVersion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ModuleFirmwareVersion": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "ModuleFirmwareVersion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PONMode": {
|
||||||
|
"type": "string",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "string",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "PONMode"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"RxPower": {
|
||||||
|
"type": "int",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "int",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "RxPower"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TxPower": {
|
||||||
|
"type": "int",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "int",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "TxPower"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Voltage": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Voltage"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Bias": {
|
||||||
|
"type": "unsignedInt",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "unsignedInt",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Bias"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Temperature": {
|
||||||
|
"type": "int",
|
||||||
|
"read": true,
|
||||||
|
"write": false,
|
||||||
|
"protocols": [
|
||||||
|
"cwmp",
|
||||||
|
"usp"
|
||||||
|
],
|
||||||
|
"datatype": "int",
|
||||||
|
"mapping": [
|
||||||
|
{
|
||||||
|
"data": "@Parent",
|
||||||
|
"type": "json",
|
||||||
|
"key": "Temperature"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
300
ponmngr/xpon_ubus.json
Normal file
300
ponmngr/xpon_ubus.json
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
|
"$id": "http://example.com/root.json",
|
||||||
|
"type": "object",
|
||||||
|
"title": "xpon",
|
||||||
|
"object": "xpon",
|
||||||
|
"properties": {
|
||||||
|
"status": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"output": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ONU": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"Enable",
|
||||||
|
"Version",
|
||||||
|
"EquipmentID",
|
||||||
|
"SoftwareImage",
|
||||||
|
"EthernetUNI",
|
||||||
|
"ANI",
|
||||||
|
"Transceiver"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Enable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false"
|
||||||
|
},
|
||||||
|
"Version": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"EquipmentID": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
"maxLength": 20
|
||||||
|
},
|
||||||
|
"SoftwareImage": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"ID",
|
||||||
|
"Version",
|
||||||
|
"IsCommitted",
|
||||||
|
"IsActive",
|
||||||
|
"IsValid"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ID": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 1
|
||||||
|
},
|
||||||
|
"Version": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
"maxLength": 14,
|
||||||
|
"default": "7.2_BETA2"
|
||||||
|
},
|
||||||
|
"IsCommitted": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false"
|
||||||
|
},
|
||||||
|
"IsActive": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false"
|
||||||
|
},
|
||||||
|
"IsValid": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"EthernetUNI": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"Enable",
|
||||||
|
"Status",
|
||||||
|
"ANIs",
|
||||||
|
"InterdomainID",
|
||||||
|
"InterdomainName",
|
||||||
|
"Stats"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Enable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false"
|
||||||
|
},
|
||||||
|
"Status": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"Up",
|
||||||
|
"Down",
|
||||||
|
"unknown",
|
||||||
|
"Dormant",
|
||||||
|
"NotPresent",
|
||||||
|
"LowerLayerDown",
|
||||||
|
"Error"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ANIs": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
"maxLength": 1024,
|
||||||
|
"pattern": "gpon[0-9]\\.[0-9]"
|
||||||
|
},
|
||||||
|
"InterdomainID": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
"maxLength": 256,
|
||||||
|
"pattern": "(VEIP|PPTPEthernetUNI),(1025|257)"
|
||||||
|
},
|
||||||
|
"InterdomainName": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
"maxLength": 25,
|
||||||
|
"default": "VEIP"
|
||||||
|
},
|
||||||
|
"Stats": {
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"BytesSent",
|
||||||
|
"BytesReceived",
|
||||||
|
"PacketsSent",
|
||||||
|
"PacketsReceived"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"BytesSent": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"BytesReceived": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"PacketsSent": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"PacketsReceived": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ANI": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"Enable",
|
||||||
|
"Status",
|
||||||
|
"PONMode",
|
||||||
|
"Stats"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Enable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false"
|
||||||
|
},
|
||||||
|
"Status": {
|
||||||
|
"type": "string",
|
||||||
|
"enum":[
|
||||||
|
"Up",
|
||||||
|
"Down",
|
||||||
|
"Dormant",
|
||||||
|
"Unknown",
|
||||||
|
"NotPresent",
|
||||||
|
"Error"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PONMode": {
|
||||||
|
"type": "string",
|
||||||
|
"enum":[
|
||||||
|
"GPON",
|
||||||
|
"XG-PON",
|
||||||
|
"NG-PON2",
|
||||||
|
"XGS-PON"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Stats": {
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"BytesSent",
|
||||||
|
"BytesReceived",
|
||||||
|
"PacketsSent",
|
||||||
|
"PacketsReceived"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"BytesSent": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"BytesReceived": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"PacketsSent": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"PacketsReceived": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Transceiver": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"ID",
|
||||||
|
"Identifier",
|
||||||
|
"ModuleVendor",
|
||||||
|
"ModuleName",
|
||||||
|
"ModuleVersion",
|
||||||
|
"ModuleFirmwareVersion",
|
||||||
|
"PONMode",
|
||||||
|
"RxPower",
|
||||||
|
"TxPower",
|
||||||
|
"Voltage",
|
||||||
|
"Bias",
|
||||||
|
"Temperature"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ID": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"Identier": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"ModuleVendor": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"ModuleName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"ModuleVersion": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"ModuleFirmwareVersion": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"PONMode": {
|
||||||
|
"type": "string",
|
||||||
|
"enum":[
|
||||||
|
"GPON",
|
||||||
|
"XG-PON",
|
||||||
|
"NG-PON2",
|
||||||
|
"XGS-PON"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"RxPower": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"TxPower": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"Voltage": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"Bias": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"Temperature": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=port-management
|
|
||||||
PKG_VERSION:=1.1.0
|
|
||||||
PKG_RELEASE:=1
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
|
||||||
PKG_LICENSE:=GPL-2.0-only
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
define Package/port-management
|
|
||||||
CATEGORY:=Utilities
|
|
||||||
TITLE:=Port management tool
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/port-management/description
|
|
||||||
Port configuration utility
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
mkdir -p $(PKG_BUILD_DIR)
|
|
||||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Compile
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/port-management/install
|
|
||||||
$(CP) ./files/* $(1)/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,port-management))
|
|
||||||
@@ -27,7 +27,7 @@ define Package/qosmngr
|
|||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
TITLE:=QoS Manager
|
TITLE:=QoS Manager
|
||||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet) +libuci +libubox +libubus +libblobmsg-json +libjson-c +libqos
|
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libqos +!(TARGET_brcmbca||TARGET_airoha):tc-full
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/qosmngr/description
|
define Package/qosmngr/description
|
||||||
@@ -41,8 +41,14 @@ endef
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
define Package/qosmngr/install
|
define Package/qosmngr/install
|
||||||
$(CP) ./files/* $(1)/
|
$(CP) ./files/common/* $(1)/
|
||||||
$(INSTALL_DIR) $(1)/usr
|
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||||
|
$(CP) ./files/broadcom/* $(1)/
|
||||||
|
else ifneq ($(CONFIG_TARGET_airoha),)
|
||||||
|
$(CP) ./files/airoha/* $(1)/
|
||||||
|
else
|
||||||
|
$(CP) ./files/linux/* $(1)/
|
||||||
|
endif
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/qosmngr $(1)/usr/sbin
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/qosmngr $(1)/usr/sbin
|
||||||
endef
|
endef
|
||||||
|
|||||||
64
qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate
Normal file
64
qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||||
|
|
||||||
|
populate_no_of_queue(){
|
||||||
|
queue_num=4
|
||||||
|
|
||||||
|
# writing no. of queue per port into file and read on classify generate
|
||||||
|
if [ ! -d "/tmp/qos" ]; then
|
||||||
|
mkdir -p "/tmp/qos"
|
||||||
|
fi
|
||||||
|
no_queue_file="/tmp/qos/no_queue_per_port"
|
||||||
|
touch "$no_queue_file"
|
||||||
|
echo $queue_num >"$no_queue_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_queue(){
|
||||||
|
section="$1"
|
||||||
|
|
||||||
|
config_get ifname "$section" "ifname"
|
||||||
|
|
||||||
|
if [ "$ifname" != "$ethwan" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# guaranteed number of queues
|
||||||
|
no_of_q="0 1 2 3"
|
||||||
|
|
||||||
|
i=0
|
||||||
|
local total_q=$((${no_of_q##* } + 1))
|
||||||
|
for i in $no_of_q; do
|
||||||
|
order=$((total_q - i))
|
||||||
|
uci add qos queue
|
||||||
|
uci rename qos.@queue[-1]="q_${i}_${ifname}"
|
||||||
|
uci set qos.@queue[-1].enable="1"
|
||||||
|
uci set qos.@queue[-1].ifname="$ifname"
|
||||||
|
uci set qos.@queue[-1].precedence="$order"
|
||||||
|
uci set qos.@queue[-1].scheduling="SP"
|
||||||
|
uci set qos.@queue[-1].rate="0"
|
||||||
|
uci set qos.@queue[-1].burst_size="0"
|
||||||
|
uci set qos.@queue[-1].weight="1"
|
||||||
|
done
|
||||||
|
|
||||||
|
uci commit qos
|
||||||
|
}
|
||||||
|
|
||||||
|
populate_no_of_queue
|
||||||
|
|
||||||
|
if [ -s "/etc/config/qos" ]; then
|
||||||
|
if uci -q get qos.@queue[0] >/dev/null; then
|
||||||
|
# return if there is any valid content
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
rm -f /etc/config/qos
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
touch /etc/config/qos
|
||||||
|
|
||||||
|
# generate qos queue config
|
||||||
|
config_load ports
|
||||||
|
config_foreach generate_queue ethport
|
||||||
|
|
||||||
190
qosmngr/files/airoha/lib/qos/airoha.sh
Executable file
190
qosmngr/files/airoha/lib/qos/airoha.sh
Executable file
@@ -0,0 +1,190 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Implementation of QoS setup for Econet platform.
|
||||||
|
|
||||||
|
errmsg() {
|
||||||
|
echo "$@" >&2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
get_var() {
|
||||||
|
local varname="$1"
|
||||||
|
eval echo \$\{${varname}\}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Initialized queues
|
||||||
|
# (Not needed on Econet)
|
||||||
|
hw_queue_init_all() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Initialize all interfaces
|
||||||
|
# (Not needed on Econet)
|
||||||
|
hw_intf_init() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Initialize the hardware setup library
|
||||||
|
hw_init_all() {
|
||||||
|
export TMP_HW_QUEUE_LIST=""
|
||||||
|
export TMP_HW_QUEUE_MASK="0"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remember selected queue options. They will be committed
|
||||||
|
# during hw_commit_all()
|
||||||
|
hw_queue_set() {
|
||||||
|
local ifname="$1"
|
||||||
|
local q_count="$2"
|
||||||
|
local order="$3"
|
||||||
|
local qsize="$4"
|
||||||
|
local wgt="$5"
|
||||||
|
local sc_alg="$6"
|
||||||
|
local rate="$7"
|
||||||
|
local burstsize="$8"
|
||||||
|
local index="$((order - 1))"
|
||||||
|
local ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||||
|
|
||||||
|
#if [ "${ifname}" != "${ethwan}" ] ; then
|
||||||
|
# return 2
|
||||||
|
#fi
|
||||||
|
|
||||||
|
export TMP_HW_QUEUE_${order}_no="${q_count}"
|
||||||
|
export TMP_HW_QUEUE_${order}_ifname="${ifname}"
|
||||||
|
export TMP_HW_QUEUE_${order}_order="${order}"
|
||||||
|
export TMP_HW_QUEUE_${order}_qsize="${qsize}"
|
||||||
|
export TMP_HW_QUEUE_${order}_wgt="${wgt}"
|
||||||
|
export TMP_HW_QUEUE_${order}_sc_alg="${sc_alg}"
|
||||||
|
export TMP_HW_QUEUE_${order}_rate="${rate}"
|
||||||
|
export TMP_HW_QUEUE_${order}_burstsize="${burstsize}"
|
||||||
|
export TMP_HW_QUEUE_LIST="${TMP_HW_QUEUE_LIST} ${order}"
|
||||||
|
export TMP_HW_QUEUE_MASK="$((TMP_HW_QUEUE_MASK | 1 << index))"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set policer options. In fact, they are not supported.
|
||||||
|
hw_policer_set() {
|
||||||
|
local action="$1"
|
||||||
|
local dir="$2"
|
||||||
|
local policer_no="$3"
|
||||||
|
|
||||||
|
shift 3
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
|
add)
|
||||||
|
meter="$1"
|
||||||
|
cir="$2"
|
||||||
|
cbs="$3"
|
||||||
|
ebs="$4"
|
||||||
|
pir="$5"
|
||||||
|
pbs="$6"
|
||||||
|
|
||||||
|
;;
|
||||||
|
del)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
errmsg "Policer (action $action, direction $dir) is not implemented"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set ingress rate. In fact, it is not supported
|
||||||
|
hw_policer_set_ingress_rate() {
|
||||||
|
local ifname="$1"
|
||||||
|
local ingress_rate="$2"
|
||||||
|
local in_burst_size="$3"
|
||||||
|
|
||||||
|
errmsg "Policer (action set_ingress_rate) is not implemented"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure shaper rate that will be committed during hw_commit_all()
|
||||||
|
hw_shaper_set() {
|
||||||
|
local ifname="$1"
|
||||||
|
local action="$2"
|
||||||
|
local rate="$3"
|
||||||
|
local burstsize="$4"
|
||||||
|
|
||||||
|
case "${action}" in
|
||||||
|
add)
|
||||||
|
export TMP_HW_SHAPE_RATE="$rate"
|
||||||
|
export TMP_HW_SHAPE_BURSTSIZE="$burstsize"
|
||||||
|
;;
|
||||||
|
del)
|
||||||
|
export TMP_HW_SHAPE_RATE=""
|
||||||
|
export TMP_HW_SHAPE_BURSTSIZE=""
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Convert shaper in UCI terms to Econet terms
|
||||||
|
hw_sc_alg2str() {
|
||||||
|
local sc_alg="$1"
|
||||||
|
|
||||||
|
case "${sc_alg}" in
|
||||||
|
SP)
|
||||||
|
echo "PQ"
|
||||||
|
;;
|
||||||
|
WRR)
|
||||||
|
echo "WRR"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo ""
|
||||||
|
return 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Commit all options preserved during
|
||||||
|
hw_commit_all() {
|
||||||
|
local sorted_list="$(echo $TMP_HW_QUEUE_LIST | tr ' ' '\n' | sort | xargs)"
|
||||||
|
local weight_list=""
|
||||||
|
local glob_alg=""
|
||||||
|
local shape_rate="$TMP_HW_SHAPE_RATE"
|
||||||
|
local queue_mask="$TMP_HW_QUEUE_MASK"
|
||||||
|
local q_count="0"
|
||||||
|
|
||||||
|
# Reorder queues
|
||||||
|
for q in ${sorted_list} ; do
|
||||||
|
local sc_alg="$(get_var TMP_HW_QUEUE_${q}_sc_alg)"
|
||||||
|
local wgt="$(get_var TMP_HW_QUEUE_${q}_wgt)"
|
||||||
|
|
||||||
|
if [ "$glob_alg" != "" ] && [ "$sc_alg" != "$glob_alg" ] ; then
|
||||||
|
errmsg "Not matching scheduling algorithm: $sc_alg vs $glob_alg"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
glob_alg="$sc_alg"
|
||||||
|
|
||||||
|
case "${sc_alg}" in
|
||||||
|
WRR)
|
||||||
|
if [ $(($q_count >= 4)) != 0 ] ; then
|
||||||
|
errmsg "Too many queues, next queues will be ignored"
|
||||||
|
else
|
||||||
|
weight_list="$weight_list $wgt"
|
||||||
|
fi
|
||||||
|
q_count=$((q_count + 1))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${glob_alg}" == "WRR" ] ; then
|
||||||
|
while [ $((q_count < 4)) != 0 ] ; do
|
||||||
|
weight_list="$weight_list 1"
|
||||||
|
q_count=$((q_count + 1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${glob_alg}" != "" ] ; then
|
||||||
|
/userfs/bin/qosrule discpline $(hw_sc_alg2str ${glob_alg}) ${weight_list} \
|
||||||
|
uplink-bandwidth ${shape_rate:-0} \
|
||||||
|
queuemask $queue_mask
|
||||||
|
else
|
||||||
|
/userfs/bin/qosrule discpline Enable 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
453
qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh
Executable file
453
qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh
Executable file
@@ -0,0 +1,453 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Install ebtables rules
|
||||||
|
|
||||||
|
BR_RULE=""
|
||||||
|
BR6_RULE=""
|
||||||
|
|
||||||
|
init_broute_rule() {
|
||||||
|
BR_RULE=""
|
||||||
|
BR6_RULE=""
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_filter_on_src_if() {
|
||||||
|
BR_RULE="$BR_RULE --in-if $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_filter_on_src_mac() {
|
||||||
|
BR_RULE="$BR_RULE --src $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_filter_on_dst_mac() {
|
||||||
|
BR_RULE="$BR_RULE --dst $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_filter_on_pcp() {
|
||||||
|
case "$BR_RULE" in
|
||||||
|
*proto*)
|
||||||
|
BR_RULE="$BR_RULE --vlan-prio $1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
BR_RULE="$BR_RULE --proto 802_1Q --vlan-prio $1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_filter_on_ether_type() {
|
||||||
|
BR_RULE="$BR_RULE --proto $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_filter_on_ether_type6() {
|
||||||
|
BR6_RULE="$BR6_RULE --proto IPv6"
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_src_ip() {
|
||||||
|
BR_RULE="$BR_RULE --ip-src $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_dst_ip() {
|
||||||
|
BR_RULE="$BR_RULE --ip-dst $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ipv6_src_ip() {
|
||||||
|
BR_RULE="$BR_RULE --ip6-src $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ipv6_dst_ip() {
|
||||||
|
BR_RULE="$BR_RULE --ip6-dst $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ip_src_port() {
|
||||||
|
BR_RULE="$BR_RULE --ip-source-port $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ip_dst_port() {
|
||||||
|
BR_RULE="$BR_RULE --ip-destination-port $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ipv6_src_port() {
|
||||||
|
if [ -n "$BR6_RULE" ]; then
|
||||||
|
BR6_RULE="$BR6_RULE --ip6-source-port $1"
|
||||||
|
else
|
||||||
|
BR_RULE="$BR_RULE --ip6-source-port $1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ipv6_dst_port() {
|
||||||
|
if [ -n "$BR6_RULE" ]; then
|
||||||
|
BR6_RULE="$BR6_RULE --ip6-destination-port $1"
|
||||||
|
else
|
||||||
|
BR_RULE="$BR_RULE --ip6-destination-port $1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ip_protocol() {
|
||||||
|
BR_RULE="$BR_RULE --ip-proto $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ipv6_protocol() {
|
||||||
|
if [ -n "$BR6_RULE" ]; then
|
||||||
|
BR6_RULE="$BR6_RULE --ip6-proto $1"
|
||||||
|
else
|
||||||
|
BR_RULE="$BR_RULE --ip6-proto $1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ebt_match_ipv6_dscp() {
|
||||||
|
if [ -n "$BR6_RULE" ]; then
|
||||||
|
BR6_RULE="$BR6_RULE --ip6-tclass $1"
|
||||||
|
else
|
||||||
|
BR_RULE="$BR_RULE --ip6-tclass $1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_filter_on_vid() {
|
||||||
|
|
||||||
|
if [ -z "$1" ] || [ "$1" -lt 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$BR_RULE" in
|
||||||
|
*proto*)
|
||||||
|
BR_RULE="$BR_RULE --vlan-id $1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
BR_RULE="$BR_RULE --proto 802_1Q --vlan-id $1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_rule_set_traffic_class() {
|
||||||
|
BR_RULE="$BR_RULE -j mark --mark-or 0x$1 --mark-target ACCEPT"
|
||||||
|
if [ -n "$BR6_RULE" ]; then
|
||||||
|
BR6_RULE="$BR6_RULE -j mark --mark-or 0x$1 --mark-target ACCEPT"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_append_rule() {
|
||||||
|
echo "ebtables -t broute -A qos $BR_RULE" >> /tmp/qos/classify.ebtables
|
||||||
|
if [ -n "$BR6_RULE" ]; then
|
||||||
|
echo "ebtables -t broute -A qos $BR6_RULE" >> /tmp/qos/classify.ebtables
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_ip_addr()
|
||||||
|
{
|
||||||
|
local cid="$1"
|
||||||
|
local match_src_ip_func="$2"
|
||||||
|
local match_dst_ip_func="$3"
|
||||||
|
|
||||||
|
config_get src_ip "$cid" "src_ip"
|
||||||
|
config_get dst_ip "$cid" "dest_ip"
|
||||||
|
|
||||||
|
if [ -n "$src_ip" ]; then
|
||||||
|
$match_src_ip_func "$src_ip"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$dst_ip" ]; then
|
||||||
|
$match_dst_ip_func "$dst_ip"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_ports()
|
||||||
|
{
|
||||||
|
local cid="$1"
|
||||||
|
local match_src_port_func="$2"
|
||||||
|
local match_dst_port_func="$3"
|
||||||
|
local src_port=""
|
||||||
|
local dst_port=""
|
||||||
|
local src_port_range=""
|
||||||
|
local dst_port_range=""
|
||||||
|
|
||||||
|
config_get src_port "$cid" "src_port"
|
||||||
|
config_get dst_port "$cid" "dest_port"
|
||||||
|
config_get src_port_range "$cid" "src_port_range"
|
||||||
|
config_get dst_port_range "$cid" "dest_port_range"
|
||||||
|
|
||||||
|
if [ -n "$src_port" ] && [ -n "$src_port_range" ] ; then
|
||||||
|
$match_src_port_func "$src_port:$src_port_range"
|
||||||
|
elif [ -n "$src_port" ] ; then
|
||||||
|
$match_src_port_func "$src_port"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$dst_port" ] && [ -n "$dst_port_range" ] ; then
|
||||||
|
$match_dst_port_func "$dst_port:$dst_port_range"
|
||||||
|
elif [ -n "$dst_port" ] ; then
|
||||||
|
$match_dst_port_func "$dst_port"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol_string_to_num()
|
||||||
|
{
|
||||||
|
local value="-1"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
*[0-9]*)
|
||||||
|
value="$1"
|
||||||
|
;;
|
||||||
|
TCP|tcp)
|
||||||
|
value=6
|
||||||
|
;;
|
||||||
|
UDP|udp)
|
||||||
|
value=17
|
||||||
|
;;
|
||||||
|
ICMP|icmp)
|
||||||
|
value=1
|
||||||
|
;;
|
||||||
|
ICMPv6|icmpv6)
|
||||||
|
value=58
|
||||||
|
;;
|
||||||
|
IGMP|igmp)
|
||||||
|
value=2
|
||||||
|
;;
|
||||||
|
SCTP|sctp)
|
||||||
|
value=132
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
value=-1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo $value
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_ipv4_rule_options()
|
||||||
|
{
|
||||||
|
local cid="$1"
|
||||||
|
config_get protocol "$cid" "proto"
|
||||||
|
config_get dscp_filter "$cid" "dscp_filter"
|
||||||
|
|
||||||
|
set_ip_addr "$cid" ebt_match_src_ip ebt_match_dst_ip
|
||||||
|
|
||||||
|
if [ -n "$dscp_filter" ]; then
|
||||||
|
echo "DSCP filter is not supporter"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$protocol" ]; then
|
||||||
|
local proto_num="$(protocol_string_to_num "$protocol")"
|
||||||
|
ebt_match_ip_protocol "$proto_num"
|
||||||
|
|
||||||
|
if [ "$proto_num" == "6" ] || [ "$proto_num" == "17" ] || [ "$proto_num" = "132" ] ; then
|
||||||
|
set_ports "$cid" ebt_match_ip_src_port ebt_match_ip_dst_port
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
broute_ipv6_rule_options()
|
||||||
|
{
|
||||||
|
local cid="$1"
|
||||||
|
|
||||||
|
config_get protocol "$cid" "proto"
|
||||||
|
config_get dscp_filter "$cid" "dscp_filter"
|
||||||
|
|
||||||
|
set_ip_addr "$cid" ebt_match_ipv6_src_ip ebt_match_ipv6_dst_ip
|
||||||
|
|
||||||
|
if [ -n "$dscp_filter" ]; then
|
||||||
|
local tos_val
|
||||||
|
local tos_hex
|
||||||
|
|
||||||
|
tos_val=$((dscp_filter<<2))
|
||||||
|
tos_hex=$(printf "%x" $tos_val)
|
||||||
|
ebt_match_ipv6_dscp "$tos_hex"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$protocol" ]; then
|
||||||
|
local proto_num="$(protocol_string_to_num "$protocol")"
|
||||||
|
ebt_match_ipv6_protocol "$proto_num"
|
||||||
|
|
||||||
|
if [ "$proto_num" = "6" ] || [ "$proto_num" = "17" ] || [ "$proto_num" = "132" ] ; then
|
||||||
|
set_ports "$cid" ebt_match_ipv6_src_port ebt_match_ipv6_dst_port
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_ebtables_rules() {
|
||||||
|
local sid="$1"
|
||||||
|
local is_l2_rule=0
|
||||||
|
local src_dhcp_options=""
|
||||||
|
local dst_dhcp_options=""
|
||||||
|
local protocol=""
|
||||||
|
local ip_version=""
|
||||||
|
|
||||||
|
init_broute_rule
|
||||||
|
|
||||||
|
config_get src_if "$sid" "ifname"
|
||||||
|
config_get src_mac "$sid" "src_mac"
|
||||||
|
config_get dst_mac "$sid" "dst_mac"
|
||||||
|
config_get dscp_filter "$sid" "dscp_filter"
|
||||||
|
config_get pcp_check "$sid" "pcp_check"
|
||||||
|
config_get eth_type "$sid" "ethertype"
|
||||||
|
config_get vid "$sid" "vid_check"
|
||||||
|
config_get dhcp_type "$sid" "dhcp_type" # dhcpv4 or v6
|
||||||
|
config_get src_vcid "$sid" "src_vendor_class_id" # dhcp option 60
|
||||||
|
config_get dst_vcid "$sid" "dst_vendor_class_id" # dhcp option 60
|
||||||
|
config_get src_clid "$sid" "src_client_id" # dhcp option 61
|
||||||
|
config_get dst_clid "$sid" "dst_client_id" # dhcp option 61
|
||||||
|
config_get src_ucid "$sid" "src_user_class_id" # dhcp option 77
|
||||||
|
config_get dst_ucid "$sid" "dst_user_class_id" # dhcp option 77
|
||||||
|
config_get traffic_class "$sid" "traffic_class"
|
||||||
|
config_get protocol "$sid" "proto"
|
||||||
|
|
||||||
|
if [ -n "$src_if" ]; then
|
||||||
|
for interf in $(db -q get hw.board.ethernetPortOrder); do
|
||||||
|
if [ "$src_if" == "$interf" ]; then
|
||||||
|
src_if="$src_if+"
|
||||||
|
broute_filter_on_src_if "$src_if"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$src_mac" ]; then
|
||||||
|
broute_filter_on_src_mac "$src_mac"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$dst_mac" ]; then
|
||||||
|
broute_filter_on_dst_mac "$dst_mac"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$pcp_check" ]; then
|
||||||
|
broute_filter_on_pcp "$pcp_check"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$eth_type" ]; then
|
||||||
|
broute_filter_on_ether_type "$eth_type"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$vid" ]; then
|
||||||
|
broute_filter_on_vid "$vid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $eth_type in
|
||||||
|
IPv4|IPV4|0800)
|
||||||
|
ip_version=4
|
||||||
|
;;
|
||||||
|
IPv6|IPV6|86DD)
|
||||||
|
ip_version=6
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -z "$eth_type" ]; then
|
||||||
|
case "$src_ip$dst_ip" in
|
||||||
|
*.*)
|
||||||
|
ip_version=4
|
||||||
|
broute_filter_on_ether_type "IPv4"
|
||||||
|
;;
|
||||||
|
*:*)
|
||||||
|
ip_version=6
|
||||||
|
broute_filter_on_ether_type "IPv6"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -n "$protocol" ] || [ -n "$dscp_filter" ]; then
|
||||||
|
# Neither ether_type nor ip address used,
|
||||||
|
# ethertype is not configured by user, so install
|
||||||
|
# both proto IPv4 and IPv6 rule (version 1)
|
||||||
|
ip_version=1
|
||||||
|
BR6_RULE="$BR_RULE"
|
||||||
|
broute_filter_on_ether_type "IPv4"
|
||||||
|
broute_filter_on_ether_type6 "IPv6"
|
||||||
|
fi
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "$ip_version" == "4" ] || [ "$ip_version" == "1" ]; then
|
||||||
|
broute_ipv4_rule_options "$sid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ip_version" == "6" ] || [ "$ip_version" == "1" ]; then
|
||||||
|
broute_ipv6_rule_options "$sid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# first process options that will help figure our source mac address
|
||||||
|
# dhcp option for "vendor class id"
|
||||||
|
if [ -n "$src_vcid" ]; then
|
||||||
|
src_dhcp_options="$src_dhcp_options vcid=$src_vcid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# dhcp option for "client id"
|
||||||
|
if [ -n "$src_clid" ]; then
|
||||||
|
src_dhcp_options="$src_dhcp_options clid=$src_clid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# dhcp option for "user class id"
|
||||||
|
if [ -n "$src_ucid" ]; then
|
||||||
|
src_dhcp_options="$src_dhcp_options ucid=$src_ucid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if src mac is already a classification criteria, then it
|
||||||
|
# does not really make sense to add it as a criteria to
|
||||||
|
# filter packets again based on source mac
|
||||||
|
if [ -n "$src_dhcp_options" ] && [ -z "$src_mac" ]; then
|
||||||
|
comp="$(grep -i "$src_dhcp_options" /tmp/dhcp.client.options)"
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
s_mac_add="$(echo $comp | head -n1 | awk '{print $1;}')"
|
||||||
|
if [ -n "$s_mac_add" ]; then
|
||||||
|
broute_filter_on_src_mac "$s_mac_add"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Now process options that will help figure our destination mac address
|
||||||
|
# dhcp option for "vendor class id"
|
||||||
|
if [ -n "$dst_vcid" ]; then
|
||||||
|
dst_dhcp_options="$dst_dhcp_options vcid=$dst_vcid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# dhcp option for "client id"
|
||||||
|
if [ -n "$dst_clid" ]; then
|
||||||
|
dst_dhcp_options="$dst_dhcp_options clid=$dst_clid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# dhcp option for "user class id"
|
||||||
|
if [ -n "$dst_ucid" ]; then
|
||||||
|
dst_dhcp_options="$dst_dhcp_options ucid=$dst_ucid"
|
||||||
|
is_l2_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if dst mac is already a classification criteria, then it
|
||||||
|
# does not really make sense to add it as a criteria to
|
||||||
|
# filter packets again based on destination mac
|
||||||
|
if [ -n "$dst_dhcp_options" ] && [ -z "$dst_mac" ] ; then
|
||||||
|
comp="$(grep -i "$dst_dhcp_options" /tmp/dhcp.client.options)"
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
d_mac_add="$(echo $comp | head -n1 | awk '{print $1;}')"
|
||||||
|
if [ -n "$d_mac_add" ]; then
|
||||||
|
broute_filter_on_dst_mac "$d_mac_add"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $is_l2_rule -eq 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$traffic_class" ] && broute_rule_set_traffic_class "$traffic_class"
|
||||||
|
|
||||||
|
[ -n "$BR_RULE" ] && broute_append_rule
|
||||||
|
}
|
||||||
|
|
||||||
|
create_ebtables_chains() {
|
||||||
|
ebtables -t broute -N qos
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -eq 0 ]; then
|
||||||
|
ebtables -t broute -I BROUTING -j qos
|
||||||
|
else
|
||||||
|
ebtables -t broute -D BROUTING -j qos
|
||||||
|
ebtables -t broute -I BROUTING -j qos
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
flush_ebtables_chains() {
|
||||||
|
echo "ebtables -t broute -F qos" > /tmp/qos/classify.ebtables
|
||||||
|
}
|
||||||
|
|
||||||
240
qosmngr/files/airoha/lib/qos/common/chains.iptables.sh
Executable file
240
qosmngr/files/airoha/lib/qos/common/chains.iptables.sh
Executable file
@@ -0,0 +1,240 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Install iptables rules
|
||||||
|
|
||||||
|
IP_RULE=""
|
||||||
|
|
||||||
|
init_iptables_rule() {
|
||||||
|
IP_RULE=""
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_intf() {
|
||||||
|
IP_RULE="$IP_RULE -i $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_proto() {
|
||||||
|
IP_RULE="$IP_RULE -p $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_ip_src() {
|
||||||
|
IP_RULE="$IP_RULE -s $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_ip_dest() {
|
||||||
|
IP_RULE="$IP_RULE -d $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_port_dest() {
|
||||||
|
IP_RULE="$IP_RULE --dport $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_port_src() {
|
||||||
|
IP_RULE="$IP_RULE --sport $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_port_dest_range() {
|
||||||
|
IP_RULE="$IP_RULE --dport $1:$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_port_src_range() {
|
||||||
|
IP_RULE="$IP_RULE --sport $1:$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_dscp_filter() {
|
||||||
|
IP_RULE="$IP_RULE -m dscp --dscp $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_ip_len_min() {
|
||||||
|
IP_RULE="$IP_RULE -m length --length $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_filter_ip_len_max() {
|
||||||
|
IP_RULE="$IP_RULE:$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_set_dscp_mark() {
|
||||||
|
IP_RULE="$IP_RULE -j DSCP --set-dscp $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
iptables_set_traffic_class() {
|
||||||
|
IP_RULE="$IP_RULE -j MARK --set-xmark 0x${1}0/0xF0"
|
||||||
|
}
|
||||||
|
|
||||||
|
append_rule_to_mangle_table() {
|
||||||
|
if [ "$2" == 4 ]; then
|
||||||
|
echo "iptables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.iptables
|
||||||
|
elif [ "$2" == 6 ]; then
|
||||||
|
echo "ip6tables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.ip6tables
|
||||||
|
elif [ "$2" == 1 ]; then
|
||||||
|
echo "iptables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.iptables
|
||||||
|
echo "ip6tables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.ip6tables
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_iptables_rules() {
|
||||||
|
local cid="$1"
|
||||||
|
local ip_version=0
|
||||||
|
local is_l3_rule=0
|
||||||
|
|
||||||
|
init_iptables_rule
|
||||||
|
config_get proto "$cid" "proto"
|
||||||
|
config_get traffic_class "$cid" "traffic_class"
|
||||||
|
config_get dscp_mark "$cid" "dscp_mark"
|
||||||
|
config_get dscp_filter "$cid" "dscp_filter"
|
||||||
|
config_get dest_port "$cid" "dest_port"
|
||||||
|
config_get dest_port_range "$cid" "dest_port_range"
|
||||||
|
config_get src_port "$cid" "src_port"
|
||||||
|
config_get src_port_range "$cid" "src_port_range"
|
||||||
|
config_get dest_ip "$cid" "dest_ip"
|
||||||
|
config_get src_ip "$cid" "src_ip"
|
||||||
|
config_get ip_len_min "$cid" "ip_len_min"
|
||||||
|
config_get ip_len_max "$cid" "ip_len_max"
|
||||||
|
config_get ifname "$cid" "ifname"
|
||||||
|
|
||||||
|
#check version of ip
|
||||||
|
case $src_ip$dest_ip in
|
||||||
|
*.*)
|
||||||
|
ip_version=4
|
||||||
|
;;
|
||||||
|
*:*)
|
||||||
|
ip_version=6
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ip_version=1 #ip address not used
|
||||||
|
esac
|
||||||
|
|
||||||
|
#filter interface
|
||||||
|
if [ -n "$ifname" ]; then
|
||||||
|
if [ "$ifname" != "lo" ]; then
|
||||||
|
iptables_filter_intf "$ifname"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# filter proto
|
||||||
|
if [ -n "$proto" ]; then
|
||||||
|
iptables_filter_proto "$proto"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter src. ip
|
||||||
|
if [ -n "$src_ip" ]; then
|
||||||
|
iptables_filter_ip_src "$src_ip"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter dest. ip
|
||||||
|
if [ -n "$dest_ip" ]; then
|
||||||
|
iptables_filter_ip_dest "$dest_ip"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter dest. port
|
||||||
|
if [ -n "$dest_port" ] && [ -z "$dest_port_range" ]; then
|
||||||
|
iptables_filter_port_dest "$dest_port"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter src. port
|
||||||
|
if [ -n "$src_port" ] && [ -z "$src_port_range" ]; then
|
||||||
|
iptables_filter_port_src "$src_port"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter dest. port range
|
||||||
|
if [ -n "$dest_port" ] && [ -n "$dest_port_range" ]; then
|
||||||
|
|
||||||
|
if [ "$dest_port_range" == "-1" ] ; then
|
||||||
|
dest_port_range="$dest_port"
|
||||||
|
fi
|
||||||
|
|
||||||
|
iptables_filter_port_dest_range "$dest_port" "$dest_port_range"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter src. port range
|
||||||
|
if [ -n "$src_port" ] && [ -n "$src_port_range" ]; then
|
||||||
|
|
||||||
|
if [ "$src_port_range" == "-1" ] ; then
|
||||||
|
src_port_range="$src_port"
|
||||||
|
fi
|
||||||
|
|
||||||
|
iptables_filter_port_src_range "$src_port" "$src_port_range"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter dscp
|
||||||
|
if [ -n "$dscp_filter" ]; then
|
||||||
|
iptables_filter_dscp_filter "$dscp_filter"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter min. IP packet len.
|
||||||
|
if [ -n "$ip_len_min" ]; then
|
||||||
|
iptables_filter_ip_len_min "$ip_len_min"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#filter max. IP packet len.
|
||||||
|
if [ -n "$ip_len_max" ]; then
|
||||||
|
iptables_filter_ip_len_max "$ip_len_max"
|
||||||
|
is_l3_rule=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$is_l3_rule" ] || [ "$is_l3_rule" -eq 0 ] ; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
#set dscp mark
|
||||||
|
[ -n "$dscp_mark" ] && iptables_set_dscp_mark "$dscp_mark"
|
||||||
|
|
||||||
|
#set packet queue mark
|
||||||
|
[ -n "$traffic_class" ] && iptables_set_traffic_class "$traffic_class"
|
||||||
|
|
||||||
|
#write iptables rule for dscp marking
|
||||||
|
[ -n "$IP_RULE" ] && [ -n "$dscp_mark" ] && append_rule_to_mangle_table "qos_forward" $ip_version
|
||||||
|
|
||||||
|
if [ -n "$IP_RULE" ] && [ -n "$traffic_class" ]; then
|
||||||
|
if [ "$ifname" == "lo" ]; then
|
||||||
|
#write iptables rule for putting WAN directed internal packets in different queue
|
||||||
|
append_rule_to_mangle_table "qos_output" $ip_version
|
||||||
|
else
|
||||||
|
#write iptables rule for putting WAN directed LAN packets in different queue
|
||||||
|
append_rule_to_mangle_table "qos_prerouting" $ip_version
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
create_iptables_chains() {
|
||||||
|
iptables -w -t mangle -N qos_forward
|
||||||
|
ret=$?
|
||||||
|
[ $ret -eq 0 ] && iptables -w -t mangle -I FORWARD -j qos_forward
|
||||||
|
|
||||||
|
iptables -w -t mangle -N qos_prerouting
|
||||||
|
ret=$?
|
||||||
|
[ $ret -eq 0 ] && iptables -w -t mangle -I PREROUTING -j qos_prerouting
|
||||||
|
|
||||||
|
iptables -w -t mangle -N qos_output
|
||||||
|
ret=$?
|
||||||
|
[ $ret -eq 0 ] && iptables -w -t mangle -I OUTPUT -j qos_output
|
||||||
|
|
||||||
|
ip6tables -t mangle -N qos_forward
|
||||||
|
ret=$?
|
||||||
|
[ $ret -eq 0 ] && ip6tables -t mangle -I FORWARD -j qos_forward
|
||||||
|
|
||||||
|
ip6tables -t mangle -N qos_prerouting
|
||||||
|
ret=$?
|
||||||
|
[ $ret -eq 0 ] && ip6tables -t mangle -I PREROUTING -j qos_prerouting
|
||||||
|
|
||||||
|
ip6tables -t mangle -N qos_output
|
||||||
|
ret=$?
|
||||||
|
[ $ret -eq 0 ] && ip6tables -t mangle -I OUTPUT -j qos_output
|
||||||
|
}
|
||||||
|
|
||||||
|
flush_iptables_chains() {
|
||||||
|
echo "iptables -w -t mangle -F qos_forward" > /tmp/qos/classify.iptables
|
||||||
|
echo "iptables -w -t mangle -F qos_prerouting" >> /tmp/qos/classify.iptables
|
||||||
|
echo "iptables -w -t mangle -F qos_output" >> /tmp/qos/classify.iptables
|
||||||
|
|
||||||
|
echo "ip6tables -w -t mangle -F qos_forward" > /tmp/qos/classify.ip6tables
|
||||||
|
echo "ip6tables -w -t mangle -F qos_prerouting" >> /tmp/qos/classify.ip6tables
|
||||||
|
echo "ip6tables -w -t mangle -F qos_output" >> /tmp/qos/classify.ip6tables
|
||||||
|
}
|
||||||
12
qosmngr/files/airoha/lib/qos/common/chains.sh
Executable file
12
qosmngr/files/airoha/lib/qos/common/chains.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Set up or flush all chains
|
||||||
|
|
||||||
|
setup_qos() {
|
||||||
|
create_ebtables_chains
|
||||||
|
create_iptables_chains
|
||||||
|
}
|
||||||
|
|
||||||
|
flush_chains() {
|
||||||
|
flush_ebtables_chains
|
||||||
|
flush_iptables_chains
|
||||||
|
}
|
||||||
44
qosmngr/files/airoha/lib/qos/common/classify.sh
Executable file
44
qosmngr/files/airoha/lib/qos/common/classify.sh
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Common classifier library
|
||||||
|
|
||||||
|
# Handle classify section
|
||||||
|
handle_classify() {
|
||||||
|
cid="$1" #classify section ID
|
||||||
|
|
||||||
|
config_get is_enable "$cid" "enable" 1
|
||||||
|
# no need to configure disabled classify rules
|
||||||
|
if [ "$is_enable" == "0" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
handle_ebtables_rules "$cid"
|
||||||
|
handle_iptables_rules "$cid"
|
||||||
|
handle_policer_rules "$cid"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Configure classifier based on UCI subtree 'qos.classify'
|
||||||
|
configure_classify() {
|
||||||
|
# Processing classify section
|
||||||
|
# First remove old files
|
||||||
|
rm -f /tmp/qos/classify.ebtables
|
||||||
|
rm -f /tmp/qos/classify.iptables
|
||||||
|
rm -f /tmp/qos/classify.ip6tables
|
||||||
|
|
||||||
|
# Create files that will contain the rules if not present already
|
||||||
|
mkdir -p /tmp/qos/
|
||||||
|
touch /tmp/qos/classify.iptables
|
||||||
|
touch /tmp/qos/classify.ip6tables
|
||||||
|
touch /tmp/qos/classify.ebtables
|
||||||
|
|
||||||
|
# Add flush chain rules
|
||||||
|
flush_chains
|
||||||
|
|
||||||
|
# Load UCI file
|
||||||
|
config_load qos
|
||||||
|
config_foreach handle_classify classify
|
||||||
|
|
||||||
|
sh /tmp/qos/classify.ebtables
|
||||||
|
sh /tmp/qos/classify.iptables
|
||||||
|
sh /tmp/qos/classify.ip6tables
|
||||||
|
}
|
||||||
132
qosmngr/files/airoha/lib/qos/common/policer.sh
Executable file
132
qosmngr/files/airoha/lib/qos/common/policer.sh
Executable file
@@ -0,0 +1,132 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Common policer library
|
||||||
|
|
||||||
|
POLICER_COUNT=0
|
||||||
|
|
||||||
|
# Function invoked
|
||||||
|
handle_policer_rules() {
|
||||||
|
local c_sec="$1"
|
||||||
|
local policer_name
|
||||||
|
local ifname
|
||||||
|
local pname
|
||||||
|
local pindex=-1
|
||||||
|
local ingress_rate=0
|
||||||
|
local in_burst_size=0
|
||||||
|
|
||||||
|
config_get policer_name "$c_sec" "policer"
|
||||||
|
if [ -z "$policer_name" ];then
|
||||||
|
# no need to apply policer if policer not present in this
|
||||||
|
# classification rule
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_get ifname "$c_sec" "ifname"
|
||||||
|
if [ -z "$ifname" ]; then
|
||||||
|
# cannot associate policer as interface is not mentioned
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local i=0
|
||||||
|
local max_policer_inst="$(cat /tmp/qos/max_policer_inst)"
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
if [ "${i}" -eq "$max_policer_inst" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
pname="$(uci -q get qos.@policer[$i].name)"
|
||||||
|
if [ "$policer_name" == "$pname" ]; then
|
||||||
|
pindex=$i
|
||||||
|
ingress_rate="$(uci -q get qos.@policer[$i].committed_rate)"
|
||||||
|
in_burst_rate="$(uci -q get qos.@policer[$i].committed_burst_size)"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$pindex" ] || [ "$pindex" -lt 0 ]; then
|
||||||
|
# policer not found, no need to proceed further
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_ingress_rate_limit "$ifname" "$ingress_rate" "$in_burst_size"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure ingress rate limit
|
||||||
|
config_ingress_rate_limit() {
|
||||||
|
local ifname="$1"
|
||||||
|
local ingress_rate="$2"
|
||||||
|
local in_burst_size="$3"
|
||||||
|
local port=""
|
||||||
|
|
||||||
|
if [ -z "$ingress_rate" ] || [ "$ingress_rate" -lt 1000 ] ; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
ingress_rate=$((ingress_rate / 1000))
|
||||||
|
|
||||||
|
if [ "$in_burst_size" -eq 0 ]; then
|
||||||
|
in_burst_size="$ingress_rate"
|
||||||
|
else
|
||||||
|
in_burst_size="$((in_burst_size / 1000))"
|
||||||
|
fi
|
||||||
|
|
||||||
|
hw_policer_set_ingress_rate "$ifname" "$port" "$ingress_rate" "$in_burst_size"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function invoked for handling policer section in UCI
|
||||||
|
handle_policer() {
|
||||||
|
local p_sec="$1" # policer section ID
|
||||||
|
local dir=1 # default direction, upstream
|
||||||
|
|
||||||
|
config_get is_enable "$p_sec" "enable" 1
|
||||||
|
|
||||||
|
# No need to configure disabled policer
|
||||||
|
if [ "$is_enable" == "0" ] ; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_get cir "$p_sec" "committed_rate"
|
||||||
|
config_get cbs "$p_sec" "committed_burst_size" -1
|
||||||
|
config_get ebs "$p_sec" "excess_burst_size" 0
|
||||||
|
config_get pir "$p_sec" "peak_rate" 0
|
||||||
|
config_get pbs "$p_sec" "peak_burst_size" 0
|
||||||
|
config_get meter "$p_sec" "meter_type" 0
|
||||||
|
|
||||||
|
hw_policer_set add "$dir" "$POLICER_COUNT" "$meter" "$cir" "$cbs" "$ebs" "$pir" "$pbs"
|
||||||
|
|
||||||
|
POLICER_COUNT=$((POLICER_COUNT + 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure policer based on UCI subtree 'qos.policer'
|
||||||
|
configure_policer() {
|
||||||
|
for intf in $(db get hw.board.ethernetPortOrder); do
|
||||||
|
if [ -n "${intf}" ] ; then
|
||||||
|
hw_policer_set_ingress_rate "$intf" 0 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Delete policer
|
||||||
|
local i=0
|
||||||
|
local max_p_inst=0
|
||||||
|
if [ -f "/tmp/qos/max_policer_inst" ]; then
|
||||||
|
max_p_inst=$(cat /tmp/qos/max_policer_inst)
|
||||||
|
fi
|
||||||
|
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
if [ "$i" -eq "$max_p_inst" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
hw_policer_set del 1 $i
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
# reset the policer counter
|
||||||
|
echo 0 > /tmp/qos/max_policer_inst
|
||||||
|
# Load UCI file
|
||||||
|
config_load qos
|
||||||
|
config_foreach handle_policer policer
|
||||||
|
echo $POLICER_COUNT > /tmp/qos/max_policer_inst
|
||||||
|
}
|
||||||
50
qosmngr/files/airoha/lib/qos/common/queue.sh
Executable file
50
qosmngr/files/airoha/lib/qos/common/queue.sh
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Handle queues and their order
|
||||||
|
|
||||||
|
Q_COUNT=0
|
||||||
|
|
||||||
|
# Preliminary configuration of a queue
|
||||||
|
pre_configure_queue() {
|
||||||
|
# Delete queues
|
||||||
|
hw_queue_init_all
|
||||||
|
|
||||||
|
for intf in $(db get hw.board.ethernetPortOrder); do
|
||||||
|
hw_intf_init "${intf}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# UCI queue section handler
|
||||||
|
handle_queue() {
|
||||||
|
local qid="$1" #queue section ID
|
||||||
|
local intf_name="$2"
|
||||||
|
|
||||||
|
config_get is_enable "$qid" "enable" 1
|
||||||
|
|
||||||
|
# no need to configure disabled queues
|
||||||
|
if [ "${is_enable}" == "0" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_get ifname "$qid" "ifname"
|
||||||
|
# if ifname is empty that is good enough to break
|
||||||
|
if [ -z "$ifname" ];then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_get sc_alg "$qid" "scheduling"
|
||||||
|
config_get wgt "$qid" "weight" 1
|
||||||
|
config_get rate "$qid" "rate"
|
||||||
|
config_get bs "$qid" "burst_size"
|
||||||
|
config_get qsize "$qid" "queue_size" 1024
|
||||||
|
config_get precedence "$qid" "precedence"
|
||||||
|
|
||||||
|
hw_queue_set "${ifname}" "${Q_COUNT}" "${precedence}" "$qsize" "$wgt" "$sc_alg" "$shapingrate" "$rate" "$bs"
|
||||||
|
Q_COUNT=$((Q_COUNT + 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure all queues specified in UCI tree 'qos.queue'
|
||||||
|
configure_queue() {
|
||||||
|
# Load UCI file
|
||||||
|
config_load qos
|
||||||
|
config_foreach handle_queue queue
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user