mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-24 19:14:05 +08:00
Compare commits
546 Commits
netmodes_e
...
netmode_do
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18314a27d2 | ||
|
|
bb3adc86ff | ||
|
|
82a32a7731 | ||
|
|
f0f18ed780 | ||
|
|
677357d997 | ||
|
|
fa608bc23b | ||
|
|
563a5d03b8 | ||
|
|
b1b432d852 | ||
|
|
fe06c8515f | ||
|
|
9101095a0a | ||
|
|
2bd4c0c236 | ||
|
|
61bda623ca | ||
|
|
e2eaf6221a | ||
|
|
82183e9e3b | ||
|
|
edfbcb1074 | ||
|
|
5af1df3493 | ||
|
|
3ec6c21456 | ||
|
|
9d251b5d9d | ||
|
|
a3e4a0f6e9 | ||
|
|
d5044df134 | ||
|
|
cef4d4efea | ||
|
|
1f093159d8 | ||
|
|
22e6d80384 | ||
|
|
fe1bf101c3 | ||
|
|
24c30a098e | ||
|
|
a0c1801511 | ||
|
|
59e7ece054 | ||
|
|
cb9825504d | ||
|
|
628331c808 | ||
|
|
229f62a906 | ||
|
|
034bd7e8b2 | ||
|
|
c594a4957f | ||
|
|
5fd540d5ba | ||
|
|
64fcaaadc7 | ||
|
|
64f4ceda35 | ||
|
|
0485c372bd | ||
|
|
155b4fe2b3 | ||
|
|
cf573d3fad | ||
|
|
09aa9746d5 | ||
|
|
e56ad858aa | ||
|
|
362bb8b1cf | ||
|
|
9bb0da51cf | ||
|
|
3158f92912 | ||
|
|
2847fdd2c2 | ||
|
|
bde6e11169 | ||
|
|
543ba2ac7a | ||
|
|
c02548298d | ||
|
|
0f03e3ae70 | ||
|
|
2c4307f83a | ||
|
|
98925cc464 | ||
|
|
d8d2d0090b | ||
|
|
2fc98ac307 | ||
|
|
98f5e19916 | ||
|
|
e8da3d1cd7 | ||
|
|
4112fbd17c | ||
|
|
26f202edb7 | ||
|
|
67b4ba0301 | ||
|
|
68fb3bea32 | ||
|
|
c0a1139764 | ||
|
|
39f30cd31a | ||
|
|
ac78f69136 | ||
|
|
f72d4e35d0 | ||
|
|
e5fc33e941 | ||
|
|
5faab025cc | ||
|
|
7a62843c29 | ||
|
|
b0d2b10055 | ||
|
|
7129b55362 | ||
|
|
6662f27493 | ||
|
|
b42c0201cf | ||
|
|
d626a673b5 | ||
|
|
18a5f6ca5b | ||
|
|
97045b2d39 | ||
|
|
8475fa81bc | ||
|
|
e67f2bbcf7 | ||
|
|
a3d7280423 | ||
|
|
61de08f440 | ||
|
|
05ecde4f55 | ||
|
|
55c3233739 | ||
|
|
6e9a38beac | ||
|
|
fea9e4de88 | ||
|
|
ceb5a9f2e4 | ||
|
|
cb8623a862 | ||
|
|
c6672e3cf0 | ||
|
|
75d0b18f09 | ||
|
|
806f685d74 | ||
|
|
e412cfa36d | ||
|
|
55967685ef | ||
|
|
3655ae9d79 | ||
|
|
d526ee41cd | ||
|
|
c7315af615 | ||
|
|
4d414af657 | ||
|
|
074e0c1cd1 | ||
|
|
6b81616883 | ||
|
|
ee3144f736 | ||
|
|
c96eceed2d | ||
|
|
dac23ee614 | ||
|
|
cc312af2f3 | ||
|
|
e506f6462c | ||
|
|
6fb90643c7 | ||
|
|
7e82a1c907 | ||
|
|
9bf94f688c | ||
|
|
ebf0e949b4 | ||
|
|
2766fef0c3 | ||
|
|
a73cd73fe1 | ||
|
|
0df826868a | ||
|
|
2ed0a4ec01 | ||
|
|
944ef75d57 | ||
|
|
b3cfbc8536 | ||
|
|
36928bdcb9 | ||
|
|
b8634e5bec | ||
|
|
a0ba20647d | ||
|
|
642544f579 | ||
|
|
f71042d2eb | ||
|
|
40c9c7ac7c | ||
|
|
f9a046f0b4 | ||
|
|
a7ea8701b9 | ||
|
|
718fde966f | ||
|
|
e198ed73c7 | ||
|
|
5e7a131b64 | ||
|
|
7816cc1e49 | ||
|
|
28d70c56c8 | ||
|
|
2c9a35eb8c | ||
|
|
0779d9f121 | ||
|
|
afa5f38654 | ||
|
|
1eeb06fd36 | ||
|
|
d64bf6ceea | ||
|
|
c28f5afe45 | ||
|
|
1ed383bee7 | ||
|
|
8236cd4093 | ||
|
|
46a09d8f8d | ||
|
|
61c7afe582 | ||
|
|
258449fc11 | ||
|
|
f5db3d3d45 | ||
|
|
a0c6545534 | ||
|
|
96d18ad234 | ||
|
|
18c9bef5f8 | ||
|
|
bd3b904c15 | ||
|
|
350ced4c32 | ||
|
|
b4e735e731 | ||
|
|
e96e2328a7 | ||
|
|
c8c6b5ab4b | ||
|
|
9bd7e17835 | ||
|
|
fa703437e1 | ||
|
|
cfc335aed8 | ||
|
|
1139c21f34 | ||
|
|
6af6728603 | ||
|
|
5a208be259 | ||
|
|
8764f317d0 | ||
|
|
c2e9144819 | ||
|
|
fc9f946be7 | ||
|
|
2aed4dc8f5 | ||
|
|
ce1b42e095 | ||
|
|
8fee332f4c | ||
|
|
ca78501dba | ||
|
|
9280ddd093 | ||
|
|
15563ca117 | ||
|
|
0718730d6b | ||
|
|
f9ad16934c | ||
|
|
966dbd6038 | ||
|
|
b1809e6993 | ||
|
|
ad8b8b2a55 | ||
|
|
6bf1cae138 | ||
|
|
92c3d6d721 | ||
|
|
853a0c840c | ||
|
|
49bcef77aa | ||
|
|
fa8e9fc3ef | ||
|
|
e3eec0d7ab | ||
|
|
74339e6216 | ||
|
|
8197f9ad93 | ||
|
|
1f96c3d295 | ||
|
|
d1d57ca528 | ||
|
|
10428fbda0 | ||
|
|
8e5d4c53ff | ||
|
|
1fb22dfe8c | ||
|
|
99fe2c2b2a | ||
|
|
c153911acf | ||
|
|
31cd59b33c | ||
|
|
21e6193e0a | ||
|
|
3af94e2180 | ||
|
|
df91d06078 | ||
|
|
ea090f50e1 | ||
|
|
7df4486a43 | ||
|
|
6818818127 | ||
|
|
63c0fb7d3b | ||
|
|
2a38e7cd23 | ||
|
|
8f6ae03e7e | ||
|
|
fecbbe90af | ||
|
|
fe1cdbd9bc | ||
|
|
67bf2c0227 | ||
|
|
307059d44b | ||
|
|
a8aa693e18 | ||
|
|
53fc48997a | ||
|
|
9e180eb2bf | ||
|
|
b98ccac057 | ||
|
|
fb236949fc | ||
|
|
5631c28df4 | ||
|
|
8170684100 | ||
|
|
332a35102d | ||
|
|
ba5e332b0d | ||
|
|
09560fb532 | ||
|
|
c4cf8cb24b | ||
|
|
56c94f1ec6 | ||
|
|
279fe9d291 | ||
|
|
924675d271 | ||
|
|
64cf5c7c9f | ||
|
|
9fa9b1adbf | ||
|
|
9944917399 | ||
|
|
2a25fc0ec7 | ||
|
|
ebd7e68714 | ||
|
|
000762c0cb | ||
|
|
c4328f411f | ||
|
|
0428934a69 | ||
|
|
580d24e04a | ||
|
|
95778a4262 | ||
|
|
02ee448479 | ||
|
|
0dcc9743a2 | ||
|
|
1a1a1e1255 | ||
|
|
9710e46c51 | ||
|
|
19e69f7b61 | ||
|
|
e319c85064 | ||
|
|
29638a28f7 | ||
|
|
ccb337ecbd | ||
|
|
5474b1c6d0 | ||
|
|
8df0ad8e46 | ||
|
|
6e358a6bd1 | ||
|
|
20a28db536 | ||
|
|
c6ee9114bc | ||
|
|
89fb4a0857 | ||
|
|
8d86188ff1 | ||
|
|
18d6afea15 | ||
|
|
0cb9aac1f1 | ||
|
|
dfe2af4643 | ||
|
|
2fe133227d | ||
|
|
15f17da6e5 | ||
|
|
2e56ef292c | ||
|
|
65e4bebc0f | ||
|
|
ceb577a6ab | ||
|
|
2d45a45126 | ||
|
|
45294a9f0c | ||
|
|
eb5c837353 | ||
|
|
495d95dcc8 | ||
|
|
32e5dc46b3 | ||
|
|
6980c1e2e5 | ||
|
|
da727b4dc1 | ||
|
|
d8aaacc4c9 | ||
|
|
e036702c16 | ||
|
|
604a105bc9 | ||
|
|
04bdaa950f | ||
|
|
54fdaf2b43 | ||
|
|
644e98e595 | ||
|
|
9fc594d74f | ||
|
|
ac7cfb581e | ||
|
|
ba75b33fc5 | ||
|
|
912978164b | ||
|
|
7a50c328e1 | ||
|
|
f8c9088db7 | ||
|
|
fd34c3e9f3 | ||
|
|
70d7d7a64d | ||
|
|
112f4cb99d | ||
|
|
2380a6de86 | ||
|
|
b0c168322e | ||
|
|
22d8a0992c | ||
|
|
3c075c293c | ||
|
|
17ae16e5d2 | ||
|
|
46dc9e86d8 | ||
|
|
0b3420240d | ||
|
|
83ca06b626 | ||
|
|
2dafb9ec2c | ||
|
|
c2c54e5ca0 | ||
|
|
9314e4bbf3 | ||
|
|
5840332288 | ||
|
|
bb4fffb680 | ||
|
|
4b2b09080d | ||
|
|
ba651b5457 | ||
|
|
1509db0630 | ||
|
|
85e97ca660 | ||
|
|
f9640bc237 | ||
|
|
72b16e33ab | ||
|
|
4e81706967 | ||
|
|
483fc2e6cb | ||
|
|
c2594f2d37 | ||
|
|
fb2eac485b | ||
|
|
c867ab610e | ||
|
|
ef8d667b83 | ||
|
|
3934674c81 | ||
|
|
4f53f35dc1 | ||
|
|
4fe815299a | ||
|
|
9394517727 | ||
|
|
742b357026 | ||
|
|
d383896918 | ||
|
|
646f5d6e1c | ||
|
|
d897632279 | ||
|
|
47e93f13c1 | ||
|
|
70bb662514 | ||
|
|
6f9ec4bf7d | ||
|
|
fc88c554c1 | ||
|
|
5ba6ade386 | ||
|
|
0d1b585c5d | ||
|
|
bf43efa993 | ||
|
|
0e3545cacb | ||
|
|
fefe14d540 | ||
|
|
b6df14f78e | ||
|
|
24cfbe2e48 | ||
|
|
eee28bb66c | ||
|
|
5fcee38906 | ||
|
|
72a9da5bd3 | ||
|
|
2cf19c9469 | ||
|
|
bd0fed8409 | ||
|
|
b23e510dd3 | ||
|
|
bf06544066 | ||
|
|
85762b4641 | ||
|
|
60dafc2028 | ||
|
|
e6054d9f8f | ||
|
|
8b106e6b58 | ||
|
|
41edb9f1a5 | ||
|
|
f6026298e8 | ||
|
|
c3ab091cdc | ||
|
|
dcfca56db8 | ||
|
|
991657fc99 | ||
|
|
90f13664e9 | ||
|
|
e843c83d0c | ||
|
|
7d5c13a9f5 | ||
|
|
417a5c5428 | ||
|
|
0074af0d3c | ||
|
|
fae1f7d816 | ||
|
|
f500a8c749 | ||
|
|
af9e4f99c6 | ||
|
|
e451e32f77 | ||
|
|
26cbba9724 | ||
|
|
5be4e38c68 | ||
|
|
549534f8aa | ||
|
|
f4a623e637 | ||
|
|
833a9a002a | ||
|
|
ff4e68f70a | ||
|
|
b471113bfa | ||
|
|
2b997a4386 | ||
|
|
06a280707a | ||
|
|
c54fd95889 | ||
|
|
86fb3db75b | ||
|
|
70cda05eda | ||
|
|
502aab4f3c | ||
|
|
34b63e84aa | ||
|
|
5f2aa06285 | ||
|
|
5232cc61ac | ||
|
|
98d8e9866c | ||
|
|
0e59fd0d47 | ||
|
|
a7e8e65d88 | ||
|
|
1fd74364fa | ||
|
|
20c49302c1 | ||
|
|
c2e5ade3bb | ||
|
|
b933622547 | ||
|
|
7b12c29425 | ||
|
|
082452bfb5 | ||
|
|
a6b8987dac | ||
|
|
d1307bfd76 | ||
|
|
edd78f675e | ||
|
|
3a1772e1b8 | ||
|
|
b2dd40cae3 | ||
|
|
24f22d0ecc | ||
|
|
a86f478014 | ||
|
|
9a59ccc498 | ||
|
|
15e4dd732a | ||
|
|
784a281fa6 | ||
|
|
8f82b31658 | ||
|
|
3745b4e913 | ||
|
|
90d646319b | ||
|
|
13064e27b3 | ||
|
|
539bf50985 | ||
|
|
1b7b377bd1 | ||
|
|
1c9ba1c83c | ||
|
|
e307ee7aa8 | ||
|
|
6bcf7987d7 | ||
|
|
ff146bf093 | ||
|
|
0f23bee1da | ||
|
|
2070630b07 | ||
|
|
f1702b3e70 | ||
|
|
9634b0678b | ||
|
|
d395030be7 | ||
|
|
4cb0504eb3 | ||
|
|
6df57301f9 | ||
|
|
f527b8a25a | ||
|
|
fbba67542e | ||
|
|
824d6d3abe | ||
|
|
1a9a339cc6 | ||
|
|
0533f114d1 | ||
|
|
dc579e3c60 | ||
|
|
d232e76905 | ||
|
|
2fffb45748 | ||
|
|
b15f1b5026 | ||
|
|
43a0dfc863 | ||
|
|
307381c9af | ||
|
|
1a80f2df47 | ||
|
|
9b79eb42db | ||
|
|
602926b076 | ||
|
|
74cfe57095 | ||
|
|
01845eded6 | ||
|
|
11dce5812c | ||
|
|
7af15ec9a9 | ||
|
|
8359755dc8 | ||
|
|
1a735b7730 | ||
|
|
6a008d3419 | ||
|
|
6142da5d43 | ||
|
|
f5715d478a | ||
|
|
bce9364d14 | ||
|
|
425949900b | ||
|
|
938681c270 | ||
|
|
30f7a15450 | ||
|
|
4d4006309b | ||
|
|
41f1e0d52a | ||
|
|
db207a87fc | ||
|
|
89ab349565 | ||
|
|
8ffe108f95 | ||
|
|
074d9268b0 | ||
|
|
fc7b21aa73 | ||
|
|
6f83732b0e | ||
|
|
97141307ed | ||
|
|
ddec5540bc | ||
|
|
09b97ae69d | ||
|
|
977c1b5767 | ||
|
|
467b3897fb | ||
|
|
a688381a3c | ||
|
|
9bad79439b | ||
|
|
608b9637b0 | ||
|
|
fcd59e95f0 | ||
|
|
5820d98e2c | ||
|
|
9c6b9d6260 | ||
|
|
9fad74246e | ||
|
|
aab3f74290 | ||
|
|
0eb2ce3728 | ||
|
|
f9aabb68d5 | ||
|
|
9917da1ca3 | ||
|
|
acf7344c13 | ||
|
|
693ff8bd19 | ||
|
|
c1286064bb | ||
|
|
2503b1fc72 | ||
|
|
d468c13b3f | ||
|
|
064611a15d | ||
|
|
5c427dd08a | ||
|
|
1703e6d328 | ||
|
|
35c27393ce | ||
|
|
fca93627ba | ||
|
|
417a127dd9 | ||
|
|
afde0b98ad | ||
|
|
a0069cc9be | ||
|
|
368255f50b | ||
|
|
ad1233ff32 | ||
|
|
697ddc356e | ||
|
|
b82eb8325e | ||
|
|
c150053a83 | ||
|
|
7ee83ff47f | ||
|
|
98905256f8 | ||
|
|
a8a511c4ff | ||
|
|
d0d90946b3 | ||
|
|
c2ad0fa44d | ||
|
|
be7fa433c5 | ||
|
|
01e9d7c0bc | ||
|
|
2f398a2671 | ||
|
|
8254547866 | ||
|
|
e8ceb167b5 | ||
|
|
434c794671 | ||
|
|
9628be4812 | ||
|
|
bd90dc7ec2 | ||
|
|
e0736df927 | ||
|
|
afa58be1f8 | ||
|
|
3cbcac96ba | ||
|
|
a92f32eba4 | ||
|
|
842968da4f | ||
|
|
60ef90c1b6 | ||
|
|
56cec9cb7f | ||
|
|
4042d46009 | ||
|
|
d6dfc5bd08 | ||
|
|
451036aebc | ||
|
|
8d01ace7a6 | ||
|
|
d7e22b922b | ||
|
|
a1d535058d | ||
|
|
1bb307ef4f | ||
|
|
404a642e41 | ||
|
|
ae3f1819e6 | ||
|
|
fbd8f64c40 | ||
|
|
369fc0d4bb | ||
|
|
b44afe067f | ||
|
|
d69245f570 | ||
|
|
c3564ff528 | ||
|
|
fafe1d9447 | ||
|
|
e35bf1d509 | ||
|
|
8e11e5dbc8 | ||
|
|
2698ee9358 | ||
|
|
92be6f1129 | ||
|
|
4dfc196968 | ||
|
|
1c17fed77d | ||
|
|
27b9fb9350 | ||
|
|
b917a2177e | ||
|
|
2372de4864 | ||
|
|
c5d7ddd851 | ||
|
|
a688b2091c | ||
|
|
bfc7e6a78a | ||
|
|
41495cf6e5 | ||
|
|
d3d1b444de | ||
|
|
9681b6222c | ||
|
|
d20fb01a1b | ||
|
|
85e49b3df6 | ||
|
|
511e0af668 | ||
|
|
1151478d13 | ||
|
|
7e87028731 | ||
|
|
cb18ecc420 | ||
|
|
e581c05d27 | ||
|
|
3ae6c52e7d | ||
|
|
498a06916b | ||
|
|
332057fdd4 | ||
|
|
58aff3cb45 | ||
|
|
5678b6dcaa | ||
|
|
a597c514f7 | ||
|
|
3c1dcf90eb | ||
|
|
62dc6c28a3 | ||
|
|
2703ea0421 | ||
|
|
b4a0572b7c | ||
|
|
428055c911 | ||
|
|
97723f9e7a | ||
|
|
2dceb5b44b | ||
|
|
8c9689caf7 | ||
|
|
af5bb94c8c | ||
|
|
9db65fcfba | ||
|
|
2b43c27e53 | ||
|
|
c16f4d3f82 | ||
|
|
99a4f3c036 | ||
|
|
71217d4f68 | ||
|
|
ad012d7549 | ||
|
|
6cca837500 | ||
|
|
6bec3c159c | ||
|
|
fd921bb196 | ||
|
|
60d2f92da3 | ||
|
|
8f83250890 | ||
|
|
652ec8a4af | ||
|
|
937b824055 | ||
|
|
889723079b | ||
|
|
7a457ae32a | ||
|
|
7e5e38e657 | ||
|
|
44edac6572 | ||
|
|
fea3e1e4ef | ||
|
|
eae31a6dd4 | ||
|
|
3a1a65d5df | ||
|
|
70a22d0299 | ||
|
|
2a19a1a92a | ||
|
|
5b865c9dbc | ||
|
|
bc041faf04 | ||
|
|
de08bc79a1 |
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.16.6.2
|
||||
PKG_VERSION:=1.18.16
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=aa480554461c82e6f6f44ee6c23108d3e44fce21
|
||||
PKG_SOURCE_VERSION:=72c3307651cb583121fa5b4abcaad957ddc264bd
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -55,7 +55,7 @@ define Package/dm-service
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Datamodel ubus backend to expose micro-service tree
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libbbfdm-ubus +bbf_configmngr
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libbbfdm-ubus +bbf_configmngr +libeasy
|
||||
endef
|
||||
|
||||
define Package/bbf_configmngr
|
||||
@@ -107,7 +107,7 @@ endif
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
|
||||
-DBBFDMD_MAX_MSG_LEN:Integer=10485760 \
|
||||
-DBBFDMD_MAX_MSG_LEN:Integer=20971520 \
|
||||
-DCMAKE_BUILD_TYPE:String="Debug" \
|
||||
|
||||
|
||||
@@ -183,6 +183,7 @@ define Package/bbf_configmngr/install
|
||||
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbf_configd $(1)/etc/init.d/bbf_configd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_config_notify.sh $(1)/usr/share/bbfdm/scripts/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_default_reload.sh $(1)/etc/bbfdm/
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/critical_services.json $(1)/etc/bbfdm/
|
||||
endef
|
||||
|
||||
|
||||
@@ -1,23 +1,47 @@
|
||||
{
|
||||
"usp": [
|
||||
"firewall",
|
||||
"network",
|
||||
"dhcp",
|
||||
"time",
|
||||
"wireless",
|
||||
"ieee1905",
|
||||
"mapcontroller",
|
||||
"mosquitto",
|
||||
"nginx",
|
||||
"netmode"
|
||||
"/etc/config/firewall",
|
||||
"/etc/bbfdm/dmmap/dmmap_firewall",
|
||||
"/etc/config/network",
|
||||
"/etc/bbfdm/dmmap/IP",
|
||||
"/etc/bbfdm/dmmap/Ethernet",
|
||||
"/etc/bbfdm/dmmap/GRE",
|
||||
"/etc/bbfdm/dmmap/IPv6rd",
|
||||
"/etc/bbfdm/dmmap/PPP",
|
||||
"/etc/bbfdm/dmmap/Routing",
|
||||
"/etc/config/dhcp",
|
||||
"/etc/bbfdm/dmmap/DHCPv4",
|
||||
"/etc/bbfdm/dmmap/DHCPv6",
|
||||
"/etc/config/time",
|
||||
"/etc/bbfdm/dmmap/dmmap_time",
|
||||
"/etc/config/mapcontroller",
|
||||
"/etc/config/wireless",
|
||||
"/etc/bbfdm/dmmap/WiFi",
|
||||
"/etc/config/ieee1905",
|
||||
"/etc/config/mosquitto",
|
||||
"/etc/config/nginx",
|
||||
"/etc/config/netmode",
|
||||
"/etc/bbfdm/dmmap/dmmap_netmode"
|
||||
],
|
||||
"cwmp": [
|
||||
"firewall",
|
||||
"network",
|
||||
"dhcp",
|
||||
"mapcontroller",
|
||||
"wireless",
|
||||
"time",
|
||||
"netmode"
|
||||
"/etc/config/firewall",
|
||||
"/etc/bbfdm/dmmap/dmmap_firewall",
|
||||
"/etc/config/network",
|
||||
"/etc/bbfdm/dmmap/IP",
|
||||
"/etc/bbfdm/dmmap/Ethernet",
|
||||
"/etc/bbfdm/dmmap/GRE",
|
||||
"/etc/bbfdm/dmmap/IPv6rd",
|
||||
"/etc/bbfdm/dmmap/PPP",
|
||||
"/etc/bbfdm/dmmap/Routing",
|
||||
"/etc/config/dhcp",
|
||||
"/etc/bbfdm/dmmap/DHCPv4",
|
||||
"/etc/bbfdm/dmmap/DHCPv6",
|
||||
"/etc/config/mapcontroller",
|
||||
"/etc/config/wireless",
|
||||
"/etc/bbfdm/dmmap/WiFi",
|
||||
"/etc/config/time",
|
||||
"/etc/bbfdm/dmmap/dmmap_time",
|
||||
"/etc/config/netmode",
|
||||
"/etc/bbfdm/dmmap/dmmap_netmode"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,19 +10,10 @@ log() {
|
||||
echo "${@}"|logger -t bbf.config -p info
|
||||
}
|
||||
|
||||
create_needed_directories()
|
||||
{
|
||||
mkdir -p /tmp/bbfdm/.cwmp
|
||||
mkdir -p /tmp/bbfdm/.usp
|
||||
mkdir -p /tmp/bbfdm/.bbfdm
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
local log_level
|
||||
|
||||
create_needed_directories
|
||||
|
||||
config_load bbfdm
|
||||
config_get log_level "reload_handler" log_level 2
|
||||
|
||||
@@ -36,6 +27,6 @@ start_service()
|
||||
service_triggers() {
|
||||
for config_file in /etc/config/*; do
|
||||
config_name=$(basename "$config_file")
|
||||
procd_add_config_trigger "config.change" "$config_name" /usr/share/bbfdm/scripts/bbf_config_notify.sh
|
||||
procd_add_config_trigger "config.change" "$config_name" /usr/share/bbfdm/scripts/bbf_config_notify.sh "$config_name"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -5,6 +5,12 @@ config BRIDGEMNGR_BRIDGE_VLAN
|
||||
help
|
||||
Set this option to use bridge-vlan as backend for VLAN objects.
|
||||
|
||||
config BRIDGEMNGR_COPY_PBITS
|
||||
bool "Copy pbits from cvlan to svlan"
|
||||
default y
|
||||
help
|
||||
Set this option to copy cvlan pbits to svlan pbits by default (driver vlan).
|
||||
|
||||
config BRIDGEMNGR_BRIDGE_VENDOR_EXT
|
||||
bool "Use bridge BBF vendor extensions"
|
||||
default y
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bridgemngr
|
||||
PKG_VERSION:=1.0.18.2
|
||||
PKG_VERSION:=1.1.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/bridgemngr
|
||||
PKG_SOURCE_VERSION:=71ed529be038392071b0399bcfe9d46e89d3cb46
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/bridgemngr.git
|
||||
PKG_SOURCE_VERSION:=882f8c8cc9a97372297d192cc916c4f8ffe7c25a
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -51,6 +51,10 @@ ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VLAN),y)
|
||||
TARGET_CFLAGS += -DBRIDGE_VLAN_BACKEND
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BRIDGEMNGR_COPY_PBITS),y)
|
||||
TARGET_CFLAGS+=-DBRIDGEMNGR_COPY_PBITS
|
||||
endif
|
||||
|
||||
define Package/bridgemngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulkdata
|
||||
PKG_VERSION:=2.1.20
|
||||
PKG_VERSION:=2.1.23
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bulkdata.git
|
||||
PKG_SOURCE_VERSION:=a5e57962938ca143ede65d92be90b6e9fce66e15
|
||||
PKG_SOURCE_VERSION:=f54550f2d587a701c0a8d5cac4a0910a99ce92cf
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -4,4 +4,16 @@ config DECOLLECTOR_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 6
|
||||
|
||||
config DECOLLECTOR_BUILD_TR181_PLUGIN
|
||||
bool "Build TR-181 mapping module (responsible for Device.WiFi.DataElements.)"
|
||||
default y
|
||||
|
||||
config DECOLLECTOR_VENDOR_EXTENSIONS
|
||||
bool "Iopsys vendor extensions for Device.WiFi.DataElements."
|
||||
default y
|
||||
|
||||
config DECOLLECTOR_VENDOR_PREFIX
|
||||
string "Package specific datamodel Vendor Prefix for TR181 extensions"
|
||||
default ""
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=decollector
|
||||
PKG_VERSION:=6.2.1.8
|
||||
PKG_VERSION:=6.2.3.8
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b7e294d7c610adfd80cf40a0628c189695dc5156
|
||||
PKG_SOURCE_VERSION:=8396091a83aefaf8423dfd41a957b04f3ed821e7
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -24,6 +24,7 @@ PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
define Package/decollector
|
||||
SECTION:=utils
|
||||
@@ -66,6 +67,18 @@ MAKE_PATH:=src
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_DECOLLECTOR_EASYMESH_VERSION)
|
||||
|
||||
ifeq ($(CONFIG_DECOLLECTOR_BUILD_TR181_PLUGIN),y)
|
||||
MAKE_FLAGS += DECOLLECTOR_BUILD_TR181_PLUGIN=y
|
||||
ifeq ($(CONFIG_DECOLLECTOR_VENDOR_EXTENSIONS),y)
|
||||
TARGET_CFLAGS += -DDECOLLECTOR_VENDOR_EXTENSIONS
|
||||
ifeq ($(CONFIG_DECOLLECTOR_VENDOR_PREFIX),"")
|
||||
TARGET_CFLAGS += -DCUSTOM_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\"
|
||||
else
|
||||
TARGET_CFLAGS += -DCUSTOM_PREFIX=\\\"$(CONFIG_DECOLLECTOR_VENDOR_PREFIX)\\\"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
EXECS := \
|
||||
$(if $(CONFIG_PACKAGE_decollector),decollector)
|
||||
|
||||
@@ -76,6 +89,7 @@ define Package/decollector/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/decollector.init $(1)/etc/init.d/decollector
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/decollector $(1)/usr/sbin/
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,decollector))
|
||||
|
||||
26
decollector/bbfdm_service.json
Normal file
26
decollector/bbfdm_service.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"daemon": {
|
||||
"enable": "1",
|
||||
"service_name": "decollector",
|
||||
"unified_daemon": true,
|
||||
"services": [
|
||||
{
|
||||
"parent_dm": "Device.WiFi.",
|
||||
"object": "DataElements"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"loglevel": "3"
|
||||
},
|
||||
"apply_handler": {
|
||||
"uci": [
|
||||
{
|
||||
"file": [
|
||||
"mapcontroller"
|
||||
],
|
||||
"external_handler": "/etc/wifidmd/bbf_config_reload.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.7.10
|
||||
PKG_VERSION:=3.7.13
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=1f851980a6ba616df54f79930225f8bcd563b711
|
||||
PKG_SOURCE_VERSION:=5c2720563b3ed889e9d4de6fdb9b0f6a9d584094
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
|
||||
12
dhcpmngr/Config.in
Normal file
12
dhcpmngr/Config.in
Normal file
@@ -0,0 +1,12 @@
|
||||
if PACKAGE_dhcpmngr
|
||||
|
||||
config DHCPMNGR_ENABLE_VENDOR_EXT
|
||||
bool "Use datamodel vendor extensions"
|
||||
default y
|
||||
help
|
||||
Set this option to use bridge BBF vendor extensions.
|
||||
|
||||
config DHCPMNGR_VENDOR_PREFIX
|
||||
string "Package specific datamodel Vendor Prefix for TR181 extensions"
|
||||
default ""
|
||||
endif
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dhcpmngr
|
||||
PKG_VERSION:=1.0.6
|
||||
PKG_VERSION:=1.1.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dhcpmngr.git
|
||||
PKG_SOURCE_VERSION:=986f66608959f4f589009d580b046e250d8c620d
|
||||
PKG_SOURCE_VERSION:=74d96cd70119e4ea08767d68b45b4922162d0328
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -39,6 +39,22 @@ define Package/dhcpmngr/description
|
||||
Package to add Device.DHCPv4. and Device.DHCPv6. data model support.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_DHCPMNGR_ENABLE_VENDOR_EXT),y)
|
||||
MAKE_FLAGS += DHCPMNGR_ENABLE_VENDOR_EXT=y
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DHCPMNGR_VENDOR_PREFIX),"")
|
||||
VENDOR_PREFIX = $(CONFIG_BBF_VENDOR_PREFIX)
|
||||
else
|
||||
VENDOR_PREFIX = $(CONFIG_DHCPMNGR_VENDOR_PREFIX)
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(VENDOR_PREFIX)\\\"
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/dhcpmngr/* $(PKG_BUILD_DIR)/
|
||||
|
||||
48
dmcli-plugins/Makefile
Normal file
48
dmcli-plugins/Makefile
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Copyright (c) 2023 Genexis Netherlands B.V. All rights reserved.
|
||||
# This Software and its content are protected by the Dutch Copyright Act
|
||||
# ('Auteurswet'). All and any copying and distribution of the software
|
||||
# and its content without authorization by Genexis Netherlands B.V. is
|
||||
# prohibited. The prohibition includes every form of reproduction and
|
||||
# distribution.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dmcli-plugins
|
||||
PKG_LICENSE:=PROPRIETARY GENEXIS
|
||||
PKG_VERSION:=2.2.6
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/gnx/dmcli-plugin-easydm.git
|
||||
PKG_SOURCE_VERSION:=bc8b8527e8a41bdba73cb277a3c6c3b42b045153
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dmcli-plugins
|
||||
SECTION:=tools
|
||||
CATEGORY:=Genexis
|
||||
TITLE:=Easy-to-use data model on top of TR181
|
||||
URL:=http://genexis.eu
|
||||
DEPENDS:=+dmcli
|
||||
endef
|
||||
|
||||
define Package/dmcli-plugins/description
|
||||
EasyDM offers a user-friendly approach to configuring TR-181
|
||||
simplifying the process with its intuitive interface.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/dmcli-plugins/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/dmcli/plugins
|
||||
$(CP) $(PKG_BUILD_DIR)/src/*.js $(1)/usr/lib/dmcli/plugins/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dmcli-plugins))
|
||||
9
dmcli/Config.in
Normal file
9
dmcli/Config.in
Normal file
@@ -0,0 +1,9 @@
|
||||
if PACKAGE_dmcli
|
||||
|
||||
config DMCLI_REMOTE_CONNECTION
|
||||
bool "Add dmcli remote controller configuration"
|
||||
default n
|
||||
help
|
||||
This adds a usp controller configuration for dmcli remote connection from different machine/laptop/server.
|
||||
|
||||
endif
|
||||
76
dmcli/Makefile
Normal file
76
dmcli/Makefile
Normal file
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# Copyright (c) 2021 Genexis Netherlands B.V. All rights reserved.
|
||||
# This Software and its content are protected by the Dutch Copyright Act
|
||||
# ('Auteurswet'). All and any copying and distribution of the software
|
||||
# and its content without authorization by Genexis Netherlands B.V. is
|
||||
# prohibited. The prohibition includes every form of reproduction and
|
||||
# distribution.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dmcli
|
||||
PKG_LICENSE:=PROPRIETARY GENEXIS
|
||||
PKG_VERSION:=1.9.6
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/gnx/dmcli.git
|
||||
PKG_SOURCE_VERSION:=f03188eff6c2cab59e4c8f18a435c940ff5043f5
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dmcli
|
||||
SECTION:=tools
|
||||
CATEGORY:=Genexis
|
||||
TITLE:=DMCLI (datamodel-based CLI)
|
||||
URL:=http://genexis.eu
|
||||
DEPENDS:=+usp-js +DMCLI_REMOTE_CONNECTION:mosquitto-auth-plugin +shadow-utils +@BUSYBOX_CONFIG_ADDUSER
|
||||
endef
|
||||
|
||||
define Package/dmcli/description
|
||||
CLI to view and configure datamodels of CPE
|
||||
endef
|
||||
|
||||
define Package/dmcli/conffiles
|
||||
/etc/dmcli/dmcli.conf
|
||||
endef
|
||||
|
||||
define Package/dmcli/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/dmcli/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dmcli $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/dmcli
|
||||
$(CP) $(PKG_BUILD_DIR)/common $(1)/usr/lib/dmcli/
|
||||
mv $(1)/usr/lib/dmcli/common/os_qjs.js $(1)/usr/lib/dmcli/common/os.js
|
||||
rm $(1)/usr/lib/dmcli/common/os_node.js
|
||||
$(CP) $(PKG_BUILD_DIR)/core $(1)/usr/lib/dmcli/
|
||||
$(CP) $(PKG_BUILD_DIR)/cli $(1)/usr/lib/dmcli/
|
||||
$(CP) $(PKG_BUILD_DIR)/data $(1)/usr/lib/dmcli/
|
||||
$(CP) $(PKG_BUILD_DIR)/plugins $(1)/usr/lib/dmcli/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DATA) ./files/etc/uci-defaults/36-dmcli $(1)/etc/uci-defaults/
|
||||
ifeq ($(CONFIG_DMCLI_REMOTE_CONNECTION),y)
|
||||
$(INSTALL_DATA) ./files/etc/uci-defaults/36-dmcli-remote $(1)/etc/uci-defaults/
|
||||
else
|
||||
$(INSTALL_DATA) ./files/etc/uci-defaults/36-dmcli-remote-remove $(1)/etc/uci-defaults/
|
||||
endif
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/dmcli
|
||||
$(CP) ./files/etc/dmcli/dmcli.acl $(1)/etc/dmcli/
|
||||
$(CP) ./files/etc/dmcli/dmcli.conf $(1)/etc/dmcli/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/users/roles/
|
||||
$(INSTALL_DATA) ./files/etc/users/roles/operator.json $(1)/etc/users/roles/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dmcli))
|
||||
4
dmcli/files/etc/dmcli/dmcli.acl
Normal file
4
dmcli/files/etc/dmcli/dmcli.acl
Normal file
@@ -0,0 +1,4 @@
|
||||
user operator
|
||||
topic read /usp/operator/controller/reply-to
|
||||
topic read /usp/operator/controller
|
||||
topic write /usp/operator/endpoint
|
||||
45
dmcli/files/etc/dmcli/dmcli.conf
Normal file
45
dmcli/files/etc/dmcli/dmcli.conf
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"Settings": {
|
||||
"USP": {
|
||||
"ActiveConnectionProfile": "local",
|
||||
"ConnectionProfile": [
|
||||
{
|
||||
"Name": "local",
|
||||
"Host": "127.0.0.1",
|
||||
"Port": 9002,
|
||||
"Username": "operator",
|
||||
"Protocol": "ws",
|
||||
"FromId": "oui:000F94:device-controller-operator",
|
||||
"PublishEndpoint": "/usp/operator/endpoint",
|
||||
"SubscribeEndpoint": "/usp/operator/controller"
|
||||
}
|
||||
],
|
||||
"Session": {
|
||||
"AutoStart": false
|
||||
},
|
||||
"Notification": {
|
||||
"LogTo": "console",
|
||||
"Format": "brief",
|
||||
"LogFile": "usp-notification.log"
|
||||
}
|
||||
},
|
||||
"CLI": {
|
||||
"Home": "/",
|
||||
"Color": "true",
|
||||
"Mode": "Command",
|
||||
"ShowCommandTime": false,
|
||||
"SortDMTree": false
|
||||
},
|
||||
"Prompt": {
|
||||
"Auto": true,
|
||||
"Color": "default",
|
||||
"SelectedBackgroundColor": "yellow",
|
||||
"PageSize": "3",
|
||||
"AutoPromptOnEmptyCommand": false,
|
||||
"AutoPromptInstanceNumbers": false
|
||||
},
|
||||
"Log": {
|
||||
"Level": "Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
120
dmcli/files/etc/uci-defaults/36-dmcli
Normal file
120
dmcli/files/etc/uci-defaults/36-dmcli
Normal file
@@ -0,0 +1,120 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/iopsys-environment.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
DMCLI_CONF="/etc/dmcli/dmcli.conf"
|
||||
CONTROLLER_ID='oui:000F94:device-controller-operator'
|
||||
DMCLI_RESP_TOPIC="/usp/operator/endpoint"
|
||||
DMCLI_CTRL_TOPIC="/usp/operator/controller"
|
||||
DMCLI_PORT="9002"
|
||||
|
||||
grep -q "^operator:" /etc/passwd || {
|
||||
adduser -g 'Operator' -D -H -s /usr/bin/dmcli --home '/usr/lib/dmcli' 'operator'
|
||||
hash=""
|
||||
if type get_operator_password_hash > /dev/null 2>&1; then
|
||||
hash=$(get_operator_password_hash)
|
||||
fi
|
||||
if [ -z "$hash" ]; then
|
||||
hash='$6$zP4Wk/VQJOLwwofC$teuhnYFQBcA8YUZo/Q0quDMi4SsOHmfBcyvt5VNchPnzgwF1nfNNliC3yBVW22NwmwttPEWeBEBfnMTBB0rYs/'
|
||||
fi
|
||||
echo "operator:${hash}" | chpasswd -e
|
||||
}
|
||||
|
||||
grep -q "^/usr/bin/dmcli$" /etc/shells || {
|
||||
echo '/usr/bin/dmcli' >> /etc/shells
|
||||
}
|
||||
|
||||
uci -q del_list sshd.@sshd[0].AllowUsers='operator'
|
||||
uci -q add_list sshd.@sshd[0].AllowUsers='operator'
|
||||
|
||||
uci -q delete users.operator
|
||||
uci -q set users.operator=user
|
||||
uci -q set users.operator.enabled=1
|
||||
uci -q set users.operator.shell='dmcli'
|
||||
uci -q set users.operator.member_roles='operator'
|
||||
|
||||
if [ -f "/etc/config/mosquitto" ]; then
|
||||
uci_add mosquitto listener dmcli_local
|
||||
uci_set mosquitto dmcli_local enabled 1
|
||||
uci_set mosquitto dmcli_local port "${DMCLI_PORT}"
|
||||
uci_set mosquitto dmcli_local protocol 'websockets'
|
||||
uci_set mosquitto dmcli_local acl_file '/etc/dmcli/dmcli.acl'
|
||||
uci_set mosquitto dmcli_local no_remote_access '1'
|
||||
uci_set mosquitto dmcli_local allow_anonymous '1'
|
||||
fi
|
||||
|
||||
if [ -f "/etc/config/obuspa" ]; then
|
||||
uci_add obuspa mqtt mqtt_operator
|
||||
uci_set obuspa mqtt_operator BrokerAddress '127.0.0.1'
|
||||
uci_set obuspa mqtt_operator BrokerPort '1883'
|
||||
uci_set obuspa mqtt_operator TransportProtocol 'TCP/IP'
|
||||
|
||||
uci_add obuspa mtp mtp_operator
|
||||
uci_set obuspa mtp_operator Protocol 'MQTT'
|
||||
uci_set obuspa mtp_operator ResponseTopicConfigured "${DMCLI_RESP_TOPIC}"
|
||||
uci_set obuspa mtp_operator mqtt 'mqtt_operator'
|
||||
|
||||
uci_add obuspa controller controller_operator
|
||||
uci_set obuspa controller_operator EndpointID "${CONTROLLER_ID}"
|
||||
uci_set obuspa controller_operator Protocol 'MQTT'
|
||||
uci_set obuspa controller_operator Topic "${DMCLI_CTRL_TOPIC}"
|
||||
uci_set obuspa controller_operator mqtt 'mqtt_operator'
|
||||
uci_set obuspa controller_operator assigned_role_name 'operator'
|
||||
fi
|
||||
|
||||
_get_endpoint_id() {
|
||||
local id serial oui
|
||||
|
||||
id="$(uci -q get obuspa.localagent.EndpointID)"
|
||||
if [ -n "${id}" ]; then
|
||||
echo "${id}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
|
||||
echo "os::${oui}-${serial//+/%2B}"
|
||||
}
|
||||
|
||||
update_dmcli_conf() {
|
||||
local endpointid confTmpFile
|
||||
local port fromid publish subscribe toid
|
||||
|
||||
if [ -f "${DMCLI_CONF}" ]; then
|
||||
endpointid="$(_get_endpoint_id)"
|
||||
json_load_file "${DMCLI_CONF}" || return
|
||||
json_select "Settings" || return
|
||||
json_select "USP" || return
|
||||
json_select "ConnectionProfile" || return
|
||||
json_select "1" || return
|
||||
json_get_var port "Port"
|
||||
json_get_var fromid "FromId"
|
||||
json_get_var publish "PublishEndpoint"
|
||||
json_get_var subscribe "SubscribeEndpoint"
|
||||
json_get_var toid "ToId"
|
||||
|
||||
json_add_int "Port" "${DMCLI_PORT}"
|
||||
json_add_string "FromId" "${CONTROLLER_ID}"
|
||||
json_add_string "PublishEndpoint" "${DMCLI_RESP_TOPIC}"
|
||||
json_add_string "SubscribeEndpoint" "${DMCLI_CTRL_TOPIC}"
|
||||
json_add_string "ToId" "${endpointid}"
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select ..
|
||||
|
||||
if [ "${port}" != "${DMCLI_PORT}" ] || [ "${fromid}" != "${CONTROLLER_ID}" ] || \
|
||||
[ "${publish}" != "${DMCLI_RESP_TOPIC}" ] || [ "${subscribe}" != "${DMCLI_CTRL_TOPIC}" ] || \
|
||||
[ "${toid}" != "${endpointid}" ]; then
|
||||
confTmpFile="$(mktemp -u -p "$(dirname "$DMCLI_CONF")" "$(basename "$DMCLI_CONF").XXXXXXX")"
|
||||
json_pretty
|
||||
json_dump > "${confTmpFile}" || return
|
||||
mv -f "${confTmpFile}" "${DMCLI_CONF}" || return
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
update_dmcli_conf || exit
|
||||
14
dmcli/files/etc/uci-defaults/36-dmcli-remote
Normal file
14
dmcli/files/etc/uci-defaults/36-dmcli-remote
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
if [ -f "/etc/config/mosquitto" ]; then
|
||||
uci_add mosquitto listener dmcli
|
||||
uci_set mosquitto dmcli enabled 1
|
||||
uci_set mosquitto dmcli port '9003'
|
||||
uci_set mosquitto dmcli protocol 'websockets'
|
||||
uci_set mosquitto dmcli auth_plugin '/usr/lib/mosquitto_auth_plugin.so'
|
||||
uci_set mosquitto dmcli acl_file '/etc/dmcli/dmcli.acl'
|
||||
fi
|
||||
|
||||
exit 0
|
||||
9
dmcli/files/etc/uci-defaults/36-dmcli-remote-remove
Normal file
9
dmcli/files/etc/uci-defaults/36-dmcli-remote-remove
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
if [ -f "/etc/config/mosquitto" ]; then
|
||||
uci_remove mosquitto dmcli
|
||||
fi
|
||||
|
||||
exit 0
|
||||
14
dmcli/files/etc/users/roles/operator.json
Normal file
14
dmcli/files/etc/users/roles/operator.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"tr181": {
|
||||
"name": "operator",
|
||||
"instance": 6,
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_ALL"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
7
dmcli/src/Makefile
Normal file
7
dmcli/src/Makefile
Normal file
@@ -0,0 +1,7 @@
|
||||
all: dmcli
|
||||
|
||||
dmcli: main.c
|
||||
$(CC) $(CFLAGS) -Wall -Werror -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f dmcli
|
||||
32
dmcli/src/main.c
Normal file
32
dmcli/src/main.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Genexis Netherlands B.V. All rights reserved.
|
||||
* This Software and its content are protected by the Dutch Copyright Act
|
||||
* ('Auteurswet'). All and any copying and distribution of the software
|
||||
* and its content without authorization by Genexis Netherlands B.V. is
|
||||
* prohibited. The prohibition includes every form of reproduction and
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* C Wrapper for operator to login to the CLI via ssh: the shell in
|
||||
* the passwd file cannot be a script that requires an interpreter. */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *cmd[3 + (argc > 1 ? argc - 1 : 0)];
|
||||
|
||||
cmd[0] = "/usr/bin/qjs";
|
||||
cmd[1] = "/usr/lib/dmcli/cli/main.js";
|
||||
cmd[2] = NULL;
|
||||
|
||||
if (argc > 1) {
|
||||
memcpy(&cmd[2], &argv[1], (argc - 1) * sizeof(char *));
|
||||
cmd[2 + argc - 1] = NULL;
|
||||
}
|
||||
|
||||
execv(cmd[0], cmd);
|
||||
fprintf(stderr, "%s: command not found\n", cmd[0]);
|
||||
return 127;
|
||||
}
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dnsmngr
|
||||
PKG_VERSION:=1.0.18
|
||||
PKG_VERSION:=1.0.20
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dnsmngr.git
|
||||
PKG_SOURCE_VERSION:=80fa147e6f1f0d9c1a62a62a693ff3adaef45363
|
||||
PKG_SOURCE_VERSION:=83e485fae8905f9061257264cf43ea41e47743a6
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethmngr
|
||||
PKG_VERSION:=3.0.8
|
||||
PKG_VERSION:=3.1.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/ethmngr.git
|
||||
PKG_SOURCE_VERSION:=c73e5b15718ca40b2740bbe6151dfbb2bcca16df
|
||||
PKG_SOURCE_VERSION:=0283fb5cb74a7baca46c4360da680757c57c86ac
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -10,19 +10,14 @@ PKG_NAME:=fdtextract
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0
|
||||
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/fdtextract.git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/system/fdtextract.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=e3cefda3b26c9aea3021b20725ce7b31b33eebc4
|
||||
PKG_SOURCE_VERSION:=7917dbcb29724476cd46164eec29848df1e5fb67
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
RSTRIP:=true
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
@@ -40,9 +35,7 @@ endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fdtextract $(1)/usr/sbin/
|
||||
$(STRIP) $(1)/usr/sbin/fdtextract
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -8,11 +8,5 @@ config FIREWALLMNGR_PORT_TRIGGER
|
||||
help
|
||||
Set this option to include support for PortTrigger object.
|
||||
|
||||
config FIREWALLMNGR_NAT_INTERFACE_SETTING
|
||||
bool "Include Device.NAT.InterfaceSetting"
|
||||
default n
|
||||
help
|
||||
Set this option to include support for NAT InterfaceSetting object.
|
||||
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=firewallmngr
|
||||
PKG_VERSION:=1.0.9.1
|
||||
PKG_VERSION:=1.0.12
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/firewallmngr.git
|
||||
PKG_SOURCE_VERSION:=3ce0550dbbc49617c36202fc8d63e453467a246e
|
||||
PKG_SOURCE_VERSION:=30319c67fb4db285a2bcd272b1c10bc040eecf19
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -52,10 +52,6 @@ ifeq ($(CONFIG_FIREWALLMNGR_PORT_TRIGGER),y)
|
||||
TARGET_CFLAGS += -DINCLUDE_PORT_TRIGGER
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FIREWALLMNGR_NAT_INTERFACE_SETTING),y)
|
||||
TARGET_CFLAGS += -DINCLUDE_NAT_IF_SETTING
|
||||
endif
|
||||
|
||||
define Package/firewallmngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
|
||||
@@ -110,7 +110,7 @@ configure_send_op125() {
|
||||
|
||||
|
||||
if [ "${uci}" = "network" ]; then
|
||||
new_send_opt="$sendopt $opt125"
|
||||
[ -n "${sendopt}" ] && new_send_opt="$sendopt $opt125" || new_send_opt="$opt125"
|
||||
uci -q set network."${intf}".sendopts="$new_send_opt"
|
||||
else
|
||||
new_send_opt="$sendopt$opt125"
|
||||
@@ -228,7 +228,7 @@ enable_dhcp_option125() {
|
||||
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
[ -n "${reqopts}" ] && newreqopts="$reqopts 125" || newreqopts="125"
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
fi
|
||||
|
||||
|
||||
@@ -40,22 +40,22 @@ get_vivsoi() {
|
||||
|
||||
#hex-string 2 character=1 Byte
|
||||
# length in hex string will be twice of actual Byte length
|
||||
[ "$len" -gt "8" ] || return
|
||||
[ "${len}" -gt 8 ] || return
|
||||
|
||||
data="${opt125}"
|
||||
rem_len="${len}"
|
||||
while [ $rem_len -gt 0 ]; do
|
||||
while [ "${rem_len}" -gt 0 ]; do
|
||||
ent_id=${data:0:8}
|
||||
ent_id=$(printf "%d\n" "0x$ent_id")
|
||||
|
||||
if [ $ent_id -ne 3561 ]; then
|
||||
if [ "${ent_id}" -ne 3561 ]; then
|
||||
len_val=${data:8:2}
|
||||
data_len=$(printf "%d\n" "0x$len_val")
|
||||
# add 4 byte for ent_id and 1 byte for len
|
||||
data_len=$(( data_len * 2 + 10 ))
|
||||
# move ahead data to next enterprise id
|
||||
data=${data:"${data_len}":"${rem_len}"}
|
||||
rem_len=$(( rem_len - $data_len ))
|
||||
rem_len=$(( rem_len - data_len ))
|
||||
continue
|
||||
fi
|
||||
|
||||
@@ -66,7 +66,7 @@ get_vivsoi() {
|
||||
data_len=$(( data_len * 2 + 10 ))
|
||||
|
||||
opt_len=$(printf "%d\n" "0x$len_val")
|
||||
[ $opt_len -eq 0 ] && return
|
||||
[ "${opt_len}" -eq 0 ] && return
|
||||
|
||||
# populate the option data of enterprise id
|
||||
sub_data_len=$(( opt_len * 2))
|
||||
@@ -74,7 +74,7 @@ get_vivsoi() {
|
||||
sub_data=${data:10:"${sub_data_len}"}
|
||||
|
||||
# parsing of suboption of option 125
|
||||
while [ $sub_data_len -gt 0 ]; do
|
||||
while [ "${sub_data_len}" -gt 0 ]; do
|
||||
# get the suboption id
|
||||
sub_opt_id=${sub_data:0:2}
|
||||
sub_opt_id=$(printf "%d\n" "0x$sub_opt_id")
|
||||
@@ -85,20 +85,20 @@ get_vivsoi() {
|
||||
sub_opt_len=$(( sub_opt_len * 2 ))
|
||||
|
||||
# get the value of sub option starting 4 means starting after length
|
||||
sub_opt_val=${sub_data:4:${sub_opt_len}}
|
||||
sub_opt_val=${sub_data:4:"${sub_opt_len}"}
|
||||
|
||||
# assign the value found in sub option
|
||||
case "${sub_opt_id}" in
|
||||
"4")
|
||||
OUI=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
OUI=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
GW_DISCOVERED=1
|
||||
;;
|
||||
"5")
|
||||
SERIAL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
SERIAL=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
GW_DISCOVERED=1
|
||||
;;
|
||||
"6")
|
||||
CLASS=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
CLASS=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
GW_DISCOVERED=1
|
||||
;;
|
||||
esac
|
||||
@@ -110,7 +110,7 @@ get_vivsoi() {
|
||||
sub_data_len=$((sub_data_len - sub_opt_end))
|
||||
|
||||
# fetch next sub option hex string
|
||||
sub_data=${sub_data:${sub_opt_end}:${sub_data_len}}
|
||||
sub_data=${sub_data:"${sub_opt_end}":"${sub_data_len}"}
|
||||
done
|
||||
|
||||
# move ahead data to next enterprise id
|
||||
@@ -131,15 +131,13 @@ send_host_query() {
|
||||
sleep 5
|
||||
|
||||
json_load "$(ubus call umdns browse)"
|
||||
json_select discovered_services
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
if ! json_select discovered_services; then
|
||||
json_cleanup
|
||||
loop=$(( loop - 1 ))
|
||||
continue
|
||||
fi
|
||||
|
||||
json_select _usp-agt-mqtt._tcp
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
if ! json_select _usp-agt-mqtt._tcp; then
|
||||
json_cleanup
|
||||
loop=$(( loop - 1 ))
|
||||
continue
|
||||
@@ -156,7 +154,7 @@ send_host_query() {
|
||||
|
||||
json_get_keys keys
|
||||
for key in $keys; do
|
||||
json_select $key
|
||||
json_select "${key}"
|
||||
json_get_var _host host ""
|
||||
|
||||
if [ -z "${_host}" ] || [[ "${sent_host}" =~ " ${_host}" ]]; then
|
||||
@@ -166,9 +164,10 @@ send_host_query() {
|
||||
|
||||
sent_host="${sent_host} ${_host}"
|
||||
cmd="ubus call umdns query '{\"question\":\"$_host\",\"interface\":\"$intf\"}'"
|
||||
eval $cmd
|
||||
sh -c "${cmd}"
|
||||
resp=0
|
||||
json_select ..
|
||||
sleep 2 # umdns query sometime takes time to resolve so adding some sleep
|
||||
done
|
||||
|
||||
json_cleanup
|
||||
@@ -185,32 +184,29 @@ get_usp_agent_id() {
|
||||
fi
|
||||
|
||||
json_load "$(ubus call umdns browse)"
|
||||
json_select discovered_services
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
if ! json_select discovered_services; then
|
||||
json_cleanup
|
||||
echo ${ID}
|
||||
echo "${ID}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_select _usp-agt-mqtt._tcp
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
if ! json_select _usp-agt-mqtt._tcp; then
|
||||
json_cleanup
|
||||
echo ${ID}
|
||||
echo "${ID}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_get_keys keys
|
||||
for key in $keys; do
|
||||
json_select $key
|
||||
json_select $family
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
json_select "${key}"
|
||||
if ! json_select "${family}"; then
|
||||
json_select ..
|
||||
continue
|
||||
fi
|
||||
|
||||
json_get_keys ips
|
||||
for ip in $ips; do
|
||||
json_get_var ip_val $ip
|
||||
json_get_var ip_val "${ip}"
|
||||
if [ "${ip_val}" != "${dhcp_ip}" ]; then
|
||||
continue
|
||||
fi
|
||||
@@ -219,8 +215,8 @@ get_usp_agent_id() {
|
||||
json_select txt
|
||||
json_get_keys txts
|
||||
for _txt in $txts; do
|
||||
json_get_var text_val $_txt
|
||||
if [[ "${text_val:0:3}" == "ID=" ]]; then
|
||||
json_get_var text_val "${_txt}"
|
||||
if [[ "${text_val:0:3}" = "ID=" ]]; then
|
||||
ID="${text_val:3}"
|
||||
break
|
||||
fi
|
||||
@@ -238,16 +234,16 @@ get_usp_agent_id() {
|
||||
done
|
||||
|
||||
json_cleanup
|
||||
echo ${ID}
|
||||
echo "${ID}"
|
||||
}
|
||||
|
||||
get_mac_address() {
|
||||
ip="${1}"
|
||||
device="${2}"
|
||||
|
||||
mac="$(cat /proc/net/arp | grep $ip | awk '{print $4}')"
|
||||
mac=$(grep "${ip}" /proc/net/arp | awk '{print $4}')
|
||||
if [ -z "${mac}" ]; then
|
||||
arp_resp="$(arping -b -f -c 5 -I $device $ip | grep 'Unicast reply from' | awk '{print $5}')"
|
||||
arp_resp=$(arping -b -f -c 5 -I "${device}" "${ip}" | grep 'Unicast reply from' | awk '{print $5}')
|
||||
if [ -n "${arp_resp}" ]; then
|
||||
mac=${arp_resp:1:-1}
|
||||
fi
|
||||
@@ -260,7 +256,7 @@ send_unknown_gw_event() {
|
||||
mac="${1}"
|
||||
|
||||
cmd="ubus -t 5 send gateway-info.gateway.unknown '{\"hwaddr\":\"$mac\"}'"
|
||||
eval $cmd
|
||||
sh -c "${cmd}"
|
||||
}
|
||||
|
||||
send_cwmp_gw_event() {
|
||||
@@ -269,14 +265,14 @@ send_cwmp_gw_event() {
|
||||
serial="${3}"
|
||||
|
||||
cmd="ubus -t 5 send gateway-info.gateway.cwmp '{\"oui\":\"$oui\",\"class\":\"$class\",\"serial\":\"$serial\"}'"
|
||||
eval $cmd
|
||||
sh -c "${cmd}"
|
||||
}
|
||||
|
||||
send_usp_gw_event() {
|
||||
endpoint="${1}"
|
||||
|
||||
cmd="ubus -t 5 send gateway-info.gateway.usp '{\"endpoint\":\"$endpoint\"}'"
|
||||
eval $cmd
|
||||
sh -c "${cmd}"
|
||||
}
|
||||
|
||||
config_load gateway
|
||||
@@ -287,13 +283,13 @@ if [ "${enable}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
if [ "${1}" == "deconfig" ]; then
|
||||
if [ "${wan_intf}" = "${INTERFACE}" ]; then
|
||||
if [ "${1}" = "deconfig" ]; then
|
||||
rm -rf /var/state/gwinfo
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_load "$(ifstatus ${INTERFACE})"
|
||||
json_load "$(ifstatus "${INTERFACE}")"
|
||||
json_get_var dev_name device ""
|
||||
json_select data
|
||||
json_get_var dhcp_ip dhcpserver ""
|
||||
@@ -303,7 +299,7 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
MAC="$(get_mac_address $dhcp_ip $dev_name)"
|
||||
MAC=$(get_mac_address "${dhcp_ip}" "${dev_name}")
|
||||
|
||||
mkdir -p /var/state
|
||||
touch /var/state/gwinfo
|
||||
@@ -326,8 +322,8 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
len=$(printf "$opt125"|wc -c)
|
||||
get_vivsoi "$opt125" "$len"
|
||||
len=$(echo -n "${opt125}" | wc -c)
|
||||
get_vivsoi "${opt125}" "${len}"
|
||||
|
||||
if [ "${GW_DISCOVERED}" -eq 0 ]; then
|
||||
send_unknown_gw_event "${MAC}"
|
||||
@@ -341,19 +337,18 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
uci -q -c /var/state commit gwinfo
|
||||
|
||||
# Check for USP parameters
|
||||
ubus -t 15 wait_for umdns
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
if ! ubus -t 15 wait_for umdns; then
|
||||
send_cwmp_gw_event "${OUI}" "${CLASS}" "${SERIAL}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
resp=$(send_host_query $dev_name)
|
||||
resp=$(send_host_query "${dev_name}")
|
||||
if [ "${resp}" -ne 0 ]; then
|
||||
send_cwmp_gw_event "${OUI}" "${CLASS}" "${SERIAL}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
ID="$(get_usp_agent_id $dhcp_ip)"
|
||||
ID=$(get_usp_agent_id "${dhcp_ip}")
|
||||
if [ -z "${ID}" ]; then
|
||||
send_cwmp_gw_event "${OUI}" "${CLASS}" "${SERIAL}"
|
||||
return 0
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostmngr
|
||||
PKG_VERSION:=1.3.3
|
||||
PKG_VERSION:=1.4.3
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=fee5bd0067fc1f30498bc2b81e893d170796b459
|
||||
PKG_SOURCE_VERSION:=667866b8149d3df83a05536319eac02aee0b6d75
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/hostmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.9.9.4
|
||||
PKG_VERSION:=9.10.10
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
|
||||
PKG_SOURCE_VERSION:=868f749f3fd61a094cc4792ea842a261443a99ad
|
||||
PKG_SOURCE_VERSION:=63251b6c9789b1428604af0a5c1d23d32d14a8b8
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -84,6 +84,7 @@ define Package/icwmp/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
|
||||
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
|
||||
$(INSTALL_BIN) ./files/etc/init.d/icwmpd $(1)/etc/init.d/icwmpd
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/50-cwmp-align-keep-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/95-set-random-inform-time $(1)/etc/uci-defaults/
|
||||
|
||||
@@ -31,7 +31,6 @@ config cpe 'cpe'
|
||||
option bind_retries '5'
|
||||
option userid '' #$OUI-$SER
|
||||
option passwd ''
|
||||
option port '7547'
|
||||
option provisioning_code ''
|
||||
option amd_version '5'
|
||||
# compression possible configs: InstanceNumber, InstanceAlias
|
||||
@@ -43,7 +42,9 @@ config cpe 'cpe'
|
||||
option periodic_notify_interval '10'
|
||||
option incoming_rule 'Port_Only'
|
||||
option active_notif_throttle '0'
|
||||
option fw_upgrade_keep_settings '1'
|
||||
#option KeepConfig '1'
|
||||
#option KeepOpConf '1'
|
||||
#option ConfigScope 'UserOnly'
|
||||
option clock_sync_timeout '128'
|
||||
option disable_datatype_check '0'
|
||||
#list allowed_cr_ip '10.5.1.0/24'
|
||||
|
||||
@@ -133,9 +133,56 @@ add_firewall_rule() {
|
||||
fi
|
||||
}
|
||||
|
||||
remove_port_protection() {
|
||||
local enabled chain rule rule_num
|
||||
|
||||
config_get enabled "${1}" "${2}"
|
||||
|
||||
if [ "${enabled}" -eq 1 ]; then
|
||||
config_get zonename "$1" name
|
||||
[ -n "$zonename" ] || return 0
|
||||
|
||||
chain='prerouting_'$zonename'_rule'
|
||||
|
||||
while rule=$(iptables -w -t nat -nL "$chain" --line-numbers | grep -m 1 -w CWMP_Port_protection); do
|
||||
rule_num=${rule%%[$' \t']*}
|
||||
iptables -w -t nat -D "$chain" "$rule_num"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup_port_protection() {
|
||||
config_load firewall
|
||||
config_foreach remove_port_protection zone masq
|
||||
}
|
||||
|
||||
install_port_protection() {
|
||||
local PORT="${3}"
|
||||
local enabled zonename chain
|
||||
|
||||
config_get enabled "${1}" "${2}"
|
||||
|
||||
if [ "${enabled}" -eq 1 ]; then
|
||||
config_get zonename "${1}" name
|
||||
[ -n "$zonename" ] || return 0
|
||||
|
||||
chain='prerouting_'$zonename'_rule'
|
||||
|
||||
iptables -w -t nat -I "$chain" -p tcp --dport "$PORT" -j ACCEPT -m comment --comment=CWMP_Port_protection
|
||||
iptables -w -t nat -I "$chain" -p udp --dport "$PORT" -j ACCEPT -m comment --comment=CWMP_Port_protection
|
||||
fi
|
||||
}
|
||||
|
||||
add_port_protection() {
|
||||
config_load firewall
|
||||
config_foreach install_port_protection zone masq "${1}"
|
||||
}
|
||||
|
||||
configure_connection_req_rules() {
|
||||
app="${1}"
|
||||
|
||||
cleanup_port_protection
|
||||
|
||||
wan="$(uci -q get cwmp.cpe.default_wan_interface)"
|
||||
wan="${wan:-wan}"
|
||||
|
||||
@@ -175,8 +222,11 @@ configure_connection_req_rules() {
|
||||
fi
|
||||
fi
|
||||
|
||||
port=$(uci -q get cwmp.cpe.port)
|
||||
port="${port:-7547}"
|
||||
port=$(uci -q -c /var/state get icwmp.cpe.port)
|
||||
if [ -z "${port}" ]; then
|
||||
log "cwmp cpe port not configured"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ipaddr=$(uci -q get cwmp.cpe.allowed_cr_ip)
|
||||
if [ -n "${ipaddr}" ]; then
|
||||
@@ -197,6 +247,8 @@ configure_connection_req_rules() {
|
||||
# Close the ACS port at Lan side
|
||||
close_downstream_acs_port "${lan}" "${port}"
|
||||
fi
|
||||
|
||||
add_port_protection "${port}"
|
||||
}
|
||||
|
||||
load_zone_names
|
||||
|
||||
@@ -97,7 +97,9 @@ validate_cpe_section()
|
||||
'periodic_notify_enable:bool' \
|
||||
'enable:bool:1' \
|
||||
'periodic_notify_interval:uinteger' \
|
||||
'fw_upgrade_keep_settings:bool'
|
||||
'KeepConfig:bool' \
|
||||
'KeepOpConf:bool' \
|
||||
'ConfigScope:string'
|
||||
}
|
||||
|
||||
validate_defaults() {
|
||||
@@ -168,13 +170,21 @@ start_service() {
|
||||
|
||||
stop_service()
|
||||
{
|
||||
local switch_bank
|
||||
local switch_bank KeepConfig KeepOpConf ConfigScope
|
||||
|
||||
copy_cwmp_varstate_files_to_etc
|
||||
|
||||
switch_bank=$(uci -q -c /var/state/ get icwmp.cpe.switch_bank)
|
||||
if [ -n "$switch_bank" ] && [ "$switch_bank" = "1" ]; then
|
||||
[ -x /etc/sysmngr/fwbank ] && /etc/sysmngr/fwbank call copy_config
|
||||
if [ "$switch_bank" = "1" ] && [ -x /etc/sysmngr/fwbank ]; then
|
||||
KeepConfig="$(uci -q get cwmp.cpe.KeepConfig)"
|
||||
KeepOpConf="$(uci -q get cwmp.cpe.KeepOpConf)"
|
||||
ConfigScope="$(uci -q get cwmp.cpe.ConfigScope)"
|
||||
|
||||
json_init
|
||||
[ -n "${KeepConfig}" ] && json_add_boolean "keep_config" "${KeepConfig}"
|
||||
[ -n "${KeepOpConf}" ] && json_add_boolean "keep_opconf" "${KeepOpConf}"
|
||||
[ -n "${ConfigScope}" ] && json_add_string "config_scope" "${ConfigScope}"
|
||||
|
||||
json_dump| /etc/sysmngr/fwbank call copy_config
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
7
icwmp/files/etc/uci-defaults/50-cwmp-align-keep-config
Normal file
7
icwmp/files/etc/uci-defaults/50-cwmp-align-keep-config
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
keep_settings="$(uci -q get cwmp.cpe.fw_upgrade_keep_settings)"
|
||||
if [ -n "${keep_settings}" ]; then
|
||||
uci -q delete cwmp.cpe.fw_upgrade_keep_settings
|
||||
uci -q set cwmp.cpe.KeepConfig="${keep_settings}"
|
||||
fi
|
||||
@@ -5,7 +5,6 @@ uci -q batch <<-EOT
|
||||
set firewall.cwmp=include
|
||||
set firewall.cwmp.path=/etc/icwmpd/firewall.cwmp
|
||||
set firewall.cwmp.reload=1
|
||||
commit firewall
|
||||
EOT
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -16,12 +16,12 @@ get_opt43() {
|
||||
local opt43="$1"
|
||||
local len="$2"
|
||||
|
||||
[ "$len" -gt "2" ] || return
|
||||
[ "${len}" -gt 2 ] || return
|
||||
|
||||
first_byte=${opt43:0:2}
|
||||
first_byte=$(printf "%d\n" "0x$first_byte")
|
||||
|
||||
if [ $len -ge 4 ] && [ $first_byte -ge 1 ] && [ $first_byte -le 4 ]; then
|
||||
if [ "${len}" -ge 4 ] && [ "${first_byte}" -ge 1 ] && [ "${first_byte}" -le 4 ]; then
|
||||
# it is in encapsulated form
|
||||
# opt43 encapsulated vendor-specific option has data in below format
|
||||
# Code Len Data item Code Len Data item Code
|
||||
@@ -35,7 +35,7 @@ get_opt43() {
|
||||
data="${opt43}"
|
||||
rem_len="${len}"
|
||||
# parsing of suboption of option 43
|
||||
while [ $rem_len -gt 0 ]; do
|
||||
while [ "${rem_len}" -gt 0 ]; do
|
||||
# get the suboption id
|
||||
sub_opt_id=${data:0:2}
|
||||
sub_opt_id=$(printf "%d\n" "0x$sub_opt_id")
|
||||
@@ -50,13 +50,13 @@ get_opt43() {
|
||||
|
||||
# assign the value found in sub option
|
||||
case "${sub_opt_id}" in
|
||||
"1") DHCP_ACS_URL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
"1") DHCP_ACS_URL=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"2") DHCP_PROV_CODE=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
"2") DHCP_PROV_CODE=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"3") MIN_WAIT_INVL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
"3") MIN_WAIT_INVL=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"4") INVL_MULTIPLIER=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
"4") INVL_MULTIPLIER=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -70,13 +70,14 @@ get_opt43() {
|
||||
rem_len=$((rem_len - sub_opt_end))
|
||||
done
|
||||
else
|
||||
DHCP_ACS_URL=$(echo -n $opt43 | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
DHCP_ACS_URL=$(echo -n "${opt43}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
fi
|
||||
}
|
||||
|
||||
config_load cwmp
|
||||
config_get wan_intf cpe default_wan_interface "wan"
|
||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
config_get_bool insecure_enable acs insecure_enable "0"
|
||||
config_get dhcp_url acs dhcp_url ""
|
||||
config_get min_wait_intvl acs dhcp_retry_min_wait_interval "0"
|
||||
config_get intvl_multi acs dhcp_retry_interval_multiplier "0"
|
||||
@@ -92,9 +93,9 @@ if [ "$discovery_enable" = "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
if [ "${wan_intf}" = "${INTERFACE}" ]; then
|
||||
if [ -n "$opt43" ]; then
|
||||
len=$(printf "$opt43"|wc -c)
|
||||
len=$(echo -n "$opt43"|wc -c)
|
||||
get_opt43 "$opt43" "$len"
|
||||
fi
|
||||
|
||||
@@ -102,6 +103,17 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${insecure_enable}" -eq "0" ]; then
|
||||
case $DHCP_ACS_URL in
|
||||
https://*)
|
||||
log "ACS url $DHCP_ACS_URL has https"
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
sec=$(uci -q get cwmp.acs)
|
||||
|
||||
if [ -z "${sec}" ]; then
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=8.7.33
|
||||
PKG_VERSION:=8.7.44
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=f28f1c04cae008d7d6448ba02b992506af28448c
|
||||
PKG_SOURCE_VERSION:=29ba8f04dc6bd7e77683352c0c71988f51fbadf8
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -116,7 +116,7 @@ MAKE_PATH:=src
|
||||
|
||||
|
||||
define Package/ieee1905/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(CP) ./files/etc $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
23
ieee1905/files/datamodel_description.json
Normal file
23
ieee1905/files/datamodel_description.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"Device.IEEE1905.AL.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"{BBF_VENDOR_PREFIX}LocalOnlyMode": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"description": "Enable or disable interfaces from ieee1905.",
|
||||
"datatype": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ PKG_NAME:=iopsys-analytics
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=25e32ac5a860aec6e53e3449565b71595073e014
|
||||
PKG_SOURCE_VERSION:=5ad41ca8eb5de887487feb7148b5dce44943218c
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/iopsys-analytics.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -34,6 +34,9 @@ define Package/$(PKG_NAME)
|
||||
+@PACKAGE_syslog-ng:SYSLOGNG_LOGROTATE \
|
||||
+PACKAGE_fluent-bit:logrotate \
|
||||
+@DMCLI_REMOTE_CONNECTION
|
||||
# tools used in development/testing
|
||||
DEPENDS+= \
|
||||
+iperf3
|
||||
|
||||
endef
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libdpp
|
||||
PKG_VERSION:=2.1.2
|
||||
PKG_VERSION:=2.1.3
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5f1184c52be19f3bfd3bc7e9bc582ef09b0a2b1c
|
||||
PKG_SOURCE_VERSION:=fdfe23e51ff77ca6d2661ad6208d097758524147
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/libdpp.git
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -1,32 +1,28 @@
|
||||
#
|
||||
# Copyright (C) 2020-2023 Iopsys
|
||||
# Copyright (C) 2025 Genexis Sweden AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libeasy
|
||||
PKG_VERSION:=7.4.6
|
||||
PKG_VERSION:=7.5.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ca7b20068c9d373e41045a2e899a9c697576262c
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libeasy.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE_VERSION:=b981f7e1bd51f66041cd0c25d15af74ae1e3bc75
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/libeasy.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=LGPL-2.1-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_LICENSE_FILES:=
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@genexis.eu>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/openssl \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
@@ -34,9 +30,6 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Wall"
|
||||
|
||||
define Package/libeasy
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
@@ -47,7 +40,7 @@ define Package/libeasy
|
||||
endef
|
||||
|
||||
define Package/libeasy/description
|
||||
Library provides common utility functions
|
||||
This package provides libeasy.so for common utility functions.
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libeasy
|
||||
@@ -67,6 +60,7 @@ define Build/InstallDev/libeasy
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(call Build/InstallDev/cmake,$(1))
|
||||
$(call Build/InstallDev/libeasy,$(1),$(2))
|
||||
endef
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libqos
|
||||
PKG_VERSION:=7.2.109
|
||||
PKG_VERSION:=7.2.111
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libqos.git
|
||||
PKG_SOURCE_VERSION:=4948d372c3d7e43a0ba9aee517dbb83b94bba3dc
|
||||
PKG_SOURCE_VERSION:=2e4c6a9c27e0f4f68dfe7a5c930afefd8dc7119a
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -65,7 +65,7 @@ define Package/libqos
|
||||
SUBMENU:=IOPSYS HAL libs
|
||||
MENU:=1
|
||||
TITLE:= QoS library (libqos)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_brcmbca:bcm963xx-bsp
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_brcmbca:bcm963xx-bsp +TARGET_airoha:libuci
|
||||
endef
|
||||
|
||||
define Package/libqos/config
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-airoha
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.7
|
||||
PKG_VERSION:=1.1.8
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@@ -17,7 +17,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=3a30086a68a3409f0396acb01380f91daabf7a2f
|
||||
PKG_SOURCE_VERSION:=9763c574ec69e2aa492db4f1296d4bcd53776fba
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -25,6 +25,5 @@ db commit
|
||||
# configure the PCM for DECT/DCX81
|
||||
[ -f "/proc/device-tree/aliases/dcx81-uart" ] && {
|
||||
uci set dect.global.pcm_fsync='SHORT_LF'
|
||||
uci set dect.global.pcm_slot_start='8'
|
||||
uci set dect.global.dect_channel_start='3'
|
||||
}
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
#
|
||||
# Copyright (C) 2020-2023 Iopsys
|
||||
# Copyright (C) 2019-2024 Iopsys
|
||||
# Copyright (C) 2025 Genexis Sweden AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libwifi
|
||||
PKG_VERSION:=7.13.7
|
||||
PKG_VERSION:=7.22.10
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=0b3cc45334c167d164c2c79e82522f13698abf92
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libwifi.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE_VERSION:=4759a74db66dd0b4bfa6707683129a317ae42779
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/libwifi.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=LGPL-2.1-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_LICENSE_FILES:=
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@genexis.eu>
|
||||
|
||||
MAKE_VERBOSE := 1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
@@ -42,10 +47,20 @@ else ifeq ($(CONFIG_TARGET_armvirt),y)
|
||||
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_PLATFORM=ECONET
|
||||
TARGET_WIFI_TYPE=MEDIATEK
|
||||
TARGET_CFLAGS +=-DIOPSYS_ECONET
|
||||
TARGET_CFLAGS +=-DIOPSYS_ECONET -I$(LINUX_DIR)/include/uapi/linux/mtk_nl80211_inc
|
||||
ifeq ($(CONFIG_TARGET_airoha_an7581),y)
|
||||
TARGET_CFLAGS +=-DCONFIG_MTK
|
||||
endif
|
||||
else ifeq ($(CONFIG_TARGET_mediatek),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
ifeq ($(CONFIG_TARGET_DEVICE_mediatek_filogic_DEVICE_cx750),y)
|
||||
TARGET_WIFI_TYPE=MEDIATEK
|
||||
TARGET_CFLAGS +=-DCONFIG_MTK -I$(LINUX_DIR)/include/uapi/linux/mtk_nl80211_inc
|
||||
else ifeq ($(CONFIG_TARGET_DEVICE_mediatek_filogic_DEVICE_mediatek_mt7987a-spim-nand-an8801sb),y)
|
||||
TARGET_WIFI_TYPE=MEDIATEK
|
||||
TARGET_CFLAGS +=-DCONFIG_MTK -I$(LINUX_DIR)/include/uapi/linux/mtk_nl80211_inc
|
||||
endif
|
||||
else ifeq ($(CONFIG_TARGET_ipq95xx),y)
|
||||
TARGET_PLATFORM=IPQ95XX
|
||||
TARGET_WIFI_TYPE=QUALCOMM
|
||||
@@ -67,7 +82,7 @@ endif
|
||||
PKG_BUILD_DEPENDS:=PACKAGE_kmod-mt7915e_en7523:mt76_en7523
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_libwifi),)
|
||||
TARGET_CFLAGS +=-DHAS_WIFI
|
||||
CMAKE_OPTIONS +=-DHAS_WIFI=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIBWIFI_USE_CTRL_IFACE),y)
|
||||
@@ -78,18 +93,8 @@ ifeq ($(CONFIG_LIBWIFI_SKIP_PROBES),y)
|
||||
TARGET_CFLAGS +=-DLIBWIFI_BRCM_SKIP_PROBES
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/openssl \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Wall -I./" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
FPIC="$(FPIC)" \
|
||||
PLATFORM="$(TARGET_PLATFORM)" \
|
||||
WIFI_TYPE="$(TARGET_WIFI_TYPE)" \
|
||||
subdirs="$(subdirs)"
|
||||
CMAKE_OPTIONS += -DPLATFORM=$(TARGET_PLATFORM) -DWIFI_TYPE=$(TARGET_WIFI_TYPE)
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
@@ -97,43 +102,39 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/libwifi-common
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=libwifi
|
||||
SUBMENU:=IOPSYS HAL libs
|
||||
DEPENDS:=+libopenssl
|
||||
MENU:=1
|
||||
define Package/libwifiutils
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:= WiFi utility library (libwifiutils.so)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +libopenssl
|
||||
endef
|
||||
|
||||
define Package/libwifiutils/description
|
||||
Library provides WiFi utility functions
|
||||
endef
|
||||
|
||||
define Package/libwifi
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:= WiFi HAL library (libwifi-7.so.m)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +libwifiutils +TARGET_brcmbca:bcm963xx-bsp
|
||||
endef
|
||||
|
||||
define Package/libwifi/description
|
||||
Library provides WiFi HAL APIs and WiFi common utility functions
|
||||
endef
|
||||
|
||||
define Package/libwifiutils
|
||||
$(call Package/libwifi-common)
|
||||
TITLE:= WiFi utility library (libwifiutils.so)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy
|
||||
Library provides WiFi HAL APIs
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libwifiutils
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/wifidefs.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/wifiutils.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifiutils*.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifiutils/wifidefs.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifiutils/wifiutils.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifiutils/libwifiutils*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libwifiutils/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifiutils*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/libwifi
|
||||
$(call Package/libwifi-common)
|
||||
TITLE:= WiFi library (libwifi)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +libwifiutils +TARGET_brcmbca:bcm963xx-bsp
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifiutils/libwifiutils*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libwifi/config
|
||||
@@ -154,13 +155,12 @@ define Package/libwifi/config
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
define Build/InstallDev/libwifi
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/wifiops.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/wifi.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi-7*.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifiops.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifi.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi-7*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ endef
|
||||
|
||||
define Package/libwifi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi-7*.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi-7*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libwifiutils))
|
||||
|
||||
@@ -65,8 +65,10 @@ define Package/logmngr/install
|
||||
$(INSTALL_DIR) $(1)/lib/logmngr
|
||||
ifeq ($(CONFIG_LOGMNGR_BACKEND_FLUENTBIT),y)
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/ntp/
|
||||
$(INSTALL_BIN) ./files/logread $(1)/sbin/
|
||||
$(INSTALL_DATA) ./files/lib/logmngr/fluent-bit.sh $(1)/lib/logmngr/
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/ntp/20-reload_fluent_bit $(1)/etc/hotplug.d/ntp/
|
||||
else ifeq ($(CONFIG_LOGMNGR_BACKEND_SYSLOG_NG),y)
|
||||
$(INSTALL_DATA) ./files/lib/logmngr/syslog-ng.sh $(1)/lib/logmngr/
|
||||
endif
|
||||
|
||||
@@ -8,7 +8,7 @@ config source 'default_source'
|
||||
|
||||
config template 'default_template'
|
||||
option name 'default_template'
|
||||
option expression '{time} {hostname} {ident}: {message}'
|
||||
option expression '{time} {hostname} {ident}[{pid}]: {message}'
|
||||
|
||||
config action 'default_action'
|
||||
option name 'default_action'
|
||||
|
||||
14
logmngr/files/etc/hotplug.d/ntp/20-reload_fluent_bit
Normal file
14
logmngr/files/etc/hotplug.d/ntp/20-reload_fluent_bit
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# This hotplug script reloads fluent-bit, so that kmsg logs' timestamp gets in sync
|
||||
|
||||
[ "$ACTION" = stratum ] || exit 0
|
||||
|
||||
# only once
|
||||
if ! uci -q get time.global.first_use_date > /dev/null 2>&1; then
|
||||
flb_pid="$(pidof fluent-bit)"
|
||||
|
||||
if [ -n "$flb_pid" ]; then
|
||||
logger -t "logmngr.hotplug" -p info "reload fluent-bit due to ntp sync"
|
||||
kill -SIGHUP "$flb_pid"
|
||||
fi
|
||||
fi
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=12
|
||||
START=09
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ fi
|
||||
if ! uci -q get logmngr.default_template > /dev/null; then
|
||||
uci -q set logmngr.default_template=template
|
||||
uci -q set logmngr.default_template.name='default_template'
|
||||
uci -q set logmngr.default_template.expression='{time} {hostname} {ident}: {message}'
|
||||
uci -q set logmngr.default_template.expression='{time} {hostname} {ident}[{pid}]: {message}'
|
||||
fi
|
||||
|
||||
if uci -q get logmngr.a1 >/dev/null; then
|
||||
|
||||
@@ -63,7 +63,7 @@ create_service_section() {
|
||||
append_conf " flush 1"
|
||||
append_conf " daemon off"
|
||||
append_conf " log_level info"
|
||||
append_conf " coro_stack_size 24576"
|
||||
append_conf " coro_stack_size 1048576"
|
||||
append_conf " parsers_file /etc/fluent-bit/parsers.conf"
|
||||
append_conf " hot_reload on"
|
||||
append_conf ""
|
||||
@@ -77,6 +77,12 @@ create_default_filters() {
|
||||
append_conf " rename msg message"
|
||||
append_conf ""
|
||||
|
||||
append_conf "[FILTER]"
|
||||
append_conf " name modify"
|
||||
append_conf " match *"
|
||||
append_conf " add pid 0"
|
||||
append_conf ""
|
||||
|
||||
append_conf "[FILTER]"
|
||||
append_conf " name sysinfo"
|
||||
append_conf " match *"
|
||||
|
||||
@@ -63,8 +63,12 @@ config AGENT_CHECK_PARTIAL_WIFI_RELOAD
|
||||
bool "Option that allow SSID/PSK simple reload"
|
||||
default y
|
||||
|
||||
config DYNBHD_DYNAMICALLY_PERSIST_CONTROLLER
|
||||
bool "Let dynbhd through AP-Autoconfiguration Search and DHCP Discovery determine the controller or agent role"
|
||||
config DYNBH
|
||||
bool "Enable map-agent dynamic Ethernet backhaul management"
|
||||
default n
|
||||
|
||||
config DYNBH_DYNAMICALLY_PERSIST_CONTROLLER
|
||||
bool "Let map-agent through AP-Autoconfiguration Search and DHCP Discovery determine the controller or agent role"
|
||||
|
||||
config AGENT_UNASSOC_STA_CONT_MONITOR
|
||||
bool "Enable continuos monitoring of unassociated clients"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=6.3.7.0
|
||||
PKG_VERSION:=6.5.0.9
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=ab9fa6ffc6978c84ab9a3b410d31c71c3b185430
|
||||
PKG_SOURCE_VERSION:=f4d201acde3320b1019c1831315e58a8ecb0290c
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -38,14 +38,6 @@ ifeq ($(CONFIG_AGENT_USE_LIBDPP),y)
|
||||
TARGET_CFLAGS += -DUSE_LIBDPP
|
||||
endif
|
||||
|
||||
define Package/dynbhd
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Dynamic Backhaul Daemon
|
||||
DEPENDS:=+libwifi +libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 \
|
||||
+ieee1905-map-plugin +map-agent
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_AGENT_ZEROTOUCH_DPP),y)
|
||||
TARGET_CFLAGS += -DZEROTOUCH_DPP
|
||||
endif
|
||||
@@ -54,10 +46,6 @@ define Package/map-agent/description
|
||||
This package provides EasyMesh R6 compliant Wi-Fi Multi-AP Agent.
|
||||
endef
|
||||
|
||||
define Package/dynbhd/description
|
||||
Dyanmic LAN/WAN port detection and loop avoidance.
|
||||
endef
|
||||
|
||||
define Package/map-agent/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
@@ -115,7 +103,11 @@ ifeq ($(CONFIG_AGENT_CHECK_PARTIAL_WIFI_RELOAD),y)
|
||||
TARGET_CFLAGS += -DCHECK_PARTIAL_WIFI_RELOAD
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DYNBHD_DYNAMICALLY_PERSIST_CONTROLLER),y)
|
||||
ifeq ($(CONFIG_DYNBH),y)
|
||||
TARGET_CFLAGS += -DDYNBH
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DYNBH_DYNAMICALLY_PERSIST_CONTROLLER),y)
|
||||
TARGET_CFLAGS += -DPERSIST_CONTROLLER
|
||||
endif
|
||||
|
||||
@@ -128,6 +120,10 @@ MAKE_PATH:=src
|
||||
define Package/map-agent/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(CP) ./files/* $(1)/
|
||||
ifeq ($(CONFIG_DYNBH),y)
|
||||
$(RM) $(1)/etc/hotplug.d/ethernet/map-dynamic-backhaul
|
||||
$(RM) $(1)/etc/hotplug.d/ethernet/map-topology-discovery
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/lib/wifi
|
||||
@@ -135,15 +131,6 @@ define Package/map-agent/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mapagent $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/dynbhd/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/lib/wifi/dynbhd
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/ethernet
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dynbh/dynbhd $(1)/usr/sbin/dynbhd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dynbh/api $(1)/lib/wifi/dynbhd/api
|
||||
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dynbh/map-dynamic-backhaul $(1)/etc/hotplug.d/ethernet/map-dynamic-backhaul
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
@@ -152,4 +139,3 @@ endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,map-agent))
|
||||
$(eval $(call BuildPackage,dynbhd))
|
||||
|
||||
@@ -17,7 +17,7 @@ config dynamic_backhaul
|
||||
option missing_bh_reconfig_timer '1800'
|
||||
|
||||
config controller_select
|
||||
option id 'auto'
|
||||
option mode 'auto'
|
||||
option probe_int '20'
|
||||
option retry_int '9'
|
||||
option autostart '1'
|
||||
|
||||
@@ -27,11 +27,6 @@ done
|
||||
al_brnet="${al_bridge:3}"
|
||||
[ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ] || exit 0
|
||||
|
||||
############## Dynamic Backhaul Daemon ##############
|
||||
if [ -n "$(which dynbhd)" ]; then
|
||||
exit 0
|
||||
fi
|
||||
########################################################
|
||||
|
||||
################ Dedicated ETH WAN Port ################
|
||||
wanport="$(jsonfilter -i /etc/board.json -e @.network.wan.device)"
|
||||
@@ -95,7 +90,8 @@ if [ "$LINK" = "up" ]; then
|
||||
config_foreach remove_from_bridge bsta
|
||||
config_foreach update_bstas bsta down
|
||||
|
||||
/lib/wifi/multiap set_uplink "eth" "$PORT"
|
||||
hwaddr="$(ifconfig $PORT | grep -i hwaddr | awk '{print $5}' | awk '{print tolower($0)}')"
|
||||
/lib/wifi/multiap set_uplink "eth" "$PORT" "$hwaddr"
|
||||
else
|
||||
/lib/wifi/multiap unset_uplink "eth"
|
||||
#rm -f "$map_bh_file"
|
||||
|
||||
@@ -1,26 +1,12 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=98
|
||||
START=97
|
||||
STOP=20
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
IS_CFG_VALID=1
|
||||
|
||||
MAP_DEV="map_dev"
|
||||
MAP_IF="map"
|
||||
|
||||
|
||||
start_dynbhd_service() {
|
||||
rm -f /var/run/multiap/multiap.backhaul
|
||||
procd_open_instance
|
||||
procd_set_param command "/usr/sbin/dynbhd"
|
||||
procd_set_param respawn
|
||||
# procd_set_param stdout 1
|
||||
# procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
validate_agent_section() {
|
||||
uci_validate_section mapagent agent "agent" \
|
||||
'enabled:bool:true' \
|
||||
@@ -51,7 +37,7 @@ validate_cs_section() {
|
||||
|
||||
uci_validate_section mapagent $section "${section}" \
|
||||
'local:bool:false' \
|
||||
'id:string' \
|
||||
'mode:string' \
|
||||
'probe_int:range(0,1000):20' \
|
||||
'retry_int:range(0,255):3' \
|
||||
'autostart:bool:false'
|
||||
@@ -179,17 +165,6 @@ create_dir() {
|
||||
}
|
||||
|
||||
start_service() {
|
||||
if [ -f /usr/sbin/dynbhd ]; then
|
||||
# Start dynbhd only if the device is operating in extender/repeater mode
|
||||
al_bridge="$(uci -q get mapagent.agent.al_bridge)"
|
||||
if [ "${al_bridge:0:3}" = "br-" ]; then
|
||||
al_brnet="${al_bridge:3}"
|
||||
if [ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ]; then
|
||||
start_dynbhd_service
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
config_load "mapagent"
|
||||
validate_agent_config || return 1;
|
||||
|
||||
|
||||
15
map-agent/files/etc/uci-defaults/994-map-set-cntlr-sel-mode
Normal file
15
map-agent/files/etc/uci-defaults/994-map-set-cntlr-sel-mode
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
adapt_cntlr_sel() {
|
||||
local section=$1
|
||||
id=$(uci -q get mapagent.@controller_select[0].id)
|
||||
|
||||
uci -q del mapagent.@controller_select[0].id
|
||||
|
||||
# re-apply any custom value
|
||||
[ -z "${id}" ] || uci -q set mapagent.@controller_select[0].mode="${id}"
|
||||
}
|
||||
|
||||
adapt_cntlr_sel
|
||||
@@ -10,6 +10,11 @@ network_mode="$(fw_printenv -n netmode)" # default is layer3
|
||||
multiap_mode="$(fw_printenv -n multiap_mode)" # default is full
|
||||
disable_mlo="$(fw_printenv -n disable_mlo)"
|
||||
|
||||
is_logan() {
|
||||
[ -d /sys/module/mt_wifi ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
is_airoha() {
|
||||
[ -f /proc/device-tree/compatible ] || return
|
||||
strings /proc/device-tree/compatible | grep -qE '^(econet,|airoha,)'; return
|
||||
@@ -64,45 +69,45 @@ generate_multiap_config() {
|
||||
device="$dev"
|
||||
|
||||
ifprefix_radio=""
|
||||
if is_airoha; then
|
||||
if is_logan; then
|
||||
uci set mapagent.agent.mld_ap_prefix="bss"
|
||||
uci set mapagent.agent.mld_sta_prefix="sta"
|
||||
ifname_sta=""
|
||||
case "$band" in
|
||||
2g)
|
||||
ifprefix="ra%"
|
||||
ifname="ra0"
|
||||
ifname_bh="ra1"
|
||||
ifname_sta="apcli0"
|
||||
;;
|
||||
5g)
|
||||
ifprefix="rai%"
|
||||
ifname="rai0"
|
||||
ifname_bh="rai1"
|
||||
ifname_sta="apclii0"
|
||||
;;
|
||||
6g)
|
||||
ifprefix="rax%"
|
||||
ifname="rax0"
|
||||
ifname_bh="rax1"
|
||||
ifname_sta="apclix0"
|
||||
;;
|
||||
esac
|
||||
ifprefix_radio="${ifprefix}"
|
||||
if [ "${network_mode}" == "extender" ]; then
|
||||
ifname="${ifname_sta}"
|
||||
fi
|
||||
|
||||
[ "$disable_mlo" == "1" ] || {
|
||||
uci set wireless.$dev.mlo="1"
|
||||
uci set wireless.$dev.mlo_capable="1"
|
||||
}
|
||||
elif is_airoha; then
|
||||
if [ -d "/sys/module/mt76" ]; then
|
||||
ifprefix="wlan%_%"
|
||||
ifname="wlan${devidx}_0"
|
||||
ifname_bh="wlan${devidx}_1"
|
||||
else
|
||||
uci set mapagent.agent.mld_prefix="bss"
|
||||
ifname_sta=""
|
||||
case "$band" in
|
||||
2g)
|
||||
ifprefix="ra%"
|
||||
ifname="ra0"
|
||||
ifname_bh="ra1"
|
||||
ifname_sta="apcli0"
|
||||
;;
|
||||
5g)
|
||||
ifprefix="rai%"
|
||||
ifname="rai0"
|
||||
ifname_bh="rai1"
|
||||
ifname_sta="apclii0"
|
||||
;;
|
||||
6g)
|
||||
ifprefix="rax%"
|
||||
ifname="rax0"
|
||||
ifname_bh="rax1"
|
||||
ifname_sta="apclix0"
|
||||
;;
|
||||
esac
|
||||
ifprefix_radio="${ifprefix}"
|
||||
if [ "${network_mode}" == "extender" ]; then
|
||||
ifname="${ifname_sta}"
|
||||
fi
|
||||
|
||||
[ "$disable_mlo" == "1" ] || {
|
||||
uci set wireless.$dev.mlo="1"
|
||||
uci set wireless.$dev.mlo_capable="1"
|
||||
}
|
||||
fi
|
||||
|
||||
uci set wireless.$dev.channels="$channels"
|
||||
uci commit wireless
|
||||
elif is_broadcom; then
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=6.4.4.0
|
||||
PKG_VERSION:=6.4.4.16
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=d2e91ca156dbe0b44f0fc551b0a353137343fdf1
|
||||
PKG_SOURCE_VERSION:=2f8d2afc604c090637acdb01e630e233cd9aceff
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@genexis.eu>
|
||||
|
||||
LOCAL_DEV=0
|
||||
|
||||
@@ -4,17 +4,16 @@ config controller 'controller'
|
||||
option registrar '2 5 6'
|
||||
option debug '2'
|
||||
option bcn_metrics_max_num '10'
|
||||
option initial_channel_scan '0'
|
||||
option enable_ts '0'
|
||||
option primary_vid '1'
|
||||
option primary_pcp '0'
|
||||
option stale_sta_timeout '30d'
|
||||
option stale_sta_timeout '20d'
|
||||
option de_collect_interval '60'
|
||||
list plugin 'zerotouch'
|
||||
|
||||
config sta_steering 'sta_steering'
|
||||
option enable_sta_steer '1'
|
||||
option enable_bsta_steer '0'
|
||||
option enable_bsta_steer '1'
|
||||
option rcpi_threshold_2g '70'
|
||||
option rcpi_threshold_5g '86'
|
||||
option rcpi_threshold_6g '86'
|
||||
|
||||
@@ -20,7 +20,6 @@ validate_controller_section() {
|
||||
'registrar:string' \
|
||||
'debug:range(0,16)' \
|
||||
'bcn_metrics_max_num:range(1,256)' \
|
||||
'initial_channel_scan:bool:true' \
|
||||
'resend_num:uinteger:0' \
|
||||
'allow_bgdfs:range(0,2629744)' \
|
||||
'stale_sta_timeout:string' \
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
cfg="mapcontroller"
|
||||
config_load "$cfg"
|
||||
|
||||
used_ids=""
|
||||
|
||||
collect_used_ids() {
|
||||
local section="$1"
|
||||
local id
|
||||
|
||||
id=$(uci -q get ${cfg}.${section}.id)
|
||||
if [ -n "$id" ] && printf "%s" "$id" | grep -qE '^[0-9]+$'; then
|
||||
used_ids="$used_ids $id"
|
||||
fi
|
||||
}
|
||||
|
||||
# Find first available ID from 0 to INT32_MAX
|
||||
find_first_available_id() {
|
||||
local max_int=2147483647
|
||||
local expected=0
|
||||
local id
|
||||
|
||||
# Convert list to sorted unique list
|
||||
sorted_ids=$(printf "%s\n" $used_ids | sort -n | uniq)
|
||||
|
||||
for id in $sorted_ids; do
|
||||
if [ "$id" -eq "$expected" ]; then
|
||||
expected=$((expected + 1))
|
||||
elif [ "$id" -gt "$expected" ]; then
|
||||
# Found a gap -> return the gap
|
||||
echo "$expected"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
# If no gaps, next available is `expected`
|
||||
if [ "$expected" -le "$max_int" ]; then
|
||||
echo "$expected"
|
||||
else
|
||||
echo -1
|
||||
fi
|
||||
}
|
||||
|
||||
# Assign ID if missing
|
||||
add_qos_rule_id() {
|
||||
local section="$1"
|
||||
local id
|
||||
|
||||
id=$(uci -q get ${cfg}.${section}.id)
|
||||
if [ -z "$id" ]; then
|
||||
new_id=$(find_first_available_id)
|
||||
[ "$new_id" -ge 0 ] || return # No available ID
|
||||
uci -q set ${cfg}.${section}.id="$new_id"
|
||||
|
||||
used_ids="$used_ids $new_id"
|
||||
fi
|
||||
}
|
||||
|
||||
# Step 1: Collect all existing IDs
|
||||
config_foreach collect_used_ids qos_rule
|
||||
|
||||
# Step 2: Assign IDs to rules missing them
|
||||
config_foreach add_qos_rule_id qos_rule
|
||||
@@ -14,5 +14,3 @@ for sec in $sections; do
|
||||
|
||||
uci rename $cfg.$s=$sec
|
||||
done
|
||||
|
||||
uci commit $cfg
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-plugins
|
||||
PKG_VERSION:=1.1.2
|
||||
PKG_VERSION:=1.2.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=a76610182366cf05ed7e8f5fbac26890b709eeb4
|
||||
PKG_SOURCE_VERSION:=dd873ca4e2cb321302dae1955da24d1be271b2b1
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/map-plugins.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -59,7 +59,8 @@ define Package/map-plugins
|
||||
endef
|
||||
|
||||
define Package/map-plugins/description
|
||||
Provides extra Multi-AP services viz. steering, channel-planning, self-organizing network etc.
|
||||
Provides extra Multi-AP services viz. steering, channel-planning,
|
||||
self-organizing network, zero-touch onboarding etc.
|
||||
endef
|
||||
|
||||
define Package/map-plugins/install
|
||||
@@ -70,5 +71,11 @@ define Build/Compile
|
||||
$(foreach p,$(plugins),$(call Build/Compile/map-plugins-$(p), $(1)))
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/map-plugins/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,map-plugins))
|
||||
$(eval $(foreach p,$(ppkg),$(call BuildPackage,$(p))))
|
||||
|
||||
7
mosquitto-auth-plugin/Config.in
Normal file
7
mosquitto-auth-plugin/Config.in
Normal file
@@ -0,0 +1,7 @@
|
||||
if PACKAGE_mosquitto-auth-plugin
|
||||
|
||||
config MOSQUITTO_AUTH_PAM_SUPPORT
|
||||
bool "Enable support of Linux PAM module for Authentication"
|
||||
default y
|
||||
|
||||
endif
|
||||
@@ -13,33 +13,42 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mosquitto-auth-shadow
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_NAME:=mosquitto-auth-plugin
|
||||
PKG_VERSION:=1.2.1
|
||||
|
||||
PKG_MAINTAINER:=Erik Karlsson <erik.karlsson@genexis.eu>
|
||||
PKG_LICENSE:=EPL-2.0
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_MOSQUITTO_AUTH_PAM_SUPPORT
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mosquitto-auth-shadow
|
||||
define Package/mosquitto-auth-plugin
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=mosquitto - /etc/shadow authentication plugin
|
||||
DEPENDS:=+mosquitto-ssl
|
||||
DEPENDS:=+mosquitto-ssl +MOSQUITTO_AUTH_PAM_SUPPORT:libpam
|
||||
USERID:=mosquitto=200:mosquitto=200 mosquitto=200:shadow=11
|
||||
endef
|
||||
|
||||
define Package/mosquitto-auth-shadow/description
|
||||
define Package/mosquitto-auth-plugin/description
|
||||
Plugin for the mosquitto MQTT message broker that authenticates
|
||||
users using /etc/shadow
|
||||
endef
|
||||
|
||||
define Package/mosquitto-auth-shadow/install
|
||||
define Package/mosquitto-auth-plugin/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_MOSQUITTO_AUTH_PAM_SUPPORT),y)
|
||||
TARGET_CFLAGS+=-DENABLE_PAM_SUPPORT
|
||||
endif
|
||||
|
||||
define Package/mosquitto-auth-plugin/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mosquitto_auth_shadow.so $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mosquitto_auth_plugin.so $(1)/usr/lib/
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mosquitto-auth-shadow))
|
||||
$(eval $(call BuildPackage,mosquitto-auth-plugin))
|
||||
@@ -11,15 +11,15 @@
|
||||
# Erik Karlsson - initial implementation
|
||||
#
|
||||
|
||||
TARGETS = mosquitto_auth_shadow.so
|
||||
TARGETS = mosquitto_auth_plugin.so
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
%.pic.o: %.c
|
||||
$(CC) $(CFLAGS) -Wall -Werror -fPIC -c -o $@ $<
|
||||
|
||||
mosquitto_auth_shadow.so: mosquitto_auth_shadow.pic.o
|
||||
$(CC) $(LDFLAGS) -shared -o $@ $^
|
||||
mosquitto_auth_plugin.so: mosquitto_auth_plugin.pic.o
|
||||
$(CC) $(LDFLAGS) -shared -o $@ $^ $(if $(filter -DENABLE_PAM_SUPPORT,$(CFLAGS)),-lpam)
|
||||
|
||||
clean:
|
||||
rm -f *.o $(TARGETS)
|
||||
670
mosquitto-auth-plugin/src/mosquitto_auth_plugin.c
Normal file
670
mosquitto-auth-plugin/src/mosquitto_auth_plugin.c
Normal file
@@ -0,0 +1,670 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Genexis B.V.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Karlsson - initial implementation
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <shadow.h>
|
||||
#include <crypt.h>
|
||||
#include <stdlib.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <mosquitto.h>
|
||||
#include <mosquitto_broker.h>
|
||||
#include <mosquitto_plugin.h>
|
||||
|
||||
#ifdef ENABLE_PAM_SUPPORT
|
||||
#include <security/pam_appl.h>
|
||||
#endif
|
||||
|
||||
#define MAX_USERS 256
|
||||
#define MAX_SUBNETS_PER_USER 32
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
uint32_t ipv4_network;
|
||||
uint8_t ipv6_network[16];
|
||||
};
|
||||
union {
|
||||
uint32_t ipv4_netmask;
|
||||
uint8_t ipv6_netmask[16];
|
||||
};
|
||||
int is_ipv6;
|
||||
} subnet_t;
|
||||
|
||||
typedef struct {
|
||||
char username[64];
|
||||
subnet_t allow_subnets[MAX_SUBNETS_PER_USER];
|
||||
int allow_count;
|
||||
subnet_t deny_subnets[MAX_SUBNETS_PER_USER];
|
||||
int deny_count;
|
||||
} user_acl_t;
|
||||
|
||||
typedef struct {
|
||||
user_acl_t users[MAX_USERS];
|
||||
int user_count;
|
||||
mosquitto_plugin_id_t *identifier;
|
||||
char *config_file;
|
||||
} plugin_data_t;
|
||||
|
||||
/* Parse CIDR notation for IPv4 or IPv6 (e.g., "192.168.1.0/24" or "2001:db8::/32") */
|
||||
static int parse_subnet(const char *cidr, subnet_t *subnet)
|
||||
{
|
||||
char ip_str[128];
|
||||
char *slash;
|
||||
int prefix_len;
|
||||
struct in_addr addr4;
|
||||
struct in6_addr addr6;
|
||||
|
||||
strncpy(ip_str, cidr, sizeof(ip_str) - 1);
|
||||
ip_str[sizeof(ip_str) - 1] = '\0';
|
||||
|
||||
slash = strchr(ip_str, '/');
|
||||
if (slash != NULL) {
|
||||
*slash = '\0';
|
||||
prefix_len = atoi(slash + 1);
|
||||
}
|
||||
|
||||
/* Try IPv4 first */
|
||||
if (inet_pton(AF_INET, ip_str, &addr4) == 1) {
|
||||
subnet->is_ipv6 = 0;
|
||||
if (slash == NULL)
|
||||
prefix_len = 32;
|
||||
if (prefix_len < 0 || prefix_len > 32)
|
||||
return -1;
|
||||
|
||||
subnet->ipv4_network = ntohl(addr4.s_addr);
|
||||
subnet->ipv4_netmask = prefix_len == 0 ? 0 : (~0U << (32 - prefix_len));
|
||||
subnet->ipv4_network &= subnet->ipv4_netmask;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try IPv6 */
|
||||
if (inet_pton(AF_INET6, ip_str, &addr6) == 1) {
|
||||
subnet->is_ipv6 = 1;
|
||||
if (slash == NULL)
|
||||
prefix_len = 128;
|
||||
if (prefix_len < 0 || prefix_len > 128)
|
||||
return -1;
|
||||
|
||||
/* Copy network address */
|
||||
memcpy(subnet->ipv6_network, addr6.s6_addr, 16);
|
||||
|
||||
/* Generate netmask */
|
||||
memset(subnet->ipv6_netmask, 0, 16);
|
||||
for (int i = 0; i < prefix_len / 8; i++)
|
||||
subnet->ipv6_netmask[i] = 0xff;
|
||||
if (prefix_len % 8)
|
||||
subnet->ipv6_netmask[prefix_len / 8] = ~((1 << (8 - (prefix_len % 8))) - 1);
|
||||
|
||||
/* Apply netmask to network address */
|
||||
for (int i = 0; i < 16; i++)
|
||||
subnet->ipv6_network[i] &= subnet->ipv6_netmask[i];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check if IPv4 address is in subnet */
|
||||
static int ipv4_in_subnet(uint32_t ip, const subnet_t *subnet)
|
||||
{
|
||||
if (subnet->is_ipv6)
|
||||
return 0;
|
||||
return (ip & subnet->ipv4_netmask) == subnet->ipv4_network;
|
||||
}
|
||||
|
||||
/* Check if IPv6 address is in subnet */
|
||||
static int ipv6_in_subnet(const uint8_t *ip, const subnet_t *subnet)
|
||||
{
|
||||
if (!subnet->is_ipv6)
|
||||
return 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if ((ip[i] & subnet->ipv6_netmask[i]) != subnet->ipv6_network[i])
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Check if IP is in any subnet in the list */
|
||||
static int ip_in_subnet_list(const char *client_address, const subnet_t *subnets, int count)
|
||||
{
|
||||
struct in_addr addr4;
|
||||
struct in6_addr addr6;
|
||||
uint32_t ipv4;
|
||||
|
||||
/* Try IPv4 */
|
||||
if (inet_pton(AF_INET, client_address, &addr4) == 1) {
|
||||
ipv4 = ntohl(addr4.s_addr);
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (ipv4_in_subnet(ipv4, &subnets[i]))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try IPv6 */
|
||||
if (inet_pton(AF_INET6, client_address, &addr6) == 1) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (ipv6_in_subnet(addr6.s6_addr, &subnets[i]))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find or create user ACL entry */
|
||||
static user_acl_t* find_or_create_user_acl(plugin_data_t *pdata, const char *username)
|
||||
{
|
||||
user_acl_t *user;
|
||||
|
||||
/* Find existing user */
|
||||
for (int i = 0; i < pdata->user_count; i++) {
|
||||
if (strcmp(pdata->users[i].username, username) == 0)
|
||||
return &pdata->users[i];
|
||||
}
|
||||
|
||||
/* Create new user if not found */
|
||||
if (pdata->user_count >= MAX_USERS) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Max users exceeded");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
user = &pdata->users[pdata->user_count];
|
||||
strncpy(user->username, username, sizeof(user->username) - 1);
|
||||
user->username[sizeof(user->username) - 1] = '\0';
|
||||
user->allow_count = 0;
|
||||
user->deny_count = 0;
|
||||
pdata->user_count++;
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
/* Parse subnet ACL file with simplified format
|
||||
* Format:
|
||||
* # Comment lines
|
||||
* subnet allow <username> <cidr>
|
||||
* subnet deny <username> <cidr>
|
||||
*/
|
||||
static int load_subnet_acl_config(plugin_data_t *pdata, const char *config_file)
|
||||
{
|
||||
FILE *fp;
|
||||
char line[512];
|
||||
int line_num = 0;
|
||||
|
||||
/* Initialize user count */
|
||||
pdata->user_count = 0;
|
||||
|
||||
/* Config file is optional - if not provided, no subnet filtering */
|
||||
if (config_file == NULL) {
|
||||
mosquitto_log_printf(MOSQ_LOG_INFO,
|
||||
"subnet_acl: No subnet ACL file specified, subnet filtering disabled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If config file is specified but cannot be opened, this is a fatal error */
|
||||
fp = fopen(config_file, "r");
|
||||
if (fp == NULL) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Failed to open subnet ACL file '%s'", config_file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||
char *token, *saveptr;
|
||||
char *action, *username, *cidr;
|
||||
user_acl_t *user;
|
||||
subnet_t subnet;
|
||||
|
||||
line_num++;
|
||||
|
||||
/* Remove newline and comments */
|
||||
line[strcspn(line, "\r\n")] = '\0';
|
||||
char *comment = strchr(line, '#');
|
||||
if (comment)
|
||||
*comment = '\0';
|
||||
|
||||
/* Trim leading whitespace */
|
||||
char *line_start = line;
|
||||
while (*line_start == ' ' || *line_start == '\t')
|
||||
line_start++;
|
||||
|
||||
/* Skip empty lines */
|
||||
if (*line_start == '\0')
|
||||
continue;
|
||||
|
||||
/* Parse: subnet allow|deny <username> <cidr> */
|
||||
token = strtok_r(line_start, " \t", &saveptr);
|
||||
if (token == NULL)
|
||||
continue;
|
||||
|
||||
/* Must start with "subnet" */
|
||||
if (strcmp(token, "subnet") != 0) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Invalid directive '%s' at line %d (expected 'subnet')",
|
||||
token, line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get allow/deny */
|
||||
action = strtok_r(NULL, " \t", &saveptr);
|
||||
if (action == NULL) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Missing allow/deny at line %d", line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcmp(action, "allow") != 0 && strcmp(action, "deny") != 0) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Invalid action '%s' at line %d (use 'allow' or 'deny')",
|
||||
action, line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get username */
|
||||
username = strtok_r(NULL, " \t", &saveptr);
|
||||
if (username == NULL) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Missing username at line %d", line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get CIDR */
|
||||
cidr = strtok_r(NULL, " \t", &saveptr);
|
||||
if (cidr == NULL) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Missing CIDR at line %d", line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Parse subnet */
|
||||
if (parse_subnet(cidr, &subnet) != 0) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Invalid CIDR '%s' at line %d", cidr, line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Find or create user */
|
||||
user = find_or_create_user_acl(pdata, username);
|
||||
if (user == NULL) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Max users (%d) exceeded at line %d", MAX_USERS, line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Add to appropriate list */
|
||||
if (strcmp(action, "allow") == 0) {
|
||||
if (user->allow_count >= MAX_SUBNETS_PER_USER) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Max allow subnets (%d) exceeded for user '%s' at line %d",
|
||||
MAX_SUBNETS_PER_USER, user->username, line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
user->allow_subnets[user->allow_count] = subnet;
|
||||
user->allow_count++;
|
||||
|
||||
mosquitto_log_printf(MOSQ_LOG_DEBUG,
|
||||
"subnet_acl: User '%s' allow subnet %s",
|
||||
user->username, cidr);
|
||||
|
||||
} else { /* deny */
|
||||
if (user->deny_count >= MAX_SUBNETS_PER_USER) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Max deny subnets (%d) exceeded for user '%s' at line %d",
|
||||
MAX_SUBNETS_PER_USER, user->username, line_num);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
user->deny_subnets[user->deny_count] = subnet;
|
||||
user->deny_count++;
|
||||
|
||||
mosquitto_log_printf(MOSQ_LOG_DEBUG,
|
||||
"subnet_acl: User '%s' deny subnet %s",
|
||||
user->username, cidr);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
/* Log summary */
|
||||
for (int i = 0; i < pdata->user_count; i++) {
|
||||
user_acl_t *user = &pdata->users[i];
|
||||
if (user->allow_count > 0 || user->deny_count > 0) {
|
||||
mosquitto_log_printf(MOSQ_LOG_INFO,
|
||||
"subnet_acl: User '%s' has %d allow and %d deny subnet rules",
|
||||
user->username, user->allow_count, user->deny_count);
|
||||
}
|
||||
}
|
||||
|
||||
mosquitto_log_printf(MOSQ_LOG_NOTICE,
|
||||
"subnet_acl: Loaded subnet restrictions for %d user(s)", pdata->user_count);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find user ACL entry */
|
||||
static const user_acl_t* find_user_acl(const plugin_data_t *pdata, const char *username)
|
||||
{
|
||||
for (int i = 0; i < pdata->user_count; i++) {
|
||||
if (strcmp(pdata->users[i].username, username) == 0)
|
||||
return &pdata->users[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check subnet access on authentication (connection time)
|
||||
* Returns: MOSQ_ERR_SUCCESS if allowed, MOSQ_ERR_AUTH if denied
|
||||
*/
|
||||
static int check_subnet_on_auth(plugin_data_t *pdata, struct mosquitto_evt_basic_auth *ed)
|
||||
{
|
||||
const user_acl_t *user_acl;
|
||||
const char *client_address;
|
||||
|
||||
/* Skip if no subnet config loaded */
|
||||
if (pdata == NULL || pdata->user_count == 0)
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
/* Skip anonymous users */
|
||||
if (ed->username == NULL)
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
/* Find user's subnet ACL */
|
||||
user_acl = find_user_acl(pdata, ed->username);
|
||||
|
||||
/* If user not in config or has no subnet rules, allow */
|
||||
if (user_acl == NULL || (user_acl->allow_count == 0 && user_acl->deny_count == 0))
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
/* Get client IP address */
|
||||
client_address = mosquitto_client_address(ed->client);
|
||||
if (client_address == NULL) {
|
||||
mosquitto_log_printf(MOSQ_LOG_WARNING,
|
||||
"subnet_acl: Could not get client address for user '%s', denying connection",
|
||||
ed->username);
|
||||
return MOSQ_ERR_AUTH;
|
||||
}
|
||||
|
||||
/* Check deny list first - deny takes precedence */
|
||||
if (user_acl->deny_count > 0) {
|
||||
if (ip_in_subnet_list(client_address, user_acl->deny_subnets, user_acl->deny_count)) {
|
||||
mosquitto_log_printf(MOSQ_LOG_NOTICE,
|
||||
"subnet_acl: User '%s' from %s DENIED by deny rule",
|
||||
ed->username, client_address);
|
||||
return MOSQ_ERR_AUTH;
|
||||
}
|
||||
}
|
||||
|
||||
/* If there are allow rules, IP must match one of them */
|
||||
if (user_acl->allow_count > 0) {
|
||||
if (ip_in_subnet_list(client_address, user_acl->allow_subnets, user_acl->allow_count)) {
|
||||
mosquitto_log_printf(MOSQ_LOG_DEBUG,
|
||||
"subnet_acl: User '%s' from %s allowed by allow rule",
|
||||
ed->username, client_address);
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
} else {
|
||||
mosquitto_log_printf(MOSQ_LOG_NOTICE,
|
||||
"subnet_acl: User '%s' from %s DENIED (not in allowed subnets)",
|
||||
ed->username, client_address);
|
||||
return MOSQ_ERR_AUTH;
|
||||
}
|
||||
}
|
||||
|
||||
/* No subnet rules for this user - allow */
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PAM_SUPPORT
|
||||
static int pam_conversation(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr)
|
||||
{
|
||||
int i;
|
||||
const char *pass = (const char *)appdata_ptr;
|
||||
|
||||
*resp = calloc(num_msg, sizeof(struct pam_response));
|
||||
if (*resp == NULL) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR, "pam failed to allocate buffer for validation");
|
||||
return PAM_BUF_ERR;
|
||||
}
|
||||
|
||||
if (pass == NULL)
|
||||
return PAM_SUCCESS;
|
||||
|
||||
for (i = 0; i < num_msg; ++i) {
|
||||
if (msg[i]->msg_style == PAM_PROMPT_ECHO_OFF) {
|
||||
(*resp)[i].resp = strdup(pass);
|
||||
if ((*resp)[i].resp == NULL) {
|
||||
for (int j = 0; j < i ; j++)
|
||||
free((*resp)[j].resp);
|
||||
|
||||
free(*resp);
|
||||
*resp = NULL;
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR, "pam failed in strdup");
|
||||
return PAM_BUF_ERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PAM_SUCCESS;
|
||||
}
|
||||
|
||||
static int process_pam_auth_callback(struct mosquitto_evt_basic_auth *ed)
|
||||
{
|
||||
struct pam_conv conv;
|
||||
int retval;
|
||||
pam_handle_t *pamh = NULL;
|
||||
|
||||
conv.conv = pam_conversation;
|
||||
conv.appdata_ptr = (void *)ed->password;
|
||||
|
||||
retval = pam_start("mosquitto", ed->username, &conv, &pamh);
|
||||
if (retval != PAM_SUCCESS) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR, "pam start failed: %s", pam_strerror(pamh, retval));
|
||||
return MOSQ_ERR_AUTH;
|
||||
}
|
||||
|
||||
retval = pam_authenticate(pamh, 0);
|
||||
pam_end(pamh, retval);
|
||||
if (retval == PAM_SUCCESS) {
|
||||
mosquitto_log_printf(MOSQ_LOG_NOTICE, "pam user [%s] logged in", ed->username);
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
mosquitto_log_printf(MOSQ_LOG_NOTICE, "pam user [%s] failed authentication, err [%s]", ed->username, pam_strerror(pamh, retval));
|
||||
return MOSQ_ERR_AUTH;
|
||||
}
|
||||
#else
|
||||
static int process_shadow_auth_callback(struct mosquitto_evt_basic_auth *ed)
|
||||
{
|
||||
struct spwd spbuf, *sp = NULL;
|
||||
char buf[256];
|
||||
struct crypt_data data;
|
||||
char *hash;
|
||||
|
||||
getspnam_r(ed->username, &spbuf, buf, sizeof(buf), &sp);
|
||||
|
||||
if (sp == NULL || sp->sp_pwdp == NULL)
|
||||
return MOSQ_ERR_AUTH;
|
||||
|
||||
/* Empty string as hash means password is not required */
|
||||
if (sp->sp_pwdp[0] == 0)
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
if (ed->password == NULL)
|
||||
return MOSQ_ERR_AUTH;
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
hash = crypt_r(ed->password, sp->sp_pwdp, &data);
|
||||
|
||||
if (hash == NULL)
|
||||
return MOSQ_ERR_AUTH;
|
||||
|
||||
if (strcmp(hash, sp->sp_pwdp) == 0)
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
return MOSQ_ERR_AUTH;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int basic_auth_callback(int event, void *event_data, void *userdata)
|
||||
{
|
||||
struct mosquitto_evt_basic_auth *ed = event_data;
|
||||
plugin_data_t *pdata = userdata;
|
||||
int auth_result;
|
||||
|
||||
/* Let other plugins or broker decide about anonymous login */
|
||||
if (ed->username == NULL)
|
||||
return MOSQ_ERR_PLUGIN_DEFER;
|
||||
|
||||
/* First check username/password authentication */
|
||||
#ifdef ENABLE_PAM_SUPPORT
|
||||
auth_result = process_pam_auth_callback(ed);
|
||||
#else
|
||||
auth_result = process_shadow_auth_callback(ed);
|
||||
#endif
|
||||
|
||||
/* If authentication failed, reject immediately */
|
||||
if (auth_result != MOSQ_ERR_SUCCESS)
|
||||
return auth_result;
|
||||
|
||||
/* Authentication succeeded, now check subnet restrictions */
|
||||
return check_subnet_on_auth(pdata, ed);
|
||||
}
|
||||
|
||||
static int reload_callback(int event, void *event_data, void *userdata)
|
||||
{
|
||||
plugin_data_t *pdata = userdata;
|
||||
|
||||
if (pdata == NULL)
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
mosquitto_log_printf(MOSQ_LOG_NOTICE,
|
||||
"subnet_acl: Reloading subnet ACL configuration from '%s'",
|
||||
pdata->config_file ? pdata->config_file : "(none)");
|
||||
|
||||
/* Reload subnet ACL configuration */
|
||||
if (load_subnet_acl_config(pdata, pdata->config_file) != 0) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Failed to reload subnet ACL configuration, keeping old config");
|
||||
return MOSQ_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
mosquitto_log_printf(MOSQ_LOG_NOTICE,
|
||||
"subnet_acl: Reload complete, now tracking %d user(s)", pdata->user_count);
|
||||
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
int mosquitto_plugin_version(int supported_version_count,
|
||||
const int *supported_versions)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
int mosquitto_plugin_init(mosquitto_plugin_id_t *identifier,
|
||||
void **user_data,
|
||||
struct mosquitto_opt *opts, int opt_count)
|
||||
{
|
||||
plugin_data_t *pdata;
|
||||
const char *config_file = NULL;
|
||||
int rc;
|
||||
|
||||
/* Find subnet config file option */
|
||||
for (int i = 0; i < opt_count; i++) {
|
||||
if (strcmp(opts[i].key, "subnet_acl_file") == 0) {
|
||||
config_file = opts[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pdata = calloc(1, sizeof(plugin_data_t));
|
||||
if (pdata == NULL)
|
||||
return MOSQ_ERR_NOMEM;
|
||||
|
||||
pdata->identifier = identifier;
|
||||
|
||||
/* Store config file path for reload */
|
||||
if (config_file != NULL) {
|
||||
pdata->config_file = strdup(config_file);
|
||||
if (pdata->config_file == NULL) {
|
||||
free(pdata);
|
||||
return MOSQ_ERR_NOMEM;
|
||||
}
|
||||
} else {
|
||||
pdata->config_file = NULL;
|
||||
}
|
||||
|
||||
/* Load subnet ACL configuration */
|
||||
if (load_subnet_acl_config(pdata, config_file) != 0) {
|
||||
free(pdata->config_file);
|
||||
free(pdata);
|
||||
return MOSQ_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Register authentication callback only - subnet check is done during auth */
|
||||
rc = mosquitto_callback_register(identifier, MOSQ_EVT_BASIC_AUTH,
|
||||
basic_auth_callback, NULL, pdata);
|
||||
if (rc != MOSQ_ERR_SUCCESS) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Failed to register authentication callback");
|
||||
free(pdata->config_file);
|
||||
free(pdata);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Register reload callback to handle SIGHUP */
|
||||
rc = mosquitto_callback_register(identifier, MOSQ_EVT_RELOAD,
|
||||
reload_callback, NULL, pdata);
|
||||
if (rc != MOSQ_ERR_SUCCESS) {
|
||||
mosquitto_log_printf(MOSQ_LOG_ERR,
|
||||
"subnet_acl: Failed to register reload callback");
|
||||
mosquitto_callback_unregister(identifier, MOSQ_EVT_BASIC_AUTH,
|
||||
basic_auth_callback, NULL);
|
||||
free(pdata->config_file);
|
||||
free(pdata);
|
||||
return rc;
|
||||
}
|
||||
|
||||
mosquitto_log_printf(MOSQ_LOG_INFO,
|
||||
"subnet_acl: Plugin initialized with %d user(s)", pdata->user_count);
|
||||
|
||||
/* Only assign user_data after all possible error paths */
|
||||
*user_data = pdata;
|
||||
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
int mosquitto_plugin_cleanup(void *user_data,
|
||||
struct mosquitto_opt *opts, int opt_count)
|
||||
{
|
||||
plugin_data_t *pdata = user_data;
|
||||
|
||||
if (pdata) {
|
||||
mosquitto_callback_unregister(pdata->identifier, MOSQ_EVT_BASIC_AUTH,
|
||||
basic_auth_callback, NULL);
|
||||
mosquitto_callback_unregister(pdata->identifier, MOSQ_EVT_RELOAD,
|
||||
reload_callback, NULL);
|
||||
free(pdata->config_file);
|
||||
free(pdata);
|
||||
}
|
||||
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Genexis B.V.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Erik Karlsson - initial implementation
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#include <shadow.h>
|
||||
#include <crypt.h>
|
||||
#include <mosquitto.h>
|
||||
#include <mosquitto_broker.h>
|
||||
#include <mosquitto_plugin.h>
|
||||
|
||||
static int basic_auth_callback(int event, void *event_data, void *userdata)
|
||||
{
|
||||
struct mosquitto_evt_basic_auth *ed = event_data;
|
||||
struct spwd spbuf, *sp = NULL;
|
||||
char buf[256];
|
||||
struct crypt_data data;
|
||||
char *hash;
|
||||
|
||||
/* Let other plugins or broker decide about anonymous login */
|
||||
if (ed->username == NULL)
|
||||
return MOSQ_ERR_PLUGIN_DEFER;
|
||||
|
||||
getspnam_r(ed->username, &spbuf, buf, sizeof(buf), &sp);
|
||||
|
||||
if (sp == NULL || sp->sp_pwdp == NULL)
|
||||
return MOSQ_ERR_AUTH;
|
||||
|
||||
/* Empty string as hash means password is not required */
|
||||
if (sp->sp_pwdp[0] == 0)
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
if (ed->password == NULL)
|
||||
return MOSQ_ERR_AUTH;
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
hash = crypt_r(ed->password, sp->sp_pwdp, &data);
|
||||
|
||||
if (hash == NULL)
|
||||
return MOSQ_ERR_AUTH;
|
||||
|
||||
if (strcmp(hash, sp->sp_pwdp) == 0)
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
return MOSQ_ERR_AUTH;
|
||||
}
|
||||
|
||||
int mosquitto_plugin_version(int supported_version_count,
|
||||
const int *supported_versions)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
int mosquitto_plugin_init(mosquitto_plugin_id_t *identifier,
|
||||
void **user_data,
|
||||
struct mosquitto_opt *opts, int opt_count)
|
||||
{
|
||||
*user_data = identifier;
|
||||
|
||||
return mosquitto_callback_register(identifier, MOSQ_EVT_BASIC_AUTH,
|
||||
basic_auth_callback, NULL, NULL);
|
||||
}
|
||||
|
||||
int mosquitto_plugin_cleanup(void *user_data,
|
||||
struct mosquitto_opt *opts, int opt_count)
|
||||
{
|
||||
mosquitto_plugin_id_t *identifier = user_data;
|
||||
|
||||
return mosquitto_callback_unregister(identifier, MOSQ_EVT_BASIC_AUTH,
|
||||
basic_auth_callback, NULL);
|
||||
}
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netmngr
|
||||
PKG_VERSION:=1.1.8
|
||||
PKG_VERSION:=1.2.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/netmngr.git
|
||||
PKG_SOURCE_VERSION:=6310f32b80f8abeccbf99ad55ce88792b19342d6
|
||||
PKG_SOURCE_VERSION:=8240c6089cdd44f268db135920800b8fc1d65ca9
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
1220
netmode/DEVELOPER_GUIDE.md
Normal file
1220
netmode/DEVELOPER_GUIDE.md
Normal file
File diff suppressed because it is too large
Load Diff
1038
netmode/IMPLEMENTATION_GUIDE.md
Normal file
1038
netmode/IMPLEMENTATION_GUIDE.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netmode
|
||||
PKG_VERSION:=1.1.5
|
||||
PKG_VERSION:=1.1.11
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
@@ -18,6 +18,7 @@ include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
define Package/netmode
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Network Modes and Utils
|
||||
DEPENDS:=+dm-service
|
||||
endef
|
||||
|
||||
define Package/netmode/description
|
||||
|
||||
@@ -1,109 +1,380 @@
|
||||
# Creating Custom Netmodes in IOWRT
|
||||
# Netmode - Network Mode Switching for OpenWrt/iopsys
|
||||
|
||||
This guide provides developers with detailed instructions on how to create and manage custom network modes (netmodes) in IOWRT. The `netmode` script allows for flexible network configuration, and developers can define their own modes by structuring the necessary files and scripts within the `/etc/netmodes/` directory.
|
||||
**Version**: 1.1.11
|
||||
**License**: GPL-2.0-only
|
||||
**Maintainer**: iopsys
|
||||
|
||||
## Table of Contents
|
||||
1. [Overview of Netmodes](#overview-of-netmodes)
|
||||
2. [Directory Structure](#directory-structure)
|
||||
3. [Creating a Custom Netmode](#creating-a-custom-netmode)
|
||||
- [Step 1: Pre-Execution Scripts](#step-1-pre-execution-scripts)
|
||||
- [Step 2: UCI Configuration Files](#step-2-uci-configuration-files)
|
||||
- [Step 3: Custom Execution Scripts](#step-3-custom-execution-scripts)
|
||||
- [Step 4: Post-Execution Scripts](#step-4-post-execution-scripts)
|
||||
4. [Enabling and Switching Netmodes](#enabling-and-switching-netmodes)
|
||||
## Overview
|
||||
|
||||
## Overview of Netmodes
|
||||
Netmode is a network configuration management package for OpenWrt/iopsys-based routers that enables seamless switching between different WAN connection types. It provides a unified interface for managing network modes including DHCP, PPPoE, Static IP, and Bridge configurations.
|
||||
|
||||
Netmodes in IOWRT provide a way to switch between different network configurations based on the needs of the environment. Developers can create custom netmodes by organizing scripts and configuration files in specific directories under `/etc/netmodes/<NETMODE_NAME>`.
|
||||
### Key Features
|
||||
|
||||
## Directory Structure
|
||||
- **Simple Mode Switching**: Change WAN connection type with a single command
|
||||
- **Multiple Mode Support**: DHCP, PPPoE, Static IP, and Bridged mode
|
||||
- **Automatic Configuration**: Handles network, firewall, DHCP, and multicast settings
|
||||
- **TR-069/USP Integration**: Remote management via BBF data model
|
||||
- **Extensible Architecture**: Easy to add custom network modes
|
||||
- **Safe Transitions**: Proper cleanup and validation during mode switches
|
||||
|
||||
A custom netmode is defined within the `/etc/netmodes/<NETMODE_NAME>` directory, which should contain the following subdirectories:
|
||||
## Quick Start
|
||||
|
||||
- **/lib/netmode/pre/**: Generic scripts executed before the netmode-specific configurations are applied.
|
||||
- **/etc/netmodes/<NETMODE_NAME>/uci/**: Contains UCI configuration files that will be copied to `/etc/config/` during the application of the netmode.
|
||||
- **/etc/netmodes/<NETMODE_NAME>/scripts/**: Custom scripts specific to the netmode that are executed after the UCI configurations are applied.
|
||||
- **/lib/netmode/post/**: Generic scripts executed after the netmode-specific configurations are completed.
|
||||
### Installation
|
||||
|
||||
## Creating a Custom Netmode
|
||||
```bash
|
||||
# Install via opkg
|
||||
opkg update
|
||||
opkg install netmode
|
||||
|
||||
To create a new netmode, follow these steps:
|
||||
# Or build from source
|
||||
make package/feeds/iopsys/netmode/compile
|
||||
```
|
||||
|
||||
### Step 1: Pre-Execution Scripts
|
||||
### Basic Usage
|
||||
|
||||
Scripts located in `/lib/netmode/pre/` are executed before any mode-specific actions. These are typically used for preparing the system or cleaning up configurations from the previous netmode.
|
||||
```bash
|
||||
# Check current mode
|
||||
cat /etc/netmodes/.last_mode
|
||||
|
||||
- **Create Pre-Execution Scripts**:
|
||||
- Place your generic pre-execution scripts in `/lib/netmode/pre/`.
|
||||
- Example script (`/lib/netmode/pre/cleanup.sh`):
|
||||
```bash
|
||||
#!/bin/sh
|
||||
echo "Cleaning up old network configurations..."
|
||||
# Add commands here
|
||||
```
|
||||
# Switch to DHCP mode
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
|
||||
### Step 2: UCI Configuration Files
|
||||
# Switch to PPPoE mode
|
||||
uci set netmode.global.mode='routed-pppoe'
|
||||
uci set netmode.@supported_args[2].value='username@isp.com'
|
||||
uci set netmode.@supported_args[3].value='password'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
The UCI configuration files stored in `/etc/netmodes/<NETMODE_NAME>/uci/` will be copied to `/etc/config/`, effectively applying the desired network configuration.
|
||||
## Supported Modes
|
||||
|
||||
- **Place UCI Config Files**:
|
||||
- Create UCI configuration files under `/etc/netmodes/<NETMODE_NAME>/uci/`.
|
||||
- Example (`/etc/netmodes/bridge/uci/network`):
|
||||
````bash
|
||||
config device 'br_lan'
|
||||
option name 'br-lan'
|
||||
option type 'bridge'
|
||||
option multicast_to_unicast '0'
|
||||
option bridge_empty '1'
|
||||
list ports 'eth1'
|
||||
list ports 'eth3'
|
||||
list ports 'eth4'
|
||||
| Mode | Description | Use Case |
|
||||
|------|-------------|----------|
|
||||
| **routed-dhcp** | Router with DHCP WAN | Cable/Fiber internet with automatic IP |
|
||||
| **routed-pppoe** | Router with PPPoE WAN | DSL internet with authentication |
|
||||
| **routed-static** | Router with Static IP WAN | Business connections with fixed IP |
|
||||
| **bridged** | L2 Bridge Mode | Transparent bridge, no routing |
|
||||
|
||||
config interface 'lan'
|
||||
option proto 'dhcp'
|
||||
option device 'br-lan'
|
||||
option force_link '1'
|
||||
option reqopts '43 125'
|
||||
````
|
||||
## Documentation
|
||||
|
||||
### Step 3: Custom Execution Scripts
|
||||
Comprehensive documentation is available in the following guides:
|
||||
|
||||
After the UCI files are applied, any scripts in `/etc/netmodes/<NETMODE_NAME>/scripts/` are executed. These can be used to perform additional configuration tasks that are specific to the netmode.
|
||||
### For Users
|
||||
- **[USER_GUIDE.md](USER_GUIDE.md)** - Complete user guide with configuration examples
|
||||
- Getting started
|
||||
- Mode descriptions
|
||||
- Common use cases
|
||||
- Troubleshooting
|
||||
- FAQ
|
||||
|
||||
- **Create Custom Scripts**:
|
||||
- Add scripts to `/etc/netmodes/<NETMODE_NAME>/scripts/`.
|
||||
- Example (`/etc/netmodes/bridge/scripts/setup_bridge.sh`):
|
||||
```bash
|
||||
#!/bin/sh
|
||||
echo "Setting up bridge mode..."
|
||||
# Additional configuration commands here
|
||||
```
|
||||
### For Developers
|
||||
- **[DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md)** - Developer documentation
|
||||
- Development environment setup
|
||||
- Code organization
|
||||
- API reference
|
||||
- Testing framework
|
||||
- Contributing guidelines
|
||||
|
||||
### Step 4: Post-Execution Scripts
|
||||
### For Implementers
|
||||
- **[IMPLEMENTATION_GUIDE.md](IMPLEMENTATION_GUIDE.md)** - Implementation details
|
||||
- Architecture overview
|
||||
- Creating custom modes
|
||||
- Environment variables
|
||||
- Hook system
|
||||
- Data model integration
|
||||
|
||||
Finally, the generic scripts in `/lib/netmode/post/` are executed. These scripts typically finalize the setup or perform any necessary cleanups.
|
||||
## Architecture
|
||||
|
||||
- **Create Post-Execution Scripts**:
|
||||
- Place scripts in `/lib/netmode/post/`.
|
||||
- Example script (`/lib/netmode/post/restart_services.sh`):
|
||||
```bash
|
||||
#!/bin/sh
|
||||
echo "Restarting network services..."
|
||||
# Add commands here
|
||||
```
|
||||
```
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Netmode System │
|
||||
├─────────────────────────────────────────┤
|
||||
│ UCI Config → Init Service → Mode Scripts│
|
||||
│ ↓ ↓ ↓ │
|
||||
│ Environment Pre-hooks UCI Copy │
|
||||
│ Variables ↓ ↓ │
|
||||
│ ↓ Mode Scripts Post-hooks │
|
||||
│ └──────────┴────────────┘ │
|
||||
│ Network Reconfiguration │
|
||||
└─────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Enabling and Switching Netmodes
|
||||
### Components
|
||||
|
||||
The netmode mechanism can be enabled or disabled via the UCI configuration, and you can switch between netmodes using UCI commands.
|
||||
- **Init Service** (`/etc/init.d/netmode`): Orchestrates mode switching
|
||||
- **Mode Scripts** (`/etc/netmodes/<mode>/scripts/`): Mode-specific configuration
|
||||
- **UCI Config** (`/etc/config/netmode`): Mode definitions and parameters
|
||||
- **Data Model** (`datamodel.json`): BBF TR-181 integration
|
||||
- **Hooks** (`/lib/netmode/{pre,post}/`): Pre/post mode switch scripts
|
||||
|
||||
- **Enable Netmode**:
|
||||
```bash
|
||||
uci set netmode.global.enabled=1
|
||||
uci commit netmode
|
||||
```
|
||||
|
||||
- **Switch Netmode**:
|
||||
```bash
|
||||
uci set netmode.global.mode='<NETMODE_NAME>'
|
||||
uci commit netmode
|
||||
```
|
||||
## Configuration Examples
|
||||
|
||||
### DHCP with VLAN
|
||||
|
||||
```bash
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
uci set netmode.@supported_args[0].value='100' # VLAN ID
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
### PPPoE with Custom DNS
|
||||
|
||||
```bash
|
||||
uci set netmode.global.mode='routed-pppoe'
|
||||
uci set netmode.@supported_args[2].value='user@isp.com'
|
||||
uci set netmode.@supported_args[3].value='password123'
|
||||
uci set netmode.@supported_args[6].value='8.8.8.8,8.8.4.4'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
### Static IP Business Connection
|
||||
|
||||
```bash
|
||||
uci set netmode.global.mode='routed-static'
|
||||
uci set netmode.@supported_args[6].value='203.0.113.10'
|
||||
uci set netmode.@supported_args[7].value='255.255.255.0'
|
||||
uci set netmode.@supported_args[8].value='203.0.113.1'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
## Creating Custom Modes
|
||||
|
||||
Custom network modes can be added by following these steps:
|
||||
|
||||
1. **Create mode directory structure**:
|
||||
```bash
|
||||
mkdir -p /etc/netmodes/my-mode/scripts
|
||||
```
|
||||
|
||||
2. **Define mode in supported_modes.json**:
|
||||
```json
|
||||
{
|
||||
"name": "my-mode",
|
||||
"description": "My Custom Mode",
|
||||
"supported_args": [...]
|
||||
}
|
||||
```
|
||||
|
||||
3. **Create mode script**:
|
||||
```bash
|
||||
cat > /etc/netmodes/my-mode/scripts/10-my-mode << 'EOF'
|
||||
#!/bin/sh
|
||||
# Configuration logic here
|
||||
EOF
|
||||
chmod +x /etc/netmodes/my-mode/scripts/10-my-mode
|
||||
```
|
||||
|
||||
4. **Import to UCI and test**:
|
||||
```bash
|
||||
sh /etc/uci-defaults/40_netmode_populated_supported_modes
|
||||
uci set netmode.global.mode='my-mode'
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
See [IMPLEMENTATION_GUIDE.md](IMPLEMENTATION_GUIDE.md#creating-a-new-network-mode) for detailed instructions.
|
||||
|
||||
## TR-069/USP Integration
|
||||
|
||||
Netmode exposes a BBF TR-181 data model for remote management:
|
||||
|
||||
**Data Model Path**: `Device.X_IOPSYS_EU_NetMode.`
|
||||
|
||||
```
|
||||
Device.X_IOPSYS_EU_NetMode.
|
||||
├── Enable (boolean, r/w)
|
||||
├── Mode (string, r/w)
|
||||
├── SupportedModesNumberOfEntries (unsignedInt, r)
|
||||
└── SupportedModes.{i}.
|
||||
├── Name (string, r)
|
||||
├── Description (string, r)
|
||||
└── SupportedArguments.{i}.
|
||||
├── Name (string, r)
|
||||
├── Type (string, r)
|
||||
├── Required (boolean, r)
|
||||
└── Value (string, r/w)
|
||||
```
|
||||
|
||||
Example TR-069 operation:
|
||||
```xml
|
||||
<SetParameterValues>
|
||||
<ParameterList>
|
||||
<ParameterValueStruct>
|
||||
<Name>Device.X_IOPSYS_EU_NetMode.Mode</Name>
|
||||
<Value>routed-dhcp</Value>
|
||||
</ParameterValueStruct>
|
||||
</ParameterList>
|
||||
</SetParameterValues>
|
||||
```
|
||||
|
||||
## System Requirements
|
||||
|
||||
- **Platform**: OpenWrt/iopsys
|
||||
- **Dependencies**:
|
||||
- `dm-service` (BBF data model service)
|
||||
- `uci`
|
||||
- `procd`
|
||||
- `libubox` (jshn)
|
||||
- **Recommended**:
|
||||
- `logread` for monitoring
|
||||
- `firewall`, `odhcpd`, `mcast` for full functionality
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
netmode/
|
||||
├── Makefile # Package build definition
|
||||
├── README.md # This file
|
||||
├── IMPLEMENTATION_GUIDE.md # Implementation guide
|
||||
├── DEVELOPER_GUIDE.md # Developer documentation
|
||||
├── USER_GUIDE.md # User documentation
|
||||
├── bbfdm_service.json # BBF service registration
|
||||
└── files/
|
||||
├── etc/
|
||||
│ ├── config/netmode # UCI configuration
|
||||
│ ├── init.d/netmode # Init script (START=11)
|
||||
│ ├── uci-defaults/ # First-boot scripts
|
||||
│ └── netmodes/
|
||||
│ ├── supported_modes.json # Mode definitions
|
||||
│ ├── routed-dhcp/scripts/
|
||||
│ ├── routed-pppoe/scripts/
|
||||
│ ├── routed-static/scripts/
|
||||
│ └── bridged/scripts/
|
||||
└── lib/
|
||||
├── netmode/
|
||||
│ ├── pre/ # Pre-switch hooks
|
||||
│ └── post/ # Post-switch hooks
|
||||
└── upgrade/keep.d/netmode # Sysupgrade preservation
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Mode Not Switching
|
||||
|
||||
```bash
|
||||
# Check if enabled
|
||||
uci get netmode.global.enabled
|
||||
|
||||
# Check logs
|
||||
logread | grep netmode
|
||||
|
||||
# Force mode change
|
||||
rm /etc/netmodes/.last_mode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
### No Internet After Switch
|
||||
|
||||
```bash
|
||||
# Verify mode applied
|
||||
cat /etc/netmodes/.last_mode
|
||||
|
||||
# Check WAN status
|
||||
ifconfig wan
|
||||
ip route
|
||||
|
||||
# Restart network
|
||||
/etc/init.d/network restart
|
||||
```
|
||||
|
||||
### PPPoE Authentication Failed
|
||||
|
||||
```bash
|
||||
# Check credentials
|
||||
uci show network.wan | grep -E "username|password"
|
||||
|
||||
# Check logs
|
||||
logread | grep ppp
|
||||
|
||||
# Verify VLAN if required
|
||||
uci get network.wan.device
|
||||
```
|
||||
|
||||
See [USER_GUIDE.md](USER_GUIDE.md#troubleshooting) for comprehensive troubleshooting.
|
||||
|
||||
## Development
|
||||
|
||||
### Building
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
cd feeds/iopsys/netmode
|
||||
|
||||
# Build package
|
||||
make package/feeds/iopsys/netmode/compile V=s
|
||||
|
||||
# Install on device
|
||||
scp bin/packages/*/iopsys/netmode_*.ipk root@192.168.1.1:/tmp/
|
||||
ssh root@192.168.1.1 "opkg install /tmp/netmode_*.ipk"
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
```bash
|
||||
# Run mode switch test
|
||||
./test-mode-switch.sh routed-dhcp
|
||||
|
||||
# Monitor logs
|
||||
logread -f | grep netmode
|
||||
|
||||
# Verify configuration
|
||||
uci show network
|
||||
cat /etc/netmodes/.last_mode
|
||||
```
|
||||
|
||||
### Contributing
|
||||
|
||||
Contributions are welcome! Please follow these steps:
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
4. Test thoroughly on target hardware
|
||||
5. Update documentation
|
||||
6. Submit a pull request
|
||||
|
||||
See [DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md#contributing-guidelines) for detailed guidelines.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the GNU General Public License v2.0 only.
|
||||
|
||||
See `/LICENSE` for more information.
|
||||
|
||||
## Support
|
||||
|
||||
- **Documentation**: See guides in this repository
|
||||
- **Issues**: Contact iopsys development team
|
||||
- **Community**: OpenWrt and iopsys forums
|
||||
|
||||
## Changelog
|
||||
|
||||
### Version 1.1.11
|
||||
- Current stable release
|
||||
- Support for DHCP, PPPoE, Static IP, and Bridge modes
|
||||
- BBF TR-181 data model integration
|
||||
- Comprehensive documentation
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
- OpenWrt project for the underlying platform
|
||||
- iopsys for development and maintenance
|
||||
- Contributors and testers
|
||||
|
||||
## Related Projects
|
||||
|
||||
- [OpenWrt](https://openwrt.org/) - Linux operating system for embedded devices
|
||||
- [iopsys](https://www.iopsys.eu/) - Broadband device management
|
||||
- [BBF](https://www.broadband-forum.org/) - Broadband Forum standards
|
||||
|
||||
---
|
||||
|
||||
**For detailed information, please refer to the specific guides:**
|
||||
- Users: [USER_GUIDE.md](USER_GUIDE.md)
|
||||
- Developers: [DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md)
|
||||
- Implementers: [IMPLEMENTATION_GUIDE.md](IMPLEMENTATION_GUIDE.md)
|
||||
|
||||
857
netmode/USER_GUIDE.md
Normal file
857
netmode/USER_GUIDE.md
Normal file
@@ -0,0 +1,857 @@
|
||||
# Netmode User Guide
|
||||
|
||||
## Table of Contents
|
||||
1. [Introduction](#introduction)
|
||||
2. [Getting Started](#getting-started)
|
||||
3. [Available Network Modes](#available-network-modes)
|
||||
4. [Configuration Methods](#configuration-methods)
|
||||
5. [Common Use Cases](#common-use-cases)
|
||||
6. [Troubleshooting](#troubleshooting)
|
||||
7. [FAQ](#faq)
|
||||
8. [Glossary](#glossary)
|
||||
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
### What is Netmode?
|
||||
|
||||
Netmode is a network configuration management system for iopsys-based routers that allows you to easily switch between different WAN (Wide Area Network) connection types without manual configuration.
|
||||
|
||||
### Why Use Netmode?
|
||||
|
||||
- **Simplicity**: Switch network modes with a single command
|
||||
- **Flexibility**: Support for multiple WAN connection types
|
||||
- **Consistency**: Ensures proper configuration of all related network services
|
||||
- **Remote Management**: Can be controlled via TR-069/USP protocols
|
||||
- **Safety**: Automatically handles complex network reconfigurations
|
||||
|
||||
### Supported Connection Types
|
||||
|
||||
- **DHCP**: Automatic IP configuration (most common for cable/fiber connections)
|
||||
- **PPPoE**: Username/password authentication (common for DSL connections)
|
||||
- **Static IP**: Manual IP configuration (business connections)
|
||||
- **Bridged Mode**: Bridge/modem mode (disable routing)
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Checking if Netmode is Installed
|
||||
|
||||
```bash
|
||||
# Check if netmode package is installed
|
||||
opkg list-installed | grep netmode
|
||||
|
||||
# Check netmode service status
|
||||
service netmode status
|
||||
```
|
||||
|
||||
Expected output:
|
||||
```
|
||||
netmode - 1.1.11-1 - Network Modes and Utils
|
||||
```
|
||||
|
||||
### Checking Current Mode
|
||||
|
||||
```bash
|
||||
# View current configuration
|
||||
uci show netmode.global
|
||||
|
||||
# Check active mode
|
||||
cat /etc/netmodes/.last_mode
|
||||
```
|
||||
|
||||
Example output:
|
||||
```
|
||||
netmode.global=netmode
|
||||
netmode.global.enabled='1'
|
||||
netmode.global.mode='routed-dhcp'
|
||||
```
|
||||
|
||||
### Viewing Available Modes
|
||||
|
||||
```bash
|
||||
# List all supported modes
|
||||
uci show netmode | grep "supported_modes.*name"
|
||||
```
|
||||
|
||||
Example output:
|
||||
```
|
||||
netmode.@supported_modes[0].name='routed-dhcp'
|
||||
netmode.@supported_modes[1].name='routed-pppoe'
|
||||
netmode.@supported_modes[2].name='routed-static'
|
||||
netmode.@supported_modes[3].name='bridged'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Available Network Modes
|
||||
|
||||
### 1. Routed DHCP Mode
|
||||
|
||||
**Mode Name**: `routed-dhcp`
|
||||
|
||||
**When to Use**:
|
||||
- Cable internet connection
|
||||
- Fiber internet connection
|
||||
- Any ISP that automatically provides IP configuration
|
||||
|
||||
**Features**:
|
||||
- Automatic IP address assignment
|
||||
- Built-in router (NAT)
|
||||
- Firewall enabled
|
||||
- DHCP server for local devices
|
||||
- IPv4 and IPv6 support
|
||||
|
||||
**Configuration Parameters**:
|
||||
- `vlanid` (optional): VLAN ID if required by ISP
|
||||
- `dns_servers` (optional): Custom DNS servers (comma-separated)
|
||||
|
||||
**Example Configuration**:
|
||||
```bash
|
||||
# Basic DHCP mode
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
|
||||
# DHCP with VLAN ID 100
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
# Find VLAN argument and set value
|
||||
uci set netmode.@supported_args[0].value='100'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2. Routed PPPoE Mode
|
||||
|
||||
**Mode Name**: `routed-pppoe`
|
||||
|
||||
**When to Use**:
|
||||
- DSL internet connection
|
||||
- ISP requires username and password authentication
|
||||
- Connection uses PPPoE protocol
|
||||
|
||||
**Features**:
|
||||
- Username/password authentication
|
||||
- Built-in router (NAT)
|
||||
- Firewall enabled
|
||||
- DHCP server for local devices
|
||||
- Automatic MTU optimization
|
||||
|
||||
**Required Parameters**:
|
||||
- `username`: PPPoE username (provided by ISP)
|
||||
- `password`: PPPoE password (provided by ISP)
|
||||
|
||||
**Optional Parameters**:
|
||||
- `vlanid`: VLAN ID if required by ISP
|
||||
- `mtu`: Maximum transmission unit (default: 1492 for PPPoE)
|
||||
- `dns_servers`: Custom DNS servers (comma-separated)
|
||||
|
||||
**Example Configuration**:
|
||||
```bash
|
||||
# Set mode
|
||||
uci set netmode.global.mode='routed-pppoe'
|
||||
|
||||
# Set username (find correct argument index)
|
||||
uci set netmode.@supported_args[2].value='myuser@isp.com'
|
||||
|
||||
# Set password
|
||||
uci set netmode.@supported_args[3].value='mypassword'
|
||||
|
||||
# Optional: Set VLAN
|
||||
uci set netmode.@supported_args[4].value='100'
|
||||
|
||||
# Optional: Set MTU
|
||||
uci set netmode.@supported_args[5].value='1492'
|
||||
|
||||
# Apply configuration
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
**Important Notes**:
|
||||
- Device will reboot after configuration
|
||||
- Keep ISP credentials safe
|
||||
- Most DSL connections use VLAN ID 7 or 100 (check with ISP)
|
||||
- MTU typically 1492 for PPPoE (auto-configured)
|
||||
|
||||
---
|
||||
|
||||
### 3. Routed Static IP Mode
|
||||
|
||||
**Mode Name**: `routed-static`
|
||||
|
||||
**When to Use**:
|
||||
- Business internet connection with static IP
|
||||
- ISP provided specific IP address, subnet mask, and gateway
|
||||
- Fixed IP address required for services (web server, VPN, etc.)
|
||||
|
||||
**Features**:
|
||||
- Manual IP configuration
|
||||
- Built-in router (NAT)
|
||||
- Firewall enabled
|
||||
- DHCP server for local devices
|
||||
- Fixed WAN IP address
|
||||
|
||||
**Required Parameters**:
|
||||
- `ipaddr`: Static IP address (e.g., 93.21.0.104)
|
||||
- `netmask`: Subnet mask (e.g., 255.255.255.0)
|
||||
- `gateway`: Default gateway IP (e.g., 93.21.0.1)
|
||||
|
||||
**Optional Parameters**:
|
||||
- `vlanid`: VLAN ID if required
|
||||
- `dns_servers`: DNS servers (comma-separated, e.g., 8.8.8.8,8.8.4.4)
|
||||
|
||||
**Example Configuration**:
|
||||
```bash
|
||||
# Set mode
|
||||
uci set netmode.global.mode='routed-static'
|
||||
|
||||
# Set IP address
|
||||
uci set netmode.@supported_args[6].value='93.21.0.104'
|
||||
|
||||
# Set subnet mask
|
||||
uci set netmode.@supported_args[7].value='255.255.255.0'
|
||||
|
||||
# Set gateway
|
||||
uci set netmode.@supported_args[8].value='93.21.0.1'
|
||||
|
||||
# Optional: Set DNS servers
|
||||
uci set netmode.@supported_args[9].value='8.8.8.8,8.8.4.4'
|
||||
|
||||
# Apply configuration
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
**Important Notes**:
|
||||
- Use exact IP settings provided by ISP
|
||||
- Incorrect settings will result in no internet connectivity
|
||||
- DNS servers are optional but recommended
|
||||
- Device will reboot after configuration
|
||||
|
||||
---
|
||||
|
||||
### 4. Bridged Mode
|
||||
|
||||
**Mode Name**: `bridged`
|
||||
|
||||
**When to Use**:
|
||||
- Using router as a bridge/modem only
|
||||
- Another router handles routing and DHCP
|
||||
- ISP requires bridge mode
|
||||
- Cascading routers (not recommended, prefer this mode on upstream device)
|
||||
|
||||
**Features**:
|
||||
- All LAN and WAN ports bridged together
|
||||
- No routing (NAT disabled)
|
||||
- Firewall disabled
|
||||
- DHCP server disabled
|
||||
- Device acts as transparent bridge
|
||||
|
||||
**Configuration Parameters**:
|
||||
- No parameters required
|
||||
|
||||
**Example Configuration**:
|
||||
```bash
|
||||
# Set mode
|
||||
uci set netmode.global.mode='bridged'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
**Important Notes**:
|
||||
- Device will obtain IP from upstream router/ISP
|
||||
- Web interface may be inaccessible until device gets IP
|
||||
- To access device: connect directly and check DHCP leases on upstream router
|
||||
- Device will reboot after configuration
|
||||
- Use this mode carefully - you may lose access to the device
|
||||
|
||||
**Reverting from Bridge Mode**:
|
||||
If you lose access, connect via serial console or perform factory reset.
|
||||
|
||||
---
|
||||
|
||||
## Configuration Methods
|
||||
|
||||
### Method 1: UCI Command Line (SSH/Console)
|
||||
|
||||
**Step-by-step procedure**:
|
||||
|
||||
```bash
|
||||
# 1. Connect to device
|
||||
ssh root@192.168.1.1
|
||||
|
||||
# 2. View current configuration
|
||||
uci show netmode
|
||||
|
||||
# 3. Set desired mode
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
|
||||
# 4. Set any required parameters (example for PPPoE)
|
||||
uci set netmode.@supported_args[2].value='username@isp.com'
|
||||
uci set netmode.@supported_args[3].value='password123'
|
||||
|
||||
# 5. Save configuration
|
||||
uci commit netmode
|
||||
|
||||
# 6. Apply changes
|
||||
service netmode restart
|
||||
|
||||
# 7. Monitor logs (optional)
|
||||
logread -f | grep netmode
|
||||
```
|
||||
|
||||
### Method 2: TR-069/CWMP (Remote Management)
|
||||
|
||||
If your device is managed by an ACS (Auto Configuration Server):
|
||||
|
||||
**Get current mode**:
|
||||
```xml
|
||||
GetParameterValues
|
||||
Device.X_IOPSYS_EU_NetMode.Mode
|
||||
```
|
||||
|
||||
**Set PPPoE mode**:
|
||||
```xml
|
||||
SetParameterValues
|
||||
Device.X_IOPSYS_EU_NetMode.Mode = "routed-pppoe"
|
||||
Device.X_IOPSYS_EU_NetMode.SupportedModes.2.SupportedArguments.1.Value = "username@isp.com"
|
||||
Device.X_IOPSYS_EU_NetMode.SupportedModes.2.SupportedArguments.2.Value = "password123"
|
||||
```
|
||||
|
||||
**Trigger mode change**:
|
||||
```bash
|
||||
# On device (via TR-069 script)
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
### Method 3: Web Interface (if available)
|
||||
|
||||
Some firmware may provide a web interface for netmode configuration.
|
||||
|
||||
Typical location: **Network → WAN → Connection Type**
|
||||
|
||||
---
|
||||
|
||||
## Common Use Cases
|
||||
|
||||
### Use Case 1: Switching from DHCP to PPPoE
|
||||
|
||||
**Scenario**: ISP changed from cable to DSL connection
|
||||
|
||||
```bash
|
||||
# 1. Connect to router
|
||||
ssh root@192.168.1.1
|
||||
|
||||
# 2. Find username and password argument indices
|
||||
uci show netmode | grep -A3 "name='username'"
|
||||
# Note the index numbers
|
||||
|
||||
# 3. Set mode and credentials
|
||||
uci set netmode.global.mode='routed-pppoe'
|
||||
uci set netmode.@supported_args[2].value='newuser@dsl-isp.com'
|
||||
uci set netmode.@supported_args[3].value='newpassword'
|
||||
|
||||
# 4. If ISP requires VLAN (e.g., VLAN 7)
|
||||
uci set netmode.@supported_args[4].value='7'
|
||||
|
||||
# 5. Apply
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
|
||||
# Device will reboot
|
||||
```
|
||||
|
||||
### Use Case 2: Adding Custom DNS Servers
|
||||
|
||||
**Scenario**: Want to use Google DNS or Cloudflare DNS
|
||||
|
||||
```bash
|
||||
# For DHCP mode
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
|
||||
# Find dns_servers argument index
|
||||
uci show netmode | grep -B2 "name='dns_servers'"
|
||||
|
||||
# Set custom DNS (Google DNS example)
|
||||
uci set netmode.@supported_args[1].value='8.8.8.8,8.8.4.4'
|
||||
|
||||
# Or Cloudflare DNS
|
||||
uci set netmode.@supported_args[1].value='1.1.1.1,1.0.0.1'
|
||||
|
||||
# Apply
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
### Use Case 3: Configuring VLAN for ISP
|
||||
|
||||
**Scenario**: ISP requires VLAN tagging (common for fiber)
|
||||
|
||||
```bash
|
||||
# Identify your mode (example: DHCP)
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
|
||||
# Find VLAN argument
|
||||
uci show netmode | grep -B2 "name='vlanid'"
|
||||
|
||||
# Set VLAN ID (ISP will provide this, commonly 100, 7, or other)
|
||||
uci set netmode.@supported_args[0].value='100'
|
||||
|
||||
# Apply
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
### Use Case 4: Setting Up Bridge Mode for Secondary Router
|
||||
|
||||
**Scenario**: Using dedicated router behind ISP modem
|
||||
|
||||
```bash
|
||||
# Configure device as bridge
|
||||
uci set netmode.global.mode='bridged'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
|
||||
# After reboot, device will be in bridge mode
|
||||
# Connect to it via the IP it receives from upstream
|
||||
```
|
||||
|
||||
### Use Case 5: Business Static IP Setup
|
||||
|
||||
**Scenario**: ISP provided static IP configuration
|
||||
|
||||
**ISP Information**:
|
||||
- IP Address: 203.0.113.10
|
||||
- Subnet Mask: 255.255.255.248
|
||||
- Gateway: 203.0.113.9
|
||||
- DNS: 203.0.113.1, 203.0.113.2
|
||||
|
||||
```bash
|
||||
# Set mode
|
||||
uci set netmode.global.mode='routed-static'
|
||||
|
||||
# Configure IP settings (find argument indices first)
|
||||
uci show netmode | grep -B2 "name='ipaddr'"
|
||||
uci show netmode | grep -B2 "name='netmask'"
|
||||
uci show netmode | grep -B2 "name='gateway'"
|
||||
|
||||
# Set values
|
||||
uci set netmode.@supported_args[6].value='203.0.113.10'
|
||||
uci set netmode.@supported_args[7].value='255.255.255.248'
|
||||
uci set netmode.@supported_args[8].value='203.0.113.9'
|
||||
uci set netmode.@supported_args[9].value='203.0.113.1,203.0.113.2'
|
||||
|
||||
# Apply
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Problem: No Internet After Mode Switch
|
||||
|
||||
**Symptoms**:
|
||||
- Cannot access websites
|
||||
- No WAN IP address
|
||||
- Local network works but no internet
|
||||
|
||||
**Diagnosis**:
|
||||
```bash
|
||||
# Check WAN interface status
|
||||
ifconfig wan
|
||||
|
||||
# Check if WAN has IP
|
||||
ip addr show wan
|
||||
|
||||
# Check routing table
|
||||
ip route
|
||||
|
||||
# Check DNS resolution
|
||||
nslookup google.com
|
||||
|
||||
# Check mode applied correctly
|
||||
cat /etc/netmodes/.last_mode
|
||||
uci show netmode.global.mode
|
||||
```
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. **For DHCP mode**:
|
||||
```bash
|
||||
# Restart network
|
||||
/etc/init.d/network restart
|
||||
|
||||
# Release and renew DHCP
|
||||
udhcpc -i wan -n
|
||||
```
|
||||
|
||||
2. **For PPPoE mode**:
|
||||
```bash
|
||||
# Check credentials
|
||||
uci show network.wan.username
|
||||
uci show network.wan.password
|
||||
|
||||
# Check PPPoE connection
|
||||
logread | grep pppd
|
||||
|
||||
# Restart PPPoE
|
||||
ifdown wan
|
||||
ifup wan
|
||||
```
|
||||
|
||||
3. **For Static IP mode**:
|
||||
```bash
|
||||
# Verify settings
|
||||
uci show network.wan
|
||||
|
||||
# Check if gateway is reachable
|
||||
ping -c 3 $(uci get network.wan.gateway)
|
||||
```
|
||||
|
||||
### Problem: Cannot Access Router After Mode Change
|
||||
|
||||
**Symptoms**:
|
||||
- Cannot reach router web interface
|
||||
- Cannot SSH to router
|
||||
- Router appears offline
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. **Check router IP address**:
|
||||
- Routed modes: Router should be at `192.168.1.1`
|
||||
- Bridged mode: Router gets IP from upstream device
|
||||
|
||||
2. **For bridged mode**:
|
||||
```bash
|
||||
# Connect to upstream router
|
||||
# Check DHCP leases for your device MAC address
|
||||
# Or connect via serial console
|
||||
```
|
||||
|
||||
3. **Factory reset** (last resort):
|
||||
- Hold reset button for 10 seconds
|
||||
- Device will reset to default configuration
|
||||
|
||||
### Problem: Mode Not Switching
|
||||
|
||||
**Symptoms**:
|
||||
- `.last_mode` not updated
|
||||
- Old configuration still active
|
||||
- No changes after restart
|
||||
|
||||
**Diagnosis**:
|
||||
```bash
|
||||
# Check if netmode is enabled
|
||||
uci get netmode.global.enabled
|
||||
|
||||
# Check logs
|
||||
logread | grep netmode
|
||||
|
||||
# Check if mode exists
|
||||
ls /etc/netmodes/*/scripts/
|
||||
```
|
||||
|
||||
**Solutions**:
|
||||
```bash
|
||||
# Enable netmode if disabled
|
||||
uci set netmode.global.enabled='1'
|
||||
uci commit netmode
|
||||
|
||||
# Force mode change by removing last_mode
|
||||
rm /etc/netmodes/.last_mode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
### Problem: PPPoE Authentication Failure
|
||||
|
||||
**Symptoms**:
|
||||
- WAN interface shows "connecting" but never connects
|
||||
- Logs show authentication errors
|
||||
|
||||
**Diagnosis**:
|
||||
```bash
|
||||
# Check PPPoE logs
|
||||
logread | grep ppp
|
||||
|
||||
# Common errors:
|
||||
# - "authentication failed"
|
||||
# - "LCP timeout"
|
||||
# - "CHAP authentication failed"
|
||||
```
|
||||
|
||||
**Solutions**:
|
||||
```bash
|
||||
# Verify credentials (double-check with ISP)
|
||||
uci show network.wan.username
|
||||
uci show network.wan.password
|
||||
|
||||
# Some ISPs require VLAN tagging
|
||||
uci set netmode.@supported_args[4].value='7' # or ISP-specific VLAN
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
|
||||
# Check if service name is required (rare)
|
||||
uci set network.wan.service='ISP-SERVICE-NAME'
|
||||
uci commit network
|
||||
```
|
||||
|
||||
### Problem: Slow Internet After Mode Switch
|
||||
|
||||
**Symptoms**:
|
||||
- Internet works but very slow
|
||||
- High latency
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. **Check MTU settings** (especially for PPPoE):
|
||||
```bash
|
||||
# Set MTU for PPPoE
|
||||
uci set netmode.@supported_args[5].value='1492'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
2. **Check for DNS issues**:
|
||||
```bash
|
||||
# Test DNS resolution speed
|
||||
time nslookup google.com
|
||||
|
||||
# Use faster DNS
|
||||
uci set netmode.@supported_args[X].value='1.1.1.1,1.0.0.1'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
3. **Check WAN speed**:
|
||||
```bash
|
||||
# Install iperf3 and test
|
||||
opkg update
|
||||
opkg install iperf3
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## FAQ
|
||||
|
||||
### General Questions
|
||||
|
||||
**Q: Will I lose my configuration when switching modes?**
|
||||
|
||||
A: Netmode preserves most router settings (WiFi, firewall rules, etc.), but WAN-specific settings are reconfigured. Local network settings remain unchanged.
|
||||
|
||||
**Q: How long does a mode switch take?**
|
||||
|
||||
A: The mode switch itself takes a few seconds, but the device will reboot, which takes 1-2 minutes total.
|
||||
|
||||
**Q: Can I switch modes remotely?**
|
||||
|
||||
A: Yes, via SSH or TR-069/USP if configured. However, be careful with bridge mode as you may lose connectivity.
|
||||
|
||||
**Q: Do I need to reboot manually?**
|
||||
|
||||
A: No, the system automatically reboots after applying a new mode.
|
||||
|
||||
**Q: Can I schedule a mode switch?**
|
||||
|
||||
A: Yes, using cron:
|
||||
```bash
|
||||
# Switch to bridged mode at 2 AM
|
||||
echo "0 2 * * * uci set netmode.global.mode='bridged' && uci commit && service netmode restart" | crontab -
|
||||
```
|
||||
|
||||
### Mode-Specific Questions
|
||||
|
||||
**Q: Which mode should I use?**
|
||||
|
||||
A: Depends on your ISP:
|
||||
- Cable/Fiber without login: **routed-dhcp**
|
||||
- DSL with username/password: **routed-pppoe**
|
||||
- Static IP business connection: **routed-static**
|
||||
- Using as bridge only: **bridged**
|
||||
|
||||
**Q: Can I use PPPoE with VLAN?**
|
||||
|
||||
A: Yes, set both the mode and VLAN ID:
|
||||
```bash
|
||||
uci set netmode.global.mode='routed-pppoe'
|
||||
uci set netmode.@supported_args[4].value='100'
|
||||
```
|
||||
|
||||
**Q: What's the difference between routed and bridged mode?**
|
||||
|
||||
A:
|
||||
- **Routed modes**: Router performs NAT, runs firewall, provides DHCP to local network
|
||||
- **Bridged mode**: Router acts as transparent bridge, no NAT, no firewall, no DHCP
|
||||
|
||||
**Q: Can I customize the LAN IP in routed modes?**
|
||||
|
||||
A: Yes, but not through netmode. After mode switch, manually configure:
|
||||
```bash
|
||||
uci set network.lan.ipaddr='192.168.2.1'
|
||||
uci commit network
|
||||
/etc/init.d/network restart
|
||||
```
|
||||
|
||||
### Technical Questions
|
||||
|
||||
**Q: Where are my credentials stored?**
|
||||
|
||||
A: In `/etc/config/netmode` (UCI configuration). They are cleared from memory after mode application for security.
|
||||
|
||||
**Q: Can I create custom modes?**
|
||||
|
||||
A: Yes, advanced users can create custom modes. See the IMPLEMENTATION_GUIDE.md and DEVELOPER_GUIDE.md.
|
||||
|
||||
**Q: Does netmode support IPv6?**
|
||||
|
||||
A: Yes, routed-dhcp and routed-pppoe modes support IPv6 (DHCPv6).
|
||||
|
||||
**Q: What happens to firewall rules?**
|
||||
|
||||
A: Firewall is enabled for routed modes and disabled for bridged mode. Custom rules are preserved.
|
||||
|
||||
**Q: Can I use multiple WAN connections?**
|
||||
|
||||
A: Netmode manages the primary WAN. For multi-WAN setups, configure secondary WANs manually after netmode configuration.
|
||||
|
||||
---
|
||||
|
||||
## Glossary
|
||||
|
||||
**Bridge Mode**: Operating mode where the router acts as a transparent network bridge without routing or NAT.
|
||||
|
||||
**DHCP (Dynamic Host Configuration Protocol)**: Automatic IP address assignment protocol.
|
||||
|
||||
**DMZ (Demilitarized Zone)**: Network segment that sits between internal network and external network.
|
||||
|
||||
**DNS (Domain Name System)**: Service that translates domain names to IP addresses.
|
||||
|
||||
**Gateway**: Router IP address that connects local network to the internet.
|
||||
|
||||
**ISP (Internet Service Provider)**: Company providing internet access.
|
||||
|
||||
**LAN (Local Area Network)**: Internal network (devices in your home/office).
|
||||
|
||||
**MTU (Maximum Transmission Unit)**: Largest packet size that can be transmitted. PPPoE typically uses 1492.
|
||||
|
||||
**NAT (Network Address Translation)**: Technology allowing multiple devices to share one public IP address.
|
||||
|
||||
**PPPoE (Point-to-Point Protocol over Ethernet)**: Authentication protocol commonly used for DSL connections.
|
||||
|
||||
**Static IP**: Fixed IP address that doesn't change (opposite of DHCP).
|
||||
|
||||
**Subnet Mask**: Defines the network portion of an IP address (e.g., 255.255.255.0).
|
||||
|
||||
**TR-069/CWMP**: Remote management protocol for network devices.
|
||||
|
||||
**UCI (Unified Configuration Interface)**: OpenWrt configuration system.
|
||||
|
||||
**USP (User Services Platform)**: Next-generation device management protocol.
|
||||
|
||||
**VLAN (Virtual LAN)**: Network segmentation using VLAN tags (802.1Q).
|
||||
|
||||
**WAN (Wide Area Network)**: External network connection (internet).
|
||||
|
||||
---
|
||||
|
||||
## Getting Help
|
||||
|
||||
### Log Collection
|
||||
|
||||
When reporting issues, collect these logs:
|
||||
|
||||
```bash
|
||||
# System logs
|
||||
logread > /tmp/system.log
|
||||
|
||||
# Network configuration
|
||||
uci export network > /tmp/network.conf
|
||||
uci export netmode > /tmp/netmode.conf
|
||||
|
||||
# Interface status
|
||||
ifconfig > /tmp/interfaces.txt
|
||||
ip route > /tmp/routes.txt
|
||||
|
||||
# Copy to external system
|
||||
scp /tmp/*.{log,conf,txt} user@external-host:/path/
|
||||
```
|
||||
|
||||
### Support Resources
|
||||
|
||||
- **Documentation**: Check IMPLEMENTATION_GUIDE.md and DEVELOPER_GUIDE.md
|
||||
- **Community Forums**: OpenWrt and iopsys community forums
|
||||
- **Issue Tracker**: Report bugs to iopsys development team
|
||||
- **ISP Support**: Contact ISP for connection-specific parameters (VLAN, credentials, etc.)
|
||||
|
||||
### Before Contacting Support
|
||||
|
||||
Please have ready:
|
||||
1. Current mode: `cat /etc/netmodes/.last_mode`
|
||||
2. Netmode version: `opkg info netmode | grep Version`
|
||||
3. Error logs: `logread | grep netmode`
|
||||
4. Network configuration: `uci export netmode`
|
||||
5. What you're trying to achieve
|
||||
6. What you've already tried
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference Card
|
||||
|
||||
### Common Commands
|
||||
|
||||
```bash
|
||||
# View current mode
|
||||
cat /etc/netmodes/.last_mode
|
||||
|
||||
# List available modes
|
||||
uci show netmode | grep "supported_modes.*name"
|
||||
|
||||
# Switch to DHCP
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
uci commit netmode && service netmode restart
|
||||
|
||||
# Switch to PPPoE
|
||||
uci set netmode.global.mode='routed-pppoe'
|
||||
uci set netmode.@supported_args[2].value='username'
|
||||
uci set netmode.@supported_args[3].value='password'
|
||||
uci commit netmode && service netmode restart
|
||||
|
||||
# Switch to Bridge
|
||||
uci set netmode.global.mode='bridged'
|
||||
uci commit netmode && service netmode restart
|
||||
|
||||
# View logs
|
||||
logread | grep netmode
|
||||
|
||||
# Reset to last mode
|
||||
rm /etc/netmodes/.last_mode
|
||||
service netmode restart
|
||||
```
|
||||
|
||||
### Emergency Recovery
|
||||
|
||||
```bash
|
||||
# If locked out after bridge mode
|
||||
# Connect via serial console and run:
|
||||
uci set netmode.global.mode='routed-dhcp'
|
||||
uci commit netmode
|
||||
service netmode restart
|
||||
|
||||
# Factory reset (hold reset button 10 seconds)
|
||||
# Or via console:
|
||||
firstboot -y && reboot
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Document Version**: 1.0
|
||||
**Package Version**: 1.1.11
|
||||
**Last Updated**: 2024
|
||||
**License**: GPL-2.0-only
|
||||
@@ -58,7 +58,7 @@
|
||||
"name": "mode"
|
||||
}
|
||||
},
|
||||
"linker_obj": "Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.[Name==@key]."
|
||||
"linker_obj": "Device.{BBF_VENDOR_PREFIX}NetMode.SupportedModes.*.Name"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
config netmode global
|
||||
option enabled 0
|
||||
option enabled 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=10
|
||||
START=11
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
@@ -117,6 +117,7 @@ start_service() {
|
||||
config_get_bool enabled global enabled '0'
|
||||
[ $enabled -eq 0 ] && return
|
||||
|
||||
[ -d $MODEDIR ] || mkdir -p $MODEDIR
|
||||
# Get the desired netmode from config
|
||||
config_get mode global mode ""
|
||||
# Check if netmode is set as boot environment parameter
|
||||
@@ -127,9 +128,12 @@ start_service() {
|
||||
# Get the last saved mode
|
||||
lastmode="$(cat $MODEDIR/.last_mode 2>/dev/null)"
|
||||
# Return if desired mode is same as last saved mode
|
||||
[ "$mode" == "$lastmode" ] && return
|
||||
if [ "$mode" = "$lastmode" ]; then
|
||||
_log "Not switching mode[${mode}], lastmode[${lastmode}]"
|
||||
return
|
||||
fi
|
||||
|
||||
_log "Switching to [${mode}] Mode" >/dev/console
|
||||
_log "Switching to [${mode}] Mode"
|
||||
|
||||
# Configure env variables
|
||||
configure_env_vars ${mode}
|
||||
@@ -147,20 +151,19 @@ start_service() {
|
||||
|
||||
# Execute mode specific scripts
|
||||
if [ -d $MODEDIR/$mode/scripts ]; then
|
||||
_log "Executing $MODEDIR/$mode/scripts/* scripts"
|
||||
for script in $(ls $MODEDIR/$mode/scripts/); do
|
||||
_log "Executing [${mode}], script [${script}]"
|
||||
sh $MODEDIR/$mode/scripts/$script
|
||||
done
|
||||
fi
|
||||
|
||||
# Save mode as last mode
|
||||
echo "$mode" > $MODEDIR/.last_mode
|
||||
_log "Switching to Mode [${mode}] done, last mode updated"
|
||||
|
||||
# Execute netmode generic post-mode-switch scripts
|
||||
libnetmode_exec "post"
|
||||
cleanup_env_vars "${mode}"
|
||||
|
||||
# Save mode as last mode
|
||||
[ -d $MODEDIR ] || mkdir -p $MODEDIR
|
||||
echo "$mode" > $MODEDIR/.last_mode
|
||||
_log "Switching to Mode [${mode}] done, last mode updated" >/dev/console
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
@@ -61,8 +61,8 @@ l2_network_config() {
|
||||
uci -q set network.lan6.device='@lan'
|
||||
uci -q set network.lan6.reqprefix='no'
|
||||
|
||||
uci -q set network.wan.disabled='1'
|
||||
uci -q set network.wan6.disabled='1'
|
||||
uci -q delete network.wan
|
||||
uci -q delete network.wan6
|
||||
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
@@ -116,12 +116,3 @@ l2_network_config() {
|
||||
|
||||
l2_network_config
|
||||
l2_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd stop 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -16,7 +16,7 @@ l3_mcast_config() {
|
||||
|
||||
l3_network_config() {
|
||||
logger -s -p user.info -t "netmode" "Generating L3 network configuration"
|
||||
|
||||
|
||||
wandev="$(uci -q get network.WAN.ifname)"
|
||||
|
||||
# Configure L3 Network Mode
|
||||
@@ -43,26 +43,38 @@ l3_network_config() {
|
||||
uci -q delete network.wan.netmask
|
||||
|
||||
uci -q set network.wan6=interface
|
||||
uci -q set network.wan6.proto='dhcpv6'
|
||||
uci -q set network.wan6.proto="dhcpv6"
|
||||
uci -q delete network.wan6.disabled
|
||||
|
||||
if [ -n "$wandev" -a -n "$NETMODE_vlanid" -a $NETMODE_vlanid -gt 0 ]; then
|
||||
uci -q set network.vlan_${NETMODE_vlanid}=device
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.type="8021q"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.name="$wandev.$NETMODE_vlanid"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.ifname="$wandev"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.vid=$NETMODE_vlanid
|
||||
# Delete all VLAN sections; new ones will be created in next function if required
|
||||
for vlandev_sec in $(uci show network | grep "type=.*8021q" | cut -d'.' -f1,2); do
|
||||
uci -q delete $vlandev_sec
|
||||
done
|
||||
|
||||
uci -q set network.wan.device="$wandev.$NETMODE_vlanid"
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
vlandev="$wandev.$NETMODE_vlanid"
|
||||
vlandev_sec=$(echo $vlandev | tr '.' '_')
|
||||
uci -q set network.${vlandev_sec}=device
|
||||
uci -q set network.${vlandev_sec}.type="8021q"
|
||||
uci -q set network.${vlandev_sec}.name="$vlandev"
|
||||
uci -q set network.${vlandev_sec}.ifname="$wandev"
|
||||
uci -q set network.${vlandev_sec}.vid=$NETMODE_vlanid
|
||||
|
||||
wandev="$vlandev"
|
||||
fi
|
||||
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
uci -q set network.wan6.device="$wandev"
|
||||
|
||||
uci -q set network.WAN.mtu="$NETMODE_mtu"
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
if [ -n "$NETMODE_dns_servers" ]; then
|
||||
dns_servers="$(echo $NETMODE_dns_servers | tr ',' ' ')"
|
||||
for server in $dns_servers; do
|
||||
uci -q add_list network.wan.dns=$server
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
@@ -84,12 +96,6 @@ l3_network_config() {
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
if [ -n "$device" ]; then
|
||||
uci -q set network.wan.device="$device"
|
||||
uci -q set network.wan6.device="$device"
|
||||
fi
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
@@ -120,12 +126,3 @@ l3_network_config() {
|
||||
|
||||
l3_network_config
|
||||
l3_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd restart 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -16,7 +16,7 @@ l3_mcast_config() {
|
||||
|
||||
l3_network_pppoe_config() {
|
||||
logger -s -p user.info -t "netmode" "Generating L3 network configuration"
|
||||
|
||||
|
||||
wandev="$(uci -q get network.WAN.ifname)"
|
||||
|
||||
# Configure L3 Network Mode
|
||||
@@ -42,18 +42,29 @@ l3_network_pppoe_config() {
|
||||
uci -q delete network.wan.gateway
|
||||
uci -q delete network.wan.netmask
|
||||
|
||||
uci -q set network.wan6.disabled='1'
|
||||
uci -q delete network.wan6
|
||||
|
||||
if [ -n "$wandev" -a -n "$NETMODE_vlanid" -a $NETMODE_vlanid -gt 0 ]; then
|
||||
uci -q set network.vlan_${NETMODE_vlanid}=device
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.type="8021q"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.name="$wandev.$NETMODE_vlanid"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.ifname="$wandev"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.vid=$NETMODE_vlanid
|
||||
# Delete all VLAN sections; new ones will be created in next function if required
|
||||
for vlandev_sec in $(uci show network | grep "type=.*8021q" | cut -d'.' -f1,2); do
|
||||
uci -q delete $vlandev_sec
|
||||
done
|
||||
|
||||
uci -q set network.wan.device="$wandev.$NETMODE_vlanid"
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
vlandev="$wandev.$NETMODE_vlanid"
|
||||
vlandev_sec=$(echo $vlandev | tr '.' '_')
|
||||
uci -q set network.${vlandev_sec}=device
|
||||
uci -q set network.${vlandev_sec}.type="8021q"
|
||||
uci -q set network.${vlandev_sec}.name="$vlandev"
|
||||
uci -q set network.${vlandev_sec}.ifname="$wandev"
|
||||
uci -q set network.${vlandev_sec}.vid=$NETMODE_vlanid
|
||||
|
||||
wandev="$vlandev"
|
||||
fi
|
||||
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
|
||||
uci -q set network.WAN.mtu="$NETMODE_mtu"
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
if [ -n "$NETMODE_dns_servers" ]; then
|
||||
dns_servers="$(echo $NETMODE_dns_servers | tr ',' ' ')"
|
||||
@@ -82,12 +93,6 @@ l3_network_pppoe_config() {
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
if [ -n "$device" ]; then
|
||||
uci -q set network.wan.device="$device"
|
||||
uci -q set network.wan6.device="$device"
|
||||
fi
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
@@ -118,12 +123,3 @@ l3_network_pppoe_config() {
|
||||
|
||||
l3_network_pppoe_config
|
||||
l3_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd restart 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -16,7 +16,7 @@ l3_mcast_config() {
|
||||
|
||||
l3_network_config() {
|
||||
logger -s -p user.info -t "netmode" "Generating L3 network configuration"
|
||||
|
||||
|
||||
wandev="$(uci -q get network.WAN.ifname)"
|
||||
|
||||
# Configure L3 Network Mode
|
||||
@@ -43,7 +43,28 @@ l3_network_config() {
|
||||
uci -q delete network.wan.username
|
||||
uci -q delete network.wan.password
|
||||
|
||||
uci -q set network.wan6.disabled='1'
|
||||
uci -q delete network.wan6
|
||||
|
||||
# Delete all VLAN sections; new ones will be created in next function if required
|
||||
for vlandev_sec in $(uci show network | grep "type=.*8021q" | cut -d'.' -f1,2); do
|
||||
uci -q delete $vlandev_sec
|
||||
done
|
||||
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
vlandev="$wandev.$NETMODE_vlanid"
|
||||
vlandev_sec=$(echo $vlandev | tr '.' '_')
|
||||
uci -q set network.${vlandev_sec}=device
|
||||
uci -q set network.${vlandev_sec}.type="8021q"
|
||||
uci -q set network.${vlandev_sec}.name="$vlandev"
|
||||
uci -q set network.${vlandev_sec}.ifname="$wandev"
|
||||
uci -q set network.${vlandev_sec}.vid=$NETMODE_vlanid
|
||||
|
||||
wandev="$vlandev"
|
||||
fi
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
|
||||
uci -q set network.WAN.mtu="$NETMODE_mtu"
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
if [ -n "$NETMODE_dns_servers" ]; then
|
||||
@@ -53,14 +74,6 @@ l3_network_config() {
|
||||
done
|
||||
fi
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
if [ -n "$NETMODE_dns_servers" ]; then
|
||||
IFS=',' read -ra ADDRS <<< "$NETMODE_dns_servers"
|
||||
for ip in "${ADDRS[@]}"; do
|
||||
uci -q add_list network.wan.dns=$ip
|
||||
done
|
||||
fi
|
||||
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
|
||||
@@ -81,12 +94,6 @@ l3_network_config() {
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
if [ -n "$device" ]; then
|
||||
uci -q set network.wan.device="$device"
|
||||
uci -q set network.wan6.device="$device"
|
||||
fi
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
@@ -117,12 +124,3 @@ l3_network_config() {
|
||||
|
||||
l3_network_config
|
||||
l3_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd restart 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
{
|
||||
"name": "dns_servers",
|
||||
"description": "DNS Servers, comma separated",
|
||||
"description": "DNS Servers",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
@@ -43,9 +43,15 @@
|
||||
"required": false,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"name": "mtu",
|
||||
"description": "MTU",
|
||||
"required": false,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"name": "dns_servers",
|
||||
"description": "DNS Servers, comma separated",
|
||||
"description": "DNS Servers",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
@@ -84,7 +90,7 @@
|
||||
},
|
||||
{
|
||||
"name": "dns_servers",
|
||||
"description": "DNS servers, comma separated",
|
||||
"description": "DNS Servers",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
enabled="$(uci -q get netmode.global.enabled)"
|
||||
if [ "$enabled" != "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
opconf_file="/opconf/opconf.json"
|
||||
[ -f $opconf_file ] || opconf_file="/usr_data/opconf/opconf.json"
|
||||
|
||||
# Check if netmode getting provisioned from opconf, in case of opconf
|
||||
# provisioning, mode setting not required
|
||||
mode="$(jsonfilter -i $opconf_file -e @.netmode.mode 2>/dev/null)"
|
||||
if [ -n "${mode}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if opconf has wan provisioning enabled, if yes, get the proto/mode from opconf
|
||||
proto="$(jsonfilter -i $opconf_file -e '@.network.wan[@.name="wan"].proto' 2>/dev/null)"
|
||||
if [ -n "${proto}" ]; then
|
||||
mode="routed-${proto}"
|
||||
uci -q set netmode.global.mode="${mode}"
|
||||
echo "${mode}" > /etc/netmodes/.last_mode
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mode="$(uci -q get netmode.global.mode)"
|
||||
wanproto=$(uci -q get network.wan.proto)
|
||||
|
||||
if [ -n "$mode" ]; then
|
||||
# check if wanproto and mode aligned
|
||||
if [ "${mode}" = "routed-${wanproto}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "/etc/netmodes/supported_modes.json" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# NetMode is enabled without a Mode being set
|
||||
# Figure out the current mode from network config
|
||||
curmode=""
|
||||
case "$wanproto" in
|
||||
dhcp) curmode="routed-dhcp" ;;
|
||||
pppoe) curmode="routed-pppoe" ;;
|
||||
static) curmode="routed-static" ;;
|
||||
esac
|
||||
|
||||
found=0
|
||||
for md in $(jsonfilter -i /etc/netmodes/supported_modes.json -e "@.supported_modes.*.name"); do
|
||||
[ "$md" = "$curmode" ] && found=1
|
||||
done
|
||||
|
||||
if [ $found -eq 1 ]; then
|
||||
uci -q set netmode.global.mode="$curmode"
|
||||
echo "$curmode" > /etc/netmodes/.last_mode
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,25 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is to cleanup dmmap and restart datamodel related services
|
||||
# when wan mode changes
|
||||
|
||||
if [ -d "/etc/bbfdm/dmmap/" ]; then
|
||||
rm -rf /etc/bbfdm/dmmap/*
|
||||
fi
|
||||
|
||||
# If device is booting up, no need to restart services
|
||||
if [ ! -f /var/run/boot_complete ]; then
|
||||
return 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -x "/etc/init.d/bbfdm.services" ]; then
|
||||
/etc/init.d/bbfdm.services restart
|
||||
if [ -f /etc/bbfdm/dmmap/PPP ]; then
|
||||
rm -f /etc/bbfdm/dmmap/PPP
|
||||
fi
|
||||
|
||||
if [ -x "/etc/init.d/bbfdmd" ]; then
|
||||
/etc/init.d/bbfdmd restart
|
||||
if [ -f /etc/bbfdm/dmmap/IP ]; then
|
||||
rm -f /etc/bbfdm/dmmap/IP
|
||||
fi
|
||||
|
||||
if [ -x "/etc/init.d/obuspa" ]; then
|
||||
/etc/init.d/obuspa restart
|
||||
if [ -f /etc/bbfdm/dmmap/Ethernet ]; then
|
||||
rm -f /etc/bbfdm/dmmap/Ethernet
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
|
||||
reboot -f
|
||||
|
||||
1
netmode/files/lib/upgrade/keep.d/netmode
Normal file
1
netmode/files/lib/upgrade/keep.d/netmode
Normal file
@@ -0,0 +1 @@
|
||||
/etc/netmodes/.last_mode
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=10.0.0.16
|
||||
PKG_VERSION:=10.0.7.10
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||
PKG_SOURCE_VERSION:=479ffb3582aa245a84829502d9412ca2539eefca
|
||||
PKG_SOURCE_VERSION:=c3b7c7653edb63326e7070b6891a95ad6cf7a2ee
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -32,8 +32,9 @@ define Package/obuspa
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=USP agent
|
||||
MENU:=1
|
||||
DEPENDS:=+libopenssl +libuci +libblobmsg-json +libcurl +libsqlite3 +libubox +libubus +libmosquitto-ssl +libwebsockets-openssl +ca-certificates \
|
||||
+OBUSPA_LOCAL_MQTT_LISTENER:mosquitto-ssl +libjson-c
|
||||
DEPENDS:=+libopenssl +libcurl +libsqlite3 +libmosquitto-ssl +libwebsockets-openssl
|
||||
DEPENDS+=+libjson-c +libubox +libubus +libuci +libblobmsg-json
|
||||
DEPENDS+=+ca-certificates +OBUSPA_LOCAL_MQTT_LISTENER:mosquitto-ssl
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
|
||||
@@ -6,19 +6,18 @@ USE_PROCD=1
|
||||
|
||||
PROG=/usr/sbin/obuspa
|
||||
CONFIGURATION=obuspa
|
||||
FIRST_BOOT="/etc/obuspa/boot_marker"
|
||||
ENV_PROFILE="/root/.profile"
|
||||
KEEP_FILE="/lib/upgrade/keep.d/obuspa"
|
||||
|
||||
RESET_FILE="/tmp/obuspa/fw_defaults"
|
||||
SQL_DB_FILE="/tmp/obuspa/usp.db"
|
||||
DB_DUMP="/tmp/obuspa/usp.dump_$(date +%s)"
|
||||
|
||||
OBUSPA_BOOT_MARKER="/etc/obuspa/.boot"
|
||||
|
||||
BASEPATH=""
|
||||
INSTANCE_COUNT=0
|
||||
CLIENT_ID_PREFIX=""
|
||||
|
||||
. /lib/functions/network.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /etc/obuspa/usp_utils.sh
|
||||
|
||||
global_init()
|
||||
@@ -30,6 +29,7 @@ global_init()
|
||||
log()
|
||||
{
|
||||
echo "$*"|logger -t obuspa.init -p debug
|
||||
echo "$*" >/dev/console
|
||||
}
|
||||
|
||||
db_set_reset_file()
|
||||
@@ -47,37 +47,9 @@ db_set_reset_file()
|
||||
fi
|
||||
}
|
||||
|
||||
db_set_sql()
|
||||
{
|
||||
local param value
|
||||
|
||||
param="${1}"
|
||||
shift
|
||||
value="$*"
|
||||
|
||||
if [ -n "${param}" ] && [ -n "${value}" ]; then
|
||||
if grep -q "${param} " ${DB_DUMP}; then
|
||||
value="${value//\//\\/}"
|
||||
sed -i "s/${param} .*/${param} \"${value}\"/g" ${DB_DUMP}
|
||||
else
|
||||
echo "${param} \"${value}\"" >> ${DB_DUMP}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
db_set()
|
||||
{
|
||||
# if sql db dump file present, update it
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
db_set_sql "$@"
|
||||
else
|
||||
db_set_reset_file "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
dump_db()
|
||||
{
|
||||
${PROG} -v0 -f ${SQL_DB_FILE} -c show database |grep "^Internal.\|^Device."|sed '{s/=> /"/g;s/$/"/g}' | sort > ${DB_DUMP}
|
||||
db_set_reset_file "$@"
|
||||
}
|
||||
|
||||
# if db present then check if it matches with existing instances
|
||||
@@ -92,21 +64,6 @@ get_base_path()
|
||||
path=""
|
||||
count=0
|
||||
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
path=$(grep -E "${refpath}\d+.Alias \"${value}\"" ${DB_DUMP})
|
||||
path=${path%.*}
|
||||
if [ -z "${path}" ]; then
|
||||
path=$(grep -oE "${refpath}\d+" ${DB_DUMP} |sort -r|head -n 1)
|
||||
if [ -n "${path}" ]; then
|
||||
count=${path##*.}
|
||||
count=$(( count + 1 ))
|
||||
else
|
||||
count=1
|
||||
fi
|
||||
path="${refpath}${count}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${path}" ]; then
|
||||
INSTANCE_COUNT=$(( INSTANCE_COUNT + 1 ))
|
||||
path="${refpath}${INSTANCE_COUNT}"
|
||||
@@ -122,9 +79,7 @@ get_refrence_path()
|
||||
value="${2}"
|
||||
path=""
|
||||
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
path=$(grep -E "${dmref}\d+.Alias " ${DB_DUMP}|grep -w "${value}")
|
||||
elif [ -f "${RESET_FILE}" ]; then
|
||||
if [ -f "${RESET_FILE}" ]; then
|
||||
path=$(grep -E "${dmref}\d+.Alias " ${RESET_FILE}|grep -w "${value}")
|
||||
fi
|
||||
path=${path%.*}
|
||||
@@ -136,7 +91,7 @@ update_keep()
|
||||
file=${1}
|
||||
|
||||
if [ -z "${file}" ]; then
|
||||
return;
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -f "${KEEP_FILE}" ]; then
|
||||
@@ -263,7 +218,7 @@ configure_localagent()
|
||||
|
||||
validate_localagent_section "${1}" || {
|
||||
log "Validation of localagent section failed"
|
||||
return 0;
|
||||
return 0
|
||||
}
|
||||
|
||||
db_set Device.LocalAgent.EndpointID "${EndpointID}"
|
||||
@@ -271,7 +226,7 @@ configure_localagent()
|
||||
|
||||
update_reset_reason()
|
||||
{
|
||||
[ -f "/tmp/reset_reason" ] || return 0;
|
||||
[ -f "/tmp/reset_reason" ] || return 0
|
||||
|
||||
if grep -qwi "defaultreset" /tmp/reset_reason; then
|
||||
db_set Internal.Reboot.Cause "FactoryReset"
|
||||
@@ -310,10 +265,6 @@ get_role_index()
|
||||
val="$(grep "Device.LocalAgent.ControllerTrust.Role.\d.Name" ${CTRUST_RESET_FILE} |grep $name)"
|
||||
val="$(echo ${val/.Name /,}|cut -d, -f 1)"
|
||||
echo "$val"
|
||||
elif [ -f "${DB_DUMP}" ]; then
|
||||
val="$(grep "Device.LocalAgent.ControllerTrust.Role.\d.Name" ${DB_DUMP} |grep $name)"
|
||||
val="$(echo ${val/.Name /,}|cut -d, -f 1)"
|
||||
echo "$val"
|
||||
else
|
||||
log "Not able to get role ${name}, use Untrusted role"
|
||||
echo "${drole}"
|
||||
@@ -331,19 +282,19 @@ configure_controller()
|
||||
sec="${1}"
|
||||
validate_controller_section "${1}" || {
|
||||
log "Validation of controller section failed"
|
||||
return 1;
|
||||
return 1
|
||||
}
|
||||
|
||||
sec="${sec/controller_/cpe-}"
|
||||
get_base_path "Device.LocalAgent.Controller." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${Protocol}" ]; then
|
||||
log "controller:: Protocol cannot be empty"
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
dm_ref=""
|
||||
@@ -439,14 +390,14 @@ configure_subscription()
|
||||
sec="${1}"
|
||||
validate_subscription_section "${1}" || {
|
||||
log "Validation of subscription section failed"
|
||||
return 1;
|
||||
return 1
|
||||
}
|
||||
|
||||
sec="${sec/sub_/cpe-}"
|
||||
get_base_path "Device.LocalAgent.Subscription." "sub_${1}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -n "${controller}" ]; then
|
||||
@@ -483,12 +434,12 @@ configure_challenges()
|
||||
get_base_path "Device.LocalAgent.ControllerTrust.Challenge." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${role_name}" ] && [ -z "${Role}" ]; then
|
||||
log "Either role_name or Role must defined for a challenge";
|
||||
return 1;
|
||||
log "Either role_name or Role must defined for a challenge"
|
||||
return 1
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.Alias" "${sec}"
|
||||
@@ -515,18 +466,18 @@ configure_mtp() {
|
||||
sec="${1}"
|
||||
validate_mtp_section "${1}" || {
|
||||
log "Validation of mtp section failed"
|
||||
return 1;
|
||||
return 1
|
||||
}
|
||||
sec="${sec/mtp_/cpe-}"
|
||||
get_base_path "Device.LocalAgent.MTP." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${Protocol}" ]; then
|
||||
log "Protocol not defined for the mtp[${1}] section"
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
dm_ref=""
|
||||
@@ -584,14 +535,14 @@ configure_stomp_connection() {
|
||||
sec="${1}"
|
||||
validate_stomp_connection_section "${1}" || {
|
||||
log "Validation of stomp section failed"
|
||||
return 1;
|
||||
return 1
|
||||
}
|
||||
|
||||
sec="${sec/stomp_/cpe-}"
|
||||
get_base_path "Device.STOMP.Connection." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.Alias" "${sec}"
|
||||
@@ -614,14 +565,18 @@ configure_mqtt_client() {
|
||||
sec="${1}"
|
||||
validate_mqtt_client_section "${1}" || {
|
||||
log "Validation of mqtt section failed"
|
||||
return 1;
|
||||
return 1
|
||||
}
|
||||
|
||||
sec="${sec/mqtt_/cpe-}"
|
||||
get_base_path "Device.MQTT.Client." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${ClientID}" ]; then
|
||||
ClientID="${CLIENT_ID_PREFIX}-${sec}"
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.Alias" "${sec}"
|
||||
@@ -648,6 +603,9 @@ configure_obuspa() {
|
||||
fi
|
||||
|
||||
if [ -n "${log_level}" ]; then
|
||||
if [ "${log_level}" -gt "4" ]; then
|
||||
log_level="4"
|
||||
fi
|
||||
procd_append_param command -v "${log_level}"
|
||||
fi
|
||||
|
||||
@@ -676,13 +634,13 @@ configure_obuspa() {
|
||||
|
||||
if [ -n "${db_file}" ]; then
|
||||
update_keep "${db_file}"
|
||||
procd_append_param command -f "${SQL_DB_FILE}"
|
||||
procd_append_param command -f "${db_file}"
|
||||
if [ -f "${db_file}-journal" ]; then
|
||||
log "SQL Journal detected ..."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "${RESET_FILE}" ]; then
|
||||
if [ -f "${SQL_DB_FILE}" ]; then
|
||||
mv ${SQL_DB_FILE} ${SQL_DB_FILE}.old
|
||||
fi
|
||||
procd_append_param command -r ${RESET_FILE}
|
||||
fi
|
||||
|
||||
@@ -701,306 +659,34 @@ configure_obuspa() {
|
||||
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 $2}')"
|
||||
|
||||
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 PeriodicNotifInterval"
|
||||
popts="Destination Topic 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 EnableEncryption PublishQoS"
|
||||
|
||||
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
|
||||
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}"
|
||||
log "Deleting obuspa.${1} section ..."
|
||||
else
|
||||
uci_remove obuspa "${1}" _sync
|
||||
fi
|
||||
}
|
||||
|
||||
sync_uci_with_db()
|
||||
{
|
||||
if [ ! -f "${DB_DUMP}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
# Skip overriding uci in case of Firstboot
|
||||
if [ ! -f "${FIRST_BOOT}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
log "Syncing obuspa uci with usp.db ...."
|
||||
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
|
||||
|
||||
#log "Deleting with pattern [${pattern}] from ${DB_DUMP}"
|
||||
sed -i "/${pattern}/d" ${DB_DUMP}
|
||||
}
|
||||
|
||||
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 -E "${r}\d+.Alias \"${sec}\"" ${DB_DUMP})
|
||||
path=${path%.*}
|
||||
|
||||
delete_sql_db_entry_with_pattern "${path}"
|
||||
}
|
||||
|
||||
workaround_remove_download_pattern()
|
||||
{
|
||||
local inst
|
||||
|
||||
inst="$(cat ${DB_DUMP} |grep -E "Device.DeviceInfo.FirmwareImage.\d.Download()"|grep -oE "Device.LocalAgent.Request.\d.")"
|
||||
|
||||
if [ -n "${inst}" ]; then
|
||||
log "Workaround to remove the old download Request [$inst]"
|
||||
delete_sql_db_entry_with_pattern "${inst}"
|
||||
fi
|
||||
}
|
||||
|
||||
reverse_update_db_with_uci()
|
||||
{
|
||||
if [ ! -f "${DB_DUMP}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
export UCI_CONFIG_DIR="/tmp/obuspa"
|
||||
config_load obuspa
|
||||
config_foreach check_n_delete_db controller controller "Device.LocalAgent.Controller."
|
||||
config_foreach check_n_delete_db mtp mtp "Device.LocalAgent.MTP."
|
||||
config_foreach check_n_delete_db mqtt mqtt "Device.MQTT.Client."
|
||||
config_foreach check_n_delete_db stomp stomp "Device.STOMP.Connection."
|
||||
unset UCI_CONFIG_DIR
|
||||
}
|
||||
|
||||
# Create factory reset file
|
||||
db_init()
|
||||
{
|
||||
local reason role_file
|
||||
local reason
|
||||
|
||||
reason="${1}"
|
||||
mkdir -p /tmp/obuspa/
|
||||
|
||||
# Load configuration
|
||||
config_load $CONFIGURATION
|
||||
config_get SQL_DB_FILE global db_file "/tmp/obuspa/usp.db"
|
||||
config_get role_file global role_file ""
|
||||
|
||||
if [ -f "${SQL_DB_FILE}.old" ] && [ ! -f "${SQL_DB_FILE}" ]; then
|
||||
log "Copying old db, since new db not present ..."
|
||||
mv ${SQL_DB_FILE}.old ${SQL_DB_FILE}
|
||||
# remove usp.db, in case of reload
|
||||
if [ -f "${OBUSPA_BOOT_MARKER}" ] && [ "${reason}" = "update" ]; then
|
||||
log "Deleting ${OBUSPA_BOOT_MARKER} in order to enforce values from UCI..."
|
||||
rm -f "${OBUSPA_BOOT_MARKER}"
|
||||
fi
|
||||
|
||||
# Dump datamodel parameters from DB
|
||||
if [ -f "${SQL_DB_FILE}" ]; then
|
||||
dump_db
|
||||
fi
|
||||
|
||||
# In case of Reboot or service restart update the uci
|
||||
# from usp.db file
|
||||
if [ -f "${DB_DUMP}" ] && [ "${reason}" != "update" ]; then
|
||||
# Only do this if db have reasonable data
|
||||
val="$(awk 'END{print NR}' ${DB_DUMP})"
|
||||
if [ "$val" -gt 15 ]; then
|
||||
sync_uci_with_db
|
||||
fi
|
||||
fi
|
||||
|
||||
# remove entries from db if deleted from uci, only in case of reload
|
||||
if [ -f "${DB_DUMP}" ] && [ "${reason}" = "update" ] && [ -f "/tmp/obuspa/obuspa" ]; then
|
||||
log "Deleting entries from usp.db if uci not present ...."
|
||||
reverse_update_db_with_uci
|
||||
if [ -f "${OBUSPA_BOOT_MARKER}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Remove reset file if present
|
||||
[ -f "${RESET_FILE}" ] && mv ${RESET_FILE} ${RESET_FILE}.old
|
||||
[ -f "${RESET_FILE}" ] && rm ${RESET_FILE}
|
||||
|
||||
CLIENT_ID_PREFIX="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
CLIENT_ID_PREFIX="${CLIENT_ID_PREFIX}-$(db -q get device.deviceinfo.SerialNumber)"
|
||||
CLIENT_ID_PREFIX="${CLIENT_ID_PREFIX//+/%2b}"
|
||||
|
||||
#log "Create reset file ...."
|
||||
config_load $CONFIGURATION
|
||||
config_get dualstack_pref global dualstack_pref "IPv6"
|
||||
|
||||
log "Enforcing UCI values, no boot marker found."
|
||||
global_init
|
||||
config_foreach configure_localagent localagent
|
||||
global_init
|
||||
@@ -1016,22 +702,12 @@ db_init()
|
||||
global_init
|
||||
config_foreach configure_challenges challenge
|
||||
|
||||
# enforce ctrust only on upgrades, not on reloads
|
||||
if [ -f "${CTRUST_RESET_FILE}" ] && [ -z "${reason}" ]; then
|
||||
cat ${CTRUST_RESET_FILE} >> ${RESET_FILE}
|
||||
fi
|
||||
update_reset_reason
|
||||
update_dual_stack_pref "${dualstack_pref}"
|
||||
|
||||
uci_commit ${CONFIGURATION}
|
||||
|
||||
cp /etc/config/obuspa /tmp/obuspa/
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
workaround_remove_download_pattern
|
||||
mv ${DB_DUMP} ${RESET_FILE}
|
||||
fi
|
||||
|
||||
if [ -f "${CTRUST_RESET_FILE}" ]; then
|
||||
cat ${CTRUST_RESET_FILE} >> ${RESET_FILE}
|
||||
rm ${CTRUST_RESET_FILE}
|
||||
fi
|
||||
[ -f "${FIRST_BOOT}" ] || touch "${FIRST_BOOT}"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
@@ -1039,12 +715,12 @@ start_service() {
|
||||
|
||||
mkdir -p /tmp/obuspa/
|
||||
config_load obuspa
|
||||
config_get_bool enabled global enabled 0
|
||||
config_get_bool enabled global enabled 1
|
||||
|
||||
procd_open_instance ${CONFIGURATION}
|
||||
if [ "${enabled}" -eq 1 ]; then
|
||||
db_init "${1}"
|
||||
procd_set_param command ${PROG}
|
||||
db_init "${1}"
|
||||
configure_obuspa
|
||||
procd_set_param respawn \
|
||||
"${respawn_threshold:-10}" \
|
||||
@@ -1054,9 +730,7 @@ start_service() {
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout 5 ${PROG} -c stop
|
||||
fi
|
||||
${PROG} -c stop
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
@@ -1065,5 +739,6 @@ reload_service() {
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
export PROCD_RELOAD_DELAY=3000
|
||||
procd_add_reload_trigger "obuspa"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
CTRUST_RESET_FILE="/tmp/obuspa/ctrust_reset"
|
||||
CTRUST_RESET_FILE="/etc/obuspa/ctrust_reset"
|
||||
VENDOR_PREFIX_FILE="/etc/obuspa/vendor_prefix"
|
||||
FW_DEFAULT_ROLE_DIR="/etc/users/roles"
|
||||
SECURE_ROLES=""
|
||||
|
||||
CTRUST_RESET_FILE_TEMP="/tmp/obuspa/ctrust_reset"
|
||||
|
||||
mkdir -p /tmp/obuspa/
|
||||
|
||||
# include jshn.sh
|
||||
@@ -23,9 +25,9 @@ db_add()
|
||||
value="$*"
|
||||
|
||||
if [ -n "${param}" ] && [ -n "${value}" ]; then
|
||||
echo "${param} \"${value}\"">>${CTRUST_RESET_FILE}
|
||||
echo "${param} \"${value}\"">>${CTRUST_RESET_FILE_TEMP}
|
||||
else
|
||||
echo >>${CTRUST_RESET_FILE}
|
||||
echo >>${CTRUST_RESET_FILE_TEMP}
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -252,7 +254,10 @@ configure_ctrust_role()
|
||||
if [ -n "${SECURE_ROLES}" ]; then
|
||||
db_add Device.LocalAgent.ControllerTrust.SecuredRoles "${SECURE_ROLES}"
|
||||
fi
|
||||
|
||||
if [ -f "${CTRUST_RESET_FILE_TEMP}" ]; then
|
||||
mv -f "${CTRUST_RESET_FILE_TEMP}" "${CTRUST_RESET_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
# configure_ctrust_role "${@}"
|
||||
|
||||
|
||||
@@ -4,5 +4,3 @@
|
||||
. /etc/obuspa/usp_utils.sh
|
||||
|
||||
configure_ctrust_role
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -53,13 +53,7 @@ add_mdns_advertise() {
|
||||
json_dump > /etc/umdns/obuspa_mdns.json
|
||||
}
|
||||
|
||||
config_load obuspa
|
||||
config_get_bool enable_obuspa global enabled 1
|
||||
|
||||
if [ "${enable_obuspa}" -eq 1 ]; then
|
||||
role="$(get_device_role)"
|
||||
|
||||
if [ "${role}" == "gateway" ]; then
|
||||
add_mdns_advertise
|
||||
fi
|
||||
role="$(get_device_role)"
|
||||
if [ "${role}" == "gateway" ]; then
|
||||
add_mdns_advertise
|
||||
fi
|
||||
|
||||
@@ -19,19 +19,11 @@ get_access_role()
|
||||
|
||||
configure_dhcp_options() {
|
||||
local enabled inerface discovery
|
||||
config_load obuspa
|
||||
|
||||
config_get_bool enabled global enabled 1
|
||||
config_get interface global interface
|
||||
config_get_bool discovery global dhcp_discovery 1
|
||||
|
||||
if [ "${enabled}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${discovery}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
role="$(get_access_role)"
|
||||
|
||||
@@ -66,12 +58,12 @@ configure_dhcp_options() {
|
||||
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
[ -n "${reqopts}" ] && newreqopts="$reqopts 125" || newreqopts="125"
|
||||
uci -q set network."${interface}".reqopts="$newreqopts"
|
||||
fi
|
||||
|
||||
if [ ${send124_present} -eq 0 ]; then
|
||||
newsendopts="${sendopts} 124:00:00:0D:E9:04:03:75:73:70"
|
||||
[ -n "${sendopts}" ] && newsendopts="${sendopts} 124:00:00:0D:E9:04:03:75:73:70" || newsendopts="124:00:00:0D:E9:04:03:75:73:70"
|
||||
uci -q set network."${interface}".sendopts="$newsendopts"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -8,6 +8,7 @@ RETRY_MIN_INTERVAL="5"
|
||||
RETRY_INTERVAL_MUL="2000"
|
||||
ENDPOINT_ID=""
|
||||
CONTROLLER_DISCOVERED=0
|
||||
OBUSPA_BOOT_MARKER="/etc/obuspa/.boot"
|
||||
|
||||
log()
|
||||
{
|
||||
@@ -57,18 +58,18 @@ get_vivsoi() {
|
||||
|
||||
data="${opt125}"
|
||||
rem_len="${len}"
|
||||
while [ $rem_len -gt 0 ]; do
|
||||
while [ "${rem_len}" -gt 0 ]; do
|
||||
ent_id=${data:0:8}
|
||||
ent_id=$(printf "%d\n" "0x$ent_id")
|
||||
|
||||
if [ $ent_id -ne 3561 ]; then
|
||||
if [ "${ent_id}" -ne 3561 ]; then
|
||||
len_val=${data:8:2}
|
||||
data_len=$(printf "%d\n" "0x$len_val")
|
||||
# add 4 byte for ent_id and 1 byte for len
|
||||
data_len=$(( data_len * 2 + 10 ))
|
||||
# move ahead data to next enterprise id
|
||||
data=${data:"${data_len}":"${rem_len}"}
|
||||
rem_len=$(( rem_len - $data_len ))
|
||||
rem_len=$(( rem_len - data_len ))
|
||||
continue
|
||||
fi
|
||||
|
||||
@@ -79,7 +80,7 @@ get_vivsoi() {
|
||||
data_len=$(( data_len * 2 + 10 ))
|
||||
|
||||
opt_len=$(printf "%d\n" "0x$len_val")
|
||||
[ $opt_len -eq 0 ] && return
|
||||
[ "${opt_len}" -eq 0 ] && return
|
||||
|
||||
# populate the option data of enterprise id
|
||||
sub_data_len=$(( opt_len * 2))
|
||||
@@ -98,28 +99,28 @@ get_vivsoi() {
|
||||
sub_opt_len=$(( sub_opt_len * 2 ))
|
||||
|
||||
# get the value of sub option starting 4 means starting after length
|
||||
sub_opt_val=${sub_data:4:${sub_opt_len}}
|
||||
sub_opt_val=${sub_data:4:"${sub_opt_len}"}
|
||||
|
||||
# assign the value found in sub option
|
||||
case "${sub_opt_id}" in
|
||||
"25")
|
||||
URL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
URL=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
CONTROLLER_DISCOVERED=1
|
||||
;;
|
||||
"26")
|
||||
PROV_CODE=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
PROV_CODE=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
CONTROLLER_DISCOVERED=1
|
||||
;;
|
||||
"27")
|
||||
RETRY_MIN_INTERVAL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
RETRY_MIN_INTERVAL=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
CONTROLLER_DISCOVERED=1
|
||||
;;
|
||||
"28")
|
||||
RETRY_INTERVAL_MUL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
RETRY_INTERVAL_MUL=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
CONTROLLER_DISCOVERED=1
|
||||
;;
|
||||
"29")
|
||||
ENDPOINT_ID=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
ENDPOINT_ID=$(echo -n "${sub_opt_val}" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
CONTROLLER_DISCOVERED=1
|
||||
;;
|
||||
esac
|
||||
@@ -131,7 +132,7 @@ get_vivsoi() {
|
||||
sub_data_len=$((sub_data_len - sub_opt_end))
|
||||
|
||||
# fetch next sub option hex string
|
||||
sub_data=${sub_data:${sub_opt_end}:${sub_data_len}}
|
||||
sub_data=${sub_data:"${sub_opt_end}":"${sub_data_len}"}
|
||||
done
|
||||
|
||||
# move ahead data to next enterprise id
|
||||
@@ -146,7 +147,7 @@ get_access_role()
|
||||
|
||||
lan_proto="$(uci -q get network.lan.proto)"
|
||||
|
||||
if [ "${lan_proto}" == "dhcp" ]; then
|
||||
if [ "${lan_proto}" = "dhcp" ]; then
|
||||
mode="extender"
|
||||
else
|
||||
mode="full_access"
|
||||
@@ -174,7 +175,7 @@ config_get_bool enable_obuspa global enabled 1
|
||||
config_get wan_intf global interface
|
||||
config_get_bool dhcp_discovery global dhcp_discovery 1
|
||||
|
||||
if [ "$enable_obuspa" = "0" ] || [ "$dhcp_discovery" = "0" ]; then
|
||||
if [ "${enable_obuspa}" -eq 0 ] || [ "${dhcp_discovery}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -190,9 +191,9 @@ if [ -z "${wan_intf}" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
if [ "${wan_intf}" = "${INTERFACE}" ]; then
|
||||
if [ -n "$opt125" ]; then
|
||||
len=$(printf "$opt125"|wc -c)
|
||||
len=$(echo -n "${opt125}"|wc -c)
|
||||
get_vivsoi "$opt125" "$len"
|
||||
fi
|
||||
|
||||
@@ -228,10 +229,10 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
;;
|
||||
*)
|
||||
# This is an FQDN, perform DNS query
|
||||
nslookup $URL > /tmp/fqdn_ip
|
||||
nslookup -type=ptr $URL > /tmp/fqdn_ptr
|
||||
nslookup -type=srv $URL > /tmp/fqdn_srv
|
||||
nslookup -type=txt $URL > /tmp/fqdn_srv
|
||||
nslookup "${URL}" > /tmp/fqdn_ip
|
||||
nslookup -type=ptr "${URL}" > /tmp/fqdn_ptr
|
||||
nslookup -type=srv "${URL}" > /tmp/fqdn_srv
|
||||
nslookup -type=txt "${URL}" > /tmp/fqdn_srv
|
||||
|
||||
# TODO extend to collect information from dns-sd records
|
||||
;;
|
||||
@@ -247,16 +248,16 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${proto}" == "mqtt" ] || [ "${proto}" == "mqtts" ]; then
|
||||
if [ "${proto}" = "mqtt" ] || [ "${proto}" = "mqtts" ]; then
|
||||
offered_proto="MQTT"
|
||||
if [ "${proto}" == "mqtt" ]; then
|
||||
if [ "${proto}" = "mqtt" ]; then
|
||||
mtp_encrypt="TCP/IP"
|
||||
else
|
||||
mtp_encrypt="TLS"
|
||||
fi
|
||||
elif [ "${proto}" == "ws" ] || [ "${proto}" == "wss" ]; then
|
||||
elif [ "${proto}" = "ws" ] || [ "${proto}" = "wss" ]; then
|
||||
offered_proto="WebSocket"
|
||||
if [ "${proto}" == "wss" ]; then
|
||||
if [ "${proto}" = "wss" ]; then
|
||||
mtp_encrypt="1"
|
||||
else
|
||||
mtp_encrypt="0"
|
||||
@@ -265,35 +266,46 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
|
||||
controllers=$(uci -q show obuspa | grep "=controller" | cut -d'=' -f1 | cut -d'.' -f2)
|
||||
for controller in $controllers; do
|
||||
dhcp_disc=$(uci -q get obuspa.$controller.dhcp_discovered)
|
||||
dhcp_disc=$(uci -q get obuspa."${controller}".dhcp_discovered)
|
||||
if [ "${dhcp_disc}" -eq 1 ]; then
|
||||
dhcp_controller="${controller}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if any of the existing controller section matches with the endpointid
|
||||
if [ -z "${dhcp_controller}" ] && [ -n "${ENDPOINT_ID}" ]; then
|
||||
for controller in $controllers; do
|
||||
endpointid=$(uci -q get obuspa."${controller}".EndpointID)
|
||||
if [ "${endpointid}" = "${ENDPOINT_ID}" ]; then
|
||||
dhcp_controller="${controller}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "${dhcp_controller}" ]; then
|
||||
cont_proto="$(uci -q get obuspa.$dhcp_controller.Protocol)"
|
||||
if [ "${cont_proto}" == "MQTT" ]; then
|
||||
dhcp_mqtt="$(uci -q get obuspa.$dhcp_controller.mqtt)"
|
||||
cont_proto=$(uci -q get obuspa."${dhcp_controller}".Protocol)
|
||||
if [ "${cont_proto}" = "MQTT" ]; then
|
||||
dhcp_mqtt=$(uci -q get obuspa."${dhcp_controller}".mqtt)
|
||||
|
||||
mtps=$(uci -q show obuspa | grep "=mtp" | cut -d'=' -f1 | cut -d'.' -f2)
|
||||
for mtp in $mtps; do
|
||||
mtp_mqtt="$(uci -q get obuspa.$mtp.mqtt)"
|
||||
if [ "${mtp_mqtt}" == "${dhcp_mqtt}" ]; then
|
||||
mtp_mqtt=$(uci -q get obuspa."${mtp}".mqtt)
|
||||
if [ "${mtp_mqtt}" = "${dhcp_mqtt}" ]; then
|
||||
dhcp_mtp="${mtp}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
elif [ "${cont_proto}" == "WebSocket" ]; then
|
||||
cont_port="$(uci -q get obuspa.$dhcp_controller.Port)"
|
||||
cont_encr="$(uci -q get obuspa.$dhcp_controller.EnableEncryption)"
|
||||
elif [ "${cont_proto}" = "WebSocket" ]; then
|
||||
cont_port=$(uci -q get obuspa."${dhcp_controller}".Port)
|
||||
cont_encr=$(uci -q get obuspa."${dhcp_controller}".EnableEncryption)
|
||||
|
||||
mtps=$(uci -q show obuspa | grep "=mtp" | cut -d'=' -f1 | cut -d'.' -f2)
|
||||
for mtp in $mtps; do
|
||||
mtp_port="$(uci -q get obuspa.$mtp.Port)"
|
||||
mtp_encr="$(uci -q get obuspa.$mtp.EnableEncryption)"
|
||||
if [ "${mtp_port}" == "${cont_port}" ] && [ "${mtp_encr}" == "${cont_encr}" ]; then
|
||||
mtp_port=$(uci -q get obuspa."${mtp}".Port)
|
||||
mtp_encr=$(uci -q get obuspa."${mtp}".EnableEncryption)
|
||||
if [ "${mtp_port}" = "${cont_port}" ] && [ "${mtp_encr}" = "${cont_encr}" ]; then
|
||||
dhcp_mtp="${mtp}"
|
||||
break
|
||||
fi
|
||||
@@ -306,43 +318,43 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
|
||||
if [ -n "${dhcp_controller}" ]; then
|
||||
## Handling of controller section
|
||||
ct_endpoint=$(uci -q get obuspa.$dhcp_controller.EndpointID)
|
||||
ct_proto=$(uci -q get obuspa.$dhcp_controller.Protocol)
|
||||
ct_prov=$(uci -q get obuspa.$dhcp_controller.ProvisioningCode)
|
||||
ct_endpoint=$(uci -q get obuspa."${dhcp_controller}".EndpointID)
|
||||
ct_proto=$(uci -q get obuspa."${dhcp_controller}".Protocol)
|
||||
ct_prov=$(uci -q get obuspa."${dhcp_controller}".ProvisioningCode)
|
||||
|
||||
if [ "${ct_proto}" = "MQTT" ]; then
|
||||
ct_topic=$(uci -q get obuspa.$dhcp_controller.Topic)
|
||||
ct_topic=$(uci -q get obuspa."${dhcp_controller}".Topic)
|
||||
else
|
||||
ct_topic=$(uci -q get obuspa.$dhcp_controller.Path)
|
||||
ct_topic=$(uci -q get obuspa."${dhcp_controller}".Path)
|
||||
fi
|
||||
|
||||
if [ -n "${ENDPOINT_ID}" ] && [ "${ct_endpoint}" != "${ENDPOINT_ID}" ]; then
|
||||
uci -q set obuspa.$dhcp_controller.EndpointID="${ENDPOINT_ID}"
|
||||
uci -q set obuspa."${dhcp_controller}".EndpointID="${ENDPOINT_ID}"
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
if [ -n "${offered_proto}" ] && [ "${ct_proto}" != "${offered_proto}" ]; then
|
||||
uci -q set obuspa.$dhcp_controller.Protocol="${offered_proto}"
|
||||
uci -q set obuspa."${dhcp_controller}".Protocol="${offered_proto}"
|
||||
if [ "${offered_proto}" != "MQTT" ]; then
|
||||
uci -q set obuspa.$dhcp_controller.mqtt=""
|
||||
uci -q set obuspa.$dhcp_controller.Topic=""
|
||||
uci -q set obuspa.$dhcp_controller.Host="${ip}"
|
||||
uci -q set obuspa.$dhcp_controller.Port="${port}"
|
||||
uci -q set obuspa.$dhcp_controller.Path="${ct_topic}"
|
||||
uci -q set obuspa.$dhcp_controller.EnableEncryption="${mtp_encrypt}"
|
||||
uci -q delete obuspa."${dhcp_controller}".mqtt
|
||||
uci -q delete obuspa."${dhcp_controller}".Topic
|
||||
uci -q set obuspa."${dhcp_controller}".Host="${ip}"
|
||||
uci -q set obuspa."${dhcp_controller}".Port="${port}"
|
||||
uci -q set obuspa."${dhcp_controller}".Path="${ct_topic}"
|
||||
uci -q set obuspa."${dhcp_controller}".EnableEncryption="${mtp_encrypt}"
|
||||
else
|
||||
uci -q set obuspa.$dhcp_controller.EnableEncryption=""
|
||||
uci -q set obuspa.$dhcp_controller.Path=""
|
||||
uci -q set obuspa.$dhcp_controller.Host=""
|
||||
uci -q set obuspa.$dhcp_controller.Port=""
|
||||
uci -q delete obuspa."${dhcp_controller}".EnableEncryption
|
||||
uci -q delete obuspa."${dhcp_controller}".Path
|
||||
uci -q delete obuspa."${dhcp_controller}".Host
|
||||
uci -q delete obuspa."${dhcp_controller}".Port
|
||||
|
||||
if [ -z "${dhcp_mqtt}" ]; then
|
||||
uci -q set obuspa.$dhcp_controller.mqtt='dhcpmqtt'
|
||||
uci -q set obuspa."${dhcp_controller}".mqtt='dhcpmqtt'
|
||||
else
|
||||
uci -q set obuspa.$dhcp_controller.mqtt="${dhcp_mqtt}"
|
||||
uci -q set obuspa."${dhcp_controller}".mqtt="${dhcp_mqtt}"
|
||||
fi
|
||||
|
||||
uci -q set obuspa.$dhcp_controller.Topic="${ct_topic}"
|
||||
uci -q set obuspa."${dhcp_controller}".Topic="${ct_topic}"
|
||||
fi
|
||||
|
||||
proto_changed=1
|
||||
@@ -355,38 +367,37 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
protocol="${offered_proto}"
|
||||
fi
|
||||
|
||||
if [ "${protocol}" == "MQTT" ]; then
|
||||
uci -q set obuspa.$dhcp_controller.Topic="${topic}"
|
||||
if [ "${protocol}" = "MQTT" ]; then
|
||||
uci -q set obuspa."${dhcp_controller}".Topic="${topic}"
|
||||
else
|
||||
uci -q set obuspa.$dhcp_controller.Path="${topic}"
|
||||
uci -q set obuspa."${dhcp_controller}".Path="${topic}"
|
||||
fi
|
||||
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
if [ -n "${PROV_CODE}" ] && [ "${ct_prov}" != "${PROV_CODE}" ]; then
|
||||
uci -q set obuspa.$dhcp_controller.ProvisioningCode="${PROV_CODE}"
|
||||
uci -q set obuspa."${dhcp_controller}".ProvisioningCode="${PROV_CODE}"
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
if [ "${proto_changed}" -eq 1 ]; then
|
||||
if [ "${offered_proto}" == "WebSocket" ]; then
|
||||
if [ "${offered_proto}" = "WebSocket" ]; then
|
||||
if [ -n "${dhcp_mqtt}" ]; then
|
||||
uci -q del obuspa.$dhcp_mqtt
|
||||
uci -q delete obuspa."${dhcp_mqtt}"
|
||||
fi
|
||||
|
||||
if [ -z "${dhcp_mtp}" ]; then
|
||||
sec=$(uci -q add obuspa mtp)
|
||||
uci -q rename obuspa."${sec}"='dhcpmtp'
|
||||
uci -q set obuspa.dhcpmtp="mtp"
|
||||
dhcp_mtp="dhcpmtp"
|
||||
uci -q set obuspa.$dhcp_mtp.Enable='1'
|
||||
uci -q set obuspa."${dhcp_mtp}".Enable='1'
|
||||
fi
|
||||
|
||||
uci -q set obuspa.$dhcp_mtp.mqtt=''
|
||||
uci -q set obuspa.$dhcp_mtp.ResponseTopicConfigured=''
|
||||
uci -q set obuspa.$dhcp_mtp.Protocol='WebSocket'
|
||||
uci -q set obuspa.$dhcp_mtp.Port="${port}"
|
||||
uci -q set obuspa.$dhcp_mtp.EnableEncryption="${mtp_encrypt}"
|
||||
uci -q set obuspa."${dhcp_mtp}".mqtt=''
|
||||
uci -q set obuspa."${dhcp_mtp}".ResponseTopicConfigured=''
|
||||
uci -q set obuspa."${dhcp_mtp}".Protocol='WebSocket'
|
||||
uci -q set obuspa."${dhcp_mtp}".Port="${port}"
|
||||
uci -q set obuspa."${dhcp_mtp}".EnableEncryption="${mtp_encrypt}"
|
||||
|
||||
uci_change=1
|
||||
else
|
||||
@@ -394,137 +405,135 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
user="$(uci -q get obuspa.global.username)"
|
||||
pass="$(uci -q get obuspa.global.password)"
|
||||
|
||||
sec=$(uci -q add obuspa mqtt)
|
||||
uci -q rename obuspa."${sec}"='dhcpmqtt'
|
||||
uci -q set obuspa.dhcpmqtt="mqtt"
|
||||
dhcp_mqtt="dhcpmqtt"
|
||||
uci -q set obuspa.$dhcp_mqtt.Enable='1'
|
||||
uci -q set obuspa.$dhcp_mqtt.Username="${user}"
|
||||
uci -q set obuspa.$dhcp_mqtt.Password="${pass}"
|
||||
uci -q set obuspa."${dhcp_mqtt}".Enable='1'
|
||||
uci -q set obuspa."${dhcp_mqtt}".Username="${user}"
|
||||
uci -q set obuspa."${dhcp_mqtt}".Password="${pass}"
|
||||
fi
|
||||
|
||||
uci -q set obuspa.$dhcp_mqtt.BrokerAddress="${ip}"
|
||||
uci -q set obuspa.$dhcp_mqtt.BrokerPort="${port}"
|
||||
uci -q set obuspa.$dhcp_mqtt.TransportProtocol="${mtp_encrypt}"
|
||||
uci -q set obuspa.$dhcp_mqtt.ProtocolVersion='5.0'
|
||||
uci -q set obuspa."${dhcp_mqtt}".BrokerAddress="${ip}"
|
||||
uci -q set obuspa."${dhcp_mqtt}".BrokerPort="${port}"
|
||||
uci -q set obuspa."${dhcp_mqtt}".TransportProtocol="${mtp_encrypt}"
|
||||
uci -q set obuspa."${dhcp_mqtt}".ProtocolVersion='5.0'
|
||||
|
||||
if [ -z "${dhcp_mtp}" ]; then
|
||||
sec=$(uci -q add obuspa mtp)
|
||||
uci -q rename obuspa."${sec}"='dhcpmtp'
|
||||
uci -q set obuspa.dhcpmtp="mtp"
|
||||
dhcp_mtp="dhcpmtp"
|
||||
uci -q set obuspa.$dhcp_mtp.Enable='1'
|
||||
uci -q set obuspa."${dhcp_mtp}".Enable='1'
|
||||
fi
|
||||
|
||||
agent_topic=$(get_agent_topic)
|
||||
uci -q set obuspa.$dhcp_mtp.Port=""
|
||||
uci -q set obuspa.$dhcp_mtp.EnableEncryption=""
|
||||
uci -q set obuspa.$dhcp_mtp.Protocol='MQTT'
|
||||
uci -q set obuspa.$dhcp_mtp.ResponseTopicConfigured="${agent_topic}"
|
||||
uci -q set obuspa.$dhcp_mtp.mqtt="${dhcp_mqtt}"
|
||||
uci -q delete obuspa."${dhcp_mtp}".Port
|
||||
uci -q delete obuspa."${dhcp_mtp}".EnableEncryption
|
||||
uci -q set obuspa."${dhcp_mtp}".Protocol='MQTT'
|
||||
uci -q set obuspa."${dhcp_mtp}".ResponseTopicConfigured="${agent_topic}"
|
||||
uci -q set obuspa."${dhcp_mtp}".mqtt="${dhcp_mqtt}"
|
||||
|
||||
uci_change=1
|
||||
fi
|
||||
else
|
||||
if [ "${ct_proto}" == "WebSocket" ]; then
|
||||
conf_ip="$(uci -q get obuspa.$dhcp_controller.Host)"
|
||||
conf_port="$(uci -q get obuspa.$dhcp_mtp.Port)"
|
||||
conf_encr="$(uci -q get obuspa.$dhcp_mtp.EnableEncryption)"
|
||||
if [ "${ct_proto}" = "WebSocket" ]; then
|
||||
conf_ip="$(uci -q get obuspa."${dhcp_controller}".Host)"
|
||||
conf_port="$(uci -q get obuspa."${dhcp_mtp}".Port)"
|
||||
conf_encr="$(uci -q get obuspa."${dhcp_mtp}".EnableEncryption)"
|
||||
|
||||
if [ -n "${ip}" ] && [ "${conf_ip}" != "${ip}" ]; then
|
||||
uci -q set obuspa.$dhcp_controller.Host="${ip}"
|
||||
uci -q set obuspa."${dhcp_controller}".Host="${ip}"
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
if [ -n "${port}" ] && [ "${conf_port}" != "${port}" ]; then
|
||||
uci -q set obuspa.$dhcp_mtp.Port="${port}"
|
||||
uci -q set obuspa.$dhcp_controller.Port="${port}"
|
||||
uci -q set obuspa."${dhcp_mtp}".Port="${port}"
|
||||
uci -q set obuspa."${dhcp_controller}".Port="${port}"
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
if [ -n "${mtp_encrypt}" ] && [ "${conf_encr}" != "${mtp_encrypt}" ]; then
|
||||
uci -q set obuspa.$dhcp_mtp.EnableEncryption="${mtp_encrypt}"
|
||||
uci -q set obuspa.$dhcp_controller.EnableEncryption="${mtp_encrypt}"
|
||||
uci -q set obuspa."${dhcp_mtp}".EnableEncryption="${mtp_encrypt}"
|
||||
uci -q set obuspa."${dhcp_controller}".EnableEncryption="${mtp_encrypt}"
|
||||
uci_change=1
|
||||
fi
|
||||
else
|
||||
conf_ip="$(uci -q get obuspa.$dhcp_mqtt.BrokerAddress)"
|
||||
conf_port="$(uci -q get obuspa.$dhcp_mqtt.BrokerPort)"
|
||||
conf_encr="$(uci -q get obuspa.$dhcp_mqtt.TransportProtocol)"
|
||||
conf_ip=$(uci -q get obuspa."${dhcp_mqtt}".BrokerAddress)
|
||||
conf_port=$(uci -q get obuspa."${dhcp_mqtt}".BrokerPort)
|
||||
conf_encr=$(uci -q get obuspa."${dhcp_mqtt}".TransportProtocol)
|
||||
|
||||
if [ -n "${port}" ] && [ "${conf_port}" != "${port}" ]; then
|
||||
uci -q set obuspa.$dhcp_mqtt.BrokerPort="${port}"
|
||||
uci -q set obuspa."${dhcp_mqtt}".BrokerPort="${port}"
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
if [ -n "${mtp_encrypt}" ] && [ "${conf_encr}" != "${mtp_encrypt}" ]; then
|
||||
uci -q set obuspa.$dhcp_mqtt.TransportProtocol="${mtp_encrypt}"
|
||||
uci -q set obuspa."${dhcp_mqtt}".TransportProtocol="${mtp_encrypt}"
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
if [ -n "${ip}" ] && [ "${conf_ip}" != "${ip}" ]; then
|
||||
uci -q set obuspa.$dhcp_mqtt.BrokerAddress="${ip}"
|
||||
uci -q set obuspa."${dhcp_mqtt}".BrokerAddress="${ip}"
|
||||
uci_change=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
uci -q del obuspa.dhcpmtp
|
||||
uci -q del obuspa.dhcpmqtt
|
||||
# Only setup a new controller, only if mandatory param present
|
||||
if [ -n "${ENDPOINT_ID}" ] && [ -n "${URL}" ]; then
|
||||
uci -q delete obuspa.dhcpmtp
|
||||
uci -q delete obuspa.dhcpmqtt
|
||||
|
||||
sec=$(uci -q add obuspa controller)
|
||||
uci -q rename obuspa."${sec}"='dhcpcontroller'
|
||||
uci -q set obuspa.dhcpcontroller.dhcp_discovered="1"
|
||||
uci -q set obuspa.dhcpcontroller.EndpointID="${ENDPOINT_ID}"
|
||||
uci -q set obuspa.dhcpcontroller.ProvisioningCode="${PROV_CODE}"
|
||||
uci -q set obuspa.dhcpcontroller.Protocol="${offered_proto}"
|
||||
uci -q set obuspa.dhcpcontroller.assigned_role_name="$(get_access_role)"
|
||||
uci -q set obuspa.dhcpcontroller.Enable='1'
|
||||
uci -q set obuspa.dhcpcontroller="controller"
|
||||
uci -q set obuspa.dhcpcontroller.dhcp_discovered="1"
|
||||
uci -q set obuspa.dhcpcontroller.EndpointID="${ENDPOINT_ID}"
|
||||
uci -q set obuspa.dhcpcontroller.ProvisioningCode="${PROV_CODE}"
|
||||
uci -q set obuspa.dhcpcontroller.Protocol="${offered_proto}"
|
||||
uci -q set obuspa.dhcpcontroller.assigned_role_name="$(get_access_role)"
|
||||
uci -q set obuspa.dhcpcontroller.Enable='1'
|
||||
|
||||
if [ -n "${offered_proto}" ]; then
|
||||
if [ "${offered_proto}" == "MQTT" ]; then
|
||||
user="$(uci -q get obuspa.global.username)"
|
||||
pass="$(uci -q get obuspa.global.password)"
|
||||
if [ -n "${offered_proto}" ]; then
|
||||
if [ "${offered_proto}" = "MQTT" ]; then
|
||||
user="$(uci -q get obuspa.global.username)"
|
||||
pass="$(uci -q get obuspa.global.password)"
|
||||
|
||||
uci -q set obuspa.dhcpcontroller.Topic="${topic}"
|
||||
uci -q set obuspa.dhcpcontroller.mqtt='dhcpmqtt'
|
||||
uci -q set obuspa.dhcpcontroller.Topic="${topic}"
|
||||
uci -q set obuspa.dhcpcontroller.mqtt='dhcpmqtt'
|
||||
|
||||
sec=$(uci -q add obuspa mqtt)
|
||||
uci -q rename obuspa."${sec}"='dhcpmqtt'
|
||||
uci -q set obuspa.dhcpmqtt.BrokerAddress="${ip}"
|
||||
uci -q set obuspa.dhcpmqtt.BrokerPort="${port}"
|
||||
uci -q set obuspa.dhcpmqtt.TransportProtocol="${mtp_encrypt}"
|
||||
uci -q set obuspa.dhcpmqtt.Enable='1'
|
||||
uci -q set obuspa.dhcpmqtt.ProtocolVersion='5.0'
|
||||
uci -q set obuspa.dhcpmqtt.Username="${user}"
|
||||
uci -q set obuspa.dhcpmqtt.Password="${pass}"
|
||||
uci -q set obuspa.dhcpmqtt="mqtt"
|
||||
uci -q set obuspa.dhcpmqtt.BrokerAddress="${ip}"
|
||||
uci -q set obuspa.dhcpmqtt.BrokerPort="${port}"
|
||||
uci -q set obuspa.dhcpmqtt.TransportProtocol="${mtp_encrypt}"
|
||||
uci -q set obuspa.dhcpmqtt.Enable='1'
|
||||
uci -q set obuspa.dhcpmqtt.ProtocolVersion='5.0'
|
||||
uci -q set obuspa.dhcpmqtt.Username="${user}"
|
||||
uci -q set obuspa.dhcpmqtt.Password="${pass}"
|
||||
|
||||
|
||||
agent_topic=$(get_agent_topic)
|
||||
sec=$(uci -q add obuspa mtp)
|
||||
uci -q rename obuspa."${sec}"='dhcpmtp'
|
||||
uci -q set obuspa.dhcpmtp.Protocol='MQTT'
|
||||
uci -q set obuspa.dhcpmtp.ResponseTopicConfigured="${agent_topic}"
|
||||
uci -q set obuspa.dhcpmtp.Enable='1'
|
||||
uci -q set obuspa.dhcpmtp.mqtt='dhcpmqtt'
|
||||
else
|
||||
uci -q set obuspa.dhcpcontroller.Path="${topic}"
|
||||
uci -q set obuspa.dhcpcontroller.Host="${ip}"
|
||||
uci -q set obuspa.dhcpcontroller.Port="${port}"
|
||||
uci -q set obuspa.dhcpcontroller.EnableEncryption="${mtp_encrypt}"
|
||||
agent_topic=$(get_agent_topic)
|
||||
uci -q set obuspa.dhcpmtp="mtp"
|
||||
uci -q set obuspa.dhcpmtp.Protocol='MQTT'
|
||||
uci -q set obuspa.dhcpmtp.ResponseTopicConfigured="${agent_topic}"
|
||||
uci -q set obuspa.dhcpmtp.Enable='1'
|
||||
uci -q set obuspa.dhcpmtp.mqtt='dhcpmqtt'
|
||||
else
|
||||
uci -q set obuspa.dhcpcontroller.Path="${topic}"
|
||||
uci -q set obuspa.dhcpcontroller.Host="${ip}"
|
||||
uci -q set obuspa.dhcpcontroller.Port="${port}"
|
||||
uci -q set obuspa.dhcpcontroller.EnableEncryption="${mtp_encrypt}"
|
||||
|
||||
sec=$(uci -q add obuspa mtp)
|
||||
uci -q rename obuspa."${sec}"='dhcpmtp'
|
||||
|
||||
uci -q set obuspa.dhcpmtp.Protocol='WebSocket'
|
||||
uci -q set obuspa.dhcpmtp.Port="${port}"
|
||||
uci -q set obuspa.dhcpmtp.Enable='1'
|
||||
uci -q set obuspa.dhcpmtp.EnableEncryption="${mtp_encrypt}"
|
||||
uci -q set obuspa.dhcpmtp="mtp"
|
||||
uci -q set obuspa.dhcpmtp.Protocol='WebSocket'
|
||||
uci -q set obuspa.dhcpmtp.Port="${port}"
|
||||
uci -q set obuspa.dhcpmtp.Enable='1'
|
||||
uci -q set obuspa.dhcpmtp.EnableEncryption="${mtp_encrypt}"
|
||||
fi
|
||||
fi
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
uci_change=1
|
||||
fi
|
||||
|
||||
if [ ${uci_change} -eq 1 ]; then
|
||||
if [ -f "${OBUSPA_BOOT_MARKER}" ]; then
|
||||
rm -f "${OBUSPA_BOOT_MARKER}"
|
||||
fi
|
||||
log "# Reloading obuspa as dhcp config changed"
|
||||
ubus call uci commit '{"config":"obuspa"}'
|
||||
fi
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Index: obuspa-10.0.0.1/src/core/device_controller.c
|
||||
Index: obuspa-10.0.5.0/src/core/device_controller.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/device_controller.c
|
||||
+++ obuspa-10.0.0.1/src/core/device_controller.c
|
||||
@@ -4211,6 +4211,14 @@ int ProcessControllerAdded(int cont_inst
|
||||
--- obuspa-10.0.5.0.orig/src/core/device_controller.c
|
||||
+++ obuspa-10.0.5.0/src/core/device_controller.c
|
||||
@@ -4223,6 +4223,14 @@ int ProcessControllerAdded(int cont_inst
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ Index: obuspa-10.0.0.1/src/core/device_controller.c
|
||||
// Exit if unable to get the object instance numbers present in this controller's MTP table
|
||||
USP_SNPRINTF(path, sizeof(path), "%s.%d.MTP", device_cont_root, cont_instance);
|
||||
err = DATA_MODEL_GetInstances(path, &iv);
|
||||
@@ -4252,14 +4260,6 @@ int ProcessControllerAdded(int cont_inst
|
||||
@@ -4264,14 +4272,6 @@ int ProcessControllerAdded(int cont_inst
|
||||
DEVICE_MQTT_UpdateControllerTopics();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Index: obuspa-10.0.0.1/src/core/bdc_exec.c
|
||||
Index: obuspa-10.0.4.0/src/core/bdc_exec.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/bdc_exec.c
|
||||
+++ obuspa-10.0.0.1/src/core/bdc_exec.c
|
||||
--- obuspa-10.0.4.0.orig/src/core/bdc_exec.c
|
||||
+++ obuspa-10.0.4.0/src/core/bdc_exec.c
|
||||
@@ -549,10 +549,25 @@ int StartSendingReport(bdc_connection_t
|
||||
|
||||
// Set the list of headers
|
||||
@@ -30,10 +30,10 @@ Index: obuspa-10.0.0.1/src/core/bdc_exec.c
|
||||
bc->headers = curl_slist_append(bc->headers, "Content-Encoding: gzip");
|
||||
}
|
||||
|
||||
Index: obuspa-10.0.0.1/src/core/bdc_exec.h
|
||||
Index: obuspa-10.0.4.0/src/core/bdc_exec.h
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/bdc_exec.h
|
||||
+++ obuspa-10.0.0.1/src/core/bdc_exec.h
|
||||
--- obuspa-10.0.4.0.orig/src/core/bdc_exec.h
|
||||
+++ obuspa-10.0.4.0/src/core/bdc_exec.h
|
||||
@@ -54,6 +54,8 @@ void BDC_EXEC_ScheduleExit(void);
|
||||
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
|
||||
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
|
||||
@@ -45,10 +45,10 @@ Index: obuspa-10.0.0.1/src/core/bdc_exec.h
|
||||
+#define BDC_FLAG_HEADER_PER_ROW 0x00000020 // If set, report format in header would be csv ParameterPerRow
|
||||
+#define BDC_FLAG_HEADER_PER_COL 0x00000040 // If set, report format in header would be csv ParameterPerColumn
|
||||
#endif
|
||||
Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/device_bulkdata.c
|
||||
+++ obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
--- obuspa-10.0.4.0.orig/src/core/device_bulkdata.c
|
||||
+++ obuspa-10.0.4.0/src/core/device_bulkdata.c
|
||||
@@ -71,8 +71,12 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -95,7 +95,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
|
||||
@@ -247,7 +259,8 @@ bulkdata_profile_t *bulkdata_find_free_p
|
||||
bulkdata_profile_t *bulkdata_find_profile(int profile_id);
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map, combined_role_t *combined_role);
|
||||
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
|
||||
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp);
|
||||
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
|
||||
@@ -103,16 +103,16 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
|
||||
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
|
||||
int bulkdata_start_profile(bulkdata_profile_t *bp);
|
||||
@@ -262,6 +275,8 @@ char *bulkdata_platform_calc_uri_query_s
|
||||
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
|
||||
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv);
|
||||
@@ -263,6 +276,8 @@ int bulkdata_platform_get_param_refs(int
|
||||
int bulkdata_platform_calc_combined_role(int instance, combined_role_t **bulkdata_role, combined_role_t *combined_role, int *cont_instance);
|
||||
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv, combined_role_t *combined_role);
|
||||
void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map);
|
||||
+void append_string_to_target(char *str, char **output);
|
||||
+char *csv_encode(const char *str);
|
||||
int GetAuto_BulkDataController(dm_req_t *req, char *buf, int len);
|
||||
#ifdef ENABLE_MQTT
|
||||
int Validate_BulkDataMqttReference(dm_req_t *req, char *value);
|
||||
void bulkdata_process_profile_mqtt(bulkdata_profile_t *bp);
|
||||
@@ -299,7 +314,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
@@ -301,7 +316,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT);
|
||||
err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols));
|
||||
@@ -121,7 +121,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT);
|
||||
@@ -314,7 +329,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
@@ -316,7 +331,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING);
|
||||
@@ -129,8 +129,8 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE_JSON, Validate_BulkDataEncodingType, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME);
|
||||
|
||||
@@ -326,9 +341,16 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadOnlyAuto("Device.BulkData.Profile.{i}.Controller", GetAuto_BulkDataController, DM_STRING);
|
||||
@@ -329,9 +344,16 @@ int DEVICE_BULKDATA_Init(void)
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Parameter.{i}.Reference", "", Validate_BulkDataReference, NULL, DM_STRING);
|
||||
|
||||
// Device.BulkData.Profile.{i}.JSONEncoding
|
||||
@@ -148,7 +148,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
// Device.BulkData.Profile.{i}.HTTP
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
|
||||
@@ -614,9 +636,10 @@ int Validate_BulkDataProtocol(dm_req_t *
|
||||
@@ -687,9 +709,10 @@ int Validate_BulkDataProtocol(dm_req_t *
|
||||
int Validate_BulkDataEncodingType(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
@@ -162,7 +162,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -720,9 +743,36 @@ int Validate_BulkDataReference(dm_req_t
|
||||
@@ -793,9 +816,36 @@ int Validate_BulkDataReference(dm_req_t
|
||||
int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
@@ -201,7 +201,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -2053,6 +2103,14 @@ int bulkdata_platform_get_profile_contro
|
||||
@@ -2151,6 +2201,14 @@ int bulkdata_platform_get_profile_contro
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
// Exit if unable to get ReportTimestamp
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
|
||||
@@ -2061,6 +2119,54 @@ int bulkdata_platform_get_profile_contro
|
||||
@@ -2159,6 +2217,54 @@ int bulkdata_platform_get_profile_contro
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
#ifdef ENABLE_MQTT
|
||||
{
|
||||
char protocol[32];
|
||||
@@ -2334,7 +2440,7 @@ void bulkdata_process_profile_http(bulkd
|
||||
@@ -2492,7 +2598,7 @@ void bulkdata_process_profile_http(bulkd
|
||||
{
|
||||
int err;
|
||||
report_t *cur_report;
|
||||
@@ -280,7 +280,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
profile_ctrl_params_t ctrl;
|
||||
unsigned char *compressed_report;
|
||||
int compressed_len;
|
||||
@@ -2373,10 +2479,23 @@ void bulkdata_process_profile_http(bulkd
|
||||
@@ -2541,26 +2647,39 @@ void bulkdata_process_profile_http(bulkd
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
@@ -308,7 +308,9 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2385,14 +2504,14 @@ void bulkdata_process_profile_http(bulkd
|
||||
// Print out the JSON report, if debugging is enabled
|
||||
- USP_LOG_Info("\nBULK DATA: %sing at time %s, to url=%s", ctrl.method, iso8601_cur_time(buf, sizeof(buf)), ctrl.url);
|
||||
+ USP_LOG_Info("BULK DATA: %sing at time %s, to url=%s", ctrl.method, iso8601_cur_time(buf, sizeof(buf)), ctrl.url);
|
||||
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
|
||||
if (enable_protocol_trace)
|
||||
{
|
||||
@@ -327,7 +329,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
}
|
||||
// NOTE: From this point on, only the compressed_report exists
|
||||
|
||||
@@ -2422,8 +2541,15 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2590,8 +2709,15 @@ void bulkdata_process_profile_usp_event(
|
||||
kv_vector_t event_args;
|
||||
kv_pair_t kv;
|
||||
report_t *cur_report;
|
||||
@@ -341,11 +343,11 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
+ char escape_char[10];
|
||||
+ char csv_format[20];
|
||||
+ char row_timestamp[33];
|
||||
|
||||
// Exit if the MTP has not been connected to successfully after bootup
|
||||
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
|
||||
@@ -2432,13 +2558,63 @@ void bulkdata_process_profile_usp_event(
|
||||
goto exit;
|
||||
combined_role_t *bulkdata_role;
|
||||
combined_role_t combined_role;
|
||||
int cont_instance;
|
||||
@@ -2610,13 +2736,63 @@ void bulkdata_process_profile_usp_event(
|
||||
return;
|
||||
}
|
||||
|
||||
- // Exit if unable to get ReportTimestamp
|
||||
@@ -415,7 +417,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
|
||||
// When sending via USP events, only one report is ever sent in each USP event
|
||||
// So ensure all retained reports are removed. NOTE: Clearing the reports here is only necessary when switching protocol from HTTP to USP event, and where HTTP had some unsent reports
|
||||
@@ -2456,11 +2632,17 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2634,11 +2810,17 @@ void bulkdata_process_profile_usp_event(
|
||||
}
|
||||
bp->num_retained_reports = 1;
|
||||
|
||||
@@ -436,7 +438,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2468,15 +2650,15 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2646,15 +2828,15 @@ void bulkdata_process_profile_usp_event(
|
||||
|
||||
// Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add()
|
||||
kv.key = "Data";
|
||||
@@ -446,7 +448,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
event_args.num_entries = 1;
|
||||
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.Push!", bp->profile_id);
|
||||
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args);
|
||||
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args, cont_instance);
|
||||
|
||||
- // Free the report. No need to free the event_args as json_report is the only thing dynamically allocated in it
|
||||
- free(json_report); // The report is not allocated via USP_MALLOC
|
||||
@@ -455,7 +457,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
|
||||
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them
|
||||
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
|
||||
@@ -2548,11 +2730,24 @@ void bulkdata_process_profile_mqtt(bulkd
|
||||
@@ -2736,15 +2918,28 @@ void bulkdata_process_profile_mqtt(bulkd
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
@@ -485,7 +487,21 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
}
|
||||
|
||||
// Print out the JSON report, if debugging is enabled
|
||||
@@ -2763,7 +2958,7 @@ int bulkdata_reduce_to_alt_name(char *sp
|
||||
- USP_LOG_Debug("\nBULK DATA: Sending at time %s to MQTT topic %s", iso8601_cur_time(buf, sizeof(buf)), ctrl.mqtt_publish_topic);
|
||||
+ USP_LOG_Debug("BULK DATA: Sending at time %s to MQTT topic %s", iso8601_cur_time(buf, sizeof(buf)), ctrl.mqtt_publish_topic);
|
||||
if (enable_protocol_trace)
|
||||
{
|
||||
USP_LOG_String(kLogLevel_Info, kLogType_Protocol, report);
|
||||
@@ -2939,7 +3134,7 @@ int bulkdata_reduce_to_alt_name(char *sp
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
-** bulkdata_generate_json_report
|
||||
+** bulkdata_generate_json_name_value_pair_report
|
||||
**
|
||||
** Generates a JSON name-value pair format report
|
||||
** NOTE: The report contains all retained failed reports, as well as the current report
|
||||
@@ -2951,7 +3146,7 @@ int bulkdata_reduce_to_alt_name(char *sp
|
||||
** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||
**
|
||||
**************************************************************************/
|
||||
@@ -494,7 +510,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
{
|
||||
JsonNode *top; // top of report
|
||||
JsonNode *array; // array of reports (retained + current)
|
||||
@@ -2868,6 +3063,483 @@ char *bulkdata_generate_json_report(bulk
|
||||
@@ -3056,6 +3251,483 @@ char *bulkdata_generate_json_report(bulk
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -978,7 +994,7 @@ Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bulkdata_compress_report
|
||||
@@ -3071,6 +3743,20 @@ int bulkdata_schedule_sending_http_repor
|
||||
@@ -3259,6 +3931,20 @@ int bulkdata_schedule_sending_http_repor
|
||||
flags |= BDC_FLAG_DATE_HEADER;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Index: obuspa-10.0.0.1/src/core/expr_vector.c
|
||||
Index: obuspa-10.0.5.0/src/core/expr_vector.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/expr_vector.c
|
||||
+++ obuspa-10.0.0.1/src/core/expr_vector.c
|
||||
--- obuspa-10.0.5.0.orig/src/core/expr_vector.c
|
||||
+++ obuspa-10.0.5.0/src/core/expr_vector.c
|
||||
@@ -59,6 +59,7 @@ char *expr_op_2_str[kExprOp_Max] =
|
||||
"<", // kExprOp_LessThan
|
||||
">", // kExprOp_GreaterThan
|
||||
@@ -10,7 +10,7 @@ Index: obuspa-10.0.0.1/src/core/expr_vector.c
|
||||
};
|
||||
|
||||
|
||||
@@ -483,6 +484,15 @@ char *SplitOnOperator(char *buf, expr_op
|
||||
@@ -487,6 +488,15 @@ char *SplitOnOperator(char *buf, expr_op
|
||||
*op = '\0';
|
||||
return &op[2];
|
||||
}
|
||||
@@ -26,10 +26,10 @@ Index: obuspa-10.0.0.1/src/core/expr_vector.c
|
||||
|
||||
// Exit if found the "<" operator
|
||||
op = strchr(buf, '<');
|
||||
Index: obuspa-10.0.0.1/src/core/path_resolver.c
|
||||
Index: obuspa-10.0.5.0/src/core/path_resolver.c
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/core/path_resolver.c
|
||||
+++ obuspa-10.0.0.1/src/core/path_resolver.c
|
||||
--- obuspa-10.0.5.0.orig/src/core/path_resolver.c
|
||||
+++ obuspa-10.0.5.0/src/core/path_resolver.c
|
||||
@@ -1088,7 +1088,7 @@ int ResolveUniqueKey(char *resolved, cha
|
||||
char temp[MAX_DM_PATH];
|
||||
bool is_match;
|
||||
@@ -38,7 +38,7 @@ Index: obuspa-10.0.0.1/src/core/path_resolver.c
|
||||
+ expr_op_t valid_ops[] = {kExprOp_Equal, kExprOp_NotEqual, kExprOp_LessThanOrEqual, kExprOp_GreaterThanOrEqual, kExprOp_LessThan, kExprOp_GreaterThan, kExprOp_Contains};
|
||||
|
||||
// Exit if unable to find the end of the unique key
|
||||
p = strchr(unresolved, ']');
|
||||
p = TEXT_UTILS_StrStr(unresolved, "]");
|
||||
@@ -1754,6 +1754,67 @@ int DoUniqueKeysMatch(int index, search_
|
||||
}
|
||||
USP_ASSERT(gge->value != NULL); // GROUP_GET_VECTOR_GetValues() should have set an error message if the vendor hook didn't set a value for the parameter
|
||||
@@ -107,10 +107,10 @@ Index: obuspa-10.0.0.1/src/core/path_resolver.c
|
||||
// Determine the function to call to perform the comparison
|
||||
if (type_flags & (DM_INT | DM_UINT | DM_ULONG | DM_LONG | DM_DECIMAL))
|
||||
{
|
||||
Index: obuspa-10.0.0.1/src/include/usp_api.h
|
||||
Index: obuspa-10.0.5.0/src/include/usp_api.h
|
||||
===================================================================
|
||||
--- obuspa-10.0.0.1.orig/src/include/usp_api.h
|
||||
+++ obuspa-10.0.0.1/src/include/usp_api.h
|
||||
--- obuspa-10.0.5.0.orig/src/include/usp_api.h
|
||||
+++ obuspa-10.0.5.0/src/include/usp_api.h
|
||||
@@ -106,6 +106,7 @@ typedef enum
|
||||
kExprOp_LessThan, // '<'
|
||||
kExprOp_GreaterThan, // '>'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user