mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-22 01:53:43 +08:00
Compare commits
1099 Commits
csmngr_tes
...
sysmngr_me
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4a631f0cb | ||
|
|
c0208dab2e | ||
|
|
8dca6b8e44 | ||
|
|
4b1a7859aa | ||
|
|
6f28d90916 | ||
|
|
285e24455d | ||
|
|
d0c26b4bb7 | ||
|
|
a71d90d2c7 | ||
|
|
78e1468f51 | ||
|
|
9a1e1dbd1a | ||
|
|
3ef21188b1 | ||
|
|
65daa6c56a | ||
|
|
eb63f5d74f | ||
|
|
7da09349ec | ||
|
|
b2a28a12f6 | ||
|
|
0fe5d2a232 | ||
|
|
b50f9946bb | ||
|
|
bf28778432 | ||
|
|
d6dad64328 | ||
|
|
46003fddd5 | ||
|
|
2e7fc5fa14 | ||
|
|
7fb9b397ef | ||
|
|
cbe66d6c96 | ||
|
|
57d477c1da | ||
|
|
8e774faa3e | ||
|
|
6129323ca3 | ||
|
|
6d6ecdfe92 | ||
|
|
b66ae8d605 | ||
|
|
ed97af82b5 | ||
|
|
464f037768 | ||
|
|
024442da10 | ||
|
|
b0049df366 | ||
|
|
7115c1734e | ||
|
|
9b93ffef76 | ||
|
|
225b89ab4f | ||
|
|
d4464bf430 | ||
|
|
50731e00ef | ||
|
|
f9d3d22c14 | ||
|
|
607f3c5334 | ||
|
|
925c58aeaa | ||
|
|
447acf3b27 | ||
|
|
5bff6c3854 | ||
|
|
70f4086ecc | ||
|
|
b3bafdbba9 | ||
|
|
5788d7d284 | ||
|
|
a0c226d6ea | ||
|
|
921657f464 | ||
|
|
217ee3fa77 | ||
|
|
0aef613006 | ||
|
|
63e2bb8f6d | ||
|
|
ea0059a932 | ||
|
|
a95a6d804a | ||
|
|
3fbdd08037 | ||
|
|
e04040c4ea | ||
|
|
20a85cce5f | ||
|
|
2be7a59ff0 | ||
|
|
3102c0f981 | ||
|
|
8693a8f2c9 | ||
|
|
9bc4656525 | ||
|
|
544000177c | ||
|
|
2b1dbf7e36 | ||
|
|
641ec8a9eb | ||
|
|
c18929dbae | ||
|
|
a592f34216 | ||
|
|
4e2adf77cb | ||
|
|
9fba09f00a | ||
|
|
12d377b3bd | ||
|
|
cd1f81c8d9 | ||
|
|
f6774fd554 | ||
|
|
ea248061f3 | ||
|
|
1e2894dd46 | ||
|
|
92b607bd0e | ||
|
|
b766ea958a | ||
|
|
a7074db9f8 | ||
|
|
5c819b2018 | ||
|
|
c526df5143 | ||
|
|
31ed2ae746 | ||
|
|
702065eb3d | ||
|
|
c418266af6 | ||
|
|
9c8d80d763 | ||
|
|
007a8cb8bf | ||
|
|
2fc7d55d6c | ||
|
|
b3bdcea137 | ||
|
|
4673347125 | ||
|
|
f827f9f408 | ||
|
|
6a8aed5d3f | ||
|
|
5e54477cd1 | ||
|
|
ba9fcda886 | ||
|
|
c848d93316 | ||
|
|
d00c8f1ea0 | ||
|
|
9788a135aa | ||
|
|
899e6b1417 | ||
|
|
6f7f14b241 | ||
|
|
cc0d1b5910 | ||
|
|
0b6cd8154b | ||
|
|
c4cae5d6b4 | ||
|
|
f58959842b | ||
|
|
b813c155bc | ||
|
|
98e53ae941 | ||
|
|
4d993266b3 | ||
|
|
8da27926a1 | ||
|
|
7fae7acc91 | ||
|
|
47708d34df | ||
|
|
ab322f1194 | ||
|
|
aab45b16b0 | ||
|
|
586920d8a8 | ||
|
|
ac8a1c69ae | ||
|
|
604cd52a79 | ||
|
|
37109a8531 | ||
|
|
136db7b085 | ||
|
|
c177d59b7b | ||
|
|
fa9611f4f5 | ||
|
|
859e2958c0 | ||
|
|
0dda22833d | ||
|
|
ccb40910e2 | ||
|
|
eddaa9233c | ||
|
|
a09f5a3ba6 | ||
|
|
ed78a58455 | ||
|
|
b130d50bb3 | ||
|
|
7ab286753d | ||
|
|
bc6aadb0ed | ||
|
|
fd9c8b0922 | ||
|
|
2c9b9cadfe | ||
|
|
fb1ac0994d | ||
|
|
5ba8e293eb | ||
|
|
801ed0eb9f | ||
|
|
54503f98d4 | ||
|
|
903ff637e7 | ||
|
|
82ef5f6b6e | ||
|
|
398f09a1ce | ||
|
|
f29de07d0d | ||
|
|
8524f719c1 | ||
|
|
0a73e686f5 | ||
|
|
615b3d0507 | ||
|
|
4df8574fb6 | ||
|
|
e39d51a37b | ||
|
|
598b5c8e4a | ||
|
|
135e31a3e2 | ||
|
|
8e4810baa1 | ||
|
|
acd0a7ba24 | ||
|
|
032bb6bf2e | ||
|
|
083bcd79f9 | ||
|
|
30a7c285b1 | ||
|
|
5d03bbfd20 | ||
|
|
1a167f8854 | ||
|
|
06b6b64d4c | ||
|
|
26999d2381 | ||
|
|
9fba0888eb | ||
|
|
1ce4ba836f | ||
|
|
6493720c11 | ||
|
|
dd0dec6ac4 | ||
|
|
cbfc98d85e | ||
|
|
086763919a | ||
|
|
62cbccd274 | ||
|
|
b0a8549453 | ||
|
|
757ab29b57 | ||
|
|
82eb62a9e1 | ||
|
|
66bed5a044 | ||
|
|
12449bf471 | ||
|
|
5c4f315083 | ||
|
|
0a88793328 | ||
|
|
4ea26f9bec | ||
|
|
85542591d0 | ||
|
|
91ef8ff9a2 | ||
|
|
13aa279c39 | ||
|
|
eadb87d369 | ||
|
|
f250bc3c79 | ||
|
|
eaaf653b0f | ||
|
|
4a30355aab | ||
|
|
2abd075e59 | ||
|
|
aec10de11f | ||
|
|
50e53a5b15 | ||
|
|
6a89907ddb | ||
|
|
3dae593802 | ||
|
|
5b2d26a839 | ||
|
|
3fa318c58f | ||
|
|
7dab64d1e0 | ||
|
|
99d1900c79 | ||
|
|
16bffe35f7 | ||
|
|
3efb822b6e | ||
|
|
a3463ec253 | ||
|
|
a76e7d641d | ||
|
|
ab75eaa19d | ||
|
|
2d50afe767 | ||
|
|
916ea44e1d | ||
|
|
59bbbd822e | ||
|
|
8b67c32fd8 | ||
|
|
0852b1c635 | ||
|
|
38f0ec2180 | ||
|
|
67567aeed5 | ||
|
|
5315408948 | ||
|
|
5f255090f5 | ||
|
|
2e8a62001e | ||
|
|
52add3fc14 | ||
|
|
964a1008fd | ||
|
|
5fd9145a27 | ||
|
|
988717574c | ||
|
|
23ea6da091 | ||
|
|
927442fb89 | ||
|
|
4db0f00c26 | ||
|
|
c710784038 | ||
|
|
5072d9025a | ||
|
|
b5a963c1bf | ||
|
|
608b4a2b8a | ||
|
|
ae5a982dc4 | ||
|
|
3ec6b54d46 | ||
|
|
6a34e2da97 | ||
|
|
627a4c4ad6 | ||
|
|
abbab7118c | ||
|
|
31e6887d42 | ||
|
|
fc37507afb | ||
|
|
e160b6795a | ||
|
|
5ace2f5cc9 | ||
|
|
0e54c37963 | ||
|
|
e9e118fa12 | ||
|
|
9af1de3b43 | ||
|
|
b74c2d2d17 | ||
|
|
ee779c0fd8 | ||
|
|
36fb5d5343 | ||
|
|
0d2f443da0 | ||
|
|
5dc696f7e6 | ||
|
|
6ae56f6737 | ||
|
|
76af31b457 | ||
|
|
7838b7b5c3 | ||
|
|
f98664f398 | ||
|
|
89b1584816 | ||
|
|
da0234f66b | ||
|
|
45af6700f5 | ||
|
|
c60bc158a4 | ||
|
|
b2895d8908 | ||
|
|
eb10bd6b6b | ||
|
|
af0a111b81 | ||
|
|
fc9e35c18f | ||
|
|
7d619a85b3 | ||
|
|
ded9e8d248 | ||
|
|
4b5a232a9e | ||
|
|
bbe85d77a3 | ||
|
|
172581b794 | ||
|
|
2b965738cb | ||
|
|
47fe2abfe0 | ||
|
|
5068f2ae2d | ||
|
|
479df88a67 | ||
|
|
be93ce6e1e | ||
|
|
f41f010aa9 | ||
|
|
72aa9ac89a | ||
|
|
77a4bee249 | ||
|
|
54bd79427e | ||
|
|
1d773de3ca | ||
|
|
791881dd85 | ||
|
|
fc7c6e123d | ||
|
|
e3af6258f5 | ||
|
|
0bf9cc31d0 | ||
|
|
c3a0c839a8 | ||
|
|
4b84c570b5 | ||
|
|
57a8f7e98a | ||
|
|
0483212986 | ||
|
|
96ad10a2b0 | ||
|
|
a7fbef8753 | ||
|
|
1443111081 | ||
|
|
9c78c6e78d | ||
|
|
0aa3452fdb | ||
|
|
2ca261f10d | ||
|
|
bbe62b4c7b | ||
|
|
fd08ddde07 | ||
|
|
6020c2d64b | ||
|
|
012efefbad | ||
|
|
a18d9af782 | ||
|
|
5bc6d6aaa9 | ||
|
|
bedb6b8afb | ||
|
|
3eeb24fea8 | ||
|
|
645d6d9beb | ||
|
|
20cf6d1654 | ||
|
|
5bbab3b822 | ||
|
|
0a73c8150b | ||
|
|
8619514bdb | ||
|
|
1ad9254588 | ||
|
|
2bff75633e | ||
|
|
fa9bfb428e | ||
|
|
ab2766f79b | ||
|
|
bcdb31c830 | ||
|
|
32203771f6 | ||
|
|
2ff18658c9 | ||
|
|
29979d3559 | ||
|
|
7e56b7eca4 | ||
|
|
7d7c89d24f | ||
|
|
07701b459b | ||
|
|
6c6d1eae5f | ||
|
|
58a91d6a7d | ||
|
|
b033b53958 | ||
|
|
f5df102fd9 | ||
|
|
d1f16dc432 | ||
|
|
0884ecd15e | ||
|
|
787570e7c7 | ||
|
|
33387c8e40 | ||
|
|
1b63c05762 | ||
|
|
c816ee7358 | ||
|
|
71c92846d2 | ||
|
|
fdf005fd8f | ||
|
|
ddac1730e6 | ||
|
|
c5e76fe6d4 | ||
|
|
eb7df8993c | ||
|
|
0c0e09fb2d | ||
|
|
834921f50b | ||
|
|
f161417d64 | ||
|
|
98689253d0 | ||
|
|
2be2045403 | ||
|
|
332793e0a8 | ||
|
|
736f77087e | ||
|
|
274d25094d | ||
|
|
636249c142 | ||
|
|
7bf598573b | ||
|
|
09588fe45e | ||
|
|
3f95d1f3f1 | ||
|
|
87425e5db9 | ||
|
|
a7f1342ad7 | ||
|
|
680c4b8f2a | ||
|
|
c897647054 | ||
|
|
d4715fd1ad | ||
|
|
8c2a7cfeac | ||
|
|
b898b5761b | ||
|
|
c298b611d2 | ||
|
|
b43fd6a3c0 | ||
|
|
53fc9f5782 | ||
|
|
7e975f95b5 | ||
|
|
3ee64793cc | ||
|
|
45bb27cff4 | ||
|
|
b15d45731e | ||
|
|
f043b4e0d9 | ||
|
|
328bc26684 | ||
|
|
7a06a9e479 | ||
|
|
77f50aaa16 | ||
|
|
ca646f8243 | ||
|
|
b7efd787cb | ||
|
|
91e9278cba | ||
|
|
1b1598273d | ||
|
|
272b7fce34 | ||
|
|
72f0044f1a | ||
|
|
a22a2c4386 | ||
|
|
a7a3352bca | ||
|
|
38e12b5b95 | ||
|
|
10f3015d32 | ||
|
|
3e14637e3d | ||
|
|
a03c7f0681 | ||
|
|
2053e3281f | ||
|
|
625fd2a488 | ||
|
|
99178dacd1 | ||
|
|
947fe9ef99 | ||
|
|
d99da1039b | ||
|
|
94e507b607 | ||
|
|
eb7fe9572d | ||
|
|
4f9dae3d0e | ||
|
|
dc650533f4 | ||
|
|
6521b012b3 | ||
|
|
c75fb703d2 | ||
|
|
ab250abfdb | ||
|
|
37111f2233 | ||
|
|
c4fa5713a2 | ||
|
|
657b2c7b65 | ||
|
|
b702ff6564 | ||
|
|
fb1dc90367 | ||
|
|
e57b39b430 | ||
|
|
cc0e87a0cd | ||
|
|
dd5bc10c72 | ||
|
|
092c7d139b | ||
|
|
137114d62a | ||
|
|
01f88ce2a8 | ||
|
|
243aba8c51 | ||
|
|
5211e526ec | ||
|
|
c5483f81db | ||
|
|
d8f4afdca5 | ||
|
|
6ef90dcd9d | ||
|
|
9eb14ac309 | ||
|
|
949b5db030 | ||
|
|
f42c062c08 | ||
|
|
42e23d0162 | ||
|
|
8794818492 | ||
|
|
412c88fb33 | ||
|
|
855d29af0c | ||
|
|
f9757c7f7a | ||
|
|
74eea33f1d | ||
|
|
0e9146a5c5 | ||
|
|
895c05669b | ||
|
|
7cd7719f9b | ||
|
|
c76e6142c2 | ||
|
|
dc63e6da74 | ||
|
|
affb07b513 | ||
|
|
4ea324f493 | ||
|
|
156acb308d | ||
|
|
e9237858b1 | ||
|
|
42cf056d57 | ||
|
|
a16bde6dae | ||
|
|
8b24b648c7 | ||
|
|
df9f5f97af | ||
|
|
8766ee44d6 | ||
|
|
1ab0c5b13d | ||
|
|
90dfcd0ad3 | ||
|
|
72e4b4f0cb | ||
|
|
633519ac3a | ||
|
|
7b4db3d325 | ||
|
|
305dd1d6a2 | ||
|
|
5a4eb4d297 | ||
|
|
8f81c1c4c3 | ||
|
|
5d6ae3fc2d | ||
|
|
faf133212e | ||
|
|
3c170edee3 | ||
|
|
736885c999 | ||
|
|
b9d8faff99 | ||
|
|
74fec650f6 | ||
|
|
c24ffb6b7c | ||
|
|
280c4e2592 | ||
|
|
88b31df121 | ||
|
|
fdd67171bd | ||
|
|
826d023608 | ||
|
|
925f6217ce | ||
|
|
7c12473940 | ||
|
|
44315a3d75 | ||
|
|
ebcbc1b2b5 | ||
|
|
1fb471872f | ||
|
|
5a890b32dc | ||
|
|
8cc10e6634 | ||
|
|
11f68bdac7 | ||
|
|
6751b6667b | ||
|
|
7b1786d7fe | ||
|
|
04fb442a7a | ||
|
|
0e4f81b7f4 | ||
|
|
b7e0196aa7 | ||
|
|
2fdfb8900d | ||
|
|
251a9925d2 | ||
|
|
59e8c4d89f | ||
|
|
49930e3f6a | ||
|
|
4021324465 | ||
|
|
b6930a2056 | ||
|
|
1821af8963 | ||
|
|
f33d9e7d53 | ||
|
|
879e38773b | ||
|
|
c4d0b985e3 | ||
|
|
6a8c438907 | ||
|
|
0e38151087 | ||
|
|
3766d14b0c | ||
|
|
9fcfe8f85d | ||
|
|
6c7c2e456c | ||
|
|
23fb6bc837 | ||
|
|
191bab4b36 | ||
|
|
3f9665531b | ||
|
|
3535170fa1 | ||
|
|
2129df6d5f | ||
|
|
f6fdaafe42 | ||
|
|
b2d07e6e30 | ||
|
|
1ae6eb33e9 | ||
|
|
f0d9a40f59 | ||
|
|
4ef5f5427d | ||
|
|
7ac03aa9d0 | ||
|
|
07c69b34ea | ||
|
|
d2c3cda897 | ||
|
|
8456cf37e3 | ||
|
|
2f1d7d5f6c | ||
|
|
6e87362a85 | ||
|
|
36de4ee5a2 | ||
|
|
63b6ff0f27 | ||
|
|
78e9f55363 | ||
|
|
9845ba6d83 | ||
|
|
d0c1e957f9 | ||
|
|
8c4a5584b9 | ||
|
|
0100fa1c93 | ||
|
|
38118de339 | ||
|
|
95b9097a3e | ||
|
|
8765ea2733 | ||
|
|
b3f019ed98 | ||
|
|
bd92591b7b | ||
|
|
e6178dfa65 | ||
|
|
2412a29226 | ||
|
|
c80b487052 | ||
|
|
4ca4047418 | ||
|
|
c30151607a | ||
|
|
6df48c0f7f | ||
|
|
d67c459153 | ||
|
|
47f5aade80 | ||
|
|
e06e1db9b0 | ||
|
|
6bfc426e63 | ||
|
|
04be1d3efd | ||
|
|
4b57a9dcd5 | ||
|
|
0a065403d5 | ||
|
|
0b598ddfb1 | ||
|
|
b5ef7c7278 | ||
|
|
8ed348342c | ||
|
|
aeb966b798 | ||
|
|
0d9ca4aa94 | ||
|
|
3529860fd2 | ||
|
|
a03ee39fd7 | ||
|
|
dca448d139 | ||
|
|
8947c5b8c7 | ||
|
|
572570b0f1 | ||
|
|
95d200bf3d | ||
|
|
3f58dd2dd2 | ||
|
|
c60672a710 | ||
|
|
16b6469277 | ||
|
|
cf18df1a94 | ||
|
|
ce6766ba9f | ||
|
|
0f517dd0e7 | ||
|
|
d3be3f9c4f | ||
|
|
efd1537a07 | ||
|
|
33c9290916 | ||
|
|
853c6a8452 | ||
|
|
5526fdb02c | ||
|
|
df05c3a3d6 | ||
|
|
40d414f791 | ||
|
|
0cf8492eab | ||
|
|
4619bf1722 | ||
|
|
6c52598bfb | ||
|
|
69330c5799 | ||
|
|
67781c7f18 | ||
|
|
482ddb50e8 | ||
|
|
6b937f3248 | ||
|
|
04ddc46cd5 | ||
|
|
51ce00eebe | ||
|
|
611c1414dc | ||
|
|
5ad1bea18b | ||
|
|
57339f81be | ||
|
|
82762ede0d | ||
|
|
4e324f3d18 | ||
|
|
8ab10fb3a1 | ||
|
|
f9a9543726 | ||
|
|
62223cebfd | ||
|
|
6104c14cfd | ||
|
|
6fb7284483 | ||
|
|
7c373c2edb | ||
|
|
82390070c1 | ||
|
|
c5bfa7332a | ||
|
|
e0e9dffee8 | ||
|
|
b5cfd5410e | ||
|
|
7b0e49753e | ||
|
|
6a04e6e29a | ||
|
|
9b2ca1bf90 | ||
|
|
2f2089e114 | ||
|
|
b78a542d28 | ||
|
|
08ce89a394 | ||
|
|
e4416db22b | ||
|
|
b5e195499a | ||
|
|
eb1d8deeff | ||
|
|
cb37cc60b9 | ||
|
|
83277d8a0c | ||
|
|
e28f1a653c | ||
|
|
c23c0248e1 | ||
|
|
82c064d4d9 | ||
|
|
5dc2d1ea7b | ||
|
|
f072dc5ba3 | ||
|
|
370af9b5fa | ||
|
|
aff71647aa | ||
|
|
b6ffbdae70 | ||
|
|
214c588bc1 | ||
|
|
da91ccda1c | ||
|
|
1d64b9e958 | ||
|
|
bbe507c740 | ||
|
|
c36da1cf8e | ||
|
|
54172e7065 | ||
|
|
5a145b69f8 | ||
|
|
20d861bd21 | ||
|
|
dc2ba58371 | ||
|
|
e800a445ae | ||
|
|
eadfc0feb3 | ||
|
|
bf5a6f6c3b | ||
|
|
4862dec4d9 | ||
|
|
56960ef0c0 | ||
|
|
3d5c8467c2 | ||
|
|
3fb8a697a0 | ||
|
|
c165587b54 | ||
|
|
e661570fbd | ||
|
|
28ff0a01df | ||
|
|
86075ea908 | ||
|
|
9ed638eb6b | ||
|
|
4054f8d273 | ||
|
|
d44a9e2634 | ||
|
|
e0cdb4020d | ||
|
|
74dadc162f | ||
|
|
e53c25807f | ||
|
|
ca64bded7c | ||
|
|
0709b46a63 | ||
|
|
e3be97f48e | ||
|
|
82f0db990f | ||
|
|
b2d17c0704 | ||
|
|
47fd6bd077 | ||
|
|
8837dc7a6c | ||
|
|
e35f05d037 | ||
|
|
5b3d595030 | ||
|
|
dfa9e7357e | ||
|
|
1a63ffbe5a | ||
|
|
5238b0776a | ||
|
|
28cfda6b96 | ||
|
|
eeae93881d | ||
|
|
5ef2db2754 | ||
|
|
d3a1612294 | ||
|
|
ee619a99a6 | ||
|
|
31c4944988 | ||
|
|
94aeedd9b0 | ||
|
|
3fbe2bd73b | ||
|
|
ff6f46dbd2 | ||
|
|
dc312da663 | ||
|
|
c0b8538dfe | ||
|
|
9935c43076 | ||
|
|
0b5b7d4984 | ||
|
|
23387f0fcc | ||
|
|
afe7a13e3c | ||
|
|
5eb7f17b84 | ||
|
|
9b7b0184c8 | ||
|
|
3f64f35b50 | ||
|
|
58e0b0556a | ||
|
|
0f69d96b8f | ||
|
|
3cc7151326 | ||
|
|
4191852fcb | ||
|
|
e049486b44 | ||
|
|
5fc945c32e | ||
|
|
a021f7984e | ||
|
|
9a3fbe874e | ||
|
|
b1b86e7093 | ||
|
|
5ea3018b02 | ||
|
|
3f336a21f4 | ||
|
|
ac28911137 | ||
|
|
c04d6e5414 | ||
|
|
0745ab63cf | ||
|
|
bce42023b1 | ||
|
|
b852055460 | ||
|
|
f1acd2b4b1 | ||
|
|
77c62b3059 | ||
|
|
206305fa40 | ||
|
|
9a7f798933 | ||
|
|
3cabbb6919 | ||
|
|
ab0645fe4c | ||
|
|
60adf6e369 | ||
|
|
5ca12a752e | ||
|
|
5fe6420620 | ||
|
|
fd5ae2b847 | ||
|
|
d1f3854b99 | ||
|
|
f444ba6651 | ||
|
|
2214fd99e8 | ||
|
|
35c5d54a76 | ||
|
|
4fd6d70b71 | ||
|
|
f67d771ea4 | ||
|
|
0fc5cc4442 | ||
|
|
9b1d5753eb | ||
|
|
34d5a178ae | ||
|
|
6cfb68796e | ||
|
|
dcdf4e82e5 | ||
|
|
9f3e2ae06d | ||
|
|
0793dccefa | ||
|
|
5d7350279b | ||
|
|
44d242d4aa | ||
|
|
bae25db654 | ||
|
|
a66aacb48d | ||
|
|
b7d861466a | ||
|
|
f17c3d4763 | ||
|
|
3ed8832a85 | ||
|
|
11f8d68cc3 | ||
|
|
52551d7357 | ||
|
|
9d777db805 | ||
|
|
1f3c68ad79 | ||
|
|
34be7d88b0 | ||
|
|
62dc2e55d5 | ||
|
|
492579a5d1 | ||
|
|
025ce42f56 | ||
|
|
6fef055c62 | ||
|
|
eae6b6b8eb | ||
|
|
23d4e3cf18 | ||
|
|
41bcbe55b9 | ||
|
|
63e9af8cc2 | ||
|
|
40ef251948 | ||
|
|
ad7d90c070 | ||
|
|
3b165d9e2f | ||
|
|
190e3cb3a0 | ||
|
|
8a759a67e4 | ||
|
|
d6edbf4e57 | ||
|
|
c8ab92f6dc | ||
|
|
6e2209f6e0 | ||
|
|
fadc9ffcf4 | ||
|
|
10b627f68c | ||
|
|
34e29aaf84 | ||
|
|
016dbef779 | ||
|
|
d95dae7282 | ||
|
|
b274be6adc | ||
|
|
975008a951 | ||
|
|
893c292150 | ||
|
|
3857f5d3ee | ||
|
|
e09277cdc2 | ||
|
|
37c24c0625 | ||
|
|
354d7e8c22 | ||
|
|
2409d8f4e0 | ||
|
|
df0e96d9ac | ||
|
|
fae8008269 | ||
|
|
a6a3599455 | ||
|
|
86983e9c9c | ||
|
|
b2c5d21322 | ||
|
|
161c89060e | ||
|
|
d14dbe80c9 | ||
|
|
c7a08a2f04 | ||
|
|
b104b1997a | ||
|
|
06ac5624ab | ||
|
|
7572e4eb1e | ||
|
|
eb34cb7cb2 | ||
|
|
6fc3ff4750 | ||
|
|
cbed9517bc | ||
|
|
2ca9158f15 | ||
|
|
5b77f36ae4 | ||
|
|
289d805bdc | ||
|
|
ed159425a5 | ||
|
|
f701de6e47 | ||
|
|
8f159de428 | ||
|
|
54aa763d01 | ||
|
|
df39cf1e4f | ||
|
|
3a74eb3d86 | ||
|
|
46603ce0f2 | ||
|
|
3c6f3ab3bf | ||
|
|
02761cabac | ||
|
|
72ff019c46 | ||
|
|
f2256e36a1 | ||
|
|
0772483396 | ||
|
|
4956969ef5 | ||
|
|
ed6901fe74 | ||
|
|
f981f1ea39 | ||
|
|
04bc5acf53 | ||
|
|
35c49cb4b7 | ||
|
|
bcd4ad4c24 | ||
|
|
c3f99c0914 | ||
|
|
67a85ccf49 | ||
|
|
7df3657de8 | ||
|
|
0d4b589f86 | ||
|
|
fb608ea6ff | ||
|
|
3b05ec8666 | ||
|
|
9463798787 | ||
|
|
92f1e90079 | ||
|
|
8b60cb2457 | ||
|
|
0527428f6c | ||
|
|
508ff7d041 | ||
|
|
53cdb49ba8 | ||
|
|
cdb76b1c18 | ||
|
|
8ed6bd1bfc | ||
|
|
028efc13c9 | ||
|
|
115234d93b | ||
|
|
34afbc348d | ||
|
|
8842b7e8b8 | ||
|
|
b10d8e0ec6 | ||
|
|
1ec66d5732 | ||
|
|
084691a29a | ||
|
|
d083dc041e | ||
|
|
c0c30ca012 | ||
|
|
65fbf9958d | ||
|
|
c0a6739981 | ||
|
|
81fdef1991 | ||
|
|
dc0dbb29ff | ||
|
|
aa98c2fff5 | ||
|
|
5c935f03fe | ||
|
|
b44e25c8ee | ||
|
|
822f5624b1 | ||
|
|
60f2fdd7cb | ||
|
|
6518f92be7 | ||
|
|
f674d32c4e | ||
|
|
e81c9f80cd | ||
|
|
e1fffddf85 | ||
|
|
1ddc202fd0 | ||
|
|
9ed4bea12e | ||
|
|
cebc62066b | ||
|
|
ebba65c729 | ||
|
|
0373547a79 | ||
|
|
1076ca4bd8 | ||
|
|
fda5aed59c | ||
|
|
1393125ceb | ||
|
|
8557dbc1a7 | ||
|
|
c4ca2ec55c | ||
|
|
3090636827 | ||
|
|
804e2c1568 | ||
|
|
1a2b31e159 | ||
|
|
37e930f183 | ||
|
|
c2560af1e9 | ||
|
|
1d24d5c4f7 | ||
|
|
ce5e7a3f61 | ||
|
|
a1a7bd02f5 | ||
|
|
1068ffa0eb | ||
|
|
628887b426 | ||
|
|
ec7ba74900 | ||
|
|
e383d1d145 | ||
|
|
abe813b656 | ||
|
|
d690cf904c | ||
|
|
fe82de8bd5 | ||
|
|
7a943dc49a | ||
|
|
bc2278e89b | ||
|
|
2996f2313c | ||
|
|
d95c7288e9 | ||
|
|
43f7c0d23e | ||
|
|
616273eb43 | ||
|
|
aeca902517 | ||
|
|
652cd1c78a | ||
|
|
7ab19c15d9 | ||
|
|
35226f843c | ||
|
|
b8b02aabd3 | ||
|
|
6784f696af | ||
|
|
350b9ce7c8 | ||
|
|
5cbe7033c8 | ||
|
|
c15b4aa0c3 | ||
|
|
e7ff39bfc8 | ||
|
|
196ea82509 | ||
|
|
be38a9cdca | ||
|
|
aa4424b97f | ||
|
|
a1b4b34b39 | ||
|
|
b0ea1a6a53 | ||
|
|
ad9742abb4 | ||
|
|
53c8950947 | ||
|
|
edd89d2aaf | ||
|
|
718860f30e | ||
|
|
025533f734 | ||
|
|
8644a80d80 | ||
|
|
e8c51b6977 | ||
|
|
51305266e8 | ||
|
|
832c0753ce | ||
|
|
453fc865ee | ||
|
|
dead9fca70 | ||
|
|
7f048bbf57 | ||
|
|
6ae1e846ee | ||
|
|
4286dec1a1 | ||
|
|
6d3399ccb8 | ||
|
|
a3b547ab80 | ||
|
|
f80b0b3eac | ||
|
|
09b8975174 | ||
|
|
9cdba3b3e0 | ||
|
|
e6eba50913 | ||
|
|
7e6a3f4a1f | ||
|
|
faff3b9337 | ||
|
|
11e613ce05 | ||
|
|
04413be781 | ||
|
|
fa95755642 | ||
|
|
72f6521710 | ||
|
|
2a9012763e | ||
|
|
c06016bc5b | ||
|
|
b946c2842a | ||
|
|
356c6c76d2 | ||
|
|
27f466ae8d | ||
|
|
3f0f5ba019 | ||
|
|
1e4c3cec94 | ||
|
|
e21a57e76c | ||
|
|
7abe44c412 | ||
|
|
c24a0ccd66 | ||
|
|
9926d0fa80 | ||
|
|
b598e31ca3 | ||
|
|
0faae8cfad | ||
|
|
4535954699 | ||
|
|
e9d0a81e8e | ||
|
|
d6333aa476 | ||
|
|
5b702e1991 | ||
|
|
cb2ce4a8a3 | ||
|
|
82ab0e5367 | ||
|
|
d8506b4239 | ||
|
|
5ded1fc682 | ||
|
|
8f4010d0cf | ||
|
|
2319f033f7 | ||
|
|
9bf0b5ff70 | ||
|
|
c414fc6259 | ||
|
|
43d3d72620 | ||
|
|
800597ae2b | ||
|
|
291bef2007 | ||
|
|
39f1bbe436 | ||
|
|
43b5e66431 | ||
|
|
d21c3f33b6 | ||
|
|
a58b047723 | ||
|
|
9ef7c35ee0 | ||
|
|
3d4708bd68 | ||
|
|
7536b725b4 | ||
|
|
8101ef0c5a | ||
|
|
80d027ba12 | ||
|
|
fb0310b8f6 | ||
|
|
8482cb4ddc | ||
|
|
1700c3fa19 | ||
|
|
63fd69ad75 | ||
|
|
548be0303f | ||
|
|
8b39953242 | ||
|
|
6d0de809ec | ||
|
|
8c2a353096 | ||
|
|
a5d275147d | ||
|
|
12b6711a73 | ||
|
|
b0fd3e8295 | ||
|
|
80a7f348ad | ||
|
|
a56049b5db | ||
|
|
53e6168c8c | ||
|
|
b17e5140ce | ||
|
|
95d1a7cc30 | ||
|
|
b8b2dcb6fe | ||
|
|
504d124486 | ||
|
|
380daf4a00 | ||
|
|
248fadbf9d | ||
|
|
78a272d633 | ||
|
|
9174ce4b47 | ||
|
|
ec4dd70279 | ||
|
|
97093db976 | ||
|
|
2aba8381a8 | ||
|
|
5ce0a2213c | ||
|
|
d3599d5ed3 | ||
|
|
98939b4868 | ||
|
|
89df7486bd | ||
|
|
e9b42e1008 | ||
|
|
72578c94e5 | ||
|
|
2f20ec448d | ||
|
|
ddfab6f729 | ||
|
|
5ea154d45d | ||
|
|
1beb50b0f3 | ||
|
|
1539bd4698 | ||
|
|
10895fcdfd | ||
|
|
5f36059857 | ||
|
|
b04ae36466 | ||
|
|
1d433ee82a | ||
|
|
2ec27f40be | ||
|
|
d99b63f6cf | ||
|
|
37a064dc55 | ||
|
|
f8375dd9e0 | ||
|
|
38c523375b | ||
|
|
8bdc8a0bb7 | ||
|
|
ecaf8ab2e9 | ||
|
|
dbeaf1111d | ||
|
|
cb8f4d060b | ||
|
|
013b26e692 | ||
|
|
1db3d69571 | ||
|
|
272493dc31 | ||
|
|
75215e4909 | ||
|
|
d3b21a3ae7 | ||
|
|
9e9b46f4a2 | ||
|
|
b73f43e200 | ||
|
|
911f9a28b5 | ||
|
|
f76e77585c | ||
|
|
1ba45eb368 | ||
|
|
adfcc9a55c | ||
|
|
d3247ed266 | ||
|
|
3cc1dc5bb7 | ||
|
|
214901dfe6 | ||
|
|
ed6b6e169d | ||
|
|
295e8c2d9e | ||
|
|
ea4b3432c0 | ||
|
|
c2ebd96aab | ||
|
|
d80d488656 | ||
|
|
7e26836e48 | ||
|
|
64e5753381 | ||
|
|
78642492bf | ||
|
|
388fb57b7a | ||
|
|
fdde24d9e9 | ||
|
|
70a24dfa69 | ||
|
|
403af75f87 | ||
|
|
40444a3fe9 | ||
|
|
559215189a | ||
|
|
57ac13c87e | ||
|
|
018939d301 | ||
|
|
e1cf78ef2b | ||
|
|
b5eb3a0433 | ||
|
|
dd8b1c3635 | ||
|
|
c53a7a0368 | ||
|
|
3feaa262be | ||
|
|
7496af52d7 | ||
|
|
293f1f7d47 | ||
|
|
3f3533134c | ||
|
|
b505d6af02 | ||
|
|
3aac39c4f7 | ||
|
|
b1417f539d | ||
|
|
5f234ade12 | ||
|
|
1564d8b8c4 | ||
|
|
e64aba2c2c | ||
|
|
7129467410 | ||
|
|
504cc025a2 | ||
|
|
6906fada68 | ||
|
|
649e2a7a76 | ||
|
|
24c455cdc6 | ||
|
|
69806152aa | ||
|
|
1a22bc45c1 | ||
|
|
02a87fb94c | ||
|
|
55ba31c7d3 | ||
|
|
da34a6f7c1 | ||
|
|
6a4b29d6f6 | ||
|
|
dd55c60bd6 | ||
|
|
f735ec7d3e | ||
|
|
3e15668da5 | ||
|
|
75117cba49 | ||
|
|
0a1bf10fc3 | ||
|
|
6865aa2ff7 | ||
|
|
46292ef117 | ||
|
|
af74715a84 | ||
|
|
ad6a3fcf99 | ||
|
|
bed61fea08 | ||
|
|
0a34d99b6e | ||
|
|
6dbfa5897c | ||
|
|
9eee63b031 | ||
|
|
21106d98d0 | ||
|
|
8727a7a809 | ||
|
|
99612516b6 | ||
|
|
198f30b1ae | ||
|
|
fbc8a916ac | ||
|
|
4f295d01af | ||
|
|
e8554bcd03 | ||
|
|
749e095b04 | ||
|
|
45f47de514 | ||
|
|
174ba8951a | ||
|
|
d59793c752 | ||
|
|
6b93fd6e27 | ||
|
|
35b45c4045 | ||
|
|
cc61f8ab1f | ||
|
|
19a224d375 | ||
|
|
82e5b81fda | ||
|
|
ba493b07e7 | ||
|
|
8521b7133d | ||
|
|
153409f3b5 | ||
|
|
0a41cfeeac | ||
|
|
47b90c4939 | ||
|
|
4385b647c1 | ||
|
|
322c381ed4 | ||
|
|
88d5b5ac57 | ||
|
|
52835de6c9 | ||
|
|
39edba2ab3 | ||
|
|
bac9790dab | ||
|
|
eba395c22f | ||
|
|
9f59d9ce20 | ||
|
|
6110a9f8b7 | ||
|
|
111dc5950b | ||
|
|
f1f96516d0 | ||
|
|
0ed837ffda | ||
|
|
98bd33aa29 | ||
|
|
56af888ded | ||
|
|
9fa2e983ad | ||
|
|
c3e17f0df8 | ||
|
|
ddbd9a5b70 | ||
|
|
2f6c5433ce | ||
|
|
4bd1e59c20 | ||
|
|
598f3cbf8b | ||
|
|
4c7899dc1e | ||
|
|
97f5d60d7c | ||
|
|
16aeb4e6fe | ||
|
|
45d3cce3e6 | ||
|
|
8e5f474c1f | ||
|
|
aa1adcad3c | ||
|
|
570cd68d15 | ||
|
|
e3947e44bd | ||
|
|
9a1a93c25e | ||
|
|
c9ea556273 | ||
|
|
aee2c22afe | ||
|
|
f6bf0f3a96 | ||
|
|
3fc9f450f9 | ||
|
|
c26327306b | ||
|
|
5c10cfcb99 | ||
|
|
67f114cf29 | ||
|
|
2658e12c52 | ||
|
|
0a454a0967 | ||
|
|
9800d4a335 | ||
|
|
e3d00ebb68 | ||
|
|
c9fefe95aa | ||
|
|
fdb22bff37 | ||
|
|
3eba14e0a6 | ||
|
|
f2b5016920 | ||
|
|
3eedd0dd23 | ||
|
|
555babf34c | ||
|
|
ec165a9042 | ||
|
|
d4b2d251d6 | ||
|
|
78aecb52ca | ||
|
|
8eb17ec066 | ||
|
|
01c1899208 | ||
|
|
bec7eeaa33 | ||
|
|
dc49178002 | ||
|
|
ddf59c0756 | ||
|
|
6dc1e0de1c | ||
|
|
4dd401a0cb | ||
|
|
e60ef9d02e | ||
|
|
9f2a6f3265 | ||
|
|
36db9285f6 | ||
|
|
559ea53e69 | ||
|
|
f7ade9751e | ||
|
|
963e1ecc6c | ||
|
|
35ca583dc1 | ||
|
|
8b12debefe | ||
|
|
a0caa174d0 | ||
|
|
8bd2d74316 | ||
|
|
e6015f5db2 | ||
|
|
a227490dcb | ||
|
|
c0c5cf032d | ||
|
|
25c09589f2 | ||
|
|
22b273faf0 | ||
|
|
fd850636a5 | ||
|
|
2568cba699 | ||
|
|
2968ad5dd8 | ||
|
|
6311e0f8b0 | ||
|
|
7449779f37 | ||
|
|
459bc4f9ff | ||
|
|
a574514a41 | ||
|
|
ceb70ecefb | ||
|
|
bc0e021b3c | ||
|
|
19d372a4ad | ||
|
|
8a08dd3916 | ||
|
|
a672e1708f | ||
|
|
4b4407c3f9 | ||
|
|
2d1c7428b6 | ||
|
|
ad28f56744 | ||
|
|
a8c1c6b25f | ||
|
|
4a89da8067 | ||
|
|
386649b0bb | ||
|
|
e050489073 | ||
|
|
94895ef110 | ||
|
|
4c93c01d22 | ||
|
|
9228b44a94 | ||
|
|
7ace7892b1 | ||
|
|
f4dfdc46f1 | ||
|
|
cc8b0f70d6 |
@@ -1,23 +0,0 @@
|
||||
config BBF_VENDOR_EXTENSION
|
||||
bool "Enable Vendor Extension"
|
||||
default y
|
||||
|
||||
config BBF_VENDOR_LIST
|
||||
string "Vendor List"
|
||||
default "iopsys"
|
||||
|
||||
config BBF_VENDOR_PREFIX
|
||||
string "Vendor Prefix"
|
||||
default "X_IOPSYS_EU_"
|
||||
|
||||
config BBF_TR143
|
||||
bool "Enable TR-143 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBF_TR471
|
||||
bool "Enable TR-471 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBF_MAX_OBJECT_INSTANCES
|
||||
int "Maximum number of instances per object"
|
||||
default 255
|
||||
14
bbfdm/Config_bbfdmd.in
Normal file
14
bbfdm/Config_bbfdmd.in
Normal file
@@ -0,0 +1,14 @@
|
||||
if PACKAGE_bbfdmd
|
||||
|
||||
config BBF_VENDOR_PREFIX
|
||||
string "Vendor Prefix"
|
||||
default "X_IOPSYS_EU_"
|
||||
|
||||
config BBF_OBFUSCATION_KEY
|
||||
string "Obfuscation key"
|
||||
default "371d530c95a17d1ca223a29b7a6cdc97e1135c1e0959b51106cca91a0b148b5e42742d372a359760742803f2a44bd88fca67ccdcfaeed26d02ce3b6049cb1e04"
|
||||
|
||||
config BBF_MAX_OBJECT_INSTANCES
|
||||
int "Maximum number of instances per object"
|
||||
default 255
|
||||
endif
|
||||
264
bbfdm/Makefile
264
bbfdm/Makefile
@@ -5,14 +5,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.4.23.11
|
||||
PKG_VERSION:=1.12.21
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=3cdbb5432c3a76824cfc0262b35d479471cba12c
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_VERSION:=062c13e83387e3ad37d6caaffd47cf57a1db7c7f
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -21,88 +21,75 @@ PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
include bbfdm.mk
|
||||
|
||||
define Package/libbbfdm-api
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=BBF datamodel library, provides API to extend datamodel using DotSO plugins
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl
|
||||
ABI_VERSION:=1.0
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default
|
||||
define Package/libbbfdm-ubus
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Library for broadband forum data model support
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl +libbbfdm-api \
|
||||
+BBF_TR471:obudpst
|
||||
endef
|
||||
|
||||
define Package/libbbfdm
|
||||
$(Package/libbbfdm/default)
|
||||
TITLE += (default)
|
||||
VARIANT:=default
|
||||
DEPENDS += +PACKAGE_libbbfdm-openssl:libopenssl
|
||||
DEFAULT_VARIANT:=1
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-mbedtls
|
||||
$(Package/libbbfdm/default)
|
||||
TITLE += (mbedtls)
|
||||
DEPENDS += +PACKAGE_libbbfdm-mbedtls:libmbedtls
|
||||
VARIANT:=mbedtls
|
||||
CONFLICTS := libbbfdm libbbfdm-openssl libbbfdm-wolfssl
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-openssl
|
||||
$(Package/libbbfdm/default)
|
||||
TITLE += (openssl)
|
||||
DEPENDS += +PACKAGE_libbbfdm-openssl:libopenssl
|
||||
VARIANT:=openssl
|
||||
CONFLICTS := libbbfdm libbbfdm-mbedtls libbbfdm-wolfssl
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-wolfssl
|
||||
$(Package/libbbfdm/default)
|
||||
TITLE += (wolfssl)
|
||||
DEPENDS += +PACKAGE_libbbfdm-wolfssl:libwolfssl
|
||||
VARIANT:=wolfssl
|
||||
CONFLICTS := libbbfdm libbbfdm-mbedtls libbbfdm-openssl
|
||||
TITLE:=BBF datamodel ubus library, provides API to expose datamodel over ubus
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api
|
||||
endef
|
||||
|
||||
define Package/bbfdmd
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Datamodel ubus backend
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libbbfdm-api +PACKAGE_libbbfdm-mbedtls:libbbfdm-mbedtls \
|
||||
+PACKAGE_libbbfdm-openssl:libbbfdm-openssl +PACKAGE_libbbfdm-wolfssl:libbbfdm-wolfssl \
|
||||
+PACKAGE_libbbfdm:libbbfdm
|
||||
TITLE:=Datamodel ubus backend to expose core tree
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libopenssl +libbbfdm-ubus +bbf_configmngr
|
||||
endef
|
||||
|
||||
define Package/userinterface
|
||||
define Package/dm-service
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Package to add Device.UserInterface. datamodel support
|
||||
TITLE:=Datamodel ubus backend to expose micro-service tree
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libbbfdm-ubus +bbf_configmngr
|
||||
endef
|
||||
|
||||
define Package/userinterface/description
|
||||
Package to add Device.UserInterface. datamodel support
|
||||
define Package/bbf_configmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:= BBF Config Manager
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/config
|
||||
source "$(SOURCE)/Config_bbfdm.in"
|
||||
define Package/bbfdmd/config
|
||||
source "$(SOURCE)/Config_bbfdmd.in"
|
||||
endef
|
||||
|
||||
define Package/bbf_configmngr/config
|
||||
source "$(SOURCE)/bbf_configmngr.in"
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-api/description
|
||||
Library contains the API(UCI, UBUS, JSON, CLI and Browse) of libbbfdm
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/description
|
||||
Library contains the data model tree. It includes TR181, TR143 data models
|
||||
define Package/libbbfdm-ubus/description
|
||||
Library contains the APIs to expose data model over ubus
|
||||
endef
|
||||
|
||||
define Package/bbfdmd/description
|
||||
Daemon to expose Datamodel core tree
|
||||
endef
|
||||
|
||||
define Package/dm-service/description
|
||||
Daemon to expose Datamodel micro-service tree
|
||||
endef
|
||||
|
||||
define Package/bbf_configmngr/description
|
||||
Daemon for handling bbf reload services via ubus bbf.config
|
||||
endef
|
||||
|
||||
ifeq ($(USE_LOCAL),1)
|
||||
@@ -112,140 +99,97 @@ endef
|
||||
endif
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR181=ON
|
||||
-DBBF_WIFI_DATAELEMENTS=ON
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR143),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR143=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR471),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR471=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_EXTENSION=ON
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \
|
||||
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
|
||||
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES)
|
||||
|
||||
endif ##CONFIG_BBF_VENDOR_EXTENSION
|
||||
|
||||
ifeq ($(BUILD_VARIANT),default)
|
||||
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),openssl)
|
||||
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),wolfssl)
|
||||
CMAKE_OPTIONS += -DWITH_WOLFSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),mbedtls)
|
||||
CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_bbfdmd),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES) \
|
||||
-DBBFDMD_MAX_MSG_LEN:Integer=10485760
|
||||
endif
|
||||
|
||||
define Package/libbbfdm-api/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/libbbfdm-api.so $(1)/lib/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/libexec/rpcd/bbf.secure $(1)/usr/libexec/rpcd/bbf.secure
|
||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/libexec/rpcd/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm/scripts/
|
||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_api $(1)/usr/share/bbfdm/scripts/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/certificates
|
||||
echo "$(CONFIG_BBF_OBFUSCATION_KEY)" > $(1)/etc/bbfdm/.secure_hash
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default/install
|
||||
define Package/libbbfdm-ubus/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-ubus/libbbfdm-ubus.so $(1)/lib/
|
||||
endef
|
||||
|
||||
define Package/bbfdmd/install
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm/libbbfdm.so $(1)/lib/
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/95-portmap-firewall $(1)/etc/uci-defaults/95-portmap-firewall
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/97-firewall-service $(1)/etc/uci-defaults/97-firewall-service
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-link-core-plugins $(1)/etc/uci-defaults/99-link-core-plugins
|
||||
$(INSTALL_BIN) ./files/etc/firewall.portmap $(1)/etc/firewall.portmap
|
||||
$(INSTALL_BIN) ./files/etc/firewall.service $(1)/etc/firewall.service
|
||||
ifeq ($(CONFIG_BBF_TR143),y)
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
|
||||
$(INSTALL_CONF) ./files/etc/config/schedules $(1)/etc/config/schedules
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
|
||||
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/91-fix-bbfdmd-enabled-option $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
define Package/dm-service/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdm.services $(1)/etc/init.d/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dm-service/dm-service $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/bbf_configmngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
ifeq ($(CONFIG_BBF_CONFIGMNGR_C_BACKEND),y)
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/bbf_configd $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbf_configd $(1)/etc/init.d/bbf_configd
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm/scripts
|
||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_config_notify.sh $(1)/usr/share/bbfdm/scripts/
|
||||
endif
|
||||
ifeq ($(CONFIG_BBF_CONFIGMNGR_SCRIPT_BACKEND),y)
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libbbfdm/scripts/* $(1)/usr/share/bbfdm
|
||||
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/libexec/rpcd/bbf.config $(1)/usr/libexec/rpcd/bbf.config
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default/prerm
|
||||
define Package/bbfdmd/prerm
|
||||
#!/bin/sh
|
||||
rm -rf /etc/bbfdm/dmmap/*
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/bbfdmd/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/input.json $(1)/etc/bbfdm/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
|
||||
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
|
||||
$(INSTALL_BIN) ./files/etc/bbfdm/bbfdm_services.sh $(1)/etc/bbfdm/
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
|
||||
endef
|
||||
|
||||
define Package/userinterface/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(INSTALL_DATA) ./files/etc/config/userinterface $(1)/etc/config/userinterface
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/userinterface $(1)/lib/upgrade/keep.d/userinterface
|
||||
$(INSTALL_BIN) ./files/etc/init.d/userinterface $(1)/etc/init.d/userinterface
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/93-userinterface-firewall $(1)/etc/uci-defaults/93-userinterface-firewall
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/94-userinterface-json $(1)/etc/uci-defaults/94-userinterface-json
|
||||
$(INSTALL_BIN) ./files/etc/firewall.userinterface $(1)/etc/firewall.userinterface
|
||||
endef
|
||||
|
||||
Package/libbbfdm/prerm = $(Package/libbbfdm/default/prerm)
|
||||
Package/libbbfdm-openssl/prerm = $(Package/libbbfdm/default/prerm)
|
||||
Package/libbbfdm-wolfssl/prerm = $(Package/libbbfdm/default/prerm)
|
||||
Package/libbbfdm-mbedtls/prerm = $(Package/libbbfdm/default/prerm)
|
||||
|
||||
Package/libbbfdm/install = $(Package/libbbfdm/default/install)
|
||||
Package/libbbfdm-openssl/install = $(Package/libbbfdm/default/install)
|
||||
Package/libbbfdm-wolfssl/install = $(Package/libbbfdm/default/install)
|
||||
Package/libbbfdm-mbedtls/install = $(Package/libbbfdm/default/install)
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm-api
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbf_api
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/include/*.h $(1)/usr/include/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm/dmtree/tr181/device.h $(1)/usr/include/libbbfdm/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm/dmtree/vendor/vendor.h $(1)/usr/include/libbbfdm/
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm-ubus
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/*.h $(1)/usr/include/libbbfdm-api/
|
||||
# Work around for backward compatibility
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/*.h $(1)/usr/include/libbbf_api/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/include/libbbfdm_api.h $(1)/usr/include/libbbf_api.h
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-ubus/bbfdm-ubus.h $(1)/usr/include/libbbfdm-ubus/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/include/*.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/libbbfdm-api.so $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-ubus/libbbfdm-ubus.so $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bbf_configmngr))
|
||||
$(eval $(call BuildPackage,libbbfdm-api))
|
||||
$(eval $(call BuildPackage,libbbfdm))
|
||||
$(eval $(call BuildPackage,libbbfdm-openssl))
|
||||
$(eval $(call BuildPackage,libbbfdm-wolfssl))
|
||||
$(eval $(call BuildPackage,libbbfdm-mbedtls))
|
||||
$(eval $(call BuildPackage,libbbfdm-ubus))
|
||||
$(eval $(call BuildPackage,bbfdmd))
|
||||
|
||||
$(eval $(call BuildPackage,userinterface))
|
||||
$(eval $(call BuildPackage,dm-service))
|
||||
|
||||
38
bbfdm/README.md
Normal file
38
bbfdm/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# BBFDM configuration options and utilities
|
||||
|
||||
bbfdm provides few compile time configuration options and compile time help utility called [bbfdm.mk](./bbfdm.mk), this document aimed to explain the available usages and best practices.
|
||||
|
||||
## Compilation options
|
||||
|
||||
| Configuration option | Description | Default Value |
|
||||
| ----------------------- | ------------- | ----------- |
|
||||
| CONFIG_BBF_VENDOR_LIST | List of vendor extension directories | iopsys |
|
||||
| CONFIG_BBF_VENDOR_PREFIX | Prefix for Vendor extension datamodel objects/parameters | X_IOPSYS_EU_ |
|
||||
| CONFIG_BBF_MAX_OBJECT_INSTANCES | Maximum number of instances per object | 255 |
|
||||
| BBF_OBFUSCATION_KEY | Hash used to encode/decode in `bbf.secure` object | 371d530c95a17d1ca223a29b7a6cdc97e1135c1e0959b51106cca91a0b148b5e42742d372a359760742803f2a44bd88fca67ccdcfaeed26d02ce3b6049cb1e04 |
|
||||
|
||||
|
||||
#### BBF_OBFUSCATION_KEY
|
||||
|
||||
`bbfdm` provides an ubus object called `bbf.secure` to allow encoding/decoding the values, `bbf.secure` currently support following methods internally to encode/decode
|
||||
|
||||
- Encode/Decode using a predefined SHA512 Hash key
|
||||
- Encode/Decode using a private/public RSA key pair
|
||||
|
||||
The `BBF_OBFUSCATION_KEY` compile time configuration option used to defined the SHA512 HASH, if this option is undefined, then it usages a default value as mention in the above table.
|
||||
|
||||
User must override this parameter with their own hash value, to generate a hash user can run below command and copy the hash value to this option.
|
||||
|
||||
ex: User wants to use 'Sup3rS3cur3Passw0rd' as passkey, then can get the SHA512 sum with
|
||||
|
||||
```bash
|
||||
$ echo -n "Sup3rS3cur3Passw0rd" | sha512sum
|
||||
371d530c95a17d1ca223a29b7a6cdc97e1135c1e0959b51106cca91a0b148b5e42742d372a359760742803f2a44bd88fca67ccdcfaeed26d02ce3b6049cb1e04 -
|
||||
```
|
||||
|
||||
> Note: Additionally, user can install RSA private key in '/etc/bbfdm/certificates/private_key.pem' path, if private key is present `bbf.secure` shall use rsa private certificate for encrypt/decrypt function. In case of key not present in the pre-defined path, hash will be used for the same.
|
||||
|
||||
## Helper utility (bbfdm.mk)
|
||||
|
||||
bbfdm provides a helper utility [bbfdm.mk](./bbfdm.mk) to install datamodel plugins in bbfdm core or in microservice directory.
|
||||
|
||||
19
bbfdm/bbf_configmngr.in
Normal file
19
bbfdm/bbf_configmngr.in
Normal file
@@ -0,0 +1,19 @@
|
||||
if PACKAGE_bbf_configmngr
|
||||
choice
|
||||
prompt "Select backend daemon for bbf.config"
|
||||
default BBF_CONFIGMNGR_C_BACKEND
|
||||
help
|
||||
Select which backend daemon should be used for ubus bbf.config
|
||||
|
||||
config BBF_CONFIGMNGR_SCRIPT_BACKEND
|
||||
bool "Use shell script backend"
|
||||
help
|
||||
Enable this option to use shell script as the backend for bbf.config. This can be useful for quick and easy scripting of configuration tasks.
|
||||
|
||||
config BBF_CONFIGMNGR_C_BACKEND
|
||||
bool "Use C code backend"
|
||||
help
|
||||
Enable this option to use a C code implementation as the backend for bbf.config. This option is generally preferred for performance-critical tasks and scenarios requiring more robust and efficient handling.
|
||||
|
||||
endchoice
|
||||
endif
|
||||
105
bbfdm/bbfdm.mk
105
bbfdm/bbfdm.mk
@@ -2,8 +2,113 @@
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
BBFDM_BASE_DM_PATH=/usr/share/bbfdm
|
||||
BBFDM_INPUT_PATH=/etc/bbfdm/micro_services
|
||||
BBFDM_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
#BBFDM_VERSION:=$(shell grep -oP '(?<=^PKG_VERSION:=).*' ${BBFDM_DIR}/Makefile)
|
||||
#BBFDM_TOOLS:=$(BUILD_DIR)/bbfdm-$(BBFDM_VERSION)/tools
|
||||
|
||||
# Utility to install the plugin in bbfdm core path with priority.
|
||||
# Its now possible to overwrite/remove core datamodel with plugin, so, if some
|
||||
# datamodel objects/parameters are present in more than one plugin, order in
|
||||
# which they loaded into memory becomes crucial, this Utility help to configure
|
||||
# a priority order in which they gets loaded in memory.
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => Plugin artifact
|
||||
# $2 => package install directory
|
||||
# $3 => Priority of the installed plugin (Optional)
|
||||
#
|
||||
# Note:
|
||||
# - Last loaded plugin gets the highest priority
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_CORE_PLUGIN ./files/etc/bbfdm/json/CWMPManagementServer.json $(1)
|
||||
#
|
||||
# Example to install plugin with priority:
|
||||
# BBFDM_INSTALL_CORE_PLUGIN ./files/etc/bbfdm/json/CWMPManagementServer.json $(1) 01
|
||||
#
|
||||
BBFDM_INSTALL_CORE_PLUGIN:=$(BBFDM_DIR)/tools/bbfdm.sh -p
|
||||
|
||||
|
||||
# Utility to install the micro-service datamodel
|
||||
# Use Case:
|
||||
# user wants to run a datamodel micro-service, it required to install the
|
||||
# DotSO/JSON plugin into a bbf shared directory, this utility helps in
|
||||
# installing the DotSO/JSON plugin in bbfdm shared directory, and auto-generate
|
||||
# input file for the micro-service
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => DotSo or Json plugin with complete path
|
||||
# $2 => package install directory
|
||||
# $3 => service name
|
||||
#
|
||||
# Note:
|
||||
# - There could be only one main plugin file, so its bind to PKG_NAME
|
||||
# - Micro-service input.json will be auto generated with this call
|
||||
# - Use -u (optional argument) to overwrite ubus object name
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_MS_DM $(PKG_BUILD_DIR)/libcwmp.so $(1) $(PKG_NAME)
|
||||
#
|
||||
BBFDM_INSTALL_MS_DM:=$(BBFDM_DIR)/tools/bbfdm.sh -m
|
||||
|
||||
|
||||
# Utility to install a plugins in datamodel micro-service
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => DotSo or Json plugin with complete path
|
||||
# $2 => package install directory
|
||||
# $3 => service name
|
||||
#
|
||||
# Note:
|
||||
# - Use the service_name/PKG_NAME of the service in which this has to run
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_MS_PLUGIN $(PKG_BUILD_DIR)/libxmpp.so $(1) icwmp
|
||||
#
|
||||
BBFDM_INSTALL_MS_PLUGIN:=$(BBFDM_DIR)/tools/bbfdm.sh -m -p
|
||||
|
||||
# Utility to install the helper scripts in default bbfdm script path
|
||||
#
|
||||
# Use Case:
|
||||
# User want to install some script for running diagnostics
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => Script with complete path
|
||||
# $2 => package install directory
|
||||
#
|
||||
# Note:
|
||||
# - Use with -d option to install script in bbf.diag directory
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_SCRIPT $(PKG_BUILD_DIR)/download $(1)
|
||||
# BBFDM_INSTALL_SCRIPT -d $(PKG_BUILD_DIR)/ipping $(1)
|
||||
#
|
||||
BBFDM_INSTALL_SCRIPT:=$(BBFDM_DIR)/tools/bbfdm.sh -s
|
||||
|
||||
# Deprecated functions errors
|
||||
define BbfdmInstallPluginInMicroservice
|
||||
$(warning # BbfdmInstallPluginInMicroservice function is deprecated, use BBFDM_INSTALL_MS_PLUGIN macro #)
|
||||
$(INSTALL_DIR) $(1)
|
||||
$(INSTALL_DATA) $(2) $(1)/
|
||||
endef
|
||||
|
||||
define BbfdmInstallMicroServiceInputFile
|
||||
$(warning # function BbfdmInstallMicroServiceInputFile deprecated, input file auto generated with BBFDM_INSTALL_MS_DM #)
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/micro_services
|
||||
$(INSTALL_DATA) $(2) $(1)/etc/bbfdm/micro_services/$(PKG_NAME).json
|
||||
endef
|
||||
|
||||
define BbfdmInstallPlugin
|
||||
$(warning # function BbfdmInstallPlugin deprecated, use BBFDM_INSTALL_CORE_PLUGIN macro #)
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/plugins
|
||||
$(INSTALL_DATA) $(2) $(1)/etc/bbfdm/plugins/
|
||||
endef
|
||||
|
||||
define BbfdmInstallPluginWithPriority
|
||||
$(warning # fucntion BbfdmInstallPluginWithPriority deprecated, use BBFDM_INSTALL_CORE_PLUGIN #)
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/plugins
|
||||
$(INSTALL_DATA) $(3) $(1)/etc/bbfdm/plugins/$(2)_$(shell basename ${3})
|
||||
endef
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
BBFDMD="/usr/sbin/bbfdmd"
|
||||
|
||||
bbfdm_add_service()
|
||||
{
|
||||
local name path
|
||||
|
||||
name="${1}"
|
||||
path="${2}"
|
||||
|
||||
if [ -z "${name}" -o -z "$path" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
ubus call service add "{'name':'bbfdm.services','instances':{'$name':{'command':['$BBFDMD','-m','$path']}}}"
|
||||
}
|
||||
|
||||
bbfdm_stop_service()
|
||||
{
|
||||
local name
|
||||
|
||||
name="${1}"
|
||||
if [ -z "${name}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if ubus call service list '{"name":"bbfdm.services"}' |grep -q "bbfdm.$name"; then
|
||||
ubus call service delete "{'name':'bbfdm.services','instance':'bbfdm.$name'}"
|
||||
fi
|
||||
}
|
||||
|
||||
usages()
|
||||
{
|
||||
echo "Usages $0: <OPTIONS>..."
|
||||
echo
|
||||
echo " -h show help"
|
||||
echo " -k micro-service name to stop"
|
||||
echo
|
||||
}
|
||||
|
||||
while getopts "s:k:h" opts; do
|
||||
case "$opts" in
|
||||
h) usages; exit 0;;
|
||||
k) bbfdm_stop_service "${OPTARG}";;
|
||||
esac
|
||||
done
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"daemon": {
|
||||
"config": {
|
||||
},
|
||||
"input": {
|
||||
"type": "DotSo",
|
||||
"name": "/lib/libbbfdm.so",
|
||||
"plugin_dir": "/etc/bbfdm/plugins"
|
||||
},
|
||||
"output": {
|
||||
"type": "UBUS",
|
||||
"name": "bbfdm"
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"config": {
|
||||
"proto": "both",
|
||||
"instance_mode": 0
|
||||
},
|
||||
"input": {
|
||||
"type": "UBUS",
|
||||
"name": "bbfdm"
|
||||
},
|
||||
"output": {
|
||||
"type": "CLI"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
config bbfdmd 'bbfdmd'
|
||||
option enabled '1'
|
||||
option loglevel '1'
|
||||
option refresh_time '10'
|
||||
option transaction_timeout '30'
|
||||
option subprocess_level '2'
|
||||
option enable '1'
|
||||
option debug '0'
|
||||
option loglevel '3'
|
||||
|
||||
config micro_services 'micro_services'
|
||||
option enable '1'
|
||||
option enable_core '0'
|
||||
|
||||
2
bbfdm/files/etc/config/schedules
Normal file
2
bbfdm/files/etc/config/schedules
Normal file
@@ -0,0 +1,2 @@
|
||||
config global 'global'
|
||||
option enable '1'
|
||||
36
bbfdm/files/etc/init.d/bbf_configd
Normal file
36
bbfdm/files/etc/init.d/bbf_configd
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/bbf_configd
|
||||
|
||||
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()
|
||||
{
|
||||
create_needed_directories
|
||||
|
||||
procd_open_instance "bbf_configd"
|
||||
procd_set_param command ${PROG}
|
||||
#procd_append_param command -ddd
|
||||
procd_set_param respawn
|
||||
procd_close_instance "bbf_configd"
|
||||
}
|
||||
|
||||
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
|
||||
done
|
||||
}
|
||||
109
bbfdm/files/etc/init.d/bbfdm.services
Normal file
109
bbfdm/files/etc/init.d/bbfdm.services
Normal file
@@ -0,0 +1,109 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=60
|
||||
STOP=8
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/dm-service
|
||||
|
||||
BBFDM_MICROSERVICE_DIR="/etc/bbfdm/micro_services"
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t bbfdmd.services -p info
|
||||
}
|
||||
|
||||
validate_bbfdm_micro_service_section()
|
||||
{
|
||||
uci_validate_section bbfdm micro_services "micro_services" \
|
||||
'enable:bool:true' \
|
||||
'enable_core:bool:false'
|
||||
}
|
||||
|
||||
_add_microservice()
|
||||
{
|
||||
local name path loglevel
|
||||
local enable enable_core
|
||||
|
||||
# Check enable from micro-service
|
||||
path="${1}"
|
||||
enable_core="${2}"
|
||||
|
||||
name="$(basename ${path})"
|
||||
name="${name//.json}"
|
||||
|
||||
json_load_file "${path}"
|
||||
json_select daemon
|
||||
|
||||
json_get_var enable enable 1
|
||||
if [ "${enable}" -eq "0" ]; then
|
||||
log "datamodel micro-service ${name} not enabled"
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_select config
|
||||
json_get_var loglevel loglevel 3
|
||||
|
||||
procd_open_instance "${name}"
|
||||
|
||||
procd_set_param command ${PROG}
|
||||
procd_append_param command -m "${name}"
|
||||
procd_append_param command -l "${loglevel}"
|
||||
|
||||
if [ "${enable_core}" -eq "1" ]; then
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
fi
|
||||
|
||||
procd_set_param respawn
|
||||
procd_close_instance "${name}"
|
||||
}
|
||||
|
||||
configure_bbfdm_micro_services()
|
||||
{
|
||||
local enable enable_core
|
||||
|
||||
config_load bbfdm
|
||||
validate_bbfdm_micro_service_section || {
|
||||
log "Validation of micro_service section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ "${enable}" -eq "0" ] && return 0
|
||||
|
||||
if [ -d "${BBFDM_MICROSERVICE_DIR}" ]; then
|
||||
FILES="$(ls -1 ${BBFDM_MICROSERVICE_DIR}/*.json)"
|
||||
|
||||
for file in $FILES;
|
||||
do
|
||||
[ -e "$file" ] || continue
|
||||
|
||||
_add_microservice $file "${enable_core}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_start_single_service()
|
||||
{
|
||||
local service file
|
||||
|
||||
service="${1}"
|
||||
|
||||
if [ -d "${BBFDM_MICROSERVICE_DIR}" ]; then
|
||||
file="$(ls -1 ${BBFDM_MICROSERVICE_DIR}/${service}.json)"
|
||||
[ -e "$file" ] || return
|
||||
|
||||
_add_microservice $file "0"
|
||||
fi
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
_start_single_service "${1}"
|
||||
else
|
||||
configure_bbfdm_micro_services
|
||||
fi
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=65
|
||||
START=97
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/bbfdmd
|
||||
|
||||
BBFDM_JSON_INPUT="/etc/bbfdm/input.json"
|
||||
BBFDM_TEMP_JSON="/tmp/bbfdm/input.json"
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t bbfdmd.init -p info
|
||||
@@ -16,58 +15,39 @@ log() {
|
||||
validate_bbfdm_bbfdmd_section()
|
||||
{
|
||||
uci_validate_section bbfdm bbfdmd "bbfdmd" \
|
||||
'enabled:bool:true' \
|
||||
'sock:string' \
|
||||
'enable:bool:true' \
|
||||
'debug:bool:false' \
|
||||
'loglevel:uinteger:1' \
|
||||
'refresh_time:uinteger:0' \
|
||||
'transaction_timeout:uinteger:30' \
|
||||
'subprocess_level:uinteger'
|
||||
'loglevel:uinteger:3'
|
||||
}
|
||||
|
||||
configure_bbfdmd()
|
||||
{
|
||||
local enabled debug sock update
|
||||
local enable debug
|
||||
local jlog jrefresh jtimeout jlevel
|
||||
|
||||
update=0
|
||||
config_load bbfdm
|
||||
validate_bbfdm_bbfdmd_section || {
|
||||
log "Validation of bbfdmd section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ "${enabled}" -eq 0 ] && return 0
|
||||
|
||||
if [ -f "${BBFDM_JSON_INPUT}" ]; then
|
||||
echo "$(jq --arg log ${loglevel} --arg tran ${transaction_timeout} --arg refresh ${refresh_time} --arg level ${subprocess_level} '.daemon.config += {"loglevel": $log, "refresh_time": $refresh, "transaction_timeout": $tran, "subprocess_level": $level}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON}
|
||||
fi
|
||||
[ "${enable}" -eq 0 ] && return 0
|
||||
|
||||
procd_set_param command ${PROG}
|
||||
procd_append_param command -l "${loglevel}"
|
||||
|
||||
if [ "${debug}" -eq 1 ]; then
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
fi
|
||||
|
||||
if [ -f "${sock}" ]; then
|
||||
procd_append_param command -s "${sock}"
|
||||
fi
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
mkdir -p /tmp/bbfdm
|
||||
procd_open_instance "bbfdm"
|
||||
configure_bbfdmd
|
||||
procd_set_param respawn
|
||||
procd_close_instance "bbfdm"
|
||||
|
||||
ubus call service state '{"name":"bbfdm.services", "spawn":true}'
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
ubus call service state '{"name":"bbfdm.services", "spawn":false}'
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
local enable
|
||||
|
||||
config_load userinterface
|
||||
config_get_bool enable global enable 1
|
||||
|
||||
if [ ! -f "/etc/config/nginx" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${enable}" -eq "1" ]; then
|
||||
ubus call service state '{"name":"nginx", "spawn":true}'
|
||||
else
|
||||
ubus call service state '{"name":"nginx", "spawn":false}'
|
||||
fi
|
||||
|
||||
# Inject firewall rules
|
||||
procd_open_instance userinterface
|
||||
/etc/firewall.userinterface
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "userinterface" "nginx"
|
||||
}
|
||||
11
bbfdm/files/etc/uci-defaults/91-fix-bbfdmd-enabled-option
Normal file
11
bbfdm/files/etc/uci-defaults/91-fix-bbfdmd-enabled-option
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# rename bbfdmd enabled option to enable
|
||||
val="$(uci -q get bbfdm.bbfdmd.enabled)"
|
||||
if [ -n "${val}" ]; then
|
||||
uci -q set bbfdm.bbfdmd.enabled=""
|
||||
uci -q set bbfdm.bbfdmd.enable="${val}"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This deletes the userinterface json plugin if exists in case of upgrade
|
||||
if [ -f "/etc/bbfdm/json/UserInterface.json" ]; then
|
||||
rm /etc/bbfdm/json/UserInterface.json
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
UNIFIED_PATH="/etc/bbfdm/plugins/"
|
||||
|
||||
# Link JSON plugins
|
||||
for f in `ls -1 /etc/bbfdm/json/*.json`; do
|
||||
echo "# BBFDM JSON plugin ${f} not aligned #"
|
||||
ln -s ${f} "${UNIFIED_PATH}"
|
||||
done
|
||||
|
||||
# Link DotSo plugins
|
||||
for f in `ls -1 /usr/lib/bbfdm/*.so`; do
|
||||
echo "# BBFDM DotSO plugin ${f} not aligned #"
|
||||
ln -s ${f} "${UNIFIED_PATH}"
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/etc/nginx/allow_host_*
|
||||
174
bbfdm/tools/bbfdm.sh
Executable file
174
bbfdm/tools/bbfdm.sh
Executable file
@@ -0,0 +1,174 @@
|
||||
#!/bin/bash
|
||||
|
||||
BBFDM_BASE_DM_PATH="usr/share/bbfdm"
|
||||
BBFDM_INPUT_PATH="etc/bbfdm/micro_services"
|
||||
INPUT_TEMPLATE='{"daemon":{"enable":"1","service_name":"template","config":{"loglevel":"3"}}}'
|
||||
OUT_NAME=""
|
||||
|
||||
MICRO_SERVICE=0
|
||||
SCRIPT=0
|
||||
DIAG=0
|
||||
PLUGIN=0
|
||||
DEST=""
|
||||
TOOLS="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
SRC=""
|
||||
|
||||
while getopts ":mpsdu:" opt; do
|
||||
case ${opt} in
|
||||
m)
|
||||
MICRO_SERVICE=1
|
||||
;;
|
||||
p)
|
||||
PLUGIN=1
|
||||
;;
|
||||
s)
|
||||
SCRIPT=1
|
||||
;;
|
||||
d)
|
||||
DIAG=1
|
||||
;;
|
||||
u)
|
||||
OUT_NAME="${OPTARG}"
|
||||
;;
|
||||
?)
|
||||
echo "Invalid option: ${OPTARG}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
SRC="${1}"
|
||||
shift
|
||||
DEST="${1}"
|
||||
shift
|
||||
DATA="${1}"
|
||||
|
||||
install_bin() {
|
||||
if ! install -m0755 ${1} ${2}; then
|
||||
echo "Failed to install bin ${1} => ${2}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_dir() {
|
||||
if ! install -d -m0755 ${1}; then
|
||||
echo "Failed to create directory ${1}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_data() {
|
||||
if ! install -m0644 ${1} ${2}; then
|
||||
echo "Failed to install ${1} => ${2}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Installing datamodel
|
||||
bbfdm_install_dm()
|
||||
{
|
||||
local src dest minfile
|
||||
|
||||
src="$1"
|
||||
dest="$2"
|
||||
minfile=""
|
||||
|
||||
if [ -z ${src} ] || [ -z "${dest}" ] || [ -z "${TOOLS}" ]; then
|
||||
echo "Invalid input option for install dm $@"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${src}" ]; then
|
||||
echo "File $src does not exists..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${src##*.}" = "json" ]; then
|
||||
echo "Compacting BBFDM JSON file"
|
||||
minfile=$(mktemp)
|
||||
jq -c 'del(..|.description?)' ${src} > ${minfile}
|
||||
|
||||
src=${minfile}
|
||||
if dpkg -s python3-jsonschema >/dev/null 2>&1; then
|
||||
echo "Verifying bbfdm Datamodel JSON file"
|
||||
if ! ${TOOLS}/validate_plugins.py ${src}; then
|
||||
echo "Validation of the plugin failed ${src}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "## Install python3-jsonschema to verify datamodel plugins"
|
||||
fi
|
||||
fi
|
||||
|
||||
install_bin ${src} ${dest}
|
||||
|
||||
if [ -f "${minfile}" ]; then
|
||||
rm ${minfile}
|
||||
fi
|
||||
}
|
||||
|
||||
bbfdm_generate_input()
|
||||
{
|
||||
local dest ser
|
||||
|
||||
dest_dir=${1}
|
||||
ser=${2}
|
||||
dest=${dest_dir}/${ser}.json
|
||||
|
||||
if [ -n "${OUT_NAME}" ]; then
|
||||
echo ${INPUT_TEMPLATE} | jq --arg service "${ser}" --arg OUT "${OUT_NAME}" '.daemon |= (.service_name = $service |.output.name = $OUT)' > ${dest}
|
||||
else
|
||||
echo ${INPUT_TEMPLATE} | jq --arg service "${ser}" '.daemon.service_name = $service' > ${dest}
|
||||
fi
|
||||
|
||||
chmod 466 ${dest}
|
||||
}
|
||||
|
||||
if [ -z "$SRC" ] || [ -z "${DEST}" ] ; then
|
||||
echo "# BBFDM Null value in src[${SRC}], dest[${DEST}]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${SCRIPT}" -eq "1" ]; then
|
||||
if [ "${DIAG}" -eq "1" ]; then
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/bbf_diag
|
||||
install_bin ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/bbf_diag/
|
||||
else
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/scripts
|
||||
install_bin ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${MICRO_SERVICE}" -eq "1" ]; then
|
||||
if [ -z "${DATA}" ]; then
|
||||
echo "# service_name[${DATA}] not provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${PLUGIN}" -ne "1" ]; then
|
||||
extn="$(basename ${SRC})"
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}.${extn##*.}
|
||||
|
||||
# main micro-service datamodel plugin, create an input file as well
|
||||
install_dir ${DEST}/${BBFDM_INPUT_PATH}
|
||||
bbfdm_generate_input ${DEST}/${BBFDM_INPUT_PATH}/ ${DATA}
|
||||
else
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/micro_services/${DATA}/$(basename ${SRC})
|
||||
fi
|
||||
else
|
||||
if [ "${PLUGIN}" -eq "1" ]; then
|
||||
priority="${DATA:-0}"
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/plugins
|
||||
if [ "${priority}" -gt "0" ]; then
|
||||
# install with priority if defined
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/plugins/${priority}_$(basename ${SRC})
|
||||
else
|
||||
bbfdm_install_dm ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/plugins/$(basename ${SRC})
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
330
bbfdm/tools/validate_plugins.py
Executable file
330
bbfdm/tools/validate_plugins.py
Executable file
@@ -0,0 +1,330 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Copyright (C) 2024 iopsys Software Solutions AB
|
||||
# Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
|
||||
|
||||
import sys
|
||||
import json
|
||||
from jsonschema import validate
|
||||
|
||||
JSON_PLUGIN_VERSION = 0
|
||||
|
||||
obj_schema = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"object"
|
||||
]
|
||||
},
|
||||
"map_type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"uci",
|
||||
"ubus"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"version" : {"type": "string"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}},
|
||||
"uniqueKeys" : {"type" : "array"},
|
||||
"access" : {"type" : "boolean"},
|
||||
"array" : {"type" : "boolean"},
|
||||
"mapping" : {"type" : "object", "properties" : {
|
||||
"type" : {"$ref": "#/definitions/map_type_t"},
|
||||
"uci" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"},
|
||||
"section" : {"type": "object", "properties" : {
|
||||
"type" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"dmmapfile" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"ubus" : {"type" : "object", "properties" : {
|
||||
"object" : {"type": "string"},
|
||||
"method" : {"type": "string"},
|
||||
"args" : {"type": "object"},
|
||||
"key" : {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"protocols",
|
||||
"array",
|
||||
"access"
|
||||
]
|
||||
}
|
||||
|
||||
obj_schema_v1 = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"object"
|
||||
]
|
||||
},
|
||||
"map_type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"uci",
|
||||
"ubus"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"cwmp",
|
||||
"usp",
|
||||
"none"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"version" : {"type": "string"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}},
|
||||
"uniqueKeys" : {"type" : "array"},
|
||||
"access" : {"type" : "boolean"},
|
||||
"array" : {"type" : "boolean"},
|
||||
"mapping" : {"type" : "array", "items" : {
|
||||
"type" : "object", "properties" : {
|
||||
"type" : {"$ref": "#/definitions/map_type_t"},
|
||||
"uci" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"},
|
||||
"section" : {"type": "object", "properties" : {
|
||||
"type" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"dmmapfile" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"ubus" : {"type" : "object", "properties" : {
|
||||
"object" : {"type": "string"},
|
||||
"method" : {"type": "string"},
|
||||
"args" : {"type": "object"},
|
||||
"key" : {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"protocols",
|
||||
"array",
|
||||
"access"
|
||||
]
|
||||
}
|
||||
|
||||
param_schema = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"string",
|
||||
"unsignedInt",
|
||||
"unsignedLong",
|
||||
"int",
|
||||
"long",
|
||||
"boolean",
|
||||
"dateTime",
|
||||
"hexBinary",
|
||||
"base64",
|
||||
"decimal"
|
||||
]
|
||||
},
|
||||
"map_type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"uci",
|
||||
"ubus",
|
||||
"procfs",
|
||||
"sysfs",
|
||||
"json",
|
||||
"uci_sec"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"cwmp",
|
||||
"usp",
|
||||
"none"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}},
|
||||
"read" : {"type" : "boolean"},
|
||||
"write" : {"type" : "boolean"},
|
||||
"mapping" : {"type" : "array", "items" : {"type": "object", "properties" : {
|
||||
"type" : {"$ref": "#/definitions/map_type_t"},
|
||||
"uci" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"},
|
||||
"section" : {"type": "object", "properties" : {
|
||||
"type" : {"type": "string"},
|
||||
"index" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"option" : {"type": "object", "properties" : {
|
||||
"name" : {"type": "string"} }
|
||||
}
|
||||
}
|
||||
},
|
||||
"ubus" : {"type" : "object", "properties" : {
|
||||
"object" : {"type": "string"},
|
||||
"method" : {"type": "string"},
|
||||
"args" : {"type": "object"},
|
||||
"key" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"procfs" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"}
|
||||
}
|
||||
},
|
||||
"sysfs" : {"type" : "object", "properties" : {
|
||||
"file" : {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"protocols",
|
||||
"read",
|
||||
"write"
|
||||
]
|
||||
}
|
||||
|
||||
event_schema = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"event"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"usp"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"version" : {"type": "string"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"protocols"
|
||||
]
|
||||
}
|
||||
|
||||
command_schema = {
|
||||
"definitions": {
|
||||
"type_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"command"
|
||||
]
|
||||
},
|
||||
"protocols_t": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"usp"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"type" : {"$ref": "#/definitions/type_t"},
|
||||
"async" : {"type" : "boolean"},
|
||||
"protocols" : {"type" : "array", "items" : {"$ref": "#/definitions/protocols_t"}},
|
||||
"input" : {"type" : "object"},
|
||||
"output" : {"type" : "object"}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"async",
|
||||
"protocols"
|
||||
]
|
||||
}
|
||||
|
||||
def print_validate_json_usage():
|
||||
print("Usage: " + sys.argv[0] + " <dm json file>")
|
||||
print("Examples:")
|
||||
print(" - " + sys.argv[0] + " datamodel.json")
|
||||
print(" ==> Validate the json file")
|
||||
print("")
|
||||
exit(1)
|
||||
|
||||
def parse_value( key , value ):
|
||||
|
||||
if key.endswith('.') and not key.startswith('Device.'):
|
||||
print(key + " is not a valid path")
|
||||
exit(1)
|
||||
|
||||
if key.endswith('.') and (JSON_PLUGIN_VERSION == 1 or JSON_PLUGIN_VERSION == 2):
|
||||
__schema = obj_schema_v1
|
||||
elif key.endswith('.'):
|
||||
__schema = obj_schema
|
||||
elif key.endswith('!'):
|
||||
__schema = event_schema
|
||||
elif key.endswith('()'):
|
||||
__schema = command_schema
|
||||
else:
|
||||
__schema = param_schema
|
||||
|
||||
validate(instance = value, schema = __schema)
|
||||
|
||||
for k, v in value.items():
|
||||
if k != "list" and k != "mapping" and k != "input" and k != "output" and isinstance(v, dict):
|
||||
parse_value(k, v)
|
||||
|
||||
### main ###
|
||||
if len(sys.argv) < 2:
|
||||
print_validate_json_usage()
|
||||
|
||||
json_file = open(sys.argv[1], "r", encoding='utf-8')
|
||||
try:
|
||||
json_data = json.loads(json_file.read())
|
||||
except ValueError:
|
||||
print(sys.argv[1] + " file has a wrong JSON format!!!!!")
|
||||
exit(1)
|
||||
|
||||
for __key, __value in json_data.items():
|
||||
|
||||
if __key == "json_plugin_version":
|
||||
|
||||
if not isinstance(__value, int) or __value not in [0, 1, 2]:
|
||||
raise ValueError("Invalid value for json_plugin_version")
|
||||
|
||||
JSON_PLUGIN_VERSION = __value
|
||||
continue
|
||||
|
||||
parse_value(__key , __value)
|
||||
|
||||
print("JSON File is Valid")
|
||||
17
bridgemngr/Config.in
Normal file
17
bridgemngr/Config.in
Normal file
@@ -0,0 +1,17 @@
|
||||
if PACKAGE_bridgemngr
|
||||
|
||||
menu "Configuration"
|
||||
|
||||
config BRIDGEMNGR_BRIDGE_VLAN
|
||||
bool "Use bridge-vlan backend"
|
||||
help
|
||||
Set this option to use bridge-vlan as backend for VLAN objects.
|
||||
|
||||
config BRIDGEMNGR_BRIDGE_VENDOR_EXT
|
||||
bool "Use bridge BBF vendor extensions"
|
||||
default y
|
||||
help
|
||||
Set this option to use bridge BBF vendor extensions.
|
||||
|
||||
endmenu
|
||||
endif
|
||||
63
bridgemngr/Makefile
Normal file
63
bridgemngr/Makefile
Normal file
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bridgemngr
|
||||
PKG_VERSION:=1.0.7
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/bridgemngr
|
||||
PKG_SOURCE_VERSION:=4f22b4a4270c8d9b94b9de6f5cbe2a1dd86a3027
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/bridgemngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Bridge Manager
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
define Package/bridgemngr/description
|
||||
Package to add Device.Bridging. data model support.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\"
|
||||
|
||||
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VLAN),y)
|
||||
TARGET_CFLAGS += -DBRIDGE_VLAN_BACKEND
|
||||
endif
|
||||
|
||||
define Package/bridgemngr/install
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libbridgemngr.so $(1) $(PKG_NAME)
|
||||
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_EXT), y)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libbridgeext.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) ./files/VLAN_Filtering_Extension.json $(1) $(PKG_NAME)
|
||||
endif
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) ~/git/bridgemngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,bridgemngr))
|
||||
31
bridgemngr/files/VLAN_Filtering_Extension.json
Normal file
31
bridgemngr/files/VLAN_Filtering_Extension.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"json_plugin_version": 2,
|
||||
"Device.Bridging.Bridge.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": true,
|
||||
"array": true,
|
||||
"{BBF_VENDOR_PREFIX}VLANFiltering": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
"description": "Enable or disable VLAN Filtering on this bridge.",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "uci_sec",
|
||||
"key": "vlan_filtering"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulkdata
|
||||
PKG_VERSION:=2.1.3
|
||||
PKG_VERSION:=2.1.14
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bulkdata.git
|
||||
PKG_SOURCE_VERSION:=f556410b51a2248f11358793f11ae54d3e53e85e
|
||||
PKG_SOURCE_VERSION:=93c9e87cb9f8f635cece1473cff6f67cff9ff7c0
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -22,13 +22,19 @@ PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
define Package/bulkdata
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=BBF BulkData Collection
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +libblobmsg-json +zlib
|
||||
DEPENDS:=+ubus +libuci +libubox +libjson-c +libcurl +libblobmsg-json +zlib
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus
|
||||
endef
|
||||
|
||||
define Package/bulkdata/description
|
||||
BulkData daemon for TR069 with bbfdm backend.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
@@ -41,12 +47,13 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
define Package/bulkdata/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/bulkdata
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbf_plugin/*.json $(1)/etc/bulkdata
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
|
||||
$(INSTALL_DATA) ./files/etc/config/bulkdata $(1)/etc/config/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bulkdatad $(1)/etc/init.d/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,bulkdata))
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"daemon": {
|
||||
"input": {
|
||||
"type": "JSON",
|
||||
"name": "/etc/bulkdata/bulkdata.json"
|
||||
},
|
||||
"output": {
|
||||
"type": "UBUS",
|
||||
"name": "bbfdm.bulkdata",
|
||||
"parent_dm": "Device.",
|
||||
"object": "BulkData",
|
||||
"root_obj": "bbfdm"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,34 +3,28 @@
|
||||
START=60
|
||||
STOP=10
|
||||
|
||||
. /etc/bbfdm/bbfdm_services.sh
|
||||
|
||||
USE_PROCD=1
|
||||
PROG="/usr/sbin/bulkdatad"
|
||||
BULKDATA_JSON_INPUT="/etc/bulkdata/input.json"
|
||||
|
||||
start_service() {
|
||||
local enable
|
||||
|
||||
config_load bulkdata
|
||||
config_get_bool enable bulkdata enable 1
|
||||
|
||||
[ "$enable" -eq "1" ] && {
|
||||
procd_open_instance "bulkdata"
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_close_instance "bulkdata"
|
||||
}
|
||||
|
||||
bbfdm_add_service "bbfdm.bulkdata" "${BULKDATA_JSON_INPUT}"
|
||||
procd_open_instance "bulkdata"
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_close_instance "bulkdata"
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
ret=$(ubus call service list '{"name":"bulkdatad"}' | jsonfilter -qe '@.bulkdatad.instances.bulkdata.running')
|
||||
if [ "$ret" != "true" ]; then
|
||||
stop
|
||||
start
|
||||
else
|
||||
ubus send bulkdata.reload
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger bulkdata
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
PROFILE_COUNT=1
|
||||
|
||||
get_next_count()
|
||||
{
|
||||
local config="$1"
|
||||
local default_name="${2}"
|
||||
local count=${3}
|
||||
local found=0
|
||||
|
||||
if [ -z "$count" ]; then
|
||||
count=1
|
||||
fi
|
||||
|
||||
while [ "${found}" -ne 1 ]; do
|
||||
uci -q get "${config}"."${default_name}"_${count} >/dev/null
|
||||
if [ "$?" -eq 0 ]; then
|
||||
count=$((count + 1))
|
||||
else
|
||||
found=1;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${default_name}_${count}"
|
||||
}
|
||||
|
||||
translate_profile_id_to_profile_name() {
|
||||
local section="${1}"
|
||||
local profile_id="${2}"
|
||||
local profile_name="${3}"
|
||||
local curr_profile_id
|
||||
|
||||
config_get curr_profile_id "${section}" profile_id
|
||||
|
||||
[ -n "${curr_profile_id}" ] || return
|
||||
|
||||
[ "${curr_profile_id}" != "${profile_id}" ] && return
|
||||
|
||||
uci -q set bulkdata."${section}".profile_name="${profile_name}"
|
||||
uci -q set bulkdata."${section}".profile_id=""
|
||||
}
|
||||
|
||||
update_profile_sections() {
|
||||
local section="${1}"
|
||||
local default="${2}"
|
||||
local profile_name
|
||||
|
||||
config_get profile_id "${section}" profile_id
|
||||
|
||||
[ -n "${profile_id}" ] || return
|
||||
|
||||
case "${section}" in
|
||||
"cfg"*)
|
||||
profile_name="$(get_next_count bulkdata "${default}" ${PROFILE_COUNT})"
|
||||
uci_rename bulkdata "${section}" "${profile_name}"
|
||||
;;
|
||||
esac
|
||||
PROFILE_COUNT=$((PROFILE_COUNT + 1))
|
||||
|
||||
[ -n "$profile_name" ] && section="${profile_name}"
|
||||
|
||||
uci -q set bulkdata."${section}".profile_id=""
|
||||
|
||||
config_foreach translate_profile_id_to_profile_name profile_parameter "${profile_id}" "${profile_name}"
|
||||
config_foreach translate_profile_id_to_profile_name profile_http_request_uri_parameter "${profile_id}" "${profile_name}"
|
||||
}
|
||||
|
||||
config_load bulkdata
|
||||
config_foreach update_profile_sections profile profile
|
||||
uci commit bulkdata
|
||||
|
||||
exit 0
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=capiagent
|
||||
PKG_VERSION:=2.1.0
|
||||
PKG_VERSION:=2.1.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=3e671db8f567b19c109fc13b25bc571c4c73a962
|
||||
PKG_SOURCE_VERSION:=136cab3a9f1eec0132db9fa3f7bb1c8748ce1449
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/capiagent.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -31,7 +31,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/capiagent
|
||||
TITLE+= capiagent (daemon implementing Wi-Fi Alliance's CAPI commands)
|
||||
DEPENDS= +libubox +libuci +libubus +libnl-genl +libeasy +libwifi \
|
||||
+libjson-c +libblobmsg-json +ubus +libieee1905
|
||||
+libjson-c +libblobmsg-json +ubus +libieee1905 +libwifiutils
|
||||
endef
|
||||
|
||||
define Package/capiagent/description
|
||||
|
||||
64
csmngr/Makefile
Normal file
64
csmngr/Makefile
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=csmngr
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5e50fe388fff29b08d895c1c580152cccfa290ad
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/csmngr.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_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_PACKAGE_libwifiutils \
|
||||
CONFIG_PACKAGE_libwifi
|
||||
|
||||
PKG_BUILD_DEPENDS := libwifi
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/csmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=WiFi channel selection manager
|
||||
DEPENDS:=+libwifiutils +libwifi +libuci +libubox +ubus +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/csmngr/description
|
||||
WiFi Auto Channel Selection manager.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/csmngr/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/csmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/csmngr $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,csmngr))
|
||||
21
csmngr/files/etc/init.d/csmngr
Executable file
21
csmngr/files/etc/init.d/csmngr
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=95
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/csmngr
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command ${PROG}
|
||||
# procd_set_param stderr 1 #for debugging only
|
||||
# procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
16
ddnsmngr/Config.in
Normal file
16
ddnsmngr/Config.in
Normal file
@@ -0,0 +1,16 @@
|
||||
if PACKAGE_ddnsmngr
|
||||
choice
|
||||
prompt "Select backend for dynamic DNS management"
|
||||
default DDNSMNGR_BACKEND_DDNSSCRIPT
|
||||
depends on PACKAGE_ddnsmngr
|
||||
help
|
||||
Select which package to use for dynamic DNS support
|
||||
|
||||
config DDNSMNGR_BACKEND_DDNSSCRIPT
|
||||
bool "Use ddns_script"
|
||||
|
||||
config DDNSMNGR_BACKEND_INADYN
|
||||
bool "Use inadyn"
|
||||
|
||||
endchoice
|
||||
endif
|
||||
78
ddnsmngr/Makefile
Normal file
78
ddnsmngr/Makefile
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddnsmngr
|
||||
PKG_VERSION:=1.0.9
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ddnsmngr.git
|
||||
PKG_SOURCE_VERSION:=5144e73fad92d23ae706894a4357436c3fe89355
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_DDNSMNGR_BACKEND_DDNSSCRIPT CONFIG_DDNSMNGR_BACKEND_INADYN
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Dynamic DNS manager
|
||||
DEPENDS:=+DDNSMNGR_BACKEND_DDNSSCRIPT:ddns-scripts +DDNSMNGR_BACKEND_INADYN:inadyn
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Manage dynamic DNS updation and provides Device.DynamicDNS. datamodel object based on TR181-2.16
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/ddnsmngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/etc/ddnsmngr/ddns
|
||||
$(INSTALL_DIR) $(1)/etc/ddnsmngr/servers
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddnsmngr
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_DATA) ./files/etc/config/ddnsmngr $(1)/etc/config/ddnsmngr
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-ddns-config-migrate $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/ddnsmngr $(1)/etc/init.d/ddnsmngr
|
||||
ifeq ($(CONFIG_DDNSMNGR_BACKEND_DDNSSCRIPT),y)
|
||||
$(INSTALL_BIN) ./files/usr/lib/ddns_script/ddnsmngr_service.sh $(1)/usr/lib/ddnsmngr/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns-script/usr/lib/ddnsmngr/ddnsmngr_updater.sh $(1)/usr/lib/ddnsmngr/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/ddns-script/server/* $(1)/etc/ddnsmngr/servers
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns-script/usr/libexec/rpcd/ddnsmngr $(1)/usr/libexec/rpcd/ddnsmngr
|
||||
endif
|
||||
ifeq ($(CONFIG_DDNSMNGR_BACKEND_INADYN),y)
|
||||
$(INSTALL_BIN) ./files/usr/lib/inadyn/ddnsmngr_service.sh $(1)/usr/lib/ddnsmngr/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/inadyn/server/* $(1)/etc/ddnsmngr/servers
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/inadyn/usr/libexec/rpcd/ddnsmngr $(1)/usr/libexec/rpcd/ddnsmngr
|
||||
endif
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libddnsmngr.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
23
ddnsmngr/files/etc/config/ddnsmngr
Normal file
23
ddnsmngr/files/etc/config/ddnsmngr
Normal file
@@ -0,0 +1,23 @@
|
||||
config ddnsmngr 'global'
|
||||
option configfile '/var/run/ddnsmngr/ddnsmngr.json'
|
||||
option ddns_dateformat '%F %R'
|
||||
option ddns_rundir '/var/run/ddnsmngr'
|
||||
option ddns_logdir '/var/log/ddnsmngr'
|
||||
option ddns_loglines '250'
|
||||
option upd_privateip '0'
|
||||
option use_curl '1'
|
||||
|
||||
config server 'ddns_server_1'
|
||||
option enabled '1'
|
||||
option service 'dynu.com'
|
||||
option name 'dynu.com'
|
||||
|
||||
config server 'ddns_server_2'
|
||||
option enabled '1'
|
||||
option service 'dyndns.org'
|
||||
option name 'dyndns.org'
|
||||
|
||||
config server 'ddns_server_3'
|
||||
option enabled '1'
|
||||
option service 'zoneedit.com'
|
||||
option name 'zoneedit.com'
|
||||
26
ddnsmngr/files/etc/init.d/ddnsmngr
Normal file
26
ddnsmngr/files/etc/init.d/ddnsmngr
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
. /usr/lib/ddnsmngr/ddnsmngr_service.sh
|
||||
|
||||
start_service() {
|
||||
start_ddnsmngr_service
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
stop_ddnsmngr_service
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger ddnsmngr
|
||||
add_ddnsmngr_triggers
|
||||
}
|
||||
170
ddnsmngr/files/etc/uci-defaults/01-ddns-config-migrate
Normal file
170
ddnsmngr/files/etc/uci-defaults/01-ddns-config-migrate
Normal file
@@ -0,0 +1,170 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
cl_id=1
|
||||
srv_id=1
|
||||
|
||||
function get_ddns_config_option() {
|
||||
local val
|
||||
|
||||
val="$(uci -q get ddns.${1}.${2})"
|
||||
|
||||
if [ -z "${val}" ] && [ -n "${3}" ]; then
|
||||
val="${3}"
|
||||
fi
|
||||
|
||||
echo "${val}"
|
||||
}
|
||||
|
||||
function config_supported_service() {
|
||||
if ! uci -q get ddnsmngr.global >/dev/null 2>&1; then
|
||||
uci -q set ddnsmngr.global="ddnsmngr"
|
||||
fi
|
||||
|
||||
servers=""
|
||||
|
||||
for i in $(find /etc/ddnsmngr/servers/ -name '*.json' | cut -d'/' -f 5 | sed "s/.json//")
|
||||
do
|
||||
if [ -z "${servers}" ]; then
|
||||
servers="${i}"
|
||||
else
|
||||
servers="${servers},${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
uci -q set ddnsmngr.global.supported_services="${servers}"
|
||||
}
|
||||
|
||||
function migrate_service_section() {
|
||||
client_sec=""
|
||||
enabled="$(get_ddns_config_option ${1} enabled "0")"
|
||||
service_name="$(get_ddns_config_option ${1} service_name)"
|
||||
interface="$(get_ddns_config_option ${1} interface)"
|
||||
ip_network="$(get_ddns_config_option ${1} ip_network)"
|
||||
username="$(get_ddns_config_option ${1} username)"
|
||||
password="$(get_ddns_config_option ${1} password)"
|
||||
lookup_host="$(get_ddns_config_option ${1} lookup_host)"
|
||||
use_ipv6="$(get_ddns_config_option ${1} use_ipv6 "0")"
|
||||
force_ipversion="$(get_ddns_config_option ${1} force_ipversion "0")"
|
||||
use_https="$(get_ddns_config_option ${1} use_https "0")"
|
||||
force_dnstcp="$(get_ddns_config_option ${1} force_dnstcp "0")"
|
||||
|
||||
if [ -z "${service_name}" ]; then
|
||||
uci -q delete ddns."${1}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# check server file is present in device
|
||||
if [ ! -f "/etc/ddnsmngr/servers/${service_name}.json" ]; then
|
||||
uci -q delete ddns."${1}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if client section is already added for this service
|
||||
clients=$(uci -q show ddnsmngr | grep "=client")
|
||||
client_count=$(echo "${clients}" | wc -l)
|
||||
|
||||
tmp=0
|
||||
while [ $tmp -lt $client_count ]
|
||||
do
|
||||
mngr_serv="$(uci -q get ddnsmngr.@client[$tmp].service_name)"
|
||||
mngr_intf="$(uci -q get ddnsmngr.@client[$tmp].interface)"
|
||||
mngr_netw="$(uci -q get ddnsmngr.@client[$tmp].ip_network)"
|
||||
mngr_user="$(uci -q get ddnsmngr.@client[$tmp].username)"
|
||||
mngr_ipv6="$(uci -q get ddnsmngr.@client[$tmp].use_ipv6)"
|
||||
mngr_forceip="$(uci -q get ddnsmngr.@client[$tmp].force_ipversion)"
|
||||
mngr_https="$(uci -q get ddnsmngr.@client[$tmp].use_https)"
|
||||
mngr_dnstcp="$(uci -q get ddnsmngr.@client[$tmp].force_dnstcp)"
|
||||
|
||||
[ -z "${mngr_ipv6}" ] && mngr_ipv6="0"
|
||||
[ -z "${mngr_forceip}" ] && mngr_forceip="0"
|
||||
[ -z "${mngr_https}" ] && mngr_https="0"
|
||||
[ -z "${mngr_dnstcp}" ] && mngr_dnstcp="0"
|
||||
|
||||
if [ "${mngr_serv}" == "${service_name}" ] && [ "${mngr_intf}" == "${interface}" ] && \
|
||||
[ "${mngr_netw}" == "${ip_network}" ] && [ "${mngr_user}" == "${username}" ] && \
|
||||
[ "${mngr_ipv6}" == "${use_ipv6}" ] && [ "${mngr_forceip}" == "${force_ipversion}" ] && \
|
||||
[ "${mngr_https}" == "${use_https}" ] && [ "${mngr_dnstcp}" == "${force_dnstcp}" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
tmp=$(( tmp + 1 ))
|
||||
done
|
||||
|
||||
if [ $tmp -ne $client_count ]; then
|
||||
i=0
|
||||
for client in $clients; do
|
||||
if [ $i -eq $tmp ]; then
|
||||
client_sec="$(echo $client | cut -d'=' -f 1 | cut -d'.' -f 2)"
|
||||
break
|
||||
fi
|
||||
i=$(( i + 1 ))
|
||||
done
|
||||
|
||||
if [ $enabled -eq 1 ]; then
|
||||
uci -q set ddnsmngr."${client_sec}".enabled="1"
|
||||
fi
|
||||
else
|
||||
client_sec=ddns_mig_client_"${cl_id}"
|
||||
|
||||
uci -q set ddnsmngr."${client_sec}"="client"
|
||||
uci -q set ddnsmngr."${client_sec}".enabled="${enabled}"
|
||||
uci -q set ddnsmngr."${client_sec}".service_name="${service_name}"
|
||||
uci -q set ddnsmngr."${client_sec}".interface="${interface}"
|
||||
uci -q set ddnsmngr."${client_sec}".ip_network="${ip_network}"
|
||||
uci -q set ddnsmngr."${client_sec}".username="${username}"
|
||||
uci -q set ddnsmngr."${client_sec}".password="${password}"
|
||||
uci -q set ddnsmngr."${client_sec}".use_ipv6="${use_ipv6}"
|
||||
uci -q set ddnsmngr."${client_sec}".force_ipversion="${force_ipversion}"
|
||||
uci -q set ddnsmngr."${client_sec}".use_https="${use_https}"
|
||||
uci -q set ddnsmngr."${client_sec}".force_dnstcp="${force_dnstcp}"
|
||||
|
||||
cl_id=$(( cl_id + 1 ))
|
||||
|
||||
# add server section if not added
|
||||
servers=$(uci -q show ddnsmngr | grep "service=\'${service_name}\'")
|
||||
if [ -z "${servers}" ]; then
|
||||
server_sec=ddns_mig_server_"${srv_id}"
|
||||
uci -q set ddnsmngr."${server_sec}"="server"
|
||||
uci -q set ddnsmngr."${server_sec}".enabled="1"
|
||||
uci -q set ddnsmngr."${server_sec}".service="${service_name}"
|
||||
uci -q set ddnsmngr."${server_sec}".name="${service_name}"
|
||||
|
||||
srv_id=$(( srv_id + 1 ))
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# if lookup_host is set then add host section
|
||||
if [ -n "${lookup_host}" ] && [ -n "${client_sec}" ]; then
|
||||
# check number of hosts present for this client
|
||||
host_count=$(uci -q show ddnsmngr | grep "dm_parent=\'${client_sec}\'" | wc -l)
|
||||
host_ix=$(( host_count + 1 ))
|
||||
host_sec="${client_sec}"_host_"${host_ix}"
|
||||
|
||||
uci -q set ddnsmngr."${host_sec}"="host"
|
||||
uci -q set ddnsmngr."${host_sec}".enabled="${enabled}"
|
||||
uci -q set ddnsmngr."${host_sec}".lookup_host="${lookup_host}"
|
||||
uci -q set ddnsmngr."${host_sec}".dm_parent="${client_sec}"
|
||||
fi
|
||||
|
||||
uci -q delete ddns."${1}"
|
||||
}
|
||||
|
||||
function migrate_ddns_config() {
|
||||
if [ ! -f "/etc/config/ddnsmngr" ]; then
|
||||
# Create ddnsmngr config file
|
||||
touch /etc/config/ddnsmngr
|
||||
fi
|
||||
|
||||
config_supported_service
|
||||
|
||||
config_load ddns
|
||||
config_foreach migrate_service_section service
|
||||
|
||||
uci -q commit ddns
|
||||
uci -q commit ddnsmngr
|
||||
}
|
||||
|
||||
migrate_ddns_config
|
||||
169
ddnsmngr/files/usr/lib/ddns_script/ddnsmngr_service.sh
Normal file
169
ddnsmngr/files/usr/lib/ddns_script/ddnsmngr_service.sh
Normal file
@@ -0,0 +1,169 @@
|
||||
#! /bin/sh
|
||||
|
||||
RUNDIR="/var/run/ddnsmngr"
|
||||
LOGDIR="/var/log/ddnsmngr"
|
||||
PROG="/usr/lib/ddnsmngr/ddnsmngr_updater.sh"
|
||||
CONFIGFILE="/var/run/ddnsmngr/ddnsmngr.json"
|
||||
CLIENT_INTFS=""
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
echo "$*"|logger -t ddnsmngr.init -p debug
|
||||
}
|
||||
|
||||
validate_host_section() {
|
||||
uci_validate_section ddnsmngr host "${1}" \
|
||||
'enabled:bool:0' \
|
||||
'lookup_host:string' \
|
||||
'dm_parent:string'
|
||||
}
|
||||
|
||||
validate_client_section() {
|
||||
uci_validate_section ddnsmngr client "${1}" \
|
||||
'enabled:bool:0' \
|
||||
'service_name:string' \
|
||||
'interface:string' \
|
||||
'ip_network:string' \
|
||||
'username:string' \
|
||||
'password:string' \
|
||||
'use_https:bool:0' \
|
||||
'force_dnstcp:bool:0' \
|
||||
'use_ipv6:bool:0' \
|
||||
'force_ipversion:bool:0'
|
||||
}
|
||||
|
||||
add_object() {
|
||||
local enabled lookup_host dm_parent use_ipv6 force_ipversion proc_info_file
|
||||
local service_name interface ip_network username password use_https force_dnstcp
|
||||
|
||||
validate_host_section "${1}" || {
|
||||
log "Validation of host section failed"
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "${enabled}" -ne 1 ] || [ -z "${dm_parent}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
validate_client_section "${dm_parent}" || {
|
||||
log "Validation of client section failed"
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "${enabled}" -ne 1 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
service_name=$(uci -q get ddnsmngr.${dm_parent}.service_name)
|
||||
if [ -z "${service_name}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
service_section=$(uci -q show ddnsmngr | grep "service=\'${service_name}\'" | cut -d'.' -f 2 | head -1)
|
||||
if [ -z "${service_section}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
service_enabled=$(uci -q get ddnsmngr.${service_section}.enabled)
|
||||
if [ "${service_enabled}" -ne 1 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
json_add_object
|
||||
json_add_string "interface" "${interface}"
|
||||
json_add_string "service_name" "${service_name}"
|
||||
json_add_string "username" "${username}"
|
||||
json_add_string "password" "${password}"
|
||||
json_add_string "lookup_host" "${lookup_host}"
|
||||
json_add_string "ip_network" "${ip_network}"
|
||||
json_add_string "proc_info_file" "${1}"
|
||||
json_add_string "use_ipv6" "${use_ipv6}"
|
||||
json_add_string "force_ipversion" "${force_ipversion}"
|
||||
json_add_string "use_https" "${use_https}"
|
||||
json_add_string "force_dnstcp" "${force_dnstcp}"
|
||||
json_close_object
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
if [ "${use_ipv6}" -eq 0 ]; then
|
||||
interface="wan"
|
||||
else
|
||||
interface="wan6"
|
||||
fi
|
||||
fi
|
||||
|
||||
for intf in $CLIENT_INTFS; do
|
||||
if [ "${intf}" == "${interface}" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
CLIENT_INTFS="${CLIENT_INTFS} ${interface}"
|
||||
}
|
||||
|
||||
start_ddnsmngr_service() {
|
||||
run_dir=$(uci -q get ddnsmngr.global.ddns_rundir)
|
||||
log_dir=$(uci -q get ddnsmngr.global.ddns_logdir)
|
||||
|
||||
if [ -n "${run_dir}" ]; then
|
||||
RUNDIR="${run_dir}"
|
||||
fi
|
||||
|
||||
if [ -n "${log_dir}" ]; then
|
||||
LOGDIR="${log_dir}"
|
||||
fi
|
||||
|
||||
mkdir -p "${RUNDIR}"
|
||||
mkdir -p "${LOGDIR}"
|
||||
|
||||
conf_file=$(uci -q get ddnsmngr.global.configfile)
|
||||
if [ -n "${conf_file}" ]; then
|
||||
CONFIGFILE="${conf_file}"
|
||||
fi
|
||||
|
||||
touch "${CONFIGFILE}"
|
||||
|
||||
if [ ! -f "${CONFIGFILE}" ]; then
|
||||
log "Can not create ${CONFIGFILE}, exit"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
json_init
|
||||
json_add_array "services"
|
||||
|
||||
config_load ddnsmngr
|
||||
config_foreach add_object host
|
||||
|
||||
json_close_array
|
||||
json_dump > "${CONFIGFILE}"
|
||||
|
||||
procd_open_instance ddnsmngr
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -c "${CONFIGFILE}"
|
||||
procd_append_param command -- start
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_ddnsmngr_service() {
|
||||
conf_file=$(uci -q get ddnsmngr.global.configfile)
|
||||
if [ -n "${conf_file}" ]; then
|
||||
CONFIGFILE="${conf_file}"
|
||||
fi
|
||||
|
||||
if [ ! -f "${CONFIGFILE}" ]; then
|
||||
log "${CONFIGFILE} not found, can't stop services if running any"
|
||||
fi
|
||||
|
||||
"$PROG" -c "${CONFIGFILE}" -- stop
|
||||
return 0
|
||||
}
|
||||
|
||||
add_ddnsmngr_triggers() {
|
||||
procd_open_trigger
|
||||
for intf in $CLIENT_INTFS; do
|
||||
# No need to handle other ifevents like ifupdate etc
|
||||
procd_add_interface_trigger "interface.*.up" $intf /etc/init.d/ddnsmngr restart
|
||||
procd_add_interface_trigger "interface.*.down" $intf /etc/init.d/ddnsmngr restart
|
||||
done
|
||||
procd_close_trigger
|
||||
}
|
||||
311
ddnsmngr/files/usr/lib/inadyn/ddnsmngr_service.sh
Normal file
311
ddnsmngr/files/usr/lib/inadyn/ddnsmngr_service.sh
Normal file
@@ -0,0 +1,311 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROG="/usr/sbin/inadyn"
|
||||
CONFIGPATH="/tmp/inadyn_config"
|
||||
PIDPATH="/etc/inadyn_pid"
|
||||
CLIENT_INTFS=""
|
||||
CONFIG_FILES=""
|
||||
SERVER_PATH="/etc/ddnsmngr/servers"
|
||||
|
||||
FORMAT="custom [SECTION] {\n\tusername\t= [USER]\n\tpassword\t= [PWD]\n\tddns-server\t= [SERV]\n\tddns-path\t= [URI]\n\tssl\t\t= [SSL]\n\thostname\t= [NAME]\n\tcheckip-command\t= [CMD]\n\tddns-response\t= [RESPONSES]\n}"
|
||||
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
echo "$*"|logger -t ddnsmngr.init -p debug
|
||||
}
|
||||
|
||||
get_service_data() {
|
||||
local provider="$1"
|
||||
shift
|
||||
local dir="$1"
|
||||
shift
|
||||
local ipv6="$1"
|
||||
shift
|
||||
|
||||
local name data url answer script
|
||||
|
||||
[ $# -ne 2 ] && {
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -f "${dir}/${provider}.json" ] || {
|
||||
eval "$1=\"\""
|
||||
eval "$2=\"\""
|
||||
return 1
|
||||
}
|
||||
|
||||
json_load_file "${dir}/${provider}.json"
|
||||
json_get_var name "name"
|
||||
if [ "$ipv6" -eq "1" ]; then
|
||||
json_select "ipv6"
|
||||
else
|
||||
json_select "ipv4"
|
||||
fi
|
||||
json_get_var data "url"
|
||||
json_get_var answer "answer"
|
||||
json_select ".."
|
||||
json_cleanup
|
||||
|
||||
response=""
|
||||
if [ -n "${answer}" ]; then
|
||||
answer=$(echo "${answer}" | sed 's/|/ /g')
|
||||
for ans in $answer; do
|
||||
if [ -z "${response}" ]; then
|
||||
response="${ans}"
|
||||
else
|
||||
response="${response}, ${ans}"
|
||||
fi
|
||||
done
|
||||
response="{ ${response} }"
|
||||
fi
|
||||
|
||||
eval "$1=\"$data\""
|
||||
eval "$2=\"$response\""
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
generate_inadyn_config() {
|
||||
json_load "${1}"
|
||||
json_get_var service_name service_name
|
||||
json_get_var use_ipv6 use_ipv6
|
||||
json_get_var interface interface
|
||||
json_get_var username username
|
||||
json_get_var password password
|
||||
json_get_var host lookup_host
|
||||
json_get_var conf_file config_file
|
||||
json_get_var conf_dir config_dir
|
||||
json_get_var server_address server_address
|
||||
json_cleanup
|
||||
|
||||
if [ -z "${service_name}" ] || [ -z "${host}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${conf_file}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${conf_dir}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# First look into custom path to load the url otherwise default path
|
||||
get_service_data "${service_name}" "${SERVER_PATH}" "${use_ipv6}" server_url server_answer
|
||||
|
||||
if [ -z "${server_url}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Need to pick proto, server address and request uri separately from the url
|
||||
# format http://[server_address]/[update_Request_uri]
|
||||
proto=$(echo $server_url | cut -d':' -f 1)
|
||||
serv=$(echo $server_url | cut -d'/' -f 3 | cut -d'@' -f 2)
|
||||
uri=${server_url#*$serv}
|
||||
|
||||
if [ -z $proto ] || [ -z $serv ] || [ -z $uri ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
path=$(echo "$uri" | sed 's/&/\\&/g')
|
||||
update_uri=$(echo $path | sed -e "s#\[DOMAIN\]#%h#g" -e "s#\[PASSWORD\]#%p#g" \
|
||||
-e "s#\[USERNAME\]#%u#g" -e "s#\[IP\]#%i#g")
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
if [ "${use_ipv6}" -eq 0 ]; then
|
||||
interface="wan"
|
||||
else
|
||||
interface="wan6"
|
||||
fi
|
||||
fi
|
||||
|
||||
# now get the physical interface name
|
||||
intf=$(ifstatus "${interface}" | jsonfilter -e '@.device')
|
||||
if [ -z "${intf}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# command to get ip of the interface
|
||||
if [ "${use_ipv6}" -eq 0 ]; then
|
||||
get_ip="\"ifstatus ${interface} | jsonfilter -e '@[\\\\\"ipv4-address\\\\\"][0].address'\""
|
||||
else
|
||||
get_ip="\"ifstatus ${interface} | jsonfilter -e '@[\\\\\"ipv6-address\\\\\"][0].address'\""
|
||||
fi
|
||||
|
||||
if [ "${proto}" = "http" ]; then
|
||||
ssl="false"
|
||||
else
|
||||
ssl="true"
|
||||
fi
|
||||
|
||||
inadyn_ver=$(inadyn -v)
|
||||
user_agent="inadyn/${inadyn_ver}"
|
||||
|
||||
config_file="${conf_dir}/${conf_file}"
|
||||
touch "${config_file}"
|
||||
|
||||
echo "iface = ${intf}" > "${config_file}"
|
||||
echo "period = 600" >> "${config_file}"
|
||||
echo "user-agent = ${user_agent}" >> "${config_file}"
|
||||
|
||||
if [ "${use_ipv6}" -eq 1 ]; then
|
||||
echo "allow-ipv6 = true" >> "${config_file}"
|
||||
fi
|
||||
|
||||
if [ -z "${password}" ]; then
|
||||
FORMAT=$(echo "${FORMAT}" | sed 's/\\tpassword\\t= \[PWD\]\\n//g')
|
||||
fi
|
||||
|
||||
if [ -z "${server_answer}" ]; then
|
||||
FORMAT=$(echo "${FORMAT}" | sed 's/\\tddns-response\\t= \[RESPONSES\]\\n//g')
|
||||
fi
|
||||
|
||||
config=$(echo $FORMAT | sed -e "s#\[SECTION\]#$conf_file#g" -e "s#\[PWD\]#$password#g" \
|
||||
-e "s#\[USER\]#$username#g" -e "s#\[SERV\]#$serv#g" \
|
||||
-e "s#\[URI\]#\"$update_uri\"#g" -e "s#\[SSL\]#$ssl#g" \
|
||||
-e "s#\[NAME\]#$host#g" -e "s#\[CMD\]#$get_ip#g" \
|
||||
-e "s#\[RESPONSES\]#$server_answer#g")
|
||||
|
||||
echo -e "\n\n${config}" >> "${config_file}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_host_section() {
|
||||
uci_validate_section ddnsmngr host "${1}" \
|
||||
'enabled:bool:0' \
|
||||
'lookup_host:string' \
|
||||
'dm_parent:string'
|
||||
}
|
||||
|
||||
validate_client_section() {
|
||||
uci_validate_section ddnsmngr client "${1}" \
|
||||
'enabled:bool:0' \
|
||||
'service_name:string' \
|
||||
'interface:string' \
|
||||
'ip_network:string' \
|
||||
'username:string' \
|
||||
'password:string' \
|
||||
'use_https:bool:0' \
|
||||
'force_dnstcp:bool:0' \
|
||||
'use_ipv6:bool:0' \
|
||||
'force_ipversion:bool:0'
|
||||
}
|
||||
|
||||
add_object() {
|
||||
local enabled lookup_host dm_parent use_ipv6 force_ipversion
|
||||
local service_name interface ip_network username password use_https force_dnstcp
|
||||
|
||||
validate_host_section "${1}" || {
|
||||
log "Validation of host section failed"
|
||||
return
|
||||
}
|
||||
|
||||
if [ "${enabled}" -ne 1 ] || [ -z "${dm_parent}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
validate_client_section "${dm_parent}" || {
|
||||
log "Validation of client section failed"
|
||||
return
|
||||
}
|
||||
|
||||
if [ "${enabled}" -ne 1 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
service_name=$(uci -q get ddnsmngr.${dm_parent}.service_name)
|
||||
if [ -z "${service_name}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
service_section=$(uci show ddnsmngr | grep "service=\'${service_name}\'" | cut -d'.' -f 2 | head -1)
|
||||
if [ -z "${service_section}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
service_enabled=$(uci -q get ddnsmngr.${service_section}.enabled)
|
||||
if [ "${service_enabled}" -ne 1 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
json_init
|
||||
json_add_string "interface" "${interface}"
|
||||
json_add_string "service_name" "${service_name}"
|
||||
json_add_string "username" "${username}"
|
||||
json_add_string "password" "${password}"
|
||||
json_add_string "lookup_host" "${lookup_host}"
|
||||
json_add_string "ip_network" "${ip_network}"
|
||||
json_add_string "use_ipv6" "${use_ipv6}"
|
||||
json_add_string "force_ipversion" "${force_ipversion}"
|
||||
json_add_string "use_https" "${use_https}"
|
||||
json_add_string "force_dnstcp" "${force_dnstcp}"
|
||||
json_add_string "config_file" "${1}"
|
||||
json_add_string "config_dir" "${CONFIGPATH}"
|
||||
|
||||
json_str=$(json_dump)
|
||||
json_cleanup
|
||||
|
||||
generate_inadyn_config "${json_str}"
|
||||
|
||||
if [ "$?" -ne 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
CONFIG_FILES="${CONFIG_FILES} ${1}"
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
if [ "${use_ipv6}" -eq 0 ]; then
|
||||
interface="wan"
|
||||
else
|
||||
interface="wan6"
|
||||
fi
|
||||
fi
|
||||
|
||||
for intf in $CLIENT_INTFS; do
|
||||
if [ "${intf}" == "${interface}" ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
CLIENT_INTFS="${CLIENT_INTFS} ${interface}"
|
||||
}
|
||||
|
||||
start_ddnsmngr_service() {
|
||||
rm -rf $CONFIGPATH
|
||||
mkdir $CONFIGPATH
|
||||
mkdir -p $PIDPATH
|
||||
|
||||
config_load ddnsmngr
|
||||
config_foreach add_object host
|
||||
|
||||
i=1
|
||||
for conf in $CONFIG_FILES; do
|
||||
instance="ddnsmngr_${i}"
|
||||
i=$(( i + 1 ))
|
||||
|
||||
procd_open_instance $instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -f "${CONFIGPATH}/${conf}"
|
||||
procd_append_param command -l debug
|
||||
procd_append_param command -P "${PIDPATH}/${conf}"
|
||||
procd_append_param command -n -C
|
||||
procd_close_instance
|
||||
done
|
||||
}
|
||||
|
||||
stop_ddnsmngr_service() {
|
||||
rm -rf $CONFIGPATH
|
||||
return 0
|
||||
}
|
||||
|
||||
add_ddnsmngr_triggers() {
|
||||
procd_open_trigger
|
||||
for intf in $CLIENT_INTFS; do
|
||||
# No need to handle other ifevents like ifupdate etc
|
||||
procd_add_interface_trigger "interface.*.up" $intf /etc/init.d/ddnsmngr restart
|
||||
done
|
||||
procd_close_trigger
|
||||
}
|
||||
@@ -2,6 +2,6 @@ menu "Configuration"
|
||||
|
||||
config DECOLLECTOR_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 4
|
||||
default 6
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=decollector
|
||||
PKG_VERSION:=4.2.1.1
|
||||
PKG_VERSION:=6.1.0.3
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ae836adb0779979686d0dad34b941f319ffed1b8
|
||||
PKG_SOURCE_VERSION:=005a48c7a40c3fcf89d031fda0e109a25431b20e
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -29,7 +29,7 @@ define Package/decollector
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=WiFi DataElements Collector Proxy
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread +libnl-genl \
|
||||
+libeasy +libwifiutils +libieee1905 +map-plugin
|
||||
+libeasy +libwifiutils +libieee1905 +ieee1905-map-plugin
|
||||
endef
|
||||
|
||||
define Package/decollector/description
|
||||
|
||||
@@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.6.5
|
||||
PKG_VERSION:=3.7.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=192e74db2082e3f89f6defe9d752d752b0b09079
|
||||
PKG_SOURCE_VERSION:=daf66f6f2098a343fefb304e7ce9440f55ea1cd1
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -28,7 +28,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=DECT Manager
|
||||
DEPENDS:= +libubox +ubus +uci +libxml2 +libjson-c +gpiod-tools
|
||||
DEPENDS:= +libubox +ubus +uci +libxml2 +libjson-c +gpiod-tools +voicemngr
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
|
||||
@@ -11,8 +11,6 @@ LOG_PATH=/var/log/dectmngr
|
||||
DB_PATH=/etc/dect
|
||||
DCX81_UART_DT_ALIAS=/proc/device-tree/aliases/dcx81-uart
|
||||
|
||||
DECT_GPIO="$(gpiofind DCX81_RSTN | cut -d ' ' -f 2 2>/dev/null)"
|
||||
|
||||
# Ask dectmngr to exit nicely and wait for it to clean up, which is a slow process.
|
||||
stop_and_wait_dectmngr() {
|
||||
dect_pid=$(pidof $PROG)
|
||||
@@ -64,8 +62,6 @@ start_service() {
|
||||
dcx81_uart_device=/dev/ttyH0
|
||||
fi
|
||||
|
||||
[ -n "$DECT_GPIO" ] && echo 1 > /sys/class/gpio/gpio${DECT_GPIO}/value
|
||||
|
||||
rfpi=$(db -q get hw.board.dect_rfpi)
|
||||
[ -n "$rfpi" -a ${#rfpi} -eq 14 ] && opt_ext="$opt_ext -rfpi $rfpi"
|
||||
|
||||
@@ -112,7 +108,6 @@ start_service() {
|
||||
stop_service() {
|
||||
has_dect || return 0
|
||||
|
||||
[ -n "$DECT_GPIO" ] && echo 0 > /sys/class/gpio/gpio${DECT_GPIO}/value
|
||||
stop_and_wait_dectmngr
|
||||
}
|
||||
|
||||
@@ -126,11 +121,6 @@ service_triggers() {
|
||||
}
|
||||
|
||||
boot() {
|
||||
[ -n "$DECT_GPIO" ] && {
|
||||
echo ${DECT_GPIO} > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio${DECT_GPIO}/direction
|
||||
}
|
||||
|
||||
[ ! -d $LOG_PATH ] && mkdir -p $LOG_PATH
|
||||
[ ! -d $DB_PATH ] && mkdir -p $DB_PATH
|
||||
start
|
||||
|
||||
57
dhcpmngr/Makefile
Normal file
57
dhcpmngr/Makefile
Normal file
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dhcpmngr
|
||||
PKG_VERSION:=1.0.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dhcpmngr.git
|
||||
PKG_SOURCE_VERSION:=2a517188211849bcc324a9f9727eeb34d076c032
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/dhcpmngr
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Package to add Device.DHCPv4 and v6 data model support.
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +odhcpd
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
DEPENDS+=+DNSMNGR_DNS_SD:umdns
|
||||
DEPENDS+=+DNSMNGR_BACKEND_DNSMASQ:dnsmasq
|
||||
endef
|
||||
|
||||
define Package/dhcpmngr/description
|
||||
Package to add Device.DHCPv4. and Device.DHCPv6. data model support.
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/dhcpmngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/dhcpmngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_lease_start_time.user $(1)/etc/udhcpc.user.d/udhcpc_lease_start_time.user
|
||||
ifeq ($(CONFIG_DNSMNGR_BACKEND_UNBOUND),y)
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DATA) ./files/etc/uci-defaults/unbound.odhcpd.uci_default $(1)/etc/uci-defaults/16-set-unbound-as-odhcpd-leasetrigger
|
||||
endif
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libdhcpmngr.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dhcpmngr))
|
||||
18
dhcpmngr/files/etc/uci-defaults/unbound.odhcpd.uci_default
Normal file
18
dhcpmngr/files/etc/uci-defaults/unbound.odhcpd.uci_default
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# update odhcpd uci to use unbound's script as leasetrigger
|
||||
uci -q get dhcp.odhcpd >/dev/null 2>&1 && {
|
||||
maindhcp="$(uci -q get dhcp.odhcpd.maindhcp)"
|
||||
|
||||
# if odhcpd is the main dhcp
|
||||
[ "$maindhcp" = "1" ] || [ "$maindhcp" = "true" ] || [ "$maindhcp" = "on" ] && {
|
||||
# if unbound daemon and unbound script file is present
|
||||
[ -e /usr/lib/unbound/odhcpd.sh ] && [ -e /usr/sbin/unbound ] && {
|
||||
# then set unbound script as leasetrigger in dhcp UCI
|
||||
uci -q set dhcp.odhcpd.leasetrigger='/usr/lib/unbound/odhcpd.sh'
|
||||
uci commit dhcp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
leasestarttime="$(awk -F'.' '{print $1}' /proc/uptime 2> /dev/null)"
|
||||
target_file=/tmp/dhcp_client_info
|
||||
target_str="$INTERFACE $lease $leasestarttime"
|
||||
|
||||
# if this interface is present in file, then replace it
|
||||
if grep -q "$INTERFACE" "$target_file" 2> /dev/null; then
|
||||
# replace the whole line if pattern matches
|
||||
sed -i "/${INTERFACE}/c\\${target_str}" "$target_file"
|
||||
else
|
||||
# interface info was not present, append it to the file
|
||||
echo "$target_str" >> "$target_file"
|
||||
fi
|
||||
30
dnsmngr/Config.in
Normal file
30
dnsmngr/Config.in
Normal file
@@ -0,0 +1,30 @@
|
||||
if PACKAGE_dnsmngr
|
||||
|
||||
menu "Configuration"
|
||||
|
||||
config DNSMNGR_DNS_SD
|
||||
bool "Include Device.DNS.SD. TR-181 support"
|
||||
default y
|
||||
help
|
||||
Set this option to include support for TR-181 DNS.SD. object.
|
||||
|
||||
choice
|
||||
prompt "Select backend for DNS management"
|
||||
default DNSMNGR_BACKEND_DNSMASQ
|
||||
depends on PACKAGE_dnsmngr
|
||||
help
|
||||
Select which backend daemon to use for DNS
|
||||
|
||||
config DNSMNGR_BACKEND_DNSMASQ
|
||||
bool "Use dnsmasq for dns and dhcp"
|
||||
help
|
||||
Enable this option to use dnsmasq + odhcpd for dns and dhcp.
|
||||
|
||||
config DNSMNGR_BACKEND_UNBOUND
|
||||
bool "Use unbound with odhcpd-full for dns and dhcp"
|
||||
help
|
||||
Enable this option to use unbound + odhcpd for dns and dhcp.
|
||||
|
||||
endchoice
|
||||
endmenu
|
||||
endif
|
||||
74
dnsmngr/Makefile
Normal file
74
dnsmngr/Makefile
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# Copyright (C) 2022-2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dnsmngr
|
||||
PKG_VERSION:=1.0.12
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dnsmngr.git
|
||||
PKG_SOURCE_VERSION:=fb49088ddb498980e2c91f03aea10bd502caeca1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/dnsmngr
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +odhcpd
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
DEPENDS+=+DNSMNGR_DNS_SD:umdns
|
||||
DEPENDS+=+DNSMNGR_BACKEND_DNSMASQ:dnsmasq
|
||||
DEPENDS+=+DNSMNGR_BACKEND_UNBOUND:unbound-daemon +DNSMNGR_BACKEND_UNBOUND:unbound-control
|
||||
TITLE:=Package to configure DNS backend and TR-181 support
|
||||
endef
|
||||
|
||||
define Package/dnsmngr/description
|
||||
Package to configure DNS backend and TR-181 support.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_DNSMNGR_DNS_SD),y)
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default,all)
|
||||
endef
|
||||
else
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default,dns)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/dnsmngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DNSMNGR_BACKEND_DNSMASQ),y)
|
||||
TARGET_CFLAGS += -DDNSMASQ_BACKEND
|
||||
endif
|
||||
|
||||
define Package/dnsmngr/install
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libdnsmngr.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_SCRIPT) -d $(PKG_BUILD_DIR)/scripts/nslookup $(1)
|
||||
ifeq ($(CONFIG_DNSMNGR_DNS_SD),y)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libdns_sd.so $(1) $(PKG_NAME)
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dnsmngr))
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dslmngr
|
||||
PKG_VERSION:=1.2.1
|
||||
PKG_VERSION:=1.2.8
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=cb8b8fd2549751bcd38808391b76a1a9a908c4de
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/dslmngr.git
|
||||
PKG_SOURCE_VERSION:=5340cb31f759301f5aca3fd848fc3a63b0b4663f
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -26,6 +26,7 @@ PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
@@ -40,6 +41,7 @@ define Package/dslmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=XDSL status and configration utility
|
||||
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl +libeasy
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
define Package/dslmngr/description
|
||||
@@ -69,12 +71,14 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/dslmngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/dsl
|
||||
$(CP) ./files/common/* $(1)/
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
$(CP) ./files/broadcom/* $(1)/
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dslmngr $(1)/sbin/
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/libbbfdsl.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dslmngr))
|
||||
|
||||
@@ -211,8 +211,8 @@ create_ptm_devices() {
|
||||
|
||||
prioritize_arp()
|
||||
{
|
||||
ebtables -t nat -D POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||
ebtables -t nat -A POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||
ebtables --concurrent -t nat -D POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||
ebtables --concurrent -t nat -A POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||
}
|
||||
|
||||
xtm_remove_devices() {
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-qos
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=0
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=none
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/easy-qos
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Easy QoS
|
||||
DEPENDS:=@(TARGET_brcmbca||TARGET_airoha)
|
||||
endef
|
||||
|
||||
define Package/easy-qos/description
|
||||
This package contains Easy QoS utility
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/easy-qos/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(CP) ./files/etc/config/easy_qos $(1)/etc/config/
|
||||
$(CP) ./files/etc/init.d/easy_qos.iptables $(1)/etc/init.d/easy_qos
|
||||
$(CP) ./files/etc/uci-defaults/* $(1)/etc/uci-defaults/
|
||||
$(CP) ./files/etc/firewall.easyqos $(1)/etc/firewall.easyqos
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,easy-qos))
|
||||
@@ -1 +0,0 @@
|
||||
/etc/init.d/easy_qos reload
|
||||
@@ -1,140 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t easy_qos.ebtable -p debug
|
||||
}
|
||||
|
||||
exec_log() {
|
||||
${@}
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
fi
|
||||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr 'A-Z' 'a-z');
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 0;;
|
||||
"low")
|
||||
echo 1;;
|
||||
"besteffort")
|
||||
echo 2;;
|
||||
"normal")
|
||||
echo 3;;
|
||||
"video")
|
||||
echo 4;;
|
||||
"medium")
|
||||
echo 5;;
|
||||
"high")
|
||||
echo 6;;
|
||||
"highest")
|
||||
echo 7;;
|
||||
esac
|
||||
}
|
||||
|
||||
validate_rule_section()
|
||||
{
|
||||
uci_validate_section easy_qos rule "${1}" \
|
||||
'priority:string' \
|
||||
'macaddr:string' \
|
||||
'proto:string:none' \
|
||||
'port:list(uinteger)' \
|
||||
'comment:string:none'
|
||||
}
|
||||
|
||||
# Clear existing rules before applying new rules
|
||||
clear_existing_rules() {
|
||||
local rule=$(ebtables -t broute -L BROUTING|grep -m 1 mark)
|
||||
while [ -n "${rule}" ]; do
|
||||
exec_log ebtables -t broute -D BROUTING ${rule}
|
||||
rule=$(ebtables -t broute -L BROUTING|grep -m 1 mark)
|
||||
done
|
||||
}
|
||||
|
||||
create_rule() {
|
||||
local protocol=$1; shift
|
||||
local mac=$1; shift
|
||||
local mark="0x$1"; shift
|
||||
local forward_port=$1;
|
||||
local cmd="";
|
||||
local protocol_number
|
||||
|
||||
cmd="-j mark --mark-or ${mark}";
|
||||
if [ -n "${forward_port}" ]; then
|
||||
cmd="--ip-destination-port ${forward_port} ${cmd}";
|
||||
fi
|
||||
|
||||
case "${protocol}" in
|
||||
"tcp")
|
||||
protocol_number=6;;
|
||||
"udp")
|
||||
protocol_number=17;;
|
||||
"dccp")
|
||||
protocol_number=33;;
|
||||
"sctp")
|
||||
protocol_number=132;;
|
||||
*)
|
||||
log "Protocol ${protocol} not supported in ebtables"
|
||||
return;;
|
||||
esac
|
||||
|
||||
cmd="--ip-proto ${protocol_number} $cmd"
|
||||
cmd="-p ip $cmd"
|
||||
|
||||
cmd="-s ${mac} $cmd"
|
||||
exec_log ebtables -t broute -A BROUTING ${cmd}
|
||||
}
|
||||
|
||||
manage_rule() {
|
||||
local cfg="$1"
|
||||
local priority macaddr proto port comment prio_num protocol
|
||||
|
||||
validate_rule_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
protocol=$(echo ${proto}|tr 'A-Z' 'a-z')
|
||||
prio_num=$(get_priority ${priority})
|
||||
if [ -n "${macaddr}" -a -n "${prio_num}" ]; then
|
||||
for p in ${port}; do
|
||||
if [ "${protocol}" == "none" -o "${protocol}" == "tcpudp" ]; then
|
||||
create_rule tcp ${macaddr} ${prio_num} ${p}
|
||||
create_rule udp ${macaddr} ${prio_num} ${p}
|
||||
else
|
||||
create_rule ${protocol} ${macaddr} ${prio_num} ${p}
|
||||
fi
|
||||
done
|
||||
# Create rule for all ports if port is not mentioned in uci
|
||||
if [ -z "${port}" ]; then
|
||||
if [ "${protocol}" == "none" -o "${protocol}" == "tcpudp" ]; then
|
||||
create_rule tcp ${macaddr} ${prio_num}
|
||||
create_rule udp ${macaddr} ${prio_num}
|
||||
else
|
||||
create_rule ${protocol} ${macaddr} ${prio_num}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
# Do not apply rules if ebtables is not present in system
|
||||
[ -x /usr/sbin/ebtables ] || return;
|
||||
|
||||
clear_existing_rules
|
||||
config_load easy_qos
|
||||
config_foreach manage_rule rule
|
||||
}
|
||||
|
||||
start_service() {
|
||||
reload_service
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "easy_qos"
|
||||
}
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
CLIENT_LIST="/tmp/easy_qos_client.list"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t easy_qos -p debug
|
||||
}
|
||||
|
||||
exec_log() {
|
||||
${@}
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
fi
|
||||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr 'A-Z' 'a-z');
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 0;;
|
||||
"low")
|
||||
echo 1;;
|
||||
"besteffort")
|
||||
echo 2;;
|
||||
"normal")
|
||||
echo 3;;
|
||||
"video")
|
||||
echo 4;;
|
||||
"medium")
|
||||
echo 5;;
|
||||
"high")
|
||||
echo 6;;
|
||||
"highest")
|
||||
echo 7;;
|
||||
esac
|
||||
}
|
||||
|
||||
clean_client_entries() {
|
||||
[ -f ${CLIENT_LIST} ] && rm ${CLIENT_LIST}
|
||||
}
|
||||
|
||||
map_client_entries() {
|
||||
local clients ip mac host
|
||||
|
||||
json_load "$(ubus call router.network 'clients')"
|
||||
json_get_keys keys
|
||||
|
||||
for key in ${keys};
|
||||
do
|
||||
json_select ${key}
|
||||
json_get_vars ipaddr macaddr hostname
|
||||
clients="${macaddr} ${ipaddr} ${hostname};${clients}"
|
||||
json_select ..
|
||||
done
|
||||
|
||||
json_init
|
||||
|
||||
# json_add_array "clients"
|
||||
IFS=";"
|
||||
for client in ${clients};
|
||||
do
|
||||
macaddr=$(echo ${client} | cut -d" " -f1)
|
||||
json_add_object "${macaddr//:/_}"
|
||||
json_add_string "ip" "$(echo ${client} | cut -d" " -f2)"
|
||||
json_add_string "macaddr" "$(echo ${client} | cut -d" " -f1)"
|
||||
json_add_string "host" "$(echo ${client} | cut -d" " -f3)"
|
||||
json_close_object
|
||||
done
|
||||
|
||||
IFS=' '
|
||||
echo `json_dump` > ${CLIENT_LIST}
|
||||
json_cleanup
|
||||
}
|
||||
|
||||
# Find the IP of a corresponding mac from arp table
|
||||
get_ipaddress() {
|
||||
local clients ip mac host
|
||||
|
||||
json_load "$(cat ${CLIENT_LIST})"
|
||||
json_get_keys keys
|
||||
|
||||
# jshn seems a bit iffy on having : in key, replace by _
|
||||
json_select "${1//:/_}" 2 > /dev/null
|
||||
json_get_var ip ip
|
||||
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
validate_rule_section()
|
||||
{
|
||||
uci_validate_section easy_qos rule "${1}" \
|
||||
'priority:string' \
|
||||
'macaddr:string' \
|
||||
'proto:string:none' \
|
||||
'port:list(uinteger)' \
|
||||
'comment:string:none'
|
||||
}
|
||||
|
||||
# Clear existing rules before applying new rules
|
||||
clear_existing_rules() {
|
||||
local rule=$(iptables -t mangle -S PREROUTING | grep -m 1 MARK |sed 's/-A/-D/1')
|
||||
while [ -n "${rule}" ]; do
|
||||
exec_log iptables -t mangle ${rule}
|
||||
rule=$(iptables -t mangle -S PREROUTING | grep -m 1 MARK |sed 's/-A/-D/1')
|
||||
done
|
||||
}
|
||||
|
||||
check_and_create() {
|
||||
iptables -t mangle -C PREROUTING ${@} 2>/dev/null
|
||||
# Create rule if not exists
|
||||
if [ ${?} -ne 0 ]; then
|
||||
exec_log iptables -t mangle -A PREROUTING ${@}
|
||||
else
|
||||
log "Rule exists for ${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
create_rule() {
|
||||
local proto=$1; shift
|
||||
local src_ip=$1; shift
|
||||
local mark="0x$1/0x$1"; shift
|
||||
local ports=$1;
|
||||
local cmd="";
|
||||
|
||||
cmd="-j MARK --set-xmark ${mark}";
|
||||
if [ -n "${ports}" ]; then
|
||||
cmd="--match multiport --dports ${ports} ${cmd}";
|
||||
fi
|
||||
|
||||
if [ "${proto}" == "icmp" ]; then
|
||||
cmd="-p icmp -m icmp --icmp-type 8 $cmd"
|
||||
elif [ "${proto}" == "all" ]; then
|
||||
cmd="-p all $cmd"
|
||||
else
|
||||
cmd="-p ${proto} -m ${proto} $cmd"
|
||||
fi
|
||||
cmd="-s ${src_ip} $cmd"
|
||||
|
||||
check_and_create ${cmd}
|
||||
}
|
||||
|
||||
manage_rule() {
|
||||
local cfg="$1"
|
||||
local priority macaddr proto port comment prio_num ip port_list
|
||||
|
||||
validate_rule_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
prio_num=$(get_priority ${priority})
|
||||
ip=$(get_ipaddress ${macaddr})
|
||||
port_list=$(echo ${port}|sed 's/ /,/g')
|
||||
|
||||
if [ -n "${ip}" -a -n "${prio_num}" ]; then
|
||||
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
|
||||
create_rule tcp ${ip} ${prio_num} ${port_list}
|
||||
create_rule udp ${ip} ${prio_num} ${port_list}
|
||||
else
|
||||
create_rule ${proto} ${ip} ${prio_num} ${port_list}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
clear_existing_rules
|
||||
map_client_entries
|
||||
config_load easy_qos
|
||||
config_foreach manage_rule rule
|
||||
clean_client_entries
|
||||
}
|
||||
|
||||
start_service() {
|
||||
reload_service
|
||||
echo "Easy QoS installed">/dev/console;
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "easy_qos"
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# Add firewall include
|
||||
uci -q batch <<-EOT
|
||||
delete firewall.easyqos
|
||||
set firewall.easyqos=include
|
||||
set firewall.easyqos.path=/etc/firewall.easyqos
|
||||
set firewall.easyqos.reload=1
|
||||
commit firewall
|
||||
EOT
|
||||
80
ebtables-extensions/Makefile
Normal file
80
ebtables-extensions/Makefile
Normal file
@@ -0,0 +1,80 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ebtables-extensions
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=35fb79f95c47d90e3791c7e126048b451f078f24
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ebtables-extensions.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/vlantranslation
|
||||
SUBMENU:=Other modules
|
||||
TITLE:=Kernel module for ebtables VLAN translation
|
||||
FILES:=$(PKG_BUILD_DIR)/src/ebt_vlantranslation.ko
|
||||
DEPENDS+=+kmod-ebtables
|
||||
AUTOLOAD:=$(call AutoLoad,30,ebt_vlantranslation,1)
|
||||
KCONFIG:=
|
||||
endef
|
||||
|
||||
define KernelPackage/dscp2pbit
|
||||
SUBMENU:=Other modules
|
||||
TITLE:=Kernel module for DSCP-to-Pbit mapping
|
||||
DEPENDS+=+kmod-ebtables
|
||||
FILES:=$(PKG_BUILD_DIR)/src/ebt_dscp2pbit.ko
|
||||
AUTOLOAD:=$(call AutoLoad,30,ebt_dscp2pbit,1)
|
||||
KCONFIG:=
|
||||
endef
|
||||
|
||||
define KernelPackage/vlantranslation/description
|
||||
Kernel module to enable VLAN translation for ebtables
|
||||
endef
|
||||
|
||||
define KernelPackage/dscp2pbit/description
|
||||
Kernel module to enableDSCP-to-Pbit mapping for ebtables
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
include ../../broadcom/bcmkernel/bcm-kernel-toolchain.mk
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ./src/* $(PKG_BUILD_DIR)/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_vlantranslation.h $(LINUX_DIR)/include/uapi/linux/netfilter_bridge/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_dscp2pbit.h $(LINUX_DIR)/include/uapi/linux/netfilter_bridge/
|
||||
endef
|
||||
else
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_vlantranslation.h $(LINUX_DIR)/include/uapi/linux/netfilter_bridge/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_dscp2pbit.h $(LINUX_DIR)/include/uapi/linux/netfilter_bridge/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/include/uapi/linux/netfilter_bridge/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_vlantranslation.h $(1)/include/uapi/linux/netfilter_bridge/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_dscp2pbit.h $(1)/include/uapi/linux/netfilter_bridge/
|
||||
endef
|
||||
|
||||
KERNEL_MAKE_FLAGS += -I$(LINUX_DIR)/include
|
||||
|
||||
define Build/Compile
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/src" modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,vlantranslation))
|
||||
$(eval $(call KernelPackage,dscp2pbit))
|
||||
9
ethmngr/Config.in
Normal file
9
ethmngr/Config.in
Normal file
@@ -0,0 +1,9 @@
|
||||
if (PACKAGE_ethmngr)
|
||||
|
||||
menu "Configurations"
|
||||
|
||||
config TR181_VENDOR_EXTENSIONS_MACVLAN
|
||||
bool "Use TR181 vendor extension MACVLAN"
|
||||
default y
|
||||
endmenu
|
||||
endif
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethmngr
|
||||
PKG_VERSION:=2.1.2
|
||||
PKG_VERSION:=2.1.9
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=e5cccdd45a93d969d51c4085cb52b543df544811
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/ethmngr.git
|
||||
PKG_SOURCE_VERSION:=2d35e86cc8dfd7ef4e0d8579f5d314e90faadc90
|
||||
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -21,12 +21,14 @@ PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/ethmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Ethernet status and configration utility
|
||||
DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx||TARGET_ipq53xx||TARGET_mediatek):libethernet +libuci +libubox +ubus +libpthread +libnl-genl
|
||||
DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx||TARGET_ipq53xx||TARGET_mediatek):libethernet +libuci +libubox +ubus +libpthread +libnl-genl +libeasy
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
define Package/ethmngr/description
|
||||
@@ -35,6 +37,10 @@ define Package/ethmngr/description
|
||||
It uses APIs from the libethernet.so library.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ./ethmngr/* $(PKG_BUILD_DIR)/
|
||||
@@ -44,7 +50,12 @@ endif
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
-D_GNU_SOURCE \
|
||||
-DBBF_VENDOR_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\"
|
||||
|
||||
ifeq ($(CONFIG_TR181_VENDOR_EXTENSIONS_MACVLAN),y)
|
||||
TARGET_CFLAGS += -DTR181_VENDOR_EXTENSIONS_MACVLAN
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_ipq53xx)$(CONFIG_TARGET_mediatek),)
|
||||
define Build/Compile
|
||||
@@ -53,9 +64,15 @@ endif
|
||||
|
||||
define Package/ethmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/ethmngr
|
||||
$(INSTALL_DIR) $(1)/etc/ethmngr/plugins
|
||||
ifneq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_ipq53xx)$(CONFIG_TARGET_mediatek),)
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethmngr $(1)/usr/sbin/
|
||||
endif
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/libbbfethernet.so $(1) $(PKG_NAME)
|
||||
ifeq ($(CONFIG_TR181_VENDOR_EXTENSIONS_MACVLAN),y)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/libbbfethernetmacvlan.so $(1) $(PKG_NAME)
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$PORT" -a -n "$LINK" ] || exit 0
|
||||
|
||||
case "$PORT" in
|
||||
# do not generate ethport ubus event
|
||||
# for wifi, dsl and brige devices
|
||||
wl*|wds*|atm*|ptm*|br-*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
speed=0
|
||||
duplex=full
|
||||
|
||||
if [ "$LINK" = "up" ]; then
|
||||
devspeed="$(ubus -t 2 call network.device status "{\"name\":\"$PORT\"}" | jsonfilter -e @.speed)"
|
||||
speed=${devspeed:0:-1}
|
||||
duplex=${devspeed:0-1}
|
||||
[ "$duplex" == "H" ] && duplex="half" || duplex="full"
|
||||
fi
|
||||
|
||||
ubus send ethport "{\"ifname\":\"$PORT\",\"link\":\"$LINK\",\"speed\":\"$speed\",\"duplex\":\"$duplex\"}"
|
||||
20
ethmngr/files/etc/ruleng/ethport.json
Normal file
20
ethmngr/files/etc/ruleng/ethport.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"ethport_update": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "network.device"
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"cli": "/sbin/hotplug-call ethernet",
|
||||
"envs": {
|
||||
"PORT": "&network.device->ifname",
|
||||
"LINK": "&network.device->link"
|
||||
},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
2
ethmngr/files/etc/uci-defaults/ruleng.ethport
Normal file
2
ethmngr/files/etc/uci-defaults/ruleng.ethport
Normal file
@@ -0,0 +1,2 @@
|
||||
uci -q set ruleng.ethport=rule
|
||||
uci -q set ruleng.ethport.recipe='/etc/ruleng/ethport.json'
|
||||
12
firewallmngr/Config.in
Normal file
12
firewallmngr/Config.in
Normal file
@@ -0,0 +1,12 @@
|
||||
if PACKAGE_firewallmngr
|
||||
|
||||
menu "Configuration"
|
||||
|
||||
config FIREWALLMNGR_PORT_TRIGGER
|
||||
bool "Include Device.NAT.PortTrigger"
|
||||
default y
|
||||
help
|
||||
Set this option to include support for PortTrigger object.
|
||||
|
||||
endmenu
|
||||
endif
|
||||
75
firewallmngr/Makefile
Normal file
75
firewallmngr/Makefile
Normal file
@@ -0,0 +1,75 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=firewallmngr
|
||||
PKG_VERSION:=1.0.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/firewallmngr.git
|
||||
PKG_SOURCE_VERSION:=2cac05871f7a8d93c144157c5f3f129deecf1a29
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/firewallmngr
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Package to add Device.Firewall and Device.NAT. data model support.
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +firewall
|
||||
DEPENDS+=+FIREWALLMNGR_PORT_TRIGGER:kmod-ipt-trigger +FIREWALLMNGR_PORT_TRIGGER:kmod-ip6t-trigger
|
||||
DEPENDS+=+FIREWALLMNGR_PORT_TRIGGER:iptables-mod-nfqueue
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
define Package/firewallmngr/description
|
||||
Package to add Device.Firewall. and Device.NAT. data model support.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/firewallmngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FIREWALLMNGR_PORT_TRIGGER),y)
|
||||
TARGET_CFLAGS += -DINCLUDE_PORT_TRIGGER
|
||||
endif
|
||||
|
||||
define Package/firewallmngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
ifeq ($(CONFIG_FIREWALLMNGR_PORT_TRIGGER),y)
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/lib/port-trigger
|
||||
|
||||
$(INSTALL_BIN) ./files/port-trigger/etc/init.d/port-trigger $(1)/etc/init.d/
|
||||
$(INSTALL_DATA) ./files/port-trigger/etc/config/port-trigger $(1)/etc/config/
|
||||
$(INSTALL_DATA) ./files/port-trigger/lib/port-trigger/port_trigger.sh $(1)/lib/port-trigger/
|
||||
endif
|
||||
$(INSTALL_BIN) ./files/firewall.portmap $(1)/etc/
|
||||
$(INSTALL_DATA) ./files/etc/uci-defaults/95-portmap-firewall $(1)/etc/uci-defaults/
|
||||
|
||||
$(INSTALL_BIN) ./files/firewall.service $(1)/etc/
|
||||
$(INSTALL_DATA) ./files/etc/uci-defaults/97-firewall-service $(1)/etc/uci-defaults/
|
||||
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libfirewallmngr.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,firewallmngr))
|
||||
1
firewallmngr/files/port-trigger/etc/config/port-trigger
Normal file
1
firewallmngr/files/port-trigger/etc/config/port-trigger
Normal file
@@ -0,0 +1 @@
|
||||
#port trigger uci file
|
||||
21
firewallmngr/files/port-trigger/etc/init.d/port-trigger
Normal file
21
firewallmngr/files/port-trigger/etc/init.d/port-trigger
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=65
|
||||
STOP=20
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/port-trigger/port_trigger.sh
|
||||
|
||||
start_service() {
|
||||
port_trigger_handling
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger firewall
|
||||
procd_add_reload_trigger port-trigger
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
start
|
||||
}
|
||||
157
firewallmngr/files/port-trigger/lib/port-trigger/port_trigger.sh
Executable file
157
firewallmngr/files/port-trigger/lib/port-trigger/port_trigger.sh
Executable file
@@ -0,0 +1,157 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
process_port_trigger() {
|
||||
local rule_id="$1"
|
||||
local is_enabled=""
|
||||
local duration=""
|
||||
local trigger_dport=""
|
||||
local trigger_dport_end=""
|
||||
local protocol=""
|
||||
local interface=""
|
||||
local open_dport=""
|
||||
local open_dport_end=""
|
||||
local open_protocol=""
|
||||
local ptg_id=""
|
||||
local IP_RULE=""
|
||||
local IP6_RULE=""
|
||||
local IP_RULE_FWD=""
|
||||
|
||||
get_port_trigger() {
|
||||
local ptg_name
|
||||
config_get ptg_name "$1" "name"
|
||||
if [ "$ptg_name" == "$2" ]; then
|
||||
ptg_id="$1"
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
ptg_id=""
|
||||
config_get name "$rule_id" "port_trigger"
|
||||
config_foreach get_port_trigger "port_trigger" "$name"
|
||||
[ -z "$ptg_id" ] && return
|
||||
|
||||
is_enabled=$(uci -q get port-trigger."$ptg_id".enable)
|
||||
|
||||
if [ -z "$is_enabled" ] || [ "$is_enabled" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
protocol=$(uci -q get port-trigger."$ptg_id".protocol)
|
||||
[ -z "$protocol" ] && return
|
||||
|
||||
if [ "$protocol" = "UDP" ] || [ "$protocol" = "udp" ]; then
|
||||
IP_RULE="$IP_RULE -p udp"
|
||||
IP6_RULE="$IP6_RULE -p udp"
|
||||
IP_RULE_FWD="$IP_RULE_FWD -p udp"
|
||||
elif [ "$protocol" = "TCP" ] || [ "$protocol" = "tcp" ]; then
|
||||
IP_RULE="$IP_RULE -p tcp"
|
||||
IP6_RULE="$IP6_RULE -p tcp"
|
||||
IP_RULE_FWD="$IP_RULE_FWD -p tcp"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
trigger_dport=$(uci -q get port-trigger."$ptg_id".port)
|
||||
[ -z "$trigger_dport" ] && return
|
||||
IP_RULE="$IP_RULE --dport $trigger_dport"
|
||||
IP6_RULE="$IP6_RULE --dport $trigger_dport"
|
||||
|
||||
trigger_dport_end=$(uci -q get port-trigger."$ptg_id".end_port_range)
|
||||
if [ -n "$trigger_dport_end" ]; then
|
||||
IP_RULE="$IP_RULE:$trigger_dport"
|
||||
IP6_RULE="$IP6_RULE:$trigger_dport"
|
||||
fi
|
||||
|
||||
config_get open_protocol "$rule_id" "protocol"
|
||||
if [ "$open_protocol" = "UDP" ] || [ "$open_protocol" = "udp" ]; then
|
||||
IP_RULE="$IP_RULE -j TRIGGER --trigger-type out --trigger-proto udp"
|
||||
IP6_RULE="$IP6_RULE -j TRIGGER --trigger-type out --trigger-proto udp"
|
||||
elif [ "$open_protocol" = "TCP" ] || [ "$open_protocol" = "tcp" ]; then
|
||||
IP_RULE="$IP_RULE -j TRIGGER --trigger-type out --trigger-proto tcp"
|
||||
IP6_RULE="$IP6_RULE -j TRIGGER --trigger-type out --trigger-proto tcp"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
config_get open_dport "$rule_id" "port"
|
||||
[ -z "$open_dport" ] && return
|
||||
IP_RULE="$IP_RULE --trigger-match $open_dport"
|
||||
IP6_RULE="$IP6_RULE --trigger-match $open_dport"
|
||||
IP_RULE_FWD="$IP_RULE_FWD --dport $open_dport"
|
||||
|
||||
config_get open_dport_end "$rule_id" "end_port_range"
|
||||
if [ -z "$open_dport_end" ]; then
|
||||
IP_RULE="$IP_RULE --trigger-relate $open_dport"
|
||||
IP6_RULE="$IP6_RULE --trigger-relate $open_dport"
|
||||
else
|
||||
IP_RULE="$IP_RULE-$open_dport_end --trigger-relate $open_dport-$open_dport_end"
|
||||
IP6_RULE="$IP6_RULE-$open_dport_end --trigger-relate $open_dport-$open_dport_end"
|
||||
IP_RULE_FWD="$IP_RULE_FWD:$open_dport_end"
|
||||
fi
|
||||
|
||||
duration=$(uci -q get port-trigger."$ptg_id".auto_disable_duration)
|
||||
if [ -n "$duration" ]; then
|
||||
IP_RULE="$IP_RULE --trigger-timeout $duration"
|
||||
IP6_RULE="$IP6_RULE --trigger-timeout $duration"
|
||||
fi
|
||||
|
||||
interface=$(uci -q get port-trigger."$ptg_id".src)
|
||||
[ -z "$interface" ] && return
|
||||
device=$(uci -q get network.$interface.device)
|
||||
IP_RULE_1="iptables -w -t nat -A prerouting_porttrigger -i $device $IP_RULE"
|
||||
echo "$IP_RULE_1">>/tmp/port_trigger_iptables
|
||||
|
||||
IP_RULE_1="ip6tables -w -t nat -A prerouting_porttrigger -i $device $IP6_RULE"
|
||||
echo "$IP_RULE_1">>/tmp/port_trigger_ip6tables
|
||||
|
||||
if [ -n "$duration" ]; then
|
||||
echo "iptables -w -t filter -A forwarding_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type in --trigger-timeout $duration">>/tmp/port_trigger_iptables
|
||||
echo "ip6tables -w -t filter -A forwarding_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type in --trigger-timeout $duration">>/tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -A prerouting_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type dnat --trigger-timeout $duration">>/tmp/port_trigger_iptables
|
||||
else
|
||||
echo "iptables -w -t filter -A forwarding_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type in">>/tmp/port_trigger_iptables
|
||||
echo "ip6tables -w -t filter -A forwarding_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type in">>/tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -A prerouting_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type dnat">>/tmp/port_trigger_iptables
|
||||
fi
|
||||
}
|
||||
|
||||
port_trigger_handling() {
|
||||
rm /tmp/port_trigger_iptables 2> /dev/null
|
||||
rm /tmp/port_trigger_ip6tables 2> /dev/null
|
||||
touch /tmp/port_trigger_iptables
|
||||
touch /tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -F prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t filter -F forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t nat -F prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "ip6tables -w -t nat -F prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
echo "ip6tables -w -t filter -F forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -N prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t nat -I PREROUTING -j prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t filter -N forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t filter -I forwarding_wan_rule -j forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t nat -N prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t nat -I prerouting_wan_rule -j prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
|
||||
echo "ip6tables -w -t nat -N prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "ip6tables -w -t nat -I PREROUTING -j prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
echo "ip6tables -w -t filter -N forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "ip6tables -w -t filter -I forwarding_wan_rule -j forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
|
||||
# Load /etc/config/port-trigger UCI file
|
||||
config_load port-trigger
|
||||
config_foreach process_port_trigger rule
|
||||
|
||||
sh /tmp/port_trigger_iptables
|
||||
sh /tmp/port_trigger_ip6tables
|
||||
}
|
||||
175
fluent-bit/Makefile
Normal file
175
fluent-bit/Makefile
Normal file
@@ -0,0 +1,175 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fluent-bit
|
||||
PKG_VERSION:=3.1.0
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit/archive/v$(PKG_VERSION)
|
||||
PKG_HASH:=7a49e110cf3050b6c29c911063494b8081f3c743274d1d95e52562d0476ba1eb
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/fluent-bit
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:= +libyaml +libopenssl +libcurl +libatomic +musl-fts +flex +bison
|
||||
TITLE:=Fluent-Bit
|
||||
URL:=https://fluentbit.io/
|
||||
endef
|
||||
|
||||
define Package/fluent-bit/description
|
||||
Fluent Bit is a super fast, lightweight, and highly scalable logging and metrics processor and forwarder.
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ./fluent-bit/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
# General options
|
||||
TARGET_LDFLAGS +=-lfts -latomic
|
||||
|
||||
CMAKE_OPTIONS+= \
|
||||
-DFLB_RELEASE=Yes \
|
||||
-DFLB_SMALL=No \
|
||||
-DEXCLUDE_FROM_ALL=true \
|
||||
-DFLB_SHARED_LIBS=Yes \
|
||||
-DFLB_DEBUG=Yes \
|
||||
-DFLB_ALL=No \
|
||||
-DFLB_JEMALLOC=No \
|
||||
-DFLB_EXAMPLES=No \
|
||||
-DFLB_CHUNK_TRACE=No \
|
||||
-DFLB_BACKTRACE=No \
|
||||
-DFLB_WASM=No \
|
||||
-DFLB_LUAJIT=No
|
||||
|
||||
# In plugins
|
||||
CMAKE_OPTIONS += \
|
||||
-DFLB_IN_SYSLOG=Yes \
|
||||
-DFLB_IN_CPU=Yes \
|
||||
-DFLB_IN_MEM=Yes \
|
||||
-DFLB_IN_DISK=Yes \
|
||||
-DFLB_IN_EXEC=Yes \
|
||||
-DFLB_IN_HEAD=Yes \
|
||||
-DFLB_IN_FORWARD=No \
|
||||
-DFLB_IN_KMSG=No \
|
||||
-DFLB_IN_PROC=No \
|
||||
-DFLB_IN_RANDOM=No \
|
||||
-DFLB_IN_SERIAL=No \
|
||||
-DFLB_IN_MQTT=No \
|
||||
-DFLB_IN_STDIN=No \
|
||||
-DFLB_IN_SYSTEMD=No \
|
||||
-DFLB_IN_TAIL=No \
|
||||
-DFLB_IN_TCP=No \
|
||||
-DFLB_IN_THERMAL=No \
|
||||
-DFLB_IN_UDP=No \
|
||||
-DFLB_IN_DOCKER=No \
|
||||
-DFLB_IN_EXEC_WASI=No \
|
||||
-DFLB_IN_EVENT_TYPE=No \
|
||||
-DFLB_IN_FLUENTBIT_METRICS=No \
|
||||
-DFLB_IN_KUBERNETES_EVENTS=No \
|
||||
-DFLB_IN_KAFKA=No \
|
||||
-DFLB_IN_LIB=No \
|
||||
-DFLB_IN_SYSTEMD=No \
|
||||
-DFLB_IN_DUMMY=No \
|
||||
-DFLB_IN_NETIF=No \
|
||||
-DFLB_IN_COLLECTD=No \
|
||||
-DFLB_IN_PROMETHEUS_SCRAPE=No \
|
||||
-DFLB_IN_STATSD=No \
|
||||
-DFLB_IN_STORAGE_BACKLOG=No \
|
||||
-DFLB_IN_PODMAN_METRICS=No \
|
||||
-DFLB_IN_OPENTELEMETRY=No \
|
||||
-DFLB_IN_ELASTICSEARCH=No \
|
||||
-DFLB_IN_CALYPTIA_FLEET=No \
|
||||
-DFLB_IN_SPLUNK=No
|
||||
-DFLB_IN_HEALTH=No \
|
||||
-DFLB_IN_WINLOG=No \
|
||||
-DFLB_IN_WINEVTLOG=No
|
||||
|
||||
|
||||
# Filter options
|
||||
CMAKE_OPTIONS +=
|
||||
-DFLB_FILTER_AWS=No \
|
||||
-DFLB_FILTER_ECS=No \
|
||||
-DFLB_FILTER_KUBERNETES=No \
|
||||
-DFLB_FILTER_LUA=No \
|
||||
-DFLB_FILTER_NEST=No \
|
||||
-DFLB_FILTER_RECORD_MODIFIER=No \
|
||||
-DFLB_FILTER_THROTTLE=No \
|
||||
-DFLB_FILTER_TYPE_CONVERTER=No \
|
||||
-DFLB_FILTER_WASM=No \
|
||||
-DFLB_FILTER_TENSORFLOW=No \
|
||||
-DFLB_FILTER_GEOIP2=No \
|
||||
-DFLB_FILTER_NIGHTFALL=No
|
||||
|
||||
# out plugins
|
||||
CMAKE_OPTIONS += \
|
||||
-DFLB_OUT_EXIT=Yes \
|
||||
-DFLB_OUT_FORWARD=Yes \
|
||||
-DFLB_OUT_HTTP=Yes \
|
||||
-DFLB_OUT_NATS=Yes \
|
||||
-DFLB_OUT_TCP=Yes \
|
||||
-DFLB_OUT_UDP=Yes \
|
||||
-DFLB_OUT_FILE=Yes \
|
||||
-DFLB_OUT_STDOUT=Yes \
|
||||
-DFLB_OUT_SYSLOG=Yes \
|
||||
-DFLB_OUT_NULL=Yes \
|
||||
-DFLB_OUT_PLOT=No \
|
||||
-DFLB_OUT_AZURE=No \
|
||||
-DFLB_OUT_AZURE_BLOB=No \
|
||||
-DFLB_OUT_AZURE_LOGS_INGESTION=No \
|
||||
-DFLB_OUT_AZURE_KUSTO=No \
|
||||
-DFLB_OUT_BIGQUERY=No \
|
||||
-DFLB_OUT_CALYPTIA=No \
|
||||
-DFLB_OUT_COUNTER=No \
|
||||
-DFLB_OUT_DATADOG=No \
|
||||
-DFLB_OUT_ES=No \
|
||||
-DFLB_OUT_GELF=No \
|
||||
-DFLB_OUT_INFLUXDB=No \
|
||||
-DFLB_OUT_NRLOGS=No \
|
||||
-DFLB_OUT_OPENSEARCH=No \
|
||||
-DFLB_OUT_TD=No \
|
||||
-DFLB_OUT_SKYWALKING=No \
|
||||
-DFLB_OUT_SLACK=No \
|
||||
-DFLB_OUT_SPLUNK=No \
|
||||
-DFLB_OUT_STACKDRIVER=No \
|
||||
-DFLB_OUT_LIB=No \
|
||||
-DFLB_OUT_FLOWCOUNTER=No \
|
||||
-DFLB_OUT_LOGDNA=No \
|
||||
-DFLB_OUT_LOKI=No \
|
||||
-DFLB_OUT_KAFKA=No \
|
||||
-DFLB_OUT_KAFKA_REST=No \
|
||||
-DFLB_OUT_CLOUDWATCH_LOGS=No \
|
||||
-DFLB_OUT_KINESIS_FIREHOSE=No \
|
||||
-DFLB_OUT_KINESIS_STREAMS=No \
|
||||
-DFLB_OUT_OPENTELEMETRY=No \
|
||||
-DFLB_OUT_PROMETHEUS_EXPORTER=No \
|
||||
-DFLB_OUT_PROMETHEUS_REMOTE_WRITE=No \
|
||||
-DFLB_OUT_S3=No \
|
||||
-DFLB_OUT_VIVO_EXPORTER=No \
|
||||
-DFLB_OUT_WEBSOCKET=No \
|
||||
-DFLB_OUT_ORACLE_LOG_ANALYTICS=No \
|
||||
-DFLB_OUT_CHRONICLE=No \
|
||||
-DFLB_OUT_PGSQL=No
|
||||
|
||||
define Package/fluent-bit/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/fluent-bit
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/fluent-bit $(1)/usr/sbin/
|
||||
$(INSTALL_DATA) ./files/fluent-bit.conf $(1)/etc/fluent-bit/fluent-bit.conf
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/parsers.conf $(1)/etc/fluent-bit/parsers.conf
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fluent-bit))
|
||||
15
fluent-bit/files/fluent-bit.conf
Normal file
15
fluent-bit/files/fluent-bit.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[SERVICE]
|
||||
flush 3
|
||||
daemon Off
|
||||
log_level info
|
||||
parsers_file /etc/fluent-bit/parsers.conf
|
||||
|
||||
[INPUT]
|
||||
name syslog
|
||||
tag syslog
|
||||
path /dev/log
|
||||
|
||||
[OUTPUT]
|
||||
name null
|
||||
match *
|
||||
|
||||
14
fluent-bit/patches/0001-fix_out_file_plugin.patch
Normal file
14
fluent-bit/patches/0001-fix_out_file_plugin.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff --git a/plugins/out_file/file.c b/plugins/out_file/file.c
|
||||
index 2e47c9666..42ace24c6 100644
|
||||
--- a/plugins/out_file/file.c
|
||||
+++ b/plugins/out_file/file.c
|
||||
@@ -45,6 +45,9 @@
|
||||
#define NEWLINE "\n"
|
||||
#endif
|
||||
|
||||
+#undef PATH_MAX
|
||||
+#define PATH_MAX 256
|
||||
+
|
||||
struct flb_file_conf {
|
||||
const char *out_path;
|
||||
const char *out_file;
|
||||
45
fluent-bit/patches/0002-add_hostname_to_log_dump.patch
Normal file
45
fluent-bit/patches/0002-add_hostname_to_log_dump.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
diff --git a/plugins/out_file/file.c b/plugins/out_file/file.c
|
||||
index 2e47c9666..95d28e438 100644
|
||||
--- a/plugins/out_file/file.c
|
||||
+++ b/plugins/out_file/file.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <msgpack.h>
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@@ -55,6 +56,7 @@ struct flb_file_conf {
|
||||
int csv_column_names;
|
||||
int mkdir;
|
||||
struct flb_output_instance *ins;
|
||||
+ char hostname[256];
|
||||
};
|
||||
|
||||
static char *check_delimiter(const char *str)
|
||||
@@ -141,6 +143,9 @@ static int cb_file_init(struct flb_output_instance *ins,
|
||||
}
|
||||
}
|
||||
|
||||
+ if (gethostname(ctx->hostname, sizeof(ctx->hostname)) != 0)
|
||||
+ snprintf(ctx->hostname, sizeof(ctx->hostname), "%s", "localhost");
|
||||
+
|
||||
tmp = flb_output_get_property("delimiter", ins);
|
||||
ret_str = check_delimiter(tmp);
|
||||
if (ret_str != NULL) {
|
||||
@@ -233,12 +238,8 @@ static int template_output_write(struct flb_file_conf *ctx,
|
||||
int i;
|
||||
msgpack_object_kv *kv;
|
||||
|
||||
- /*
|
||||
- * Right now we treat "{time}" specially and fill the placeholder
|
||||
- * with the metadata timestamp (formatted as float).
|
||||
- */
|
||||
- if (!strncmp(key, "time", size)) {
|
||||
- fprintf(fp, "%f", flb_time_to_double(tm));
|
||||
+ if (!strncmp(key, "hostname", size)) {
|
||||
+ fprintf(fp, "%s", ctx->hostname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ define KernelPackage/$(PKG_NAME)
|
||||
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
|
||||
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
|
||||
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
|
||||
DEPENDS:= +(TARGET_brcmbca):bcmkernel
|
||||
DEPENDS:= +(TARGET_brcmbca):bcm963xx-bsp
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_URL:=
|
||||
endef
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostmngr
|
||||
PKG_VERSION:=1.1.7
|
||||
PKG_VERSION:=1.2.9
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=79a6649995752da3501808debeed9e3ddfdf4d59
|
||||
PKG_SOURCE_VERSION:=27b2d7c3ef0ccb4e2c30f790f2b51881b6884d9c
|
||||
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
|
||||
@@ -22,7 +22,7 @@ PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
define Package/hostmngr
|
||||
SECTION:=utils
|
||||
@@ -31,8 +31,8 @@ define Package/hostmngr
|
||||
DEPENDS= +libubox +libuci +libubus +ubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +libnfnetlink +libmnl \
|
||||
+libnetfilter-conntrack \
|
||||
+HOSTMNGR_PLATFORM_HAS_WIFI:libwifi +libbbfdm-api
|
||||
|
||||
+HOSTMNGR_PLATFORM_HAS_WIFI:libwifi +libwifiutils
|
||||
DEPENDS+= +libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
define Package/hostmngr/config
|
||||
@@ -57,14 +57,12 @@ endif
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/hostmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(CP) ./files/etc $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/hostmngr/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/hostmngr $(1)/usr/sbin/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/bbf_plugin/libhostmngr.so $(1)/etc/hostmngr/
|
||||
$(INSTALL_DATA) ./files/etc/hostmngr/input.json $(1)/etc/hostmngr/
|
||||
$(INSTALL_DIR) $(1)/usr/share/hostmngr
|
||||
$(INSTALL_DATA) ./files/scripts/hosts_acl.sh $(1)/usr/share/hostmngr/
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/bbf_plugin/libhostmngr.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"daemon": {
|
||||
"input": {
|
||||
"type": "DotSo",
|
||||
"name": "/etc/hostmngr/libhostmngr.so"
|
||||
},
|
||||
"output": {
|
||||
"type": "UBUS",
|
||||
"name": "bbfdm.hosts",
|
||||
"parent_dm": "Device.",
|
||||
"object": "Hosts",
|
||||
"root_obj": "bbfdm"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,8 @@
|
||||
START=65
|
||||
STOP=20
|
||||
|
||||
. /etc/bbfdm/bbfdm_services.sh
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
HOSTS_JSON_INPUT="/etc/hostmngr/input.json"
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "/usr/sbin/hostmngr" "--config hosts" "-o" "/tmp/hostmngr.log" "-f"
|
||||
@@ -18,7 +14,6 @@ start_service() {
|
||||
# procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
|
||||
bbfdm_add_service "bbfdm.hosts" "${HOSTS_JSON_INPUT}"
|
||||
sh /usr/share/hostmngr/hosts_acl.sh
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
day=""
|
||||
next_days=""
|
||||
prev_days=""
|
||||
schedule_added=""
|
||||
|
||||
ACCESS_RULE=""
|
||||
IP_RULE=""
|
||||
IP_RULE1=""
|
||||
|
||||
@@ -108,70 +111,77 @@ ip_rule_east_zone() {
|
||||
fi
|
||||
}
|
||||
|
||||
process_ac_schedule() {
|
||||
local acs_id="$1"
|
||||
local is_enabled
|
||||
local access_control
|
||||
local start_time=""
|
||||
local mac=""
|
||||
|
||||
add_access_rule() {
|
||||
local rule="$1"
|
||||
echo "iptables -w -A hosts_forward ${rule}" >> $ACL_FILE
|
||||
echo "ip6tables -w -A hosts_forward ${rule}" >> $ACL_FILE
|
||||
}
|
||||
|
||||
handle_day_list() {
|
||||
local value=$1
|
||||
handle_day_list() {
|
||||
local value=$1
|
||||
|
||||
val=$(echo $value | cut -c 1-3)
|
||||
next_day_val=$(get_next_day $val)
|
||||
prev_day_val=$(get_previous_day $val)
|
||||
if [ -z $day ]; then
|
||||
day="$val"
|
||||
next_days="$next_day_val"
|
||||
prev_days="$prev_day_val"
|
||||
else
|
||||
day="$day,$val"
|
||||
next_days="$next_days,$next_day_val"
|
||||
prev_days="$prev_days,$prev_day_val"
|
||||
fi
|
||||
}
|
||||
val=$(echo $value | cut -c 1-3)
|
||||
next_day_val=$(get_next_day $val)
|
||||
prev_day_val=$(get_previous_day $val)
|
||||
if [ -z $day ]; then
|
||||
day="$val"
|
||||
next_days="$next_day_val"
|
||||
prev_days="$prev_day_val"
|
||||
else
|
||||
day="$day,$val"
|
||||
next_days="$next_days,$next_day_val"
|
||||
prev_days="$prev_days,$prev_day_val"
|
||||
fi
|
||||
}
|
||||
|
||||
config_list_foreach "$acs_id" "day" handle_day_list
|
||||
config_get is_enabled "$acs_id" "enable" 1
|
||||
config_get access_control "$acs_id" "dm_parent"
|
||||
handle_schedule() {
|
||||
local schd_section="$1"
|
||||
local ac_section="$2"
|
||||
local acs_id
|
||||
local start_time
|
||||
local duration
|
||||
|
||||
if [ "$is_enabled" == "0" ] || [ -z "$access_control" ]; then
|
||||
return
|
||||
IP_RULE="$ACCESS_RULE"
|
||||
IP_RULE1=""
|
||||
day=""
|
||||
next_days=""
|
||||
prev_days=""
|
||||
|
||||
config_get acs_id "$schd_section" "dm_parent"
|
||||
|
||||
if [ "$acs_id" != "$ac_section" ]; then
|
||||
return # schedule not for this access control section
|
||||
fi
|
||||
|
||||
IP_RULE=""
|
||||
IP_RULE1=""
|
||||
|
||||
config_get is_enabled "$access_control" "enable" 1
|
||||
local is_enabled
|
||||
config_get is_enabled "$schd_section" "enable" 0
|
||||
if [ "$is_enabled" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
mac=$(uci -q get hosts.$access_control.macaddr)
|
||||
access_policy=$(uci -q get hosts.$access_control.access_policy)
|
||||
local all_days="Monday Tuesday Wednesday Thursday Friday Saturday Sunday"
|
||||
local day_config
|
||||
config_get day_config "$schd_section" "day" "$all_days"
|
||||
|
||||
config_get start_time "$acs_id" "start_time"
|
||||
config_get duration "$acs_id" "duration"
|
||||
IFS=" "
|
||||
for d in $day_config; do
|
||||
handle_day_list $d
|
||||
done
|
||||
|
||||
if [ -z "$mac" ] && [ -z "$start_time" ] && [ -z "$duration" ] && [ -z "$day" ] && [ -z "$access_policy" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -n "$mac" ]; then
|
||||
IP_RULE="$IP_RULE -m mac --mac-source $mac"
|
||||
fi
|
||||
config_get start_time "$schd_section" "start_time" "00:00"
|
||||
config_get duration "$schd_section" "duration"
|
||||
|
||||
zone=$(date +%z | cut -c 1)
|
||||
local_start_time=$start_time
|
||||
if [ -n "$duration" ]; then
|
||||
hh=$(echo $local_start_time | awk -F: '{ print $1 }')
|
||||
mm=$(echo $local_start_time | awk -F: '{ print $2 }')
|
||||
hh_s=`expr $hh \* 3600`
|
||||
mm_s=`expr $mm \* 60`
|
||||
ss=$(( hh_s + mm_s ))
|
||||
local_start_hh=$hh
|
||||
hh=$(echo $local_start_time | awk -F: '{ print $1 }')
|
||||
mm=$(echo $local_start_time | awk -F: '{ print $2 }')
|
||||
hh_s=`expr $hh \* 3600`
|
||||
mm_s=`expr $mm \* 60`
|
||||
ss=$(( hh_s + mm_s ))
|
||||
local_start_hh=$hh
|
||||
|
||||
if [ -n "$duration" ]; then
|
||||
stop_ss=$(( ss + duration ))
|
||||
hh=$(( stop_ss / 3600 ))
|
||||
rem_ss=$(( stop_ss % 3600 ))
|
||||
@@ -179,6 +189,10 @@ process_ac_schedule() {
|
||||
ss=$(( rem_ss % 60 ))
|
||||
local_stop_time="$hh:$mm:$ss"
|
||||
local_stop_hh=$hh
|
||||
else
|
||||
# if duartion is not specified, then apply rule to end of the day
|
||||
local_stop_time="23:59:59"
|
||||
local_stop_hh="23"
|
||||
fi
|
||||
|
||||
utc_start_time=$(date -u -d @$(date "+%s" -d "$local_start_time") +%H:%M)
|
||||
@@ -191,43 +205,95 @@ process_ac_schedule() {
|
||||
ip_rule_east_zone $utc_start_hh $utc_stop_hh $local_start_hh $local_stop_hh $utc_start_time $utc_stop_time
|
||||
fi
|
||||
|
||||
if [ "$access_policy" == "Deny" ]; then
|
||||
IP_RULE="$IP_RULE -j DROP"
|
||||
if [ -n "$IP_RULE1" ]; then
|
||||
IP_RULE1="$IP_RULE1 -j DROP"
|
||||
fi
|
||||
else
|
||||
IP_RULE="$IP_RULE -j ACCEPT"
|
||||
if [ -n "$IP_RULE1" ]; then
|
||||
IP_RULE1="$IP_RULE1 -j ACCEPT"
|
||||
fi
|
||||
fi
|
||||
|
||||
iptables -w -A hosts_forward ${IP_RULE}
|
||||
ip6tables -w -A hosts_forward ${IP_RULE}
|
||||
IP_RULE="$IP_RULE -j ACCEPT"
|
||||
if [ -n "$IP_RULE1" ]; then
|
||||
iptables -w -A hosts_forward ${IP_RULE1}
|
||||
ip6tables -w -A hosts_forward ${IP_RULE1}
|
||||
IP_RULE1="$IP_RULE1 -j ACCEPT"
|
||||
fi
|
||||
|
||||
day=""
|
||||
next_days=""
|
||||
prev_days=""
|
||||
add_access_rule "$IP_RULE"
|
||||
if [ -n "$IP_RULE1" ]; then
|
||||
add_access_rule "$IP_RULE1"
|
||||
fi
|
||||
|
||||
# for access rules to be effective for a schedule, need to add DROP rule
|
||||
# to block the access outside the defined schedule
|
||||
if [ "$schedule_added" == "0" ]; then
|
||||
schedule_added="1"
|
||||
fi
|
||||
}
|
||||
|
||||
iptables -w -F hosts_forward
|
||||
ip6tables -w -F hosts_forward
|
||||
handle_access_control() {
|
||||
local ac_section="$1"
|
||||
local is_enabled
|
||||
|
||||
hosts_forward=$(iptables -t filter --list | grep hosts_forward)
|
||||
if [ -z "$hosts_forward" ]; then
|
||||
iptables -w -t filter -N hosts_forward
|
||||
# default value of Hosts.AccessControl.{i}.Enable is false,
|
||||
# so, if not defined in uci as 1, assume 0
|
||||
config_get is_enabled "$ac_section" "enable" 0
|
||||
if [ "$is_enabled" == "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local mac_addr
|
||||
config_get mac_addr "$ac_section" "macaddr"
|
||||
if [ -z "$mac_addr" ]; then
|
||||
return
|
||||
else
|
||||
ACCESS_RULE="-m mac --mac-source $mac_addr"
|
||||
fi
|
||||
|
||||
local access_policy
|
||||
config_get access_policy "$ac_section" "access_policy"
|
||||
if [ -z "$access_policy" ]; then
|
||||
return # since system default is allow so no need to do anything
|
||||
fi
|
||||
|
||||
# As per Data Model, if access policy is deny, then schedule is to be ignored
|
||||
# and no access is to be provided for the device
|
||||
if [ "$access_policy" == "Deny" ]; then
|
||||
ACCESS_RULE="$ACCESS_RULE -j DROP"
|
||||
add_access_rule "$ACCESS_RULE"
|
||||
return # no need to parse schedule
|
||||
fi
|
||||
|
||||
schedule_added="0"
|
||||
# check if schedule is defined for this access_control instance
|
||||
# and if yes, create rule accordingly
|
||||
config_foreach handle_schedule ac_schedule "$ac_section"
|
||||
|
||||
# for access rule to work, need to have default drop rule as last rule
|
||||
if [ "$schedule_added" == "1" ]; then
|
||||
IP_RULE="$ACCESS_RULE -j DROP"
|
||||
add_access_rule "$IP_RULE"
|
||||
fi
|
||||
}
|
||||
|
||||
ACL_FILE="/tmp/hosts_access_control/access_control.rules"
|
||||
|
||||
rm -f $ACL_FILE
|
||||
|
||||
mkdir -p /tmp/hosts_access_control/
|
||||
touch $ACL_FILE
|
||||
|
||||
echo "iptables -w -F hosts_forward" >> $ACL_FILE
|
||||
echo "ip6tables -w -F hosts_forward" >> $ACL_FILE
|
||||
|
||||
hosts_ipv4_forward=$(iptables -t filter --list -n | grep hosts_forward)
|
||||
if [ -z "$hosts_ipv4_forward" ]; then
|
||||
echo "iptables -w -t filter -N hosts_forward" >> $ACL_FILE
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && iptables -w -t filter -I FORWARD -j hosts_forward
|
||||
ip6tables -w -t filter -N hosts_forward
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t filter -I FORWARD -j hosts_forward" >> $ACL_FILE
|
||||
fi
|
||||
|
||||
hosts_ipv6_forward=$(ip6tables -t filter --list -n | grep hosts_forward)
|
||||
if [ -z "$hosts_ipv6_forward" ]; then
|
||||
echo "ip6tables -w -t filter -N hosts_forward" >> $ACL_FILE
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && ip6tables -w -t filter -I FORWARD -j hosts_forward
|
||||
[ $ret -eq 0 ] && echo "ip6tables -w -t filter -I FORWARD -j hosts_forward" >> $ACL_FILE
|
||||
fi
|
||||
|
||||
# Load /etc/config/hosts UCI file
|
||||
config_load hosts
|
||||
config_foreach process_ac_schedule ac_schedule
|
||||
config_foreach handle_access_control access_control
|
||||
|
||||
# apply the rules
|
||||
sh $ACL_FILE
|
||||
|
||||
10
icwmp/Config.in
Normal file
10
icwmp/Config.in
Normal file
@@ -0,0 +1,10 @@
|
||||
menu "Configuration"
|
||||
|
||||
config ICWMP_MGMT_FROM_USP
|
||||
bool "Support configuration of ManagementServer from USP"
|
||||
default y
|
||||
|
||||
config ICWMP_BACKUP_EVENTS
|
||||
bool "Create backup of session events to persistent storage after each successful session"
|
||||
default y
|
||||
endmenu
|
||||
@@ -8,14 +8,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.5.29.7
|
||||
PKG_VERSION:=9.8.22
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
|
||||
PKG_SOURCE_VERSION:=12c5a6ff4bb9c423d6a24dbe7127d2d2c47d3785
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_VERSION:=2eeb0990616df846da55a154d2fed05c828d168f
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -26,59 +26,30 @@ include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/icwmp/default
|
||||
define Package/icwmp
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=TR069 CWMP client
|
||||
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml +libuuid +libbbfdm-api
|
||||
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml +libuuid +libopenssl
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/icwmp
|
||||
$(Package/icwmp/default)
|
||||
VARIANT:=default
|
||||
DEFAULT_VARIANT:=1
|
||||
DEPENDS += +PACKAGE_icwmp-openssl:libopenssl
|
||||
define Package/icwmp/description
|
||||
TR069 client implementation with bbfdm backend for TR181 support
|
||||
endef
|
||||
|
||||
define Package/icwmp-openssl
|
||||
$(Package/icwmp/default)
|
||||
TITLE += (openssl)
|
||||
VARIANT:=openssl
|
||||
DEPENDS += +PACKAGE_icwmp-openssl:libopenssl
|
||||
CONFLICTS := icwmp icwmp-mbedtls icwmp-wolfssl
|
||||
define Package/icwmp/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/icwmp-wolfssl
|
||||
$(Package/icwmp/default)
|
||||
TITLE += (wolfssl)
|
||||
VARIANT:=wolfssl
|
||||
DEPENDS += +PACKAGE_icwmp-wolfssl:libwolfssl
|
||||
CONFLICTS := icwmp icwmp-mbedtls icwmp-openssl
|
||||
endef
|
||||
|
||||
define Package/icwmp-mbedtls
|
||||
$(Package/icwmp/default)
|
||||
TITLE += (mbedtls)
|
||||
DEPENDS += +PACKAGE_icwmp-mbedtls:libmbedtls
|
||||
VARIANT:=mbedtls
|
||||
CONFLICTS := icwmp icwmp-wolfssl icwmp-openssl
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),default)
|
||||
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
|
||||
ifeq ($(CONFIG_ICWMP_MGMT_FROM_USP),y)
|
||||
EXTRA_CFLAGS += -DCWMP_DUAL_SUPPORT=BBFDM_BOTH
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),openssl)
|
||||
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),wolfssl)
|
||||
CMAKE_OPTIONS += -DWITH_WOLFSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),mbedtls)
|
||||
CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
|
||||
ifeq ($(CONFIG_ICWMP_BACKUP_EVENTS),y)
|
||||
EXTRA_CFLAGS += -DPERSIST_BACKUP_SESSION_EVENTS
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
@@ -87,7 +58,7 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/icwmp/default/install
|
||||
define Package/icwmp/install
|
||||
$(INSTALL_DIR) $(1)/etc/icwmpd
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
@@ -97,24 +68,18 @@ define Package/icwmp/default/install
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
|
||||
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
|
||||
$(INSTALL_BIN) ./files/etc/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||
$(INSTALL_BIN) ./files/etc/init.d/icwmpd $(1)/etc/init.d/icwmpd
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/95-set-random-inform-time $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/vendor_log.sh $(1)/etc/icwmpd/vendor_log.sh
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/firewall.cwmp $(1)/etc/icwmpd/firewall.cwmp
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/critical_services.json $(1)/etc/icwmpd/critical_services.json
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
|
||||
$(call BbfdmInstallPlugin,$(1),./files/etc/bbfdm/json/CWMPManagementServer.json)
|
||||
$(call BbfdmInstallPlugin,$(1),$(PKG_BUILD_DIR)/libcwmpdm.so)
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/libcwmpdm.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
Package/icwmp/install = $(Package/icwmp/default/install)
|
||||
Package/icwmp-openssl/install = $(Package/icwmp/default/install)
|
||||
Package/icwmp-wolfssl/install = $(Package/icwmp/default/install)
|
||||
Package/icwmp-mbedtls/install = $(Package/icwmp/default/install)
|
||||
|
||||
$(eval $(call BuildPackage,icwmp))
|
||||
$(eval $(call BuildPackage,icwmp-openssl))
|
||||
$(eval $(call BuildPackage,icwmp-wolfssl))
|
||||
$(eval $(call BuildPackage,icwmp-mbedtls))
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"json_plugin_version": 1,
|
||||
"json_plugin_version": 2,
|
||||
"Device.CWMPManagementServer.": {
|
||||
"type": "object",
|
||||
"version": "2.15",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
@@ -11,7 +10,6 @@
|
||||
"dependency": "file:/etc/config/cwmp",
|
||||
"EnableCWMP": {
|
||||
"type": "boolean",
|
||||
"version": "2.15",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
|
||||
@@ -5,6 +5,7 @@ config acs 'acs'
|
||||
option periodic_inform_interval '1800'
|
||||
option periodic_inform_time '0001-01-01T00:00:00Z'
|
||||
option dhcp_discovery 'enable'
|
||||
#option ssl_capath "/etc/icwmpd/ca.pem"
|
||||
# compression possible configs: GZIP, Deflate, Disabled
|
||||
option compression 'Disabled'
|
||||
# possible configs interval :[1:65535]
|
||||
@@ -40,6 +41,7 @@ config cpe 'cpe'
|
||||
option active_notif_throttle '0'
|
||||
option disable_gatewayinfo '0'
|
||||
option fw_upgrade_keep_settings '1'
|
||||
option clock_sync_timeout '128'
|
||||
|
||||
config lwn 'lwn'
|
||||
option enable '0'
|
||||
|
||||
11
icwmp/files/etc/icwmpd/critical_services.json
Normal file
11
icwmp/files/etc/icwmpd/critical_services.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"services_list": [
|
||||
"firewall",
|
||||
"network",
|
||||
"dhcp",
|
||||
"stunc",
|
||||
"xmpp",
|
||||
"wireless",
|
||||
"time"
|
||||
]
|
||||
}
|
||||
@@ -6,7 +6,7 @@ log() {
|
||||
}
|
||||
|
||||
get_firewall_zone() {
|
||||
zone="$(uci show firewall|grep network|grep ${1}|cut -d. -f 2)"
|
||||
zone="$(uci show firewall|grep network|grep -w ${1}|cut -d. -f 2)"
|
||||
zone="${zone:-wan}" # defaults to wan zone
|
||||
echo "$zone"
|
||||
}
|
||||
29
icwmp/files/etc/icwmpd/vendor_log.sh
Normal file
29
icwmp/files/etc/icwmpd/vendor_log.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# This script handles '2 Vendor Log File' of Download RPC
|
||||
# Vendors can replace this file if they need to collect more logs
|
||||
|
||||
VENDOR_LOG_FILE="/tmp/icwmp/2_vendor_log"
|
||||
ret=""
|
||||
|
||||
if [ -n "$(which logread)" ]; then
|
||||
mkdir -p /tmp/icwmp
|
||||
|
||||
logread > "${VENDOR_LOG_FILE}"
|
||||
|
||||
arch_file="${VENDOR_LOG_FILE}.tar"
|
||||
|
||||
if [ -f "${arch_file}" ]; then
|
||||
rm -f ${arch_file}
|
||||
fi
|
||||
|
||||
if [ -f "${VENDOR_LOG_FILE}" ]; then
|
||||
tar -cf "${arch_file}" "${VENDOR_LOG_FILE}" 2> /dev/null
|
||||
if [ -f "${arch_file}" ]; then
|
||||
ret="${arch_file}"
|
||||
fi
|
||||
|
||||
rm -rf "${VENDOR_LOG_FILE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "${ret}"
|
||||
@@ -9,38 +9,40 @@ PROG="/usr/sbin/icwmpd"
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
include /lib/network
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t cwmp.init -p info
|
||||
}
|
||||
|
||||
regenerate_ssl_link()
|
||||
{
|
||||
local cert_dir all_file rehash
|
||||
regenerate_ssl_link() {
|
||||
local cert_dir
|
||||
|
||||
cert_dir="${1}"
|
||||
[ ! -d "${cert_dir}" ] && return 0;
|
||||
|
||||
### Generate all ssl link for pem certicates ###
|
||||
all_file=$(ls "${cert_dir}"/*.pem 2>/dev/null)
|
||||
if [ -n "${all_file}" ]; then
|
||||
for cfile in $all_file; do
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
[ -f "${cert_dir}"/"${rehash}".0 ] || \
|
||||
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
|
||||
done
|
||||
cert_dir="${1%/}"
|
||||
if [ -f "${cert_dir}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
### Generate all ssl link for crt certicates ###
|
||||
all_file=$(ls "${cert_dir}"/*.crt 2>/dev/null)
|
||||
if [ -n "${all_file}" ]; then
|
||||
for cfile in $all_file; do
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
[ -f "${cert_dir}"/"${rehash}".0 ] || \
|
||||
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
|
||||
# do not generate the c_rehash if its system default cert path
|
||||
# ca-certificate package already generates c_rehash on compilation
|
||||
[ ! -d "${cert_dir}" ] || [ "${cert_dir}" = "/etc/ssl/certs" ] && return 0
|
||||
|
||||
generate_links() {
|
||||
local file_type="$1"
|
||||
local files="${cert_dir}"/*."${file_type}"
|
||||
for cfile in ${files}; do
|
||||
if [ -f "${cfile}" ]; then
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
if [ ! -f "${cert_dir}/${rehash}.0" ]; then
|
||||
log "Generating c_rehash for ${cfile}=>${rehash}.0"
|
||||
ln -s "${cfile}" "${cert_dir}/${rehash}.0"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
generate_links "pem"
|
||||
}
|
||||
|
||||
enable_dhcp_option43() {
|
||||
@@ -436,13 +438,14 @@ validate_cpe_section()
|
||||
'notification:bool' \
|
||||
'exec_download:bool' \
|
||||
'periodic_notify_enable:bool' \
|
||||
'enable:bool' \
|
||||
'enable:bool:1' \
|
||||
'periodic_notify_interval:uinteger' \
|
||||
'fw_upgrade_keep_settings:bool'
|
||||
}
|
||||
|
||||
validate_defaults() {
|
||||
local ssl_capath
|
||||
local ssl_capath enable url dhcp_url
|
||||
|
||||
config_load cwmp
|
||||
|
||||
validate_acs_section || {
|
||||
@@ -450,13 +453,17 @@ validate_defaults() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if [ -z "${url}" ] && [ -z "${dhcp_url}" ]; then
|
||||
log "No ACS URL is configured"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ssl_capath="${ssl_capath%/}"
|
||||
# Put the cert pem file in keep list
|
||||
if [ -d "${ssl_capath}" ]; then
|
||||
if [ -d "${ssl_capath}" ] && [ "${ssl_capath}" != "/etc/ssl/certs" ]; then
|
||||
if ! grep "*.pem\|*.crt" /lib/upgrade/keep.d/icwmp; then
|
||||
echo "${ssl_capath}"'/*.pem' >> /lib/upgrade/keep.d/icwmp
|
||||
echo "${ssl_capath}"'/*.crt' >> /lib/upgrade/keep.d/icwmp
|
||||
echo "${ssl_capath}"'/*.0' >> /lib/upgrade/keep.d/icwmp
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -465,6 +472,11 @@ validate_defaults() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if [ "$enable" = "0" ]; then
|
||||
log "CWMP service disabled"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -512,30 +524,17 @@ boot() {
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enable_cwmp url dhcp_url
|
||||
|
||||
config_load cwmp
|
||||
config_get_bool enable_cwmp cpe enable 1
|
||||
config_get url acs url ""
|
||||
config_get dhcp_url acs dhcp_url ""
|
||||
|
||||
procd_open_instance icwmp
|
||||
|
||||
if [ "$enable_cwmp" = "0" ]; then
|
||||
procd_close_instance
|
||||
return 0
|
||||
fi
|
||||
|
||||
validate_defaults || {
|
||||
log "Validation of defaults failed"
|
||||
procd_close_instance
|
||||
return 1;
|
||||
}
|
||||
|
||||
if [ -n "${url}" ] || [ -n "${dhcp_url}" ]; then
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -b
|
||||
fi
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -b
|
||||
|
||||
procd_set_param respawn \
|
||||
"${respawn_threshold:-5}" \
|
||||
@@ -552,16 +551,14 @@ stop_service()
|
||||
reload_service() {
|
||||
local ret
|
||||
|
||||
config_load cwmp
|
||||
config_get_bool enable_cwmp cpe enable 1
|
||||
|
||||
log "Reload service $ret"
|
||||
ret="0"
|
||||
if [ "$enable_cwmp" = "0" ]; then
|
||||
|
||||
validate_defaults || {
|
||||
stop
|
||||
start
|
||||
return 0
|
||||
fi
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret=$(ubus call service list '{"name":"icwmpd"}' | jsonfilter -qe '@.icwmpd.instances.icwmp.running')
|
||||
if [ "$ret" != "true" ]; then
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
uci -q batch <<-EOT
|
||||
delete firewall.cwmp
|
||||
set firewall.cwmp=include
|
||||
set firewall.cwmp.path=/etc/firewall.cwmp
|
||||
set firewall.cwmp.path=/etc/icwmpd/firewall.cwmp
|
||||
set firewall.cwmp.reload=1
|
||||
commit firewall
|
||||
EOT
|
||||
|
||||
@@ -21,6 +21,9 @@ config IEEE1905_WIFI_EASYMESH
|
||||
config IEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY
|
||||
bool "Fragment large CMDU frame at TLV boundary instead of octet boundary"
|
||||
|
||||
config IEEE1905_BUILD_TR181_PLUGIN
|
||||
bool "Build TR-181 mapping module (responsible for Device.IEEE1905.)"
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2020-2023 IOPSYS Software Solutions AB
|
||||
# Copyright (C) 2020-2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=8.3.4.2
|
||||
PKG_VERSION:=8.6.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=8288da08c76e9b0eabc26b45aebb696db321db31
|
||||
PKG_SOURCE_VERSION:=5f7e6e30cbda36e431ecb7150d7494bce0c26f6f
|
||||
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
|
||||
@@ -22,6 +22,7 @@ PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
|
||||
define Package/ieee1905/Default
|
||||
@@ -38,7 +39,7 @@ define Package/libieee1905
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=libieee1905.so (library for CMDU and TLV handling)
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json
|
||||
+libjson-c +libblobmsg-json +libwifiutils
|
||||
endef
|
||||
|
||||
define Package/ieee1905
|
||||
@@ -46,7 +47,9 @@ define Package/ieee1905
|
||||
TITLE:=ieee1905d (daemon implementing 1905.1 and provides cli)
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ubus +libpthread \
|
||||
+libieee1905 +IEEE1905_PLATFORM_HAS_WIFI:libwifi
|
||||
+libieee1905 +IEEE1905_PLATFORM_HAS_WIFI:libwifi \
|
||||
+libwifiutils
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
include $(wildcard plugins/*.mk)
|
||||
@@ -60,12 +63,12 @@ define Package/libieee1905/description
|
||||
endef
|
||||
|
||||
plugins := \
|
||||
$(if $(CONFIG_PACKAGE_map-plugin),map) \
|
||||
$(if $(CONFIG_PACKAGE_snoop-plugin),snoop) \
|
||||
$(if $(CONFIG_PACKAGE_topology-plugin),topology)
|
||||
$(if $(CONFIG_PACKAGE_ieee1905-map-plugin),map) \
|
||||
$(if $(CONFIG_PACKAGE_ieee1905-snoop-plugin),snoop) \
|
||||
$(if $(CONFIG_PACKAGE_ieee1905-topology-plugin),topology)
|
||||
|
||||
|
||||
ppkg:=$(patsubst plugins/%.mk,%-plugin,$(wildcard plugins/*.mk))
|
||||
ppkg:=$(patsubst plugins/%.mk,ieee1905-%-plugin,$(wildcard plugins/*.mk))
|
||||
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
@@ -94,6 +97,7 @@ TARGET_CFLAGS += -DEXTENSION_ALLOWED
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += -DHAS_UBUS
|
||||
TARGET_CFLAGS += -DBUILD_TR181_PLUGIN
|
||||
|
||||
MAKE_FLAGS += \
|
||||
extmod_subdirs="$(patsubst %,extensions/%,$(plugins))"
|
||||
@@ -107,6 +111,7 @@ define Package/ieee1905/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ieee1905d $(1)/usr/sbin/
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/tr181/ieee1905dm.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
define Package/libieee1905/install
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
define Package/map-plugin
|
||||
define Package/ieee1905-map-plugin
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=Multi-AP plugin supporting WiFi-Alliance Easymesh standard
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||
endef
|
||||
|
||||
define Package/map-plugin/config
|
||||
if (PACKAGE_map-plugin)
|
||||
define Package/ieee1905-map-plugin/config
|
||||
if (PACKAGE_ieee1905-map-plugin)
|
||||
|
||||
menu "Configuration"
|
||||
|
||||
config MULTIAP_EASYMESH_VERSION
|
||||
int "Easymesh version"
|
||||
default 4
|
||||
default 6
|
||||
|
||||
config MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG
|
||||
bool "Sync configuration between dynamic controllers in the network"
|
||||
@@ -32,7 +32,7 @@ ifeq ($(CONFIG_MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG),y)
|
||||
TARGET_CFLAGS += -DDYNAMIC_CNTLR_SYNC_CONFIG
|
||||
endif
|
||||
|
||||
define Build/InstallDev/map-plugin
|
||||
define Build/InstallDev/ieee1905-map-plugin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
@@ -43,7 +43,7 @@ define Build/InstallDev/map-plugin
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
||||
endef
|
||||
|
||||
define Package/map-plugin/install
|
||||
define Package/ieee1905-map-plugin/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
define Package/snoop-plugin
|
||||
define Package/ieee1905-snoop-plugin
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=Show all received 1905 CMDUs over UBUS
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||
endef
|
||||
|
||||
define Package/snoop-plugin/install
|
||||
define Package/ieee1905-snoop-plugin/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/snoop/snoop.so $(1)/usr/lib/ieee1905/snoop.so
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
define Package/topology-plugin
|
||||
define Package/ieee1905-topology-plugin
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=Build full network topology of the 1905 nodes only
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||
endef
|
||||
|
||||
define Package/topology-plugin/install
|
||||
define Package/ieee1905-topology-plugin/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/topology/topology.so $(1)/usr/lib/ieee1905/topology.so
|
||||
|
||||
336
iop/config
336
iop/config
@@ -1,336 +0,0 @@
|
||||
############
|
||||
# Generic #
|
||||
##########
|
||||
|
||||
# Build #
|
||||
CONFIG_BUILD_LOG=y
|
||||
CONFIG_CCACHE=y
|
||||
CONFIG_DEBUG=y
|
||||
CONFIG_DEVEL=y
|
||||
# CONFIG_USE_SSTRIP is not set
|
||||
CONFIG_USE_STRIP=y
|
||||
# CONFIG_SIGNED_PACKAGES is not set
|
||||
|
||||
CONFIG_JSON_CYCLONEDX_SBOM=y
|
||||
CONFIG_INCLUDE_CONFIG=y
|
||||
|
||||
# Image #
|
||||
CONFIG_TARGET_CUSTOMER="IOPSYS"
|
||||
CONFIG_TARGET_ROOTFS_TARGZ=y
|
||||
|
||||
# Although UBIFS and EXT4 images work on all non-secure-boot devices,
|
||||
# squashfs is the only officially supported rootfs filesystem.
|
||||
# A writable rootfs is useful for developping an debugging preinit code.
|
||||
# CONFIG_TARGET_ROOTFS_UBIFS is not set
|
||||
# CONFIG_TARGET_ROOTFS_EXT4FS is not set
|
||||
|
||||
# /etc/banner and /etc/device_info #
|
||||
CONFIG_IMAGEOPT=y
|
||||
CONFIG_VERSIONOPT=y
|
||||
CONFIG_VERSION_MANUFACTURER="IOPSYS"
|
||||
CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/"
|
||||
CONFIG_VERSION_DIST="IOWRT"
|
||||
|
||||
# OpenWrt is given by CONFIG_VERSION_NUMBER which we do not want to override.
|
||||
# disabling CONFIG_VERSION_FILENAMES will hide the OpenWrt version from the image filename
|
||||
# CONFIG_VERSION_FILENAMES is not set
|
||||
|
||||
# CONFIG_VERSION_CODE is set to the IOWRT version instead by the genconfig-script and
|
||||
# CONFIG_VERSION_CODE_FILENAMES will put it into the image filename.
|
||||
CONFIG_VERSION_CODE_FILENAMES=y
|
||||
|
||||
CONFIG_VERSION_HOME_URL="https://iopsys.eu"
|
||||
CONFIG_VERSION_BUG_URL="https://iopsys.eu"
|
||||
CONFIG_VERSION_SUPPORT_URL="https://iopsys.eu"
|
||||
|
||||
# /lib/preinit #
|
||||
CONFIG_PREINITOPT=y
|
||||
# CONFIG_TARGET_PREINIT_SUPPRESS_STDERR is not set
|
||||
CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE=y
|
||||
CONFIG_TARGET_PREINIT_TIMEOUT=1
|
||||
# CONFIG_TARGET_PREINIT_SHOW_NETMSG is not set
|
||||
# CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG is not set
|
||||
CONFIG_TARGET_PREINIT_IFNAME=""
|
||||
CONFIG_TARGET_PREINIT_IP=""
|
||||
CONFIG_TARGET_PREINIT_NETMASK=""
|
||||
CONFIG_TARGET_PREINIT_BROADCAST=""
|
||||
|
||||
# Mirror #
|
||||
CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/"
|
||||
|
||||
|
||||
##################
|
||||
# IOWRT Add-ons #
|
||||
################
|
||||
|
||||
# EasySoC HAL #
|
||||
CONFIG_PACKAGE_qosmngr=y
|
||||
CONFIG_PACKAGE_libwifiutils=y
|
||||
CONFIG_PACKAGE_wifimngr=y
|
||||
|
||||
# Multi-AP #
|
||||
CONFIG_PACKAGE_ieee1905=y
|
||||
CONFIG_IEEE1905_CMDU_SA_IS_ALMAC=y
|
||||
CONFIG_PACKAGE_topology-plugin=y
|
||||
CONFIG_PACKAGE_decollector=y
|
||||
CONFIG_PACKAGE_map-agent=y
|
||||
CONFIG_PACKAGE_map-controller=y
|
||||
|
||||
# Network #
|
||||
CONFIG_PACKAGE_hostmngr=y
|
||||
CONFIG_PACKAGE_netmode=y
|
||||
CONFIG_PACKAGE_testnet=y
|
||||
CONFIG_PACKAGE_urlfilter=y
|
||||
|
||||
# System #
|
||||
CONFIG_PACKAGE_imonitor=m
|
||||
CONFIG_PACKAGE_questd=y
|
||||
CONFIG_PACKAGE_rulengd=y
|
||||
CONFIG_PACKAGE_usermngr=y
|
||||
|
||||
# TR-x69 #
|
||||
CONFIG_PACKAGE_libbbfdm=y
|
||||
CONFIG_PACKAGE_bbfdmd=y
|
||||
CONFIG_PACKAGE_icwmp=y
|
||||
CONFIG_PACKAGE_obuspa=y
|
||||
CONFIG_PACKAGE_bulkdata=y
|
||||
CONFIG_PACKAGE_periodicstats=y
|
||||
CONFIG_PACKAGE_stunc=y
|
||||
CONFIG_PACKAGE_swmodd=y
|
||||
CONFIG_PACKAGE_twamp=y
|
||||
CONFIG_PACKAGE_udpecho-client=y
|
||||
CONFIG_PACKAGE_udpecho-server=y
|
||||
CONFIG_PACKAGE_userinterface=y
|
||||
CONFIG_PACKAGE_xmppc=y
|
||||
CONFIG_PACKAGE_timemngr=y
|
||||
CONFIG_PACKAGE_self-diagnostics=y
|
||||
|
||||
# WebGUI #
|
||||
CONFIG_PACKAGE_sulu=y
|
||||
|
||||
|
||||
############
|
||||
# Network #
|
||||
##########
|
||||
|
||||
# Protocols #
|
||||
CONFIG_PACKAGE_6in4=y
|
||||
CONFIG_PACKAGE_6rd=y
|
||||
CONFIG_PACKAGE_6to4=y
|
||||
CONFIG_PACKAGE_chat=y
|
||||
CONFIG_PACKAGE_comgt=y
|
||||
CONFIG_PACKAGE_comgt-directip=y
|
||||
CONFIG_PACKAGE_comgt-ncm=y
|
||||
CONFIG_PACKAGE_ds-lite=y
|
||||
CONFIG_PACKAGE_firewall=y
|
||||
# CONFIG_PACKAGE_firewall4 is not set
|
||||
CONFIG_PACKAGE_gre=y
|
||||
CONFIG_PACKAGE_map=y
|
||||
CONFIG_PACKAGE_ntfs-3g=y
|
||||
CONFIG_PACKAGE_ntpd=y
|
||||
CONFIG_PACKAGE_odhcp6c=y
|
||||
CONFIG_PACKAGE_odhcpd=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppoa=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppoe=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppol2tp=y
|
||||
CONFIG_PACKAGE_ppp-mod-pptp=y
|
||||
CONFIG_PACKAGE_ppp-multilink=y
|
||||
# CONFIG_PACKAGE_ppp is not set
|
||||
CONFIG_PACKAGE_relayd=y
|
||||
CONFIG_PACKAGE_umbim=y
|
||||
CONFIG_PACKAGE_uqmi=y
|
||||
CONFIG_PACKAGE_wwan=y
|
||||
CONFIG_PACKAGE_xl2tpd=y
|
||||
|
||||
# Services #
|
||||
CONFIG_PACKAGE_atftpd=y
|
||||
CONFIG_PACKAGE_ddns-scripts=y
|
||||
CONFIG_PACKAGE_dnsmasq=y
|
||||
CONFIG_PACKAGE_ssdpd=y
|
||||
CONFIG_PACKAGE_miniupnpd-iptables=y
|
||||
CONFIG_PACKAGE_mosquitto-client-ssl=y
|
||||
CONFIG_PACKAGE_mosquitto-ssl=y
|
||||
CONFIG_PACKAGE_nginx=y
|
||||
CONFIG_PACKAGE_openvpn-easy-rsa=y
|
||||
CONFIG_PACKAGE_openvpn-openssl=y
|
||||
CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
|
||||
# CONFIG_PACKAGE_qos-scripts is not set
|
||||
CONFIG_PACKAGE_rdnssd=y
|
||||
CONFIG_PACKAGE_vsftpd-tls=y
|
||||
|
||||
# Tools and Utilities #
|
||||
CONFIG_PACKAGE_curl=y
|
||||
CONFIG_PACKAGE_libcurl=y
|
||||
CONFIG_LIBCURL_CRYPTO_AUTH=y
|
||||
# CONFIG_LIBCURL_MBEDTLS is not set
|
||||
CONFIG_LIBCURL_OPENSSL=y
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
CONFIG_PACKAGE_ip-bridge=y
|
||||
CONFIG_PACKAGE_ip-full=y
|
||||
CONFIG_PACKAGE_iperf3=y
|
||||
CONFIG_PACKAGE_ipset=y
|
||||
CONFIG_PACKAGE_ip6tables-zz-legacy=y
|
||||
CONFIG_PACKAGE_iptables-zz-legacy=y
|
||||
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
|
||||
CONFIG_PACKAGE_iptables-mod-extra=y
|
||||
CONFIG_PACKAGE_iptables-mod-filter=y
|
||||
CONFIG_PACKAGE_iptables-mod-ipmark=y
|
||||
CONFIG_PACKAGE_iptables-mod-ipopt=y
|
||||
CONFIG_PACKAGE_iptables-mod-nflog=y
|
||||
CONFIG_PACKAGE_iptables-mod-nfqueue=y
|
||||
CONFIG_PACKAGE_iputils-arping=y
|
||||
CONFIG_PACKAGE_iputils-ping=y
|
||||
CONFIG_PACKAGE_ndisc6=y
|
||||
CONFIG_PACKAGE_rdisc6=y
|
||||
CONFIG_PACKAGE_resolveip=y
|
||||
CONFIG_PACKAGE_socat=y
|
||||
CONFIG_PACKAGE_tcpdump=y
|
||||
CONFIG_PACKAGE_traceroute6=y
|
||||
|
||||
|
||||
############
|
||||
# System #
|
||||
##########
|
||||
|
||||
CONFIG_PACKAGE_at=y
|
||||
CONFIG_PACKAGE_ca-certificates=y
|
||||
CONFIG_PACKAGE_crun=y
|
||||
CONFIG_PACKAGE_getopt=y
|
||||
CONFIG_PACKAGE_gpiod-tools=y
|
||||
# CONFIG_PACKAGE_iwatchdog is not set
|
||||
CONFIG_PACKAGE_jq=y
|
||||
CONFIG_PACKAGE_libcap-bin=y
|
||||
CONFIG_PACKAGE_libustream-openssl=y
|
||||
# CONFIG_PACKAGE_libustream-wolfssl is not set
|
||||
CONFIG_PACKAGE_lscpu=y
|
||||
CONFIG_PACKAGE_nand-utils=y
|
||||
CONFIG_PACKAGE_openssl-util=y
|
||||
CONFIG_OPENSSL_WITH_COMPRESSION=y
|
||||
CONFIG_PACKAGE_procd-ujail=m
|
||||
CONFIG_PACKAGE_quota=y
|
||||
CONFIG_PACKAGE_rpcd=y
|
||||
CONFIG_PACKAGE_rpcd-mod-rpcsys=y
|
||||
CONFIG_PACKAGE_rpcd-mod-rrdns=y
|
||||
CONFIG_PACKAGE_strace=y
|
||||
CONFIG_PACKAGE_terminfo=y
|
||||
CONFIG_PACKAGE_uledd=y
|
||||
# The urandom-seed package is very strange. It seeds urandom with urandom...
|
||||
# Disable it. Most SoCs nowadays has HW random generators anyway.
|
||||
# CONFIG_PACKAGE_urandom-seed is not set
|
||||
# CONFIG_PACKAGE_urngd is not set
|
||||
CONFIG_PACKAGE_usb-modeswitch=y
|
||||
CONFIG_PACKAGE_uuidgen=y
|
||||
CONFIG_PACKAGE_zoneinfo-core=y
|
||||
CONFIG_PACKAGE_zoneinfo-europe=y
|
||||
|
||||
|
||||
################
|
||||
# LuCI WebGUI #
|
||||
##############
|
||||
|
||||
# BEGIN: luci-nginx metapackage with some changes
|
||||
# We do not want libiwinfo-lua on non-WiFi targets, but it is already
|
||||
# depended on by other luci-packages, so no need to take it in explicitly
|
||||
CONFIG_PACKAGE_luci-mod-admin-full=y
|
||||
CONFIG_PACKAGE_luci-app-firewall=y
|
||||
CONFIG_PACKAGE_luci-app-opkg=y
|
||||
CONFIG_PACKAGE_luci-proto-ppp=y
|
||||
CONFIG_PACKAGE_luci-proto-ipv6=y
|
||||
# CONFIG_LUCI_JSMIN is not set
|
||||
# CONFIG_LUCI_CSSTIDY is not set
|
||||
CONFIG_PACKAGE_luci-mod-dashboard=y
|
||||
CONFIG_PACKAGE_luci-theme-openwrt-2020=y
|
||||
CONFIG_PACKAGE_nginx-mod-luci=y
|
||||
|
||||
|
||||
############
|
||||
# BusyBox #
|
||||
##########
|
||||
|
||||
CONFIG_BUSYBOX_CUSTOM=y
|
||||
CONFIG_BUSYBOX_CONFIG_ADDUSER=y
|
||||
CONFIG_BUSYBOX_CONFIG_ASH_IDLE_TIMEOUT=y
|
||||
CONFIG_BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT=y
|
||||
CONFIG_BUSYBOX_CONFIG_CTTYHACK=y
|
||||
CONFIG_BUSYBOX_CONFIG_DELUSER=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_UDHCP_8021Q=y
|
||||
CONFIG_BUSYBOX_CONFIG_FIRST_SYSTEM_ID=100
|
||||
# CONFIG_BUSYBOX_CONFIG_HTTPD is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_INSMOD is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_MODINFO is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_MODPROBE is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODPROBE_BLACKLIST=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_ALIAS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_SYMBOLS=y
|
||||
CONFIG_BUSYBOX_CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
|
||||
CONFIG_BUSYBOX_CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
|
||||
# CONFIG_BUSYBOX_CONFIG_IP is not set
|
||||
CONFIG_BUSYBOX_CONFIG_LAST_SYSTEM_ID=999
|
||||
CONFIG_BUSYBOX_CONFIG_LOGIN=y
|
||||
# CONFIG_BUSYBOX_CONFIG_LSMOD is not set
|
||||
CONFIG_BUSYBOX_CONFIG_LSPCI=y
|
||||
CONFIG_BUSYBOX_CONFIG_LSUSB=y
|
||||
CONFIG_BUSYBOX_CONFIG_MICROCOM=y
|
||||
# CONFIG_BUSYBOX_CONFIG_RMMOD is not set
|
||||
CONFIG_BUSYBOX_CONFIG_STTY=y
|
||||
CONFIG_BUSYBOX_CONFIG_TFTP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_AUTH_MD5=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_BASIC_AUTH=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_CGI=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_ERROR_PAGES=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_GZIP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_PROXY=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_RANGES=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_SETUID=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_USE_SENDFILE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_NOLOGIN is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_SECURETTY=y
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_GET=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_PUT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_WGET is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_LOGIN_SCRIPTS is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_LOGIN_SESSION_AS_CHILD is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_PAM is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_TFTP_DEBUG is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_NTPD is not set
|
||||
CONFIG_BUSYBOX_CONFIG_MOUNTPOINT=y
|
||||
CONFIG_BUSYBOX_CONFIG_RUN_PARTS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_RUN_PARTS_FANCY=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_GZIP_LEVELS=y
|
||||
CONFIG_BUSYBOX_CONFIG_GZIP_FAST=2
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_FANCY_SLEEP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_FLOAT_SLEEP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FLOAT_DURATION=y
|
||||
CONFIG_BUSYBOX_CONFIG_USLEEP=y
|
||||
CONFIG_BUSYBOX_CONFIG_REALPATH=y
|
||||
CONFIG_BUSYBOX_CONFIG_TTY=y
|
||||
CONFIG_BUSYBOX_CONFIG_BLOCKDEV=y
|
||||
CONFIG_BUSYBOX_CONFIG_PARTPROBE=y
|
||||
CONFIG_BUSYBOX_CONFIG_LFS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FDISK=y
|
||||
CONFIG_BUSYBOX_CONFIG_FDISK_SUPPORT_LARGE_DISKS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_GPT_LABEL=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_FDISK_ADVANCED=y
|
||||
CONFIG_BUSYBOX_CONFIG_IONICE=y
|
||||
CONFIG_BUSYBOX_CONFIG_RENICE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_BTRFS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_F2FS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y
|
||||
CONFIG_BUSYBOX_CONFIG_TIMEOUT=y
|
||||
CONFIG_BUSYBOX_CONFIG_NOHUP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512"
|
||||
# CONFIG_BUSYBOX_CONFIG_ARPING is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_PING is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_PING6 is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_FANCY_PING is not set
|
||||
@@ -33,9 +33,10 @@ _iop()
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
iopcmds="bootstrap cfe_upgrade cfe_upgrade_latest extract_core \
|
||||
feeds_update genconfig generate_tarballs install_key \
|
||||
feeds_update genconfig \
|
||||
generate_tarballs install_key \
|
||||
scp_changes setup_host ssh_install_key status \
|
||||
update_package update_feed_branches ssh_upgrade smoketest"
|
||||
ssh_upgrade smoketest"
|
||||
|
||||
if [ $COMP_CWORD -eq 1 ] ; then
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function disable_add_config () {
|
||||
local COPTION="$1"
|
||||
|
||||
HAVE_OPTION=`grep $COPTION .config | wc -l`
|
||||
HAVE_OPTION_DISABLED=`grep "# $COPTION" .config | wc -l`
|
||||
if [ "$HAVE_OPTION" = "1" ]
|
||||
then
|
||||
if [ "$HAVE_OPTION_DISABLED" = "0" ]
|
||||
then
|
||||
sed -i -e "s,$COPTION=y,# $COPTION is not set,g" .config
|
||||
fi
|
||||
else
|
||||
echo "# $COPTION is not set" >> .config
|
||||
fi
|
||||
}
|
||||
|
||||
function enable_option () {
|
||||
local COPTION="$1"
|
||||
# cat .config| grep DSL
|
||||
sed -i -e "s,# $COPTION is not set,$COPTION=y,g" .config
|
||||
# cat .config| grep DSL
|
||||
}
|
||||
|
||||
function annexconfig {
|
||||
|
||||
v() {
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
}
|
||||
|
||||
local ANNEX="$1"
|
||||
|
||||
disable_add_config CONFIG_TARGET_NO_DSL
|
||||
disable_add_config CONFIG_TARGET_DSL_ANNEX_A
|
||||
disable_add_config CONFIG_TARGET_DSL_ANNEX_B
|
||||
disable_add_config CONFIG_TARGET_DSL_ANNEX_C
|
||||
disable_add_config CONFIG_TARGET_DSL_SADSL
|
||||
disable_add_config CONFIG_TARGET_DSL_GFAST
|
||||
|
||||
|
||||
if [ "$ANNEX" = "no" ]
|
||||
then
|
||||
echo "No DSL"
|
||||
enable_option CONFIG_TARGET_NO_DSL
|
||||
elif [ "$ANNEX" = "a" ]
|
||||
then
|
||||
echo "Annex A"
|
||||
enable_option CONFIG_TARGET_DSL_ANNEX_A
|
||||
elif [ "$ANNEX" = "b" ]
|
||||
then
|
||||
echo "Annex B"
|
||||
enable_option CONFIG_TARGET_DSL_ANNEX_B
|
||||
elif [ "$ANNEX" = "c" ]
|
||||
then
|
||||
echo "Annex C"
|
||||
enable_option CONFIG_TARGET_DSL_ANNEX_C
|
||||
elif [ "$ANNEX" = "sadsl" ]
|
||||
then
|
||||
echo "sadsl"
|
||||
enable_option CONFIG_TARGET_DSL_SADSL
|
||||
elif [ "$ANNEX" = "gfast" ]
|
||||
then
|
||||
echo "G.fast"
|
||||
enable_option CONFIG_TARGET_DSL_GFAST
|
||||
else
|
||||
echo "Only option no,a,b,c,sadsl,gfast supported"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
register_command "annexconfig" "Select configuration annex"
|
||||
@@ -1,42 +0,0 @@
|
||||
# this is a developer helper script to install firmware on a remote host running in CFE mode
|
||||
|
||||
function usage {
|
||||
echo "usage: $0 cfe_upgrade <host> <file>"
|
||||
}
|
||||
|
||||
function cfe_upgrade {
|
||||
if [ -z "$1" ] ; then
|
||||
usage
|
||||
echo "Error: host required"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$2" ] ; then
|
||||
usage
|
||||
echo "Error: firmware filename required"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e $2 ] ; then
|
||||
usage
|
||||
echo "Error: firmware file does not exist"
|
||||
exit 1
|
||||
fi
|
||||
IMAGE=`basename $2`
|
||||
echo "CFE upgrade host: $1 with file $IMAGE"
|
||||
[ "$2" ] && [ -e "$2" ] && curl -i -F filedata=@$2 http://$1/upload.cgi && echo "upgrade done!"
|
||||
}
|
||||
|
||||
register_command "cfe_upgrade" "<host> <file> Install firmware on remote host in CFE mode"
|
||||
|
||||
function cfe_upgrade_latest {
|
||||
if [ -z "$1" ] ; then
|
||||
echo "usage: $0 cfe_upgrade_latest <host>"
|
||||
echo "Error: host required"
|
||||
exit 1
|
||||
fi
|
||||
{ cd `dirname $0`
|
||||
IMAGE=`ls -Art bin/*/*.w | tail -n1`
|
||||
[ "$IMAGE" ] && [ -e "$IMAGE" ] && ./iop cfe_upgrade $1 $IMAGE
|
||||
}
|
||||
}
|
||||
|
||||
register_command "cfe_upgrade_latest" "<host> Install latest firmware on remote host in CFE mode"
|
||||
@@ -1,88 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
function feeds_update {
|
||||
heads=1
|
||||
developer=0
|
||||
override=1
|
||||
force=1
|
||||
|
||||
function update_failure {
|
||||
if [ $force == 1 ]; then
|
||||
echo "WARNING: Failed to update feed(s). Forced update, proceeding anyway." >&2
|
||||
else
|
||||
echo "ERROR: Failed to update feed(s). Omit -F to proceed anyway." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
while getopts "inFh" opt; do
|
||||
case $opt in
|
||||
i)
|
||||
heads=0
|
||||
;;
|
||||
n)
|
||||
override=0
|
||||
;;
|
||||
F)
|
||||
force=0
|
||||
;;
|
||||
h|\?)
|
||||
echo "Usage: ./iop feeds_update [-i] [-n] [-F] [-h]"
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
echo " -i - Only update index. Do not change HEAD in feeds."
|
||||
echo " -n - Do not replace core packages with iopsys versions."
|
||||
echo " -F - Do not force update if there are inaccessible feeds."
|
||||
echo " -h - Display this help message and exit."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && developer=1
|
||||
|
||||
cp .config .genconfig_config_bak
|
||||
|
||||
if [ $heads == 1 ]; then
|
||||
if [ $developer == 1 ]; then
|
||||
./scripts/feeds update -g || update_failure
|
||||
else
|
||||
./scripts/feeds update || update_failure
|
||||
fi
|
||||
fi
|
||||
./scripts/feeds update -ai || exit 1
|
||||
|
||||
# replace core packages with iopsys versions
|
||||
if [ $override == 1 ]; then
|
||||
./scripts/feeds install -f -p openwrt_core -a || exit 1
|
||||
./scripts/feeds install -f -p qualcomm -a || exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update'
|
||||
echo 'FEED_DEVICES_DIRS:='
|
||||
find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h\n'
|
||||
) > target/linux/feed-devices/feed-devices-list.mk || exit 1
|
||||
|
||||
# targets need to be installed explicitly
|
||||
for target in $(ls ./feeds/targets); do
|
||||
./scripts/feeds install -f -p targets $target || exit 1
|
||||
done
|
||||
|
||||
# install all packages
|
||||
./scripts/feeds install -a || exit 1
|
||||
|
||||
# remove broken symlinks ( for packages that are no longer in the feed )
|
||||
find -L package/feeds -maxdepth 2 -type l -delete || exit 1
|
||||
|
||||
cp .genconfig_config_bak .config
|
||||
make defconfig || exit 1
|
||||
|
||||
# record when we last run this script
|
||||
touch tmp/.iop_bootstrap || exit 1
|
||||
|
||||
# always return true
|
||||
exit 0
|
||||
}
|
||||
|
||||
register_command "feeds_update" "Update feeds to point to commit hashes from feeds.conf"
|
||||
register_command "feeds_update" "Compatibility function only"
|
||||
|
||||
@@ -1,542 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function genconfig {
|
||||
export CLEAN=0
|
||||
export DIRTY="--dirty"
|
||||
export IMPORT=1
|
||||
export SRCTREEOVERR=0
|
||||
export FILEDIR="files/"
|
||||
CURRENT_CONFIG_FILE=".current_config_file"
|
||||
export CONFIGPATH="package/feeds/iopsys/iop"
|
||||
CUSTPATH="customerconfigs"
|
||||
export CUSTCONF="customerconfigs/customers"
|
||||
export VERBOSE=0
|
||||
export DEVELOPER=0
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||
airoha_feed="target/linux/feeds/airoha"
|
||||
x86_feed="target/linux/feeds/x86"
|
||||
armsr_feed="target/linux/feeds/armsr"
|
||||
mediatek_feed="target/linux/feeds/mediatek"
|
||||
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||
qualcomm_ipq53xx_feed="target/linux/feeds/ipq53xx"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
|
||||
function find_last {
|
||||
egrep "^[ #]*${1}[ =]" $2 | tail -n1
|
||||
}
|
||||
|
||||
function is_new {
|
||||
for opt in $conf_warned
|
||||
do
|
||||
if [ "$opt" == "$1" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
# option not found return true
|
||||
return 0
|
||||
}
|
||||
|
||||
function verify_config {
|
||||
local conf_opt
|
||||
local conf_org
|
||||
local conf_new
|
||||
|
||||
while read -r line
|
||||
do
|
||||
conf_opt=$(echo $line | grep "^[ #]*CONFIG_" | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|')
|
||||
if [ -n "${conf_opt}" ]
|
||||
then
|
||||
conf_org=$(find_last ${conf_opt} .genconfig.config)
|
||||
conf_new=$(find_last ${conf_opt} .config)
|
||||
if [ "$conf_org" != "$conf_new" ]
|
||||
then
|
||||
if is_new $conf_opt
|
||||
then
|
||||
echo -e "config option [${Red}$conf_opt${Color_Off}] is not set correctly in .config"
|
||||
echo -e "got value [${Yellow}$conf_new${Color_Off}] but wanted [${Yellow}$conf_org${Color_Off}]"
|
||||
echo "This is a real problem somebody needs to investigate"
|
||||
echo ""
|
||||
conf_warned="$conf_warned $conf_opt"
|
||||
fi
|
||||
else
|
||||
true
|
||||
# for debug to see all options
|
||||
#echo -e "wanted [$conf_org] got [$conf_new]"
|
||||
fi
|
||||
fi
|
||||
done < .genconfig.config
|
||||
}
|
||||
|
||||
# Takes a board name and returns the target name in global var $target
|
||||
set_target() {
|
||||
local profile=$1
|
||||
|
||||
[ -n "$profile" ] || return
|
||||
|
||||
if [ -n "$TARGET" -a -d "./target/linux/feeds/$TARGET" ]; then
|
||||
local targetpath="./target/linux/feeds/$TARGET"
|
||||
local profiles=
|
||||
local pfound=0
|
||||
|
||||
if [ -e "$targetpath/genconfig" ]; then
|
||||
profiles=$(cd $targetpath; ./genconfig)
|
||||
|
||||
for p in $profiles; do
|
||||
if [ $p == $profile ]; then
|
||||
pfound=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $pfound -eq 1 ]; then
|
||||
target="$(echo $TARGET | tr '-' '_')"
|
||||
target_config_path="$targetpath/config"
|
||||
fi
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
[ -e $brcmbca_feed/genconfig ] &&
|
||||
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||
[ -e $airoha_feed/genconfig ] &&
|
||||
airoha=$(cd $airoha_feed; ./genconfig)
|
||||
[ -e $x86_feed/genconfig ] &&
|
||||
x86=$(cd $x86_feed; ./genconfig)
|
||||
[ -e $armsr_feed/genconfig ] &&
|
||||
armsr=$(cd $armsr_feed; ./genconfig)
|
||||
[ -e $mediatek_feed/genconfig ] &&
|
||||
mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq53xx_feed/genconfig ] &&
|
||||
ipq53xx=$(cd $qualcomm_ipq53xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca airoha x86 armsr mediatek ipq95xx ipq53xx; do
|
||||
echo "$list based boards:"
|
||||
a=$(echo "${!list}" | sort)
|
||||
for b in $a; do
|
||||
echo -e "\t$b"
|
||||
done
|
||||
done
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
target_config_path="$airoha_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $x86; do
|
||||
if [ $p == $profile ]; then
|
||||
target="x86"
|
||||
target_config_path="$x86_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $armsr; do
|
||||
if [ $p == $profile ]; then
|
||||
target="armsr"
|
||||
target_config_path="$armsr_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $mediatek; do
|
||||
if [ $p == $profile ]; then
|
||||
target="mediatek"
|
||||
target_config_path="$mediatek_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $ipq95xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq95xx"
|
||||
target_config_path="$qualcomm_ipq95xx_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $ipq53xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq53xx"
|
||||
target_config_path="$qualcomm_ipq53xx_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $brcmbca; do
|
||||
if [ $p == $profile ]; then
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
DEVELOPER=1
|
||||
}
|
||||
|
||||
v() {
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo
|
||||
echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]"
|
||||
echo
|
||||
echo -e " -c|--clean\t\tRemove all files under ./files and import from config "
|
||||
echo -e " -D|--no-dirty\t\tIgnore dirty tree"
|
||||
echo -e " -v|--verbose\t\tVerbose"
|
||||
echo -e " -n|--no-update\tDo NOT! Update customer config before applying"
|
||||
echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from"
|
||||
echo -e " -s|--override\t\tEnable 'Package source tree override'"
|
||||
echo -e " -S|--brcmsingle\tForce build of bcmkernel to use only one thread"
|
||||
echo -e " -h|--help\t\tShow this message"
|
||||
echo -e " -l|--list [customer]\tList all Customers or all boards for one customer"
|
||||
echo -e " -a|--list-all\t\tList all Customers and their board types"
|
||||
echo -e " -b|--boards\t\tList all board types"
|
||||
echo
|
||||
echo "Example ./iop genconfig eg400 OPERATORX"
|
||||
echo "(if no customerconfig is chosen, iopsys config will be used)"
|
||||
echo
|
||||
exit 0
|
||||
}
|
||||
|
||||
list_customers()
|
||||
{
|
||||
local ALL="$1"
|
||||
local CUSTOMER="$2"
|
||||
if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then
|
||||
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common)"
|
||||
if [ "$boards" ]; then
|
||||
echo "$CUSTOMER has following boards:"
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
done
|
||||
else
|
||||
echo "No boards found for $CUSTOMER"
|
||||
fi
|
||||
elif [ "$CUSTOMER" ]; then
|
||||
echo "No customer called $CUSTOMER"
|
||||
exit 1
|
||||
elif [ -d $CUSTCONF ]; then
|
||||
local customers="$(ls -1 $CUSTCONF)"
|
||||
if [ "$customers" -a "$ALL" == 1 ]; then
|
||||
for customer in $customers; do
|
||||
echo $customer
|
||||
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common)"
|
||||
if [ "$boards" ]; then
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
done
|
||||
else
|
||||
echo "has no boards"
|
||||
fi
|
||||
done
|
||||
elif [ "$customers" ]; then
|
||||
echo -e "$customers"
|
||||
else
|
||||
echo "no customers found"
|
||||
fi
|
||||
else
|
||||
echo "No $CUSTCONF folder found"
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
generate_config()
|
||||
{
|
||||
DIFFFILE="$1"
|
||||
MASTERFILE="$2"
|
||||
while read p; do
|
||||
v "$p"
|
||||
sed -r -i "$p" $MASTERFILE
|
||||
done < $DIFFFILE
|
||||
}
|
||||
|
||||
setup_dirs()
|
||||
{
|
||||
git remote -v | grep -q http || {
|
||||
CUSTBRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
if git ls-remote $CUSTREPO -q 2>/dev/null; then
|
||||
if [ ! -d "$CUSTPATH" ]; then
|
||||
echo "Cloning $CUSTBRANCH branch of $CUSTREPO"
|
||||
git clone -b "$CUSTBRANCH" "$CUSTREPO" "$CUSTPATH" 2>/dev/null || {
|
||||
DEFBRANCH="$(git remote show $CUSTREPO | grep 'HEAD branch' | cut -d' ' -f5)"
|
||||
echo "$CUSTBRANCH branch is not found, cloning $DEFBRANCH branch of $CUSTREPO"
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
}
|
||||
elif [ $IMPORT -eq 1 ]; then
|
||||
cd $CUSTPATH
|
||||
echo "Checking out $CUSTBRANCH branch in $CUSTPATH"
|
||||
git checkout "$CUSTBRANCH" 2>/dev/null || {
|
||||
DEFBRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | cut -d '/' -f4)"
|
||||
echo "Checking out $CUSTBRANCH branch has failed, using $DEFBRANCH branch in $CUSTPATH"
|
||||
}
|
||||
v "git pull"
|
||||
git pull
|
||||
cd - >/dev/null #go back
|
||||
fi
|
||||
else
|
||||
echo "You do not have access to $CUSTREPO"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! -d "$FILEDIR" ]; then
|
||||
mkdir -p $FILEDIR
|
||||
elif [ -d "$FILEDIR" -a $CLEAN -eq 1 ]; then
|
||||
v "rm -rf $FILEDIR*"
|
||||
rm -rf $FILEDIR*
|
||||
fi
|
||||
}
|
||||
|
||||
get_subtarget_for_device() {
|
||||
readonly target="$1"
|
||||
readonly device="$2"
|
||||
readonly targetinfo_file="tmp/info/.targetinfo-feeds_$target"
|
||||
readonly target_profile_line="Target-Profile: DEVICE_$device"
|
||||
# We want to know after which Target: $target/$subtarget line
|
||||
# our $target_profile_line appears
|
||||
# This is a crude way to "parse" the file using shell 🤯
|
||||
# 1. grep for both lines with line number output
|
||||
# 2. grep again to determine the device profile line that we looked for
|
||||
# but output one context line before as well to determine corresponding subtarget line
|
||||
# 4. Use head and sed to extract the subtarget
|
||||
grep "^Target: $target/\|^$target_profile_line" "$targetinfo_file" \
|
||||
| grep -E -B1 "^$target_profile_line" \
|
||||
| head -n1 \
|
||||
| sed -E "s|^Target: $target/||"
|
||||
}
|
||||
|
||||
create_and_copy_files()
|
||||
{
|
||||
local BOARDTYPE=$1
|
||||
shift
|
||||
local CUSTOMERS=$@
|
||||
|
||||
# Validate seleced board and customers
|
||||
set_target $BOARDTYPE
|
||||
if [ $target == "bogus" ]; then
|
||||
echo "Hardware profile does not exist"
|
||||
exit 1
|
||||
elif [ -n "$CUSTOMERS" ]; then
|
||||
for CUSTOMER in $CUSTOMERS; do
|
||||
if [ ! -d "$CUSTCONF/$CUSTOMER/" ]; then
|
||||
echo "Customer profile for '$CUSTOMER' does not exist"
|
||||
exit 1
|
||||
elif [ ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then
|
||||
echo "'$BOARDTYPE' board profile does not exist for customer '$CUSTOMER'"
|
||||
if [ -f "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
|
||||
echo "Common profile configuration will be used"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Generate base config
|
||||
rm -f .config
|
||||
v "Config $BOARDTYPE selected"
|
||||
v "cp $CONFIGPATH/config .config"
|
||||
cp $CONFIGPATH/config .config
|
||||
|
||||
if [ -f $target_config_path/config ]; then
|
||||
cat $target_config_path/config >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
if [ -f $target_config_path/$BOARDTYPE/config ]; then
|
||||
cat $target_config_path/$BOARDTYPE/config >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
# hack to support custom-devices until we have deprecated this genconfig-script...
|
||||
local custom_found=false
|
||||
local used_config_file
|
||||
|
||||
for config_file in feeds/*/devices/$target/config/$BOARDTYPE/config; do
|
||||
if [ "$custom_found" = "true" ]; then
|
||||
echo
|
||||
echo "Error was found!"
|
||||
echo "Please use only one path."
|
||||
echo "Two instances of $target/config/$BOARDTYPE exists:"
|
||||
echo "Path 1: $used_config_file"
|
||||
echo "Path 2: $config_file"
|
||||
return 1
|
||||
fi
|
||||
if [ -f "$config_file" ]; then
|
||||
cat "$config_file" >> .config
|
||||
echo "" >> .config
|
||||
custom_found=true
|
||||
used_config_file=$config_file
|
||||
fi
|
||||
done
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | mediatek | brcmbca | ipq95xx | ipq53xx)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local subtarget="$(get_subtarget_for_device "${target/_/-}" "$BOARDTYPE")"
|
||||
if [ -z "$subtarget" ]; then
|
||||
echo "Error determining subtarget for $target / ${BOARDTYPE}"
|
||||
return 1
|
||||
fi
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
|
||||
;;
|
||||
*)
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE
|
||||
|
||||
# Add customerconfig diff if a customer is selected
|
||||
if [ -n "$CUSTOMERS" ]; then
|
||||
for CUSTOMER in $CUSTOMERS; do
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/common/fs" ]; then
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/fs" ]; then
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
|
||||
v "Apply $CUSTCONF/$CUSTOMER/common/common.diff"
|
||||
cat $CUSTCONF/$CUSTOMER/common/common.diff >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" ]; then
|
||||
v "Apply $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff"
|
||||
cat $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Ensure strict file permissions, for when provided through the above
|
||||
if [ -f "$FILEDIR/etc/shadow" ]; then
|
||||
v "chmod 0600 $FILEDIR/etc/shadow"
|
||||
chmod 0600 "$FILEDIR/etc/shadow"
|
||||
fi
|
||||
if [ -d "$FILEDIR/etc/ssl/private" ]; then
|
||||
v "find $FILEDIR/etc/ssl/private -type d -exec chmod 0700 '{}' ';' -o -type f -exec chmod 0600 '{}' ';'"
|
||||
find "$FILEDIR/etc/ssl/private" -type d -exec chmod 0700 '{}' ';' -o -type f -exec chmod 0600 '{}' ';'
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local git_version
|
||||
if ! git_version="$(git describe --always $DIRTY --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||
local version_lower="${version,,}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Package source tree override if selected
|
||||
[ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
|
||||
|
||||
# developer mode selected ?
|
||||
echo "CONFIG_DEVEL=y" >>.config
|
||||
if [ $DEVELOPER -eq 1 ]; then
|
||||
# rewrite url to clone with ssh instead of http
|
||||
echo "CONFIG_GITMIRROR_REWRITE=y" >>.config
|
||||
else
|
||||
echo "# CONFIG_GITMIRROR_REWRITE is not set" >>.config
|
||||
fi
|
||||
|
||||
if [ -n "$BRCM_MAX_JOBS" ]
|
||||
then
|
||||
echo "CONFIG_BRCM_MAX_JOBS=\"1\"" >>.config
|
||||
fi
|
||||
|
||||
# Force regeneration of kernel Makefile
|
||||
# Needed to disable kmods for iopsys-brcm targets
|
||||
touch package/kernel/linux/Makefile
|
||||
|
||||
# we need to signal to bradcom SDK that we have changed the board id
|
||||
# currently boardparms.c and boardparms_voice.c is the only place that is depending on boardid name
|
||||
# so just touch that file.
|
||||
[ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null
|
||||
|
||||
# Store generated config
|
||||
cp .config .genconfig.config
|
||||
|
||||
# Set default values based on selected parameters
|
||||
v "$(make defconfig 2>&1)"
|
||||
|
||||
echo Set version to $(grep -w CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"')
|
||||
|
||||
# Clean base-file package to force rebuild when changing profile
|
||||
v "$(make package/base-files/clean 2>&1)"
|
||||
|
||||
verify_config
|
||||
}
|
||||
|
||||
####### main #####
|
||||
if [ ! -e tmp/.iop_bootstrap ]; then
|
||||
echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration."
|
||||
echo "Run: iop feeds_update"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo Current profile:
|
||||
cat $CURRENT_CONFIG_FILE
|
||||
echo "Try ./iop genconfig -h' to get instructions if you want to change current config"
|
||||
exit 0
|
||||
else
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
|
||||
-c|--clean) export CLEAN=1;;
|
||||
-D|--no-dirty) export DIRTY="";;
|
||||
-n|--no-update) export IMPORT=0;;
|
||||
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-t|--target) export TARGET="$2"; shift;;
|
||||
-p|--profile) export PROFILE="$2"; shift;;
|
||||
-r|--repo) export CUSTREPO="$2"; shift;;
|
||||
-s|--override) export SRCTREEOVERR=1;;
|
||||
-S|--brcmsingel) export BRCM_MAX_JOBS=1;;
|
||||
-h|--help) usage;;
|
||||
-l|--list) list_customers 0 $2;;
|
||||
-a|--list-all)list_customers 1;;
|
||||
-b|--boards)set_target LIST;exit 0;;
|
||||
-*)
|
||||
echo "Invalid option: $1 "
|
||||
echo "Try -h or --help for more information."
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
|
||||
CUSTREPO="${CUSTREPO:-git@dev.iopsys.eu:consumer/iopsys.git}"
|
||||
|
||||
setup_dirs
|
||||
create_and_copy_files "$@" || exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
register_command "genconfig" "Generate configuration for board and customer"
|
||||
@@ -1,510 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function genconfig_min {
|
||||
export CLEAN=0
|
||||
export DIRTY="--dirty"
|
||||
export SRCTREEOVERR=0
|
||||
export FILEDIR="files/"
|
||||
CURRENT_CONFIG_FILE=".current_config_file"
|
||||
export CONFIGPATH="package/feeds/iopsys/iop"
|
||||
CUSTPATH="customerconfigs"
|
||||
export CUSTCONF="customerconfigs/customers"
|
||||
export VERBOSE=0
|
||||
export DEVELOPER=0
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||
airoha_feed="target/linux/feeds/airoha"
|
||||
x86_feed="target/linux/feeds/x86"
|
||||
armsr_feed="target/linux/feeds/armsr"
|
||||
mediatek_feed="target/linux/feeds/mediatek"
|
||||
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||
qualcomm_ipq53xx_feed="target/linux/feeds/ipq53xx"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
|
||||
function find_last {
|
||||
egrep "^[ #]*${1}[ =]" $2 | tail -n1
|
||||
}
|
||||
|
||||
function is_new {
|
||||
for opt in $conf_warned
|
||||
do
|
||||
if [ "$opt" == "$1" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
# option not found return true
|
||||
return 0
|
||||
}
|
||||
|
||||
function verify_config {
|
||||
local conf_opt
|
||||
local conf_org
|
||||
local conf_new
|
||||
|
||||
while read -r line
|
||||
do
|
||||
conf_opt=$(echo $line | grep "^[ #]*CONFIG_" | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|')
|
||||
if [ -n "${conf_opt}" ]
|
||||
then
|
||||
conf_org=$(find_last ${conf_opt} .genconfig.config)
|
||||
conf_new=$(find_last ${conf_opt} .config)
|
||||
if [ "$conf_org" != "$conf_new" ]
|
||||
then
|
||||
if is_new $conf_opt
|
||||
then
|
||||
echo -e "config option [${Red}$conf_opt${Color_Off}] is not set correctly in .config"
|
||||
echo -e "got value [${Yellow}$conf_new${Color_Off}] but wanted [${Yellow}$conf_org${Color_Off}]"
|
||||
echo "This is a real problem somebody needs to investigate"
|
||||
echo ""
|
||||
conf_warned="$conf_warned $conf_opt"
|
||||
fi
|
||||
else
|
||||
true
|
||||
# for debug to see all options
|
||||
#echo -e "wanted [$conf_org] got [$conf_new]"
|
||||
fi
|
||||
fi
|
||||
done < .genconfig.config
|
||||
}
|
||||
|
||||
# Takes a board name and returns the target name in global var $target
|
||||
set_target() {
|
||||
local profile=$1
|
||||
|
||||
[ -n "$profile" ] || return
|
||||
|
||||
if [ -n "$TARGET" -a -d "./target/linux/feeds/$TARGET" ]; then
|
||||
local targetpath="./target/linux/feeds/$TARGET"
|
||||
local profiles=
|
||||
local pfound=0
|
||||
|
||||
if [ -e "$targetpath/genconfig" ]; then
|
||||
profiles=$(cd $targetpath; ./genconfig)
|
||||
|
||||
for p in $profiles; do
|
||||
if [ $p == $profile ]; then
|
||||
pfound=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $pfound -eq 1 ]; then
|
||||
target="$(echo $TARGET | tr '-' '_')"
|
||||
target_config_path="$targetpath/config"
|
||||
fi
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
[ -e $brcmbca_feed/genconfig ] &&
|
||||
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||
[ -e $airoha_feed/genconfig ] &&
|
||||
airoha=$(cd $airoha_feed; ./genconfig)
|
||||
[ -e $x86_feed/genconfig ] &&
|
||||
x86=$(cd $x86_feed; ./genconfig)
|
||||
[ -e $armsr_feed/genconfig ] &&
|
||||
armsr=$(cd $armsr_feed; ./genconfig)
|
||||
[ -e $mediatek_feed/genconfig ] &&
|
||||
mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq53xx_feed/genconfig ] &&
|
||||
ipq53xx=$(cd $qualcomm_ipq53xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca airoha x86 armsr mediatek ipq95xx ipq53xx; do
|
||||
echo "$list based boards:"
|
||||
a=$(echo "${!list}" | sort)
|
||||
for b in $a; do
|
||||
echo -e "\t$b"
|
||||
done
|
||||
done
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
target_config_path="$airoha_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $x86; do
|
||||
if [ $p == $profile ]; then
|
||||
target="x86"
|
||||
target_config_path="$x86_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $armsr; do
|
||||
if [ $p == $profile ]; then
|
||||
target="armsr"
|
||||
target_config_path="$armsr_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $mediatek; do
|
||||
if [ $p == $profile ]; then
|
||||
target="mediatek"
|
||||
target_config_path="$mediatek_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $ipq95xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq95xx"
|
||||
target_config_path="$qualcomm_ipq95xx_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $ipq53xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq53xx"
|
||||
target_config_path="$qualcomm_ipq53xx_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $brcmbca; do
|
||||
if [ $p == $profile ]; then
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
DEVELOPER=1
|
||||
}
|
||||
|
||||
v() {
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo
|
||||
echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]"
|
||||
echo
|
||||
echo -e " -c|--clean\t\tRemove all files under ./files and import from config "
|
||||
echo -e " -D|--no-dirty\t\tIgnore dirty tree"
|
||||
echo -e " -v|--verbose\t\tVerbose"
|
||||
echo -e " -n|--no-update\tDo NOT! Update customer config before applying"
|
||||
echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from"
|
||||
echo -e " -s|--override\t\tEnable 'Package source tree override'"
|
||||
echo -e " -S|--brcmsingle\tForce build of bcmkernel to use only one thread"
|
||||
echo -e " -h|--help\t\tShow this message"
|
||||
echo -e " -l|--list [customer]\tList all Customers or all boards for one customer"
|
||||
echo -e " -a|--list-all\t\tList all Customers and their board types"
|
||||
echo -e " -b|--boards\t\tList all board types"
|
||||
echo
|
||||
echo "Example ./iop genconfig eg400 OPERATORX"
|
||||
echo "(if no customerconfig is chosen, iopsys config will be used)"
|
||||
echo
|
||||
exit 0
|
||||
}
|
||||
|
||||
list_customers()
|
||||
{
|
||||
local ALL="$1"
|
||||
local CUSTOMER="$2"
|
||||
if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then
|
||||
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common )"
|
||||
if [ "$boards" ]; then
|
||||
echo "$CUSTOMER has following boards:"
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
done
|
||||
else
|
||||
echo "No boards found for $CUSTOMER"
|
||||
fi
|
||||
elif [ "$CUSTOMER" ]; then
|
||||
echo "No customer called $CUSTOMER"
|
||||
exit 1
|
||||
elif [ -d $CUSTCONF ]; then
|
||||
local customers="$(ls -1 $CUSTCONF)"
|
||||
if [ "$customers" -a "$ALL" == 1 ]; then
|
||||
for customer in $customers; do
|
||||
echo $customer
|
||||
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common )"
|
||||
if [ "$boards" ]; then
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
done
|
||||
else
|
||||
echo "has no boards"
|
||||
fi
|
||||
done
|
||||
elif [ "$customers" ]; then
|
||||
echo -e "$customers"
|
||||
else
|
||||
echo "no customers found"
|
||||
fi
|
||||
else
|
||||
echo "No $CUSTCONF folder found"
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
generate_config()
|
||||
{
|
||||
DIFFFILE="$1"
|
||||
MASTERFILE="$2"
|
||||
while read p; do
|
||||
v "$p"
|
||||
sed -r -i "$p" $MASTERFILE
|
||||
done < $DIFFFILE
|
||||
}
|
||||
|
||||
setup_dirs()
|
||||
{
|
||||
|
||||
if [ ! -d "$FILEDIR" ]; then
|
||||
mkdir -p $FILEDIR
|
||||
elif [ -d "$FILEDIR" -a $CLEAN -eq 1 ]; then
|
||||
v "rm -rf $FILEDIR*"
|
||||
rm -rf $FILEDIR*
|
||||
fi
|
||||
}
|
||||
|
||||
get_subtarget_for_device() {
|
||||
readonly target="$1"
|
||||
readonly device="$2"
|
||||
readonly targetinfo_file="tmp/info/.targetinfo-feeds_$target"
|
||||
readonly target_profile_line="Target-Profile: DEVICE_$device"
|
||||
# We want to know after which Target: $target/$subtarget line
|
||||
# our $target_profile_line appears
|
||||
# This is a crude way to "parse" the file using shell 🤯
|
||||
# 1. grep for both lines with line number output
|
||||
# 2. grep again to determine the device profile line that we looked for
|
||||
# but output one context line before as well to determine corresponding subtarget line
|
||||
# 4. Use head and sed to extract the subtarget
|
||||
grep "^Target: $target/\|^$target_profile_line" "$targetinfo_file" \
|
||||
| grep -E -B1 "^$target_profile_line" \
|
||||
| head -n1 \
|
||||
| sed -E "s|^Target: $target/||"
|
||||
}
|
||||
|
||||
create_and_copy_files()
|
||||
{
|
||||
local BOARDTYPE=$1
|
||||
shift
|
||||
local CUSTOMERS=$@
|
||||
|
||||
# Validate seleced board and customers
|
||||
set_target $BOARDTYPE
|
||||
if [ $target == "bogus" ]; then
|
||||
echo "Hardware profile does not exist"
|
||||
exit 1
|
||||
elif [ -n "$CUSTOMERS" ]; then
|
||||
for CUSTOMER in $CUSTOMERS; do
|
||||
if [ ! -d "$CUSTCONF/$CUSTOMER/" ]; then
|
||||
echo "Customer profile for '$CUSTOMER' does not exist"
|
||||
exit 1
|
||||
elif [ ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then
|
||||
echo "'$BOARDTYPE' board profile does not exist for customer '$CUSTOMER'"
|
||||
if [ -f "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
|
||||
echo "Common profile configuration will be used"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Generate base config
|
||||
rm -f .config
|
||||
v "Config $BOARDTYPE selected"
|
||||
v "cp $CONFIGPATH/config .config"
|
||||
cp $CONFIGPATH/config .config
|
||||
|
||||
if [ -f $target_config_path/config ]; then
|
||||
cat $target_config_path/config >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
if [ -f $target_config_path/$BOARDTYPE/config ]; then
|
||||
cat $target_config_path/$BOARDTYPE/config >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
# hack to support custom-devices until we have deprecated this genconfig-script...
|
||||
local custom_found=false
|
||||
local used_config_file
|
||||
|
||||
for config_file in feeds/*/devices/$target/config/$BOARDTYPE/config; do
|
||||
if [ "$custom_found" = "true" ]; then
|
||||
echo
|
||||
echo "Error was found!"
|
||||
echo "Please use only one path."
|
||||
echo "Two instances of $target/config/$BOARDTYPE exists:"
|
||||
echo "Path 1: $used_config_file"
|
||||
echo "Path 2: $config_file"
|
||||
return 1
|
||||
fi
|
||||
if [ -f "$config_file" ]; then
|
||||
cat "$config_file" >> .config
|
||||
echo "" >> .config
|
||||
custom_found=true
|
||||
used_config_file=$config_file
|
||||
fi
|
||||
done
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | mediatek | brcmbca | ipq95xx | ipq53xx)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local subtarget="$(get_subtarget_for_device "${target/_/-}" "$BOARDTYPE")"
|
||||
if [ -z "$subtarget" ]; then
|
||||
echo "Error determining subtarget for $target / ${BOARDTYPE}"
|
||||
return 1
|
||||
fi
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
|
||||
;;
|
||||
*)
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE
|
||||
|
||||
# Add customerconfig diff if a customer is selected
|
||||
if [ -n "$CUSTOMERS" ]; then
|
||||
for CUSTOMER in $CUSTOMERS; do
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/common/fs" ]; then
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/fs" ]; then
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
|
||||
v "Apply $CUSTCONF/$CUSTOMER/common/common.diff"
|
||||
cat $CUSTCONF/$CUSTOMER/common/common.diff >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" ]; then
|
||||
v "Apply $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff"
|
||||
cat $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Ensure strict file permissions, for when provided through the above
|
||||
if [ -f "$FILEDIR/etc/shadow" ]; then
|
||||
v "chmod 0600 $FILEDIR/etc/shadow"
|
||||
chmod 0600 "$FILEDIR/etc/shadow"
|
||||
fi
|
||||
if [ -d "$FILEDIR/etc/ssl/private" ]; then
|
||||
v "find $FILEDIR/etc/ssl/private -type d -exec chmod 0700 '{}' ';' -o -type f -exec chmod 0600 '{}' ';'"
|
||||
find "$FILEDIR/etc/ssl/private" -type d -exec chmod 0700 '{}' ';' -o -type f -exec chmod 0600 '{}' ';'
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local git_version
|
||||
if ! git_version="$(git describe --always $DIRTY --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||
local version_lower="${version,,}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Package source tree override if selected
|
||||
[ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
|
||||
|
||||
# developer mode selected ?
|
||||
echo "CONFIG_DEVEL=y" >>.config
|
||||
|
||||
if [ -n "$BRCM_MAX_JOBS" ]
|
||||
then
|
||||
echo "CONFIG_BRCM_MAX_JOBS=\"1\"" >>.config
|
||||
fi
|
||||
|
||||
# Force regeneration of kernel Makefile
|
||||
# Needed to disable kmods for iopsys-brcm targets
|
||||
touch package/kernel/linux/Makefile
|
||||
|
||||
# we need to signal to bradcom SDK that we have changed the board id
|
||||
# currently boardparms.c and boardparms_voice.c is the only place that is depending on boardid name
|
||||
# so just touch that file.
|
||||
[ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null
|
||||
|
||||
# Store generated config
|
||||
cp .config .genconfig.config
|
||||
|
||||
# Set default values based on selected parameters
|
||||
v "$(make defconfig 2>&1)"
|
||||
|
||||
echo Set version to $(grep -w CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"')
|
||||
|
||||
# Clean base-file package to force rebuild when changing profile
|
||||
v "$(make package/base-files/clean 2>&1)"
|
||||
|
||||
verify_config
|
||||
}
|
||||
|
||||
####### main #####
|
||||
if [ ! -e tmp/.iop_bootstrap ]; then
|
||||
echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration."
|
||||
echo "Run: iop feeds_update"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo Current profile:
|
||||
cat $CURRENT_CONFIG_FILE
|
||||
echo "Try ./iop genconfig -h' to get instructions if you want to change current config"
|
||||
exit 0
|
||||
else
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
|
||||
-c|--clean) export CLEAN=1;;
|
||||
-D|--no-dirty) export DIRTY="";;
|
||||
-n|--no-update) export IMPORT=0;;
|
||||
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-t|--target) export TARGET="$2"; shift;;
|
||||
-p|--profile) export PROFILE="$2"; shift;;
|
||||
-r|--repo) export CUSTREPO="$2"; shift;;
|
||||
-s|--override) export SRCTREEOVERR=1;;
|
||||
-S|--brcmsingel) export BRCM_MAX_JOBS=1;;
|
||||
-h|--help) usage;;
|
||||
-l|--list) list_customers 0 $2;;
|
||||
-a|--list-all)list_customers 1;;
|
||||
-b|--boards)set_target LIST;exit 0;;
|
||||
-*)
|
||||
echo "Invalid option: $1 "
|
||||
echo "Try -h or --help for more information."
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
|
||||
CUSTREPO="${CUSTREPO:-git@dev.iopsys.eu:consumer/iopsys.git}"
|
||||
|
||||
setup_dirs
|
||||
create_and_copy_files "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
register_command "genconfig_min" "Generate configuration for customer with manual board configuration"
|
||||
@@ -1,283 +0,0 @@
|
||||
# this is a developer helper script to install firmware on a remote host with SSH
|
||||
|
||||
function upd_usage {
|
||||
echo "usage: $0 ssh_upgrade [-t <host>] [-f <file>] [opts] "
|
||||
echo ""
|
||||
echo " Default host is 192.168.1.1"
|
||||
echo " Default firmware file is the latest one (last.{itb,pkgtb})"
|
||||
echo " Default is to not keep configuration"
|
||||
echo "opts:"
|
||||
echo ""
|
||||
echo " -i Interactive use, allows to select firmware file"
|
||||
echo " -n Do not do the final reboot of the target board"
|
||||
echo " -c Keep configuration"
|
||||
echo " -x Force install even if firmware is not for this board"
|
||||
echo " -b Force install of bootloader regardless of version installed"
|
||||
}
|
||||
|
||||
function set_config_string {
|
||||
eval $(grep $1 .config)
|
||||
}
|
||||
|
||||
function upd_ask_ok {
|
||||
echo "Will continue with the following settings:"
|
||||
echo "-----------------------------------------"
|
||||
printf "%20s: %s\n" "Firmware file" "$upd_fw_base"
|
||||
printf "%20s: %s\n" "Host IP" "$upd_host"
|
||||
printf "%20s: " "Reboot"
|
||||
if [ "$upd_noreboot" == "0" ]; then printf "Yes\n"; else printf "No\n"; fi
|
||||
printf "%20s: " "Keep config"
|
||||
if [ "$upd_keepconf" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi
|
||||
printf "%20s: " "Force bootloader"
|
||||
if [ "$upd_forceboot" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi
|
||||
printf "%20s: " "Force image upgrade"
|
||||
if [ "$upd_forceimage" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi
|
||||
echo "-----------------------------------------"
|
||||
|
||||
echo -n "Continue? [Y/n/q]:"
|
||||
read answer
|
||||
|
||||
case $answer in
|
||||
n | N)
|
||||
return 1
|
||||
;;
|
||||
q | Q)
|
||||
exit 1
|
||||
;;
|
||||
y | Y | *)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_file {
|
||||
dialog --keep-tite --title "To select a file, use TAB/ARROW to highlight then press SPACEBAR -> RETURN" \
|
||||
--fselect "${upd_fw:-bin/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/}" \
|
||||
$((lines - 10)) $((cols - 5)) \
|
||||
2>$tempfile
|
||||
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]; then
|
||||
upd_fw="$new_file"
|
||||
upd_fw_base=$(basename $upd_fw)
|
||||
fi
|
||||
}
|
||||
|
||||
function upd_select_target {
|
||||
dialog --keep-tite --title "Input the hostname/IP of the target board" \
|
||||
--inputbox "Name/IP" \
|
||||
$((lines - 10)) $((cols - 5)) \
|
||||
"$upd_host" \
|
||||
2>$tempfile
|
||||
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]; then
|
||||
upd_host="$new_file"
|
||||
fi
|
||||
}
|
||||
|
||||
function upd_select_reboot {
|
||||
dialog --keep-tite --radiolist "Should the board reboot after download finished" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Reboot" "Restart board after done" $(if [ "$upd_noreboot" == "0" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
"No reboot" "Continue running old system" $(if [ "$upd_noreboot" == "1" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"No reboot")
|
||||
upd_noreboot=1
|
||||
;;
|
||||
"Reboot")
|
||||
upd_noreboot=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_config {
|
||||
dialog --keep-tite --radiolist "Should the configuration be kept" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Keep" "Keep the config from old system" $(if [ "$upd_keepconf" == "1" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
"Default" "Use default config for new system" $(if [ "$upd_keepconf" == "0" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Keep")
|
||||
upd_keepconf=1
|
||||
;;
|
||||
"Default")
|
||||
upd_keepconf=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_forceboot {
|
||||
dialog --keep-tite --radiolist "Should the boot loader be updated regardless of the version installed" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Force" "Always update boot loader" $(if [ "$upd_forceboot" == "1" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
"Version check" "Only upgrade if version is newer" $(if [ "$upd_forceboot" == "0" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Force")
|
||||
upd_forceboot=1
|
||||
;;
|
||||
"Version check")
|
||||
upd_forceboot=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_forceimage {
|
||||
dialog --keep-tite --radiolist "Should the image be stored in flash even if sanity checks would reject it" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Force" "Disable sanity check and force use of image (dangerous)" $(if [ "$upd_forceimage" == "1" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
"Only compatible" "Normal checks apply" $(if [ "$upd_forceimage" == "0" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Force")
|
||||
upd_forceimage=1
|
||||
;;
|
||||
"Only compatible")
|
||||
upd_forceimage=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select {
|
||||
dialog --keep-tite --ok-label "Select" --cancel-label "Done" --menu "Select item to change" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Firmware file" "$upd_fw_base" \
|
||||
"Host IP" "$upd_host" \
|
||||
"Reboot" $(if [ "$upd_noreboot" == "0" ]; then printf "Yes\n"; else printf "No\n"; fi) \
|
||||
"Keep config" $(if [ "$upd_keepconf" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi) \
|
||||
"Force bootloader" $(if [ "$upd_forceboot" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi) \
|
||||
"Force image upgrade" $(if [ "$upd_forceimage" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
case $(cat $tempfile) in
|
||||
"Firmware file")
|
||||
upd_select_file
|
||||
;;
|
||||
"Host IP")
|
||||
upd_select_target
|
||||
;;
|
||||
"Reboot")
|
||||
upd_select_reboot
|
||||
;;
|
||||
"Keep config")
|
||||
upd_select_config
|
||||
;;
|
||||
"Force bootloader")
|
||||
upd_select_forceboot
|
||||
;;
|
||||
"Force image upgrade")
|
||||
upd_select_forceimage
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
upd_select
|
||||
}
|
||||
function upd_select_start {
|
||||
lines=$(tput lines)
|
||||
cols=$(tput cols)
|
||||
tempfile="$(mktemp)"
|
||||
trap "rm -f $tempfile" 0 1 2 5 15
|
||||
upd_select
|
||||
|
||||
}
|
||||
|
||||
function ssh_upgrade {
|
||||
upd_noreboot=0
|
||||
upd_forceboot=0
|
||||
upd_keepconf=0
|
||||
upd_forceimage=0
|
||||
upd_fw_base=""
|
||||
upd_fw=""
|
||||
upd_host="192.168.1.1"
|
||||
do_dialog=0
|
||||
|
||||
while getopts "f:hnxt:icb" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
upd_noreboot=1
|
||||
;;
|
||||
x)
|
||||
upd_forceimage=1
|
||||
;;
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
c)
|
||||
upd_keepconf=1
|
||||
;;
|
||||
v)
|
||||
verbose=$OPTARG
|
||||
;;
|
||||
f)
|
||||
upd_fw=$OPTARG
|
||||
;;
|
||||
t)
|
||||
upd_host=$OPTARG
|
||||
;;
|
||||
i)
|
||||
do_dialog=1
|
||||
;;
|
||||
h)
|
||||
upd_usage
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$upd_fw" ]; then
|
||||
set_config_string CONFIG_TARGET_BOARD
|
||||
set_config_string CONFIG_TARGET_SUBTARGET
|
||||
upd_fw="$(realpath -q --canonicalize-existing --relative-to=. "bin/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/"last.{pkgtb,itb})"
|
||||
if [ -z "$upd_fw" ] && [ $do_dialog -eq 0 ]; then
|
||||
echo "Could not find image. Check that last.{itb,pkgtb} exists or specify an image using -f <image> or -i (interactive)." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
upd_fw_base="$(basename "$upd_fw")"
|
||||
|
||||
[ $do_dialog -eq 1 ] && upd_select_start
|
||||
|
||||
if ! upd_ask_ok; then
|
||||
upd_select_start
|
||||
if ! upd_ask_ok; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $upd_fw ]; then
|
||||
echo "Firmware file $firmware does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extra_args=""
|
||||
[ $upd_noreboot -eq 1 ] && extra_args="$extra_args --no-reboot"
|
||||
[ $upd_forceimage -eq 1 ] && extra_args="$extra_args --force"
|
||||
[ $upd_keepconf -eq 0 ] && extra_args="$extra_args -n"
|
||||
[ $upd_forceboot -eq 1 ] && extra_args="$extra_args --force-loader-upgrade"
|
||||
|
||||
pv "$upd_fw" |
|
||||
ssh \
|
||||
-o ConnectTimeout=60 \
|
||||
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
||||
root@"$upd_host" \
|
||||
sh -c "cat > '/tmp/$upd_fw_base' && (set -x && sysupgrade -v $extra_args /tmp/$upd_fw_base)" ||
|
||||
echo "Sysupgrade failed" >&2 && return 1
|
||||
}
|
||||
|
||||
register_command "ssh_upgrade" "-t <host> -f <file> [opts] Install firmware on remote host with SSH"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user