Compare commits

...

107 Commits
dmexec ... voip

Author SHA1 Message Date
Vivek Kumar Dutta
96d9b2ba2f sulu-vendorext: mount voip extn to SIP.Client 2025-09-23 10:50:47 +05:30
Vivek Kumar Dutta
945d95b518 tr143: Fix format syntax parsing for upload diagnostics 2025-09-22 19:04:07 +05:30
Vivek Dutta
9eee6a59f8 logmngr: Fix /dev/log permission to allow all processes to write
(cherry picked from commit 60dafc2028)

047d345b logmngr: /dev/log permissions should allow all processes to write

Co-authored-by: Husaam Mehdi <husaam.mehdi@iopsys.eu>
2025-09-22 18:58:16 +05:30
Markus Gothe
1c6e8aaec8 qosmngr: airoha: flush HW NAT to directly apply changes. 2025-09-19 16:54:11 +02:00
Markus Gothe
aa7ad2dfe9 qosmng: airoha: Don't flush HW NAT unless necessary. 2025-09-19 16:52:51 +02:00
Markus Gothe
dd637db803 qosmngr: airoha: Fix uplink bandwidth calculation.
For lower speeds we need to adjust the bandwidth
calculation for QoS to work on AN7581 (but not on EN7523).

Also make sure we clear old HW NAT entries if the uplink
bandwidth changes for QoS to take effect immediaty.
2025-09-19 16:52:29 +02:00
Jakob Olsson
04b74dca49 map-controller: 6.4.2.9 2025-09-19 15:11:08 +02:00
Anjan Chanda
5ab49f8ff4 map-plugins: 1.0.32 2025-09-19 14:34:16 +02:00
Anjan Chanda
4ac917a191 map-plugins: 1.0.18 (bsteer) 2025-09-19 14:33:53 +02:00
Vivek Kumar Dutta
37d313ccc5 sulu-vendorextn: remove parental control extn 2025-09-19 16:20:26 +05:30
Vivek Kumar Dutta
a225cc2e3f bridgemngr: Simplify QnQ deployments 2025-09-19 15:19:36 +05:30
Reidar Cederqvist
6df061de8e sulu: update to version 2 (5.1.2) 2025-09-19 11:41:31 +02:00
Jakob Olsson
c6d3cac61e hostmngr: 1.3.3 2025-09-18 17:22:54 +02:00
Reidar Cederqvist
f1ac19b604 sulu: update to version 5.1.1 2025-09-18 12:16:10 +02:00
Markus Gothe
27bd279333 dslmngr: airoha: Fix QoS uplink bandwidth monitor. 2025-09-17 19:54:03 +02:00
Reidar Cederqvist
f7d845beaa sulu: tmp give admin full access 2025-09-17 19:02:28 +02:00
Reidar Cederqvist
41c39445bc SULU: depend on sulu-vendorext 2025-09-17 16:24:17 +00:00
Vivek Kumar Dutta
f1c7fc9e1e sulu: return 503 if usp not ready 2025-09-17 18:04:40 +02:00
Sukru Senli
426ddd0f30 sulu-vendorext: move under sulu folder 2025-09-17 16:36:33 +02:00
Jouni Ikonen
9c26dc269e Make sulu work on again 2025-09-17 16:34:02 +02:00
Jouni Ikonen
775c7bf9b9 Changed dns to option instead of list and added peerdns 2025-09-17 16:33:58 +02:00
Vivek Kumar Dutta
154532348b sulu-vendorext: Updated default values 2025-09-17 16:33:53 +02:00
Vivek Kumar Dutta
ed638f3913 sulu: ui updates 2025-09-17 16:33:45 +02:00
Sukru Senli
a3298e14cc sulu-vendorext: if ssid is set different, remove mld, if same, set mld 2025-09-17 16:33:40 +02:00
Sukru Senli
0c72ad488c sulu-vendorext: sync creds from ap to mld 2025-09-17 16:33:33 +02:00
Sukru Senli
d39b258091 sulu-hmg: heimgard sulu 2025-09-17 16:33:29 +02:00
Sukru Senli
d4398bc4a7 HGM: add files extensions depend on 2025-09-17 16:33:21 +02:00
Vivek Kumar Dutta
4f479680b0 HGM vendor extensions 2025-09-17 16:32:39 +02:00
Vivek Kumar Dutta
888b1c186a tr104: Vendor extension for SIP bind Interface 2025-09-17 18:45:31 +05:30
Reidar Cederqvist
5ebb2552ac update to Sulu V2 (5.1.0) 2025-09-17 12:22:40 +02:00
Jakob Olsson
e7f26ec647 map-controller: 6.4.0.16 2025-09-17 12:10:17 +02:00
Vivek Kumar Dutta
f4350eba32 bridgemngr: Fix deletion of ProviderBridge 2025-09-17 15:36:34 +05:30
Janusz Dziedzic
e781b0c1cc libwifi: 7.13.6 2025-09-16 14:02:05 +00:00
Vivek Kumar Dutta
075280c30b userinterface: 1.1.9 2025-09-16 17:09:15 +05:30
Vivek Kumar Dutta
bd984a6f1c bridgemngr: Fix tpid order in QnQ 2025-09-16 16:35:27 +05:30
Vivek Kumar Dutta
f017ef0b41 icwmp: expose periodic inform params over usp 2025-09-16 16:19:28 +05:30
Vivek Dutta
daf540bf4d userinterface: Support for ISP info parameters
(cherry picked from commit 0f23bee1da)

Co-authored-by: Vivek Kumar Dutta <vivek.dutta@iopsys.eu>
2025-09-16 15:54:01 +05:30
Husaam Mehdi
9177090e7c logmngr: 1.1.4 2025-09-16 15:33:55 +05:30
Mohd Husaam Mehdi
8001d9d14b logmngr: fix severity and facility configuration issues 2025-09-16 15:32:31 +05:30
Husaam Mehdi
28c22277cd logmngr: use multiple workers for logging 2025-09-16 15:32:31 +05:30
Erik Karlsson
a82c3562f2 logmngr: use fluent-bit filters to adapt kmsg fields and add hostname 2025-09-16 15:32:31 +05:30
Erik Karlsson
d6e6747380 logmngr: miscellaneous fixes
Always migrate configuration. Do not set executable bit on config
files and uci-defaults scripts. Remove unused /lib/functions.sh
include. Remove redundant "default y" on choice.
2025-09-16 15:32:31 +05:30
Husaam Mehdi
9cf65109e8 logmngr: add support for Syslog Source and Template 2025-09-16 15:32:31 +05:30
Markus Gothe
819b9e3e97 logmngr: Make sure we never fail to setup /var/log/messages.
If it fails during MP the verfication of buttons will not work
as expected. The problem is that the file is created before
data is commited and when power is cut prematurely it won't
re-create the file, maybe because the uci-default script has
been removed already as well.
2025-09-16 15:32:31 +05:30
Vivek Kumar Dutta
05cf17b007 logmngr: fix /dev/log creation 2025-09-16 15:32:31 +05:30
Vivek Kumar Dutta
4538e26d87 logmngr: generate kmsg,log config if dev exists 2025-09-16 15:32:31 +05:30
Husaam Mehdi
c45695ce93 logmngr: Use kmsg module instead of klogd 2025-09-16 15:32:31 +05:30
Husaam Mehdi
e8124555bb logmngr: Include kernel logs 2025-09-16 15:32:31 +05:30
Mohd Husaam Mehdi
596df801e6 fluent-bit: fix kmsg plugin issues
* improved type conversion
* improved error checking while string parsing
* misc improvements
2025-09-15 16:07:15 +05:30
Erik Karlsson
b713b68045 fluent-bit: human readable time in file output 2025-09-15 16:07:15 +05:30
Erik Karlsson
869d482198 fluent-bit: remove patches for hostname and kmsg field adaptation
Filters will be used instead.
2025-09-15 16:07:15 +05:30
Mohd Husaam Mehdi
e5c59ebfcd fluent-bit: align kmsg output fields with syslog fields
- this allows for a better mapping to the data model
- this reduces load on fluent-bit because now one OUTPUT section
  is sufficient (earlier we needed two output sections because of
  two different templates)
2025-09-15 16:07:15 +05:30
Vivek Kumar Dutta
fd0c7e93ef fluent-bit: build using git proto 2025-09-15 16:07:15 +05:30
Janusz Dziedzic
862a278fbe fluent-bit: fix package hash 2025-09-15 16:07:15 +05:30
Mohd Husaam Mehdi
87aa6ea898 fluent-bit: bump version and adjust patch accordingly 2025-09-15 16:07:15 +05:30
Mohd Husaam Mehdi
64c6ff7787 fluent-bit: fix kmsg plugin and add syslog timestamp to kmsg logs 2025-09-15 16:07:15 +05:30
Mohd Husaam Mehdi
ab66957fad fluent-bit: enable kmsg plugin 2025-09-15 16:07:15 +05:30
Markus Gothe
e590fc7894 qosmngr: airoha: flush HW NAT to directly apply changes. 2025-09-15 11:47:13 +02:00
Filip Matusiak
785f2e9db2 map-controller: 6.4.0.15 2025-09-08 17:10:30 +02:00
Filip Matusiak
35cb886b3e map-agent: 6.3.6.15 2025-09-08 17:09:40 +02:00
Jakob Olsson
a1e8a8a464 map-agent: 6.3.6.14 2025-09-04 16:05:37 +02:00
Vivek Kumar Dutta
98c35bf25f obuspa: fallback get connection params from db 2025-09-04 11:00:58 +05:30
Jakob Olsson
7cc2e3eac9 map-agent: 6.3.6.13 2025-09-03 11:50:31 +02:00
Filip Matusiak
f6aff4ba81 hostmngr: 1.3.2 2025-09-02 14:07:47 +02:00
Filip Matusiak
cbd0b5b6bb decollector: 6.2.1.8 2025-09-02 14:07:47 +02:00
Filip Matusiak
d2df0e5633 libdpp: 2.1.2 2025-09-02 14:07:47 +02:00
Filip Matusiak
43be3d334c ieee1905: 8.7.33 2025-09-02 14:07:47 +02:00
Filip Matusiak
900c221ef8 libwifi: 7.13.5 2025-09-02 14:07:47 +02:00
Filip Matusiak
1b88e03e43 wifimngr: 17.7.6 2025-09-02 14:07:47 +02:00
Filip Matusiak
b9e40818a3 map-agent: 6.3.6.12 2025-09-02 14:07:47 +02:00
Jakob Olsson
af272291d2 map-controller: 6.4.0.14 2025-09-02 14:03:47 +02:00
Vivek Kumar Dutta
e7e49350b1 obuspa: removed test controller definition 2025-09-02 16:17:31 +05:30
Vivek Kumar Dutta
40056f3e65 iopsys-analytics: enable dmcli remote connection 2025-09-02 10:03:03 +05:30
Vivek Kumar Dutta
110589b1e2 sulu: remove jq dependency 2025-09-01 21:24:21 +05:30
Erik Karlsson
a3352224c2 sulu: depend on local MQTT listener regardlessly of variant 2025-09-01 21:24:10 +05:30
Erik Karlsson
9e3cbbc1f7 sulu: remove faulty mosquitto option
The actual spelling of this option is require_certificate and it is
anyway not relevant here since it is not a TLS listener.
2025-09-01 21:23:58 +05:30
Vivek Dutta
dd18f6f9ed sulu: Fix restarting of mqtt broker 2025-09-01 21:23:46 +05:30
Vivek Kumar Dutta
e69fba300a sulu: support dynamic QR 2025-09-01 21:23:30 +05:30
Vivek Kumar Dutta
0bd3c5e020 usp-js: 1.2.9 2025-09-01 17:28:03 +05:30
Vivek Kumar Dutta
bd115c48bf usp-js: 1.2.8 2025-09-01 17:27:47 +05:30
Vivek Dutta
6241dc0500 parental-control: improve dns packet inspection
(cherry picked from commit 1a80f2df47)

Co-authored-by: Vivek Kumar Dutta <vivek.dutta@iopsys.eu>
2025-08-28 12:53:59 +05:30
Vivek Dutta
5986d9ad3f parental-control: improve packet capture rules for DNS
(cherry picked from commit 9b79eb42db)

Co-authored-by: Mohd Husaam Mehdi <husaam.mehdi@iopsys.eu>
2025-08-28 12:48:36 +05:30
Vivek Dutta
e1d1b37edf parental-control: flush hw_nat along with conntrack
(cherry picked from commit 602926b076)

Co-authored-by: Mohd Husaam Mehdi <husaam.mehdi@iopsys.eu>
2025-08-28 12:48:01 +05:30
Vivek Kumar Dutta
ac6c0c3e60 bbfdm: fix log levels 2025-08-27 16:39:59 +05:30
Filip Matusiak
ee13ac5774 self-diagnostics: update wifi data collection 2025-08-25 15:14:57 +02:00
Filip Matusiak
f4fa5821e5 self-diagnostics: get status of MLD stations 2025-08-25 15:12:00 +02:00
Filip Matusiak
324f482548 map-controller: 6.4.0.13
Default logging level to INFO (2)
2025-08-22 16:34:05 +02:00
Jakob Olsson
a794e51f56 map-controller: 6.4.0.12 2025-08-21 15:45:48 +02:00
Mohd Husaam Mehdi
8bdc47344a parental-control: fix cleanup when bundle is default enabled 2025-08-20 20:18:04 +05:30
Husaam Mehdi
544b0346d7 parental-control: auto enable urlbundle based on /apps 2025-08-20 19:22:12 +05:30
Markus Gothe
b95714fcb9 libdsl: 7.3.2 2025-08-11 09:06:59 +02:00
Jakob Olsson
19ff37bd9b map-agent: 6.3.6.11 2025-08-07 15:27:56 +02:00
Markus Gothe
95f47e28a1 libdsl: Fix issue with G.vectoring. 2025-08-07 14:17:51 +02:00
Vivek Kumar Dutta
4edd2e5cbf tr104: Fix CallControlGroup Extension references 2025-08-07 16:48:32 +05:30
Suvendhu Hansa
3d54e83e0d icwmpd: Retry on bind failure 2025-08-07 15:36:57 +05:30
Markus Gothe
ead2de7ad1 xdsl_wan: ros -> roc. 2025-08-06 19:51:56 +02:00
Markus Gothe
8e21d2d702 xdsl_wan: Enable vectoring and G.iNP by default. 2025-08-06 19:35:41 +02:00
Vivek Kumar Dutta
a2627faef1 icwmp: use default port if not defined 2025-08-06 18:25:46 +05:30
Suvendhu Hansa
10a0fa34c3 wifidmd: sync with mapcontroller config 2025-08-06 16:57:12 +05:30
Jakob Olsson
6e8c83eafd map-agent: 6.3.6.10 2025-08-06 09:58:44 +02:00
Jakob Olsson
53cea83a61 map-agent: 6.3.6.9 2025-07-30 12:34:33 +02:00
Vivek Kumar Dutta
69ff8452e2 wifidmd: Fix legacy WiFi nodes for extenders 2025-07-29 18:29:57 +05:30
Suvendhu Hansa
f7c39b5fef wifidmd,map-agent: Fix legacy WiFi nodes for extenders 2025-07-29 18:27:58 +05:30
Jakob Olsson
7765b3de9c map-agent: 6.3.6.8 2025-07-28 12:17:13 +02:00
Vivek Kumar Dutta
a51d5e6616 wifidmd: Fix legacy nodes for extenders 2025-07-25 17:51:06 +05:30
Vivek Kumar Dutta
971392a796 xmppc: Fix ConnReqXMPPConnection value 2025-07-25 17:48:44 +05:30
Vivek Kumar Dutta
291cd43b10 bbfdm: Fix internal dm references 2025-07-25 17:44:11 +05:30
98 changed files with 4738 additions and 1936 deletions

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm
PKG_VERSION:=1.16.6
PKG_VERSION:=1.16.6.2
USE_LOCAL:=0
ifneq ($(USE_LOCAL),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
PKG_SOURCE_VERSION:=549a296cbfe0f6f6aaf22c0371651668abd8b10f
PKG_SOURCE_VERSION:=aa480554461c82e6f6f44ee6c23108d3e44fce21
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -5,14 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bridgemngr
PKG_VERSION:=1.0.17
PKG_VERSION:=1.0.18.2
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:=36e6e8319a95dad3bccfe9f2d8a298b39c6ce86b
PKG_SOURCE_VERSION:=71ed529be038392071b0399bcfe9d46e89d3cb46
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -6,12 +6,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=decollector
PKG_VERSION:=6.2.1.7
PKG_VERSION:=6.2.1.8
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=ca92325ece080389ffb405c95048b64071eda653
PKG_SOURCE_VERSION:=b7e294d7c610adfd80cf40a0628c189695dc5156
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip

View File

@@ -5,6 +5,8 @@ source "/lib/functions/network.sh"
source "/lib/functions/system.sh"
PREVLINK=""
LINK=""
LINKSPEED=""
PREVWANMODE=""
WANMODE=""
CONFIGURED=0
@@ -60,7 +62,7 @@ create_atm_devices() {
}
configure_line() {
local mode profile bitswap sra us0 sesdrop sos ginp mod prof
local mode profile bitswap sra us0 sesdrop sos roc ginp gvector mod prof
local adsl1_flag=0 issue2_flag=0 Glite_flag=0 adsl2_flag=0 adsl2p_flag=0 vdsl2_flag=0
local pro_8a_flag=0 pro_8b_flag=0 pro_8c_flag=0 pro_8d_flag=0 pro_12a_flag=0 pro_12b_flag=0 pro_17a_flag=0 pro_30a_flag=0 pro_35b_flag=0
@@ -70,8 +72,9 @@ configure_line() {
config_get sra $1 sra "1"
config_get us0 $1 us0 "1"
config_get sos $1 sos "0"
config_get sos $1 roc "0"
config_get sos $1 ginp "0"
config_get roc $1 roc "0"
config_get ginp $1 ginp "1"
config_get gvector $1 gvector "1"
for mod in $mode; do
[ "$mod" = "gdmt" ] && adsl1_flag=1
@@ -96,6 +99,7 @@ configure_line() {
/userfs/bin/blapi_cmd xdsl set_adsl_profile "$pro_8a_flag" "$pro_8b_flag" "$pro_8c_flag" "$pro_8d_flag" "$pro_12a_flag" "$pro_12b_flag" "$pro_17a_flag" "$pro_30a_flag" "$pro_35b_flag"
/userfs/bin/blapi_cmd xdsl set_adsl_mode "$adsl1_flag" "$issue2_flag" "$Glite_flag" "$adsl2_flag" "$adsl2p_flag" "$vdsl2_flag"
/userfs/bin/blapi_cmd xdsl set_adsl_gvector "$((!gvector))"
/userfs/bin/blapi_cmd xdsl set_adsl_ginp "$((!ginp))"
/userfs/bin/blapi_cmd xdsl set_adsl_sos_roc "$((!sos))" "$((!roc))"
/userfs/bin/blapi_cmd xdsl set_adsl_us0 "$((!us0))"
@@ -148,6 +152,12 @@ while [ true ]; do
if [ "$LINK" != "$PREVLINK" -a \( "$LINK" = "down" -o "$LINK" = "up" \) ]; then
if [ "$LINK" = "down" ]; then
if [ ! -s /tmp/qos/wan_link_shape_rate ]; then
rm -rf /tmp/qos/wan_link_shape_rate
rm -rf /tmp/qos/wan_link_speed
/usr/sbin/qos-uplink-bandwidth
fi
[ "$CONFIGURED" -eq 0 ] && configure_lines # Needs to be done once the slave SoC is in down state and we've not been able to auto-sync.
if [ -n "$WANMODE" ]; then
if [ "$WANMODE" = "PTM" ]; then
@@ -224,6 +234,26 @@ while [ true ]; do
call_wan_hotplug "up" "$WANPORT"
PREVWANMODE="$WANMODE"
if [ ! -s /tmp/qos/wan_link_shape_rate ]; then
LINKSPEED="$(awk '/far-end interleaved channel bit rate/{print $6}' /proc/tc3162/adsl_stats)"
LINKSPEED=$((LINKSPEED))
if [ "$LINKSPEED" -eq 0 ]; then
LINKSPEED="$(awk '/far-end fast channel bit rate/{print $6}' /proc/tc3162/adsl_stats)"
LINKSPEED=$((LINKSPEED))
fi
if [ "$LINKSPEED" -ne 0 ]; then
mkdir -p /tmp/qos
touch /tmp/qos/wan_link_shape_rate
/userfs/bin/qosrule discpline Rate uplink-bandwidth ${LINKSPEED}
hw_nat -! > /dev/null 2>&1
else
rm -rf /tmp/qos/wan_link_speed
/usr/sbin/qos-uplink-bandwidth
fi
fi
fi
# Toggle link state

View File

@@ -5,15 +5,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fluent-bit
PKG_VERSION:=4.0.2
PKG_VERSION:=4.0.4
PKG_RELEASE:=$(AUTORELEASE)
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit.git
PKG_SOURCE_VERSION=v$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit/archive/refs/tags/
PKG_HASH:=aa0577ba7251081c8d5398b2a905b5b0585bb657ca13b39a5e12931437516f08
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=Apache-2.0
@@ -65,9 +66,9 @@ CMAKE_OPTIONS += \
-DFLB_IN_DISK=Yes \
-DFLB_IN_EXEC=Yes \
-DFLB_IN_HEAD=Yes \
-DFLB_IN_KMSG=Yes \
-DFLB_IN_TAIL=Yes \
-DFLB_IN_FORWARD=No \
-DFLB_IN_KMSG=No \
-DFLB_IN_PROC=No \
-DFLB_IN_RANDOM=No \
-DFLB_IN_SERIAL=No \

View File

@@ -9,6 +9,10 @@
tag syslog
path /dev/log
[INPUT]
name kmsg
tag kernel
[OUTPUT]
name null
match *

View File

@@ -1,45 +0,0 @@
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;
}

View File

@@ -0,0 +1,27 @@
diff --git a/plugins/out_file/file.c b/plugins/out_file/file.c
index 77baf6be8..04c519d5a 100644
--- a/plugins/out_file/file.c
+++ b/plugins/out_file/file.c
@@ -238,10 +238,20 @@ static int template_output_write(struct flb_file_conf *ctx,
/*
* Right now we treat "{time}" specially and fill the placeholder
- * with the metadata timestamp (formatted as float).
+ * with the metadata timestamp.
*/
if (!strncmp(key, "time", size)) {
- fprintf(fp, "%f", flb_time_to_double(tm));
+ struct tm tm_local;
+ char buf[32];
+ if (localtime_r(&tm->tm.tv_sec, &tm_local) == NULL) {
+ flb_plg_error(ctx->ins, "localtime_r failed");
+ return -1;
+ }
+ if (strftime(buf, sizeof(buf), "%b %d %H:%M:%S", &tm_local) == 0) {
+ flb_plg_error(ctx->ins, "strftime failed");
+ return -1;
+ }
+ fputs(buf, fp);
return 0;
}

View File

@@ -0,0 +1,73 @@
diff --git a/plugins/in_kmsg/in_kmsg.c b/plugins/in_kmsg/in_kmsg.c
index cd5c4cd17..15f105451 100644
--- a/plugins/in_kmsg/in_kmsg.c
+++ b/plugins/in_kmsg/in_kmsg.c
@@ -36,7 +36,6 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <inttypes.h>
-#include <time.h>
#include "in_kmsg.h"
@@ -123,12 +122,17 @@ static inline int process_line(const char *line,
ctx->buffer_id++;
errno = 0;
- val = strtol(p, &end, 10);
- if ((errno == ERANGE && (val == INT_MAX || val == INT_MIN))
+ val = strtoul(p, &end, 10);
+ if ((errno == ERANGE && val == ULONG_MAX)
|| (errno != 0 && val == 0)) {
goto fail;
}
+ /* ensure something was consumed */
+ if (end == p) {
+ goto fail;
+ }
+
/* Priority */
priority = FLB_KLOG_PRI(val);
@@ -144,24 +148,35 @@ static inline int process_line(const char *line,
}
p++;
- val = strtoul(p, &end, 10);
- if ((errno == ERANGE && (val == INT_MAX || val == INT_MIN))
+ val = strtoull(p, &end, 10);
+ if ((errno == ERANGE && val == ULLONG_MAX)
|| (errno != 0 && val == 0)) {
goto fail;
}
+ /* make sure strtoull consumed something */
+ /* after the sequence number, the next char must be ',' */
+ if (end == p || *end != ',') {
+ goto fail;
+ }
+
sequence = val;
p = ++end;
/* Timestamp */
- val = strtoul(p, &end, 10);
- if ((errno == ERANGE && (val == INT_MAX || val == INT_MIN))
+ val = strtoull(p, &end, 10);
+ if ((errno == ERANGE && val == ULLONG_MAX)
|| (errno != 0 && val == 0)) {
goto fail;
}
+ /* ensure something was consumed */
+ if (end == p) {
+ goto fail;
+ }
+
tv.tv_sec = val/1000000;
- tv.tv_usec = val - (tv.tv_sec * 1000000);
+ tv.tv_usec = val - ((uint64_t)tv.tv_sec * 1000000);
flb_time_set(&ts, ctx->boot_time.tv_sec + tv.tv_sec, tv.tv_usec * 1000);

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostmngr
PKG_VERSION:=1.3.1
PKG_VERSION:=1.3.3
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=3663ca4d001508509774115d6797b932f9ed4f69
PKG_SOURCE_VERSION:=fee5bd0067fc1f30498bc2b81e893d170796b459
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

View File

@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=9.9.9
PKG_VERSION:=9.9.9.3
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
PKG_SOURCE_VERSION:=070e812e1bfb81a35a95a9c16cc20e8ffa6e30e4
PKG_SOURCE_VERSION:=55a64d756afd6249b8bb4cccf2cdaa7e1aa05f91
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -28,6 +28,7 @@ config cpe 'cpe'
option log_severity 'WARNING'
option log_file_name '/var/log/icwmpd.log'
option log_max_size '102400'
option bind_retries '5'
option userid '' #$OUI-$SER
option passwd ''
option port '7547'

View File

@@ -6,12 +6,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ieee1905
PKG_VERSION:=8.7.32
PKG_VERSION:=8.7.33
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=f1f653c0b7b53a243af889a4c8594aca42589045
PKG_SOURCE_VERSION:=f28f1c04cae008d7d6448ba02b992506af28448c
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

View File

@@ -33,6 +33,7 @@ define Package/$(PKG_NAME)
DEPENDS+= \
+@PACKAGE_syslog-ng:SYSLOGNG_LOGROTATE \
+PACKAGE_fluent-bit:logrotate \
+@DMCLI_REMOTE_CONNECTION
endef

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libdpp
PKG_VERSION:=2.1.1
PKG_VERSION:=2.1.2
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=6024efd3db9dd490c07465ea9b0c15120063165c
PKG_SOURCE_VERSION:=5f1184c52be19f3bfd3bc7e9bc582ef09b0a2b1c
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/libdpp.git
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libdsl
PKG_VERSION:=7.3.0
PKG_VERSION:=7.3.2
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/libdsl.git
PKG_SOURCE_VERSION:=2a7a49fac35c3d8078ffe051594c0425d355cacd
PKG_SOURCE_VERSION:=1aa9c40f9503311652e562617b1e15533257adcc
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libwifi
PKG_VERSION:=7.13.4
PKG_VERSION:=7.13.6
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=e5a8bc4985d91b0938bbdf2a46a99081408e5224
PKG_SOURCE_VERSION:=d17ad7415a821e95618c4739507bf129df3fdebf
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libwifi.git
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz

View File

@@ -1,4 +1,5 @@
if PACKAGE_logmngr
choice
prompt "Select backend for syslog management"
default LOGMNGR_BACKEND_FLUENTBIT
@@ -31,4 +32,5 @@ config LOGMNGR_VENDOR_LOG_FILE
default y
help
It adds support for Device.DeviceInfo.VendorLogFile. Object.
endif

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=logmngr
PKG_VERSION:=1.0.17
PKG_VERSION:=1.1.4
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/system/logmngr.git
PKG_SOURCE_VERSION:=ad2636c642d56967e78c0c84bf82cb0e2b6311f2
PKG_SOURCE_VERSION:=62441fdfe14a39bff8fff7c62307bd7b54d7240f
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -29,7 +29,6 @@ define Package/logmngr
CATEGORY:=Utilities
TITLE:=Logging Manager
DEPENDS:=+LOGMNGR_BACKEND_FLUENTBIT:fluent-bit
DEPENDS+=+@LOGMNGR_BACKEND_FLUENTBIT:BUSYBOX_CONFIG_KLOGD
DEPENDS+=+LOGMNGR_BACKEND_SYSLOG_NG:syslog-ng
DEPENDS+=+LOGMNGR_LOGROTATE:logrotate
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
@@ -53,31 +52,35 @@ endif
define Package/logmngr/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/logmngr.init $(1)/etc/init.d/logmngr
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/10-logmngr_config_generate $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/init.d/logmngr $(1)/etc/init.d/
$(INSTALL_DATA) ./files/etc/config/logmngr $(1)/etc/config/
$(INSTALL_DATA) ./files/etc/uci-defaults/10-logmngr_config_migrate $(1)/etc/uci-defaults/
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbfsyslog.so $(1) core 10
# Install logmngr service backend
$(INSTALL_DIR) $(1)/lib/logmngr
ifeq ($(CONFIG_LOGMNGR_BACKEND_FLUENTBIT),y)
$(INSTALL_DATA) ./files/lib/logmngr/fluent-bit.sh $(1)/lib/logmngr/
$(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_BIN) ./files/logmngr-klogd $(1)/usr/libexec/
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/logread $(1)/sbin/
endif
ifeq ($(CONFIG_LOGMNGR_BACKEND_SYSLOG_NG),y)
$(INSTALL_DATA) ./files/lib/logmngr/fluent-bit.sh $(1)/lib/logmngr/
else ifeq ($(CONFIG_LOGMNGR_BACKEND_SYSLOG_NG),y)
$(INSTALL_DATA) ./files/lib/logmngr/syslog-ng.sh $(1)/lib/logmngr/
endif
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbfsyslog.so $(1) core 10
ifeq ($(CONFIG_LOGMNGR_LOGROTATE),y)
$(INSTALL_BIN) ./files/11-logmngr_logrotate_config_generate $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/lib/logmngr/logrotate.sh $(1)/lib/logmngr/
$(INSTALL_DATA) ./files/etc/uci-defaults/11-logmngr_logrotate_syslog $(1)/etc/uci-defaults/
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbflogrotate.so $(1) sysmngr 11
endif
ifeq ($(CONFIG_LOGMNGR_VENDOR_LOG_FILE),y)
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbfvendorlog.so $(1) sysmngr 12
endif
endef
$(eval $(call BuildPackage,logmngr))

View File

@@ -1,26 +0,0 @@
#!/bin/sh
if uci -q get logmngr.@globals[0] >/dev/null; then
# return if there is any valid content
exit 0
else
rm -f /etc/config/logmngr
fi
touch /etc/config/logmngr
uci set logmngr.globals=globals
uci set logmngr.globals.enable=1
uci set logmngr.a1=action
uci set logmngr.a1.name="ac1"
uci set logmngr.lf1=log_file
uci set logmngr.lf1.enable=1
uci set logmngr.lf1.action="ac1"
uci set logmngr.lf1.file="/var/log/messages"
uci set logmngr.lr1=log_remote
uci set logmngr.lr1.enable=0
uci set logmngr.lr1.action="ac1"
uci set logmngr.lr1.port="514"

View File

@@ -0,0 +1,26 @@
config globals 'globals'
option enable '1'
config source 'default_source'
option name 'default_source'
option system_messages '1'
option kernel_messages '1'
config template 'default_template'
option name 'default_template'
option expression '{time} {hostname} {ident}: {message}'
config action 'default_action'
option name 'default_action'
list source 'default_source'
option template 'default_template'
config log_file 'lf1'
option enable '1'
option action 'default_action'
option file '/var/log/messages'
config log_remote 'lr1'
option enable '0'
option action 'default_action'
option port '514'

View File

@@ -0,0 +1,36 @@
#!/bin/sh
# check if this is a new type UCI or old type UCI
if ! uci -q get logmngr.default_source > /dev/null; then
uci -q set logmngr.default_source=source
uci -q set logmngr.default_source.name='default_source'
uci -q set logmngr.default_source.system_messages='1'
uci -q set logmngr.default_source.kernel_messages='1'
fi
if ! uci -q get logmngr.default_template > /dev/null; then
uci -q set logmngr.default_template=template
uci -q set logmngr.default_template.name='default_template'
uci -q set logmngr.default_template.expression='{time} {hostname} {ident}: {message}'
fi
if uci -q get logmngr.a1 >/dev/null; then
uci -q rename logmngr.a1='default_action'
uci -q set logmngr.default_action.name='default_action'
uci -q set logmngr.default_action.template='default_template'
uci -q delete logmngr.default_action.source
uci -q add_list logmngr.default_action.source='default_source'
fi
if uci -q get logmngr.lf1 >/dev/null; then
uci -q rename logmngr.lf1='default_logfile'
uci -q set logmngr.default_logfile.action='default_action'
fi
if uci -q get logmngr.lr1 >/dev/null; then
uci -q rename logmngr.lr1='default_logremote'
uci -q set logmngr.default_logremote.action='default_action'
fi
exit 0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Adds a default log rotate policy if none exists
if uci -q get logmngr.@log_rotate[0] >/dev/null; then
if uci -q get logmngr.lro1 >/dev/null; then
# return if there is any valid content
exit 0
fi

View File

@@ -6,6 +6,37 @@
CONF_FILE=/etc/fluent-bit/fluent-bit.conf
TMP_CONF_FILE=/tmp/fluent-bit/fluent-bit.conf
FLUENT_BIT_CONF_DIR=/etc/fluent-bit/conf.d
PROCESSED_SYSLOG_TAGS=""
PROCESSED_KMSG_TAGS=""
# check if syslog source section is already processed
# and add it to the list of processed source sections
syslog_tag_already_processed() {
local tag="$1"
for t in $PROCESSED_SYSLOG_TAGS; do
[ "$t" = "$tag" ] && return 0
done
PROCESSED_SYSLOG_TAGS="$tag $PROCESSED_SYSLOG_TAGS"
return 1
}
# check if kmsg source section is already processed
# and add it to the list of processed source sections
# two separate functions used because we want to populate
# appropriate PROCESSED variable
kmsg_tag_already_processed() {
local tag="$1"
for t in $PROCESSED_KMSG_TAGS; do
[ "$t" = "$tag" ] && return 0
done
PROCESSED_KMSG_TAGS="$tag $PROCESSED_KMSG_TAGS"
return 1
}
append_conf() {
echo "$*" >> ${TMP_CONF_FILE}
@@ -20,205 +51,276 @@ create_config_file() {
# also, if no file is found then fluent-bit aborts
# so only add include if any file is present in the FLUENT_BIT_CONF_DIR
if [ -d "$FLUENT_BIT_CONF_DIR" ] && [ "$(ls -A "$FLUENT_BIT_CONF_DIR")" ]; then
echo "@INCLUDE ${FLUENT_BIT_CONF_DIR}/*" >> ${TMP_CONF_FILE}
append_conf "@INCLUDE ${FLUENT_BIT_CONF_DIR}/*"
fi
echo "" >> ${TMP_CONF_FILE}
append_conf ""
}
create_service_section() {
# the service section of the fluent-bit.conf file has hardcoded values,
# no need to lookup any uci section to configure this section
echo "[SERVICE]" >> ${TMP_CONF_FILE}
echo " flush 1" >> ${TMP_CONF_FILE}
echo " daemon off" >> ${TMP_CONF_FILE}
echo " log_level info" >> ${TMP_CONF_FILE}
echo " coro_stack_size 24576" >> ${TMP_CONF_FILE}
echo " parsers_file /etc/fluent-bit/parsers.conf" >> ${TMP_CONF_FILE}
echo " hot_reload on" >> ${TMP_CONF_FILE}
echo "" >> ${TMP_CONF_FILE}
append_conf "[SERVICE]"
append_conf " flush 1"
append_conf " daemon off"
append_conf " log_level info"
append_conf " coro_stack_size 24576"
append_conf " parsers_file /etc/fluent-bit/parsers.conf"
append_conf " hot_reload on"
append_conf ""
}
create_default_filters() {
append_conf "[FILTER]"
append_conf " name modify"
append_conf " match KM*"
append_conf " add ident kernel"
append_conf " rename msg message"
append_conf ""
append_conf "[FILTER]"
append_conf " name sysinfo"
append_conf " match *"
append_conf " hostname_key hostname"
append_conf ""
}
create_input_section() {
local tag="$1"
# the input in our case is always syslog, hence, this section of the
# fluent-bit.conf file has hardcoded values as well that do not depend
# on any uci value
echo "[INPUT]" >> ${TMP_CONF_FILE}
echo " name syslog" >> ${TMP_CONF_FILE}
echo " tag $tag" >> ${TMP_CONF_FILE}
echo " path /dev/log" >> ${TMP_CONF_FILE}
echo "" >> ${TMP_CONF_FILE}
[ -z "$tag" ] && return
# check if this source section has already been processed
syslog_tag_already_processed "$tag" && return
append_conf "[INPUT]"
append_conf " name syslog"
append_conf " unix_perm 0666"
append_conf " tag $tag"
append_conf " path /dev/log"
append_conf ""
}
generate_facility_regex() {
local facility_level=$1
local pri=0
populate_allowed_logs() {
local facility_level sev_level
local section="$1"
if [ "$facility_level" == "24" ]; then
# value 24 means all facility level, which is as good as not
# generating a filter section, so return
return
fi
[ -z "$section" ] && return
# facility_level is a list value, hence, generate regex for
# each value
IFS=" "
for val in $facility_level; do
# as per rfc 5424 and 3164, pri in syslog msg is
# facility*8+severity. Severity value can range from 0-7 hence
# generate regex for each.
for sval in 0 1 2 3 4 5 6 7; do
pri=`expr $val \* 8 + $sval`
echo " regex pri $pri" >> ${TMP_CONF_FILE}
done
done
}
# reset
match_pattern=""
facilities=""
all_facilities=0
kern_facility=0
severities=""
sev_compare=1
sev_action=0
generate_severity_regex() {
local sev_level="$1"
local sev_compare="$2"
local sev_action="$3"
# read config
config_get match_pattern $section pattern_match
local pri=0
local param="exclude"
if [ "$sev_action" == "0" ]; then
param="regex"
fi
local fval=0
if [ "$sev_compare" == "0" ]; then
# generate regex for all facility values, with severity=sev_level
while [ $fval -le 23 ] ; do
pri=`expr $fval \* 8 + $sev_level`
echo " $param pri $pri" >> ${TMP_CONF_FILE}
fval=$((fval + 1))
done
elif [ "$sev_compare" == "1" ]; then
# generate regex for all severity value greater than or equal to
# sev_level. please, lower value have higher precedence, so sev_level
# 0 which is emergency has higher precedence than error which is 3
while [ $fval -le 23 ] ; do
sval=0
while [ $sev_level -ge $sval ]; do
pri=`expr $fval \* 8 + $sval`
echo " $param pri $pri" >> ${TMP_CONF_FILE}
sval=$((sval + 1))
done
fval=$((fval + 1))
done
fi
}
handle_filter_conf() {
local section="$1" # config filter
local filter_name="$2"
local name
# no need to proceed if name of filter section is not one of the values
# listed in option filter in config action section
config_get name $section name
if [ "$name" != "$filter_name" ]; then
return
fi
# as per data model, at a time either facility_level or severity_level can
# be specified along with pattern_match. hence, first process and generate
# regex for pattern_match which is common in both condition. Next, we will
# process facility_level and return if facility level is defined and not
# process severity related params at all.
local pattern_match
config_get pattern_match $section pattern_match
if [ -n "$pattern_match" ]; then
echo " regex $pattern_match" >> ${TMP_CONF_FILE}
fi
local facility_level
config_get facility_level $section facility_level
if [ -n "$facility_level" ]; then
generate_facility_regex $facility_level
# return from here since if facility_level is defined, then no
# need to process severity_level
return
fi
local sev_level
local sev_compare
local sev_action
config_get sev_level $section severity_level
config_get sev_compare $section severity_compare 1
config_get sev_action $section severity_action 0
if [ -n "$sev_level" ]; then
# value 1 of severity compare corresponds to data model
# and system default which is EqualorHigher
config_get sev_compare $section severity_compare 1
# value 0 of severity action corresponds to data model
# and system default that is log
config_get sev_action $section severity_action 0
# normalize facilities
if [ -n "$facility_level" ]; then
for f in $facility_level; do
if [ "$f" = "24" ]; then
all_facilities=1
# xargs is used to convert from new line separated numbers to space separated numbers
facilities="$(seq 0 23 | xargs)"
break
fi
generate_severity_regex $sev_level $sev_compare $sev_action
if [ "$f" = "0" ]; then
kern_facility=1
fi
done
if [ "$all_facilities" -eq 0 ]; then
facilities="$facility_level"
fi
else
# default to "all facilities" when unset
all_facilities=1
facilities="$(seq 0 23 | xargs)"
fi
# normalize severities
case "$sev_level" in
8) # all severities
severities="$(seq 0 7 | xargs)"
;;
9) # none
severities="none"
;;
"") # unset, treat as "all"
severities="$(seq 0 7 | xargs)"
;;
*)
if [ "$sev_compare" = "0" ]; then
# equal
severities="$sev_level"
else
# equl or higher
severities="$(seq 0 $sev_level | xargs)"
fi
;;
esac
}
create_filter_section() {
local match="$1"
local match_regex="$1"
local pattern="$2"
echo "[FILTER]" >> ${TMP_CONF_FILE}
echo " name grep" >> ${TMP_CONF_FILE}
echo " match $match" >> ${TMP_CONF_FILE}
echo " logical_op or" >> ${TMP_CONF_FILE} # handle multiple filters
[ -z "$match_regex" ] && return
append_conf "[FILTER]"
append_conf " name grep"
append_conf " match_regex $match_regex"
# we need "logical_op or" only in non-pattern sections
if [ "$pattern" = "0" ]; then
append_conf " logical_op or" # handle multiple filters
fi
}
handle_filter_ref() {
local filter_name="$1"
config_foreach handle_filter_conf filter "$filter_name"
create_kmsg_input_section() {
local tag="$1"
local max_sev=7
[ -z "$tag" ] && return
kmsg_tag_already_processed "$tag" && return
if [ -c "/dev/kmsg" ]; then
append_conf "[INPUT]"
append_conf " name kmsg"
append_conf " tag $tag"
# check kern facility (0)
if [ "$all_facilities" -eq 1 ] || [ "$kern_facility" -eq 1 ]; then
if [ "$severities" != "none" ]; then
# severity filtering
# only EqualOrHigher is supported by Prio_Level
# and only Log action is supported
# so set Prio_Level = max severity
if [ "$sev_action" = "0" ] && [ "$sev_compare" = "1" ]; then
if [ -n "$severities" ]; then
max_sev=$(echo $severities | tr ' ' '\n' | sort -n | tail -1)
fi
append_conf " prio_level $max_sev"
fi
fi
fi
append_conf ""
# if severities is none, or
# if kern facility has been excluded
# then we need to stop kernel logs
# sev_action and sev_compare is being checked because we don't want to work with rules that exclude logs
if [ "$severities" = "none" ] || { [ "$kern_facility" -eq 0 ] && [ "$all_facilities" -eq 0 ] && [ "$sev_action" = "0" ] && [ "$sev_compare" = "1" ]; }; then
# block all
# create a filter section that matches on KM* tag
# and excludes all messages
create_filter_section "KM*" "0"
append_conf " exclude message ^.*$"
append_conf ""
fi
fi
}
generate_syslog_filter() {
local param="regex"
[ "$sev_action" = "1" ] && param="exclude"
# start adding the fluent-bit filter section
create_filter_section "SL*" "0"
if [ "$severities" = "none" ]; then
append_conf " exclude pri ^.*$"
return
fi
for fval in $facilities; do
for sval in $severities; do
local pri=$((fval * 8 + sval))
append_conf " $param pri ^${pri}$"
done
done
append_conf ""
}
generate_pattern_filter() {
local match_regex="$1"
local match_pattern="$2"
[ -z "$match_regex" ] && return
[ -z "$match_pattern" ] && return
# start adding the fluent-bit filter section
create_filter_section "$match_regex" "1"
append_conf " regex message $match_pattern"
append_conf ""
}
handle_log_file() {
local section="$1" # out_file section
local match="$2"
local linker="$2"
local match_regex="$3"
local template="$4"
local action_ref
config_get action_ref $section action
if [ "$action_ref" != "$match" ]; then
if [ "$action_ref" != "$linker" ]; then
return
fi
local enabled
config_get enabled $section enable
if [ "$enabled" == 0 ]; then
config_get_bool enabled $section enable
if [ "$enabled" = "0" ]; then
return
fi
local file
config_get file $section file
if [ -z "$file" ]; then
if [ -z "$file" ] || [ -z "$match_regex" ]; then
return
fi
echo "[OUTPUT]" >> ${TMP_CONF_FILE}
echo " name file" >> ${TMP_CONF_FILE}
echo " match $match" >> ${TMP_CONF_FILE}
echo " file $file" >> ${TMP_CONF_FILE}
echo " format template" >> ${TMP_CONF_FILE}
echo " template {time} {hostname} {ident}: {message}" >> ${TMP_CONF_FILE}
append_conf "[OUTPUT]"
append_conf " name file"
append_conf " workers 2"
append_conf " match_regex $match_regex"
append_conf " file $file"
if [ -n "$template" ]; then
append_conf " format template"
append_conf " template ${template}"
fi
append_conf ""
}
handle_log_remote() {
local section="$1"
local match="$2"
local linker="$2"
local match_regex="$3"
local action_ref
config_get action_ref $section action
if [ "$action_ref" != "$match" ]; then
if [ "$action_ref" != "$linker" ]; then
return
fi
local enabled
config_get enabled $section enable
if [ "$enabled" == 0 ]; then
config_get_bool enabled $section enable
if [ "$enabled" = "0" ]; then
return
fi
@@ -228,83 +330,167 @@ handle_log_remote() {
return
fi
echo "[OUTPUT]" >> ${TMP_CONF_FILE}
echo " name syslog" >> ${TMP_CONF_FILE}
echo " match $match" >> ${TMP_CONF_FILE}
echo " host $address" >> ${TMP_CONF_FILE}
append_conf "[OUTPUT]"
append_conf " name syslog"
append_conf " match_regex $match_regex"
append_conf " host $address"
append_conf " syslog_appname_key ident"
append_conf " syslog_procid_key pid"
append_conf " syslog_message_key message"
local hostname="$(uci -q get 'system.@system[0].hostname')"
if [ -n "${hostname}" ]; then
append_conf " syslog_hostname_preset ${hostname}"
fi
append_conf " syslog_hostname_key hostname"
local proto # holds value tcp or udp
config_get proto ${section} proto
if [ -n "$proto" ]; then
if [ "$proto" == "tls" ]; then
echo " mode tcp" >> ${TMP_CONF_FILE}
echo " tls on" >> ${TMP_CONF_FILE}
append_conf " mode tcp"
append_conf " tls on"
else
echo " mode $proto" >> ${TMP_CONF_FILE}
append_conf " mode $proto"
fi
fi
local port
config_get port $section port
if [ -n "$port" ]; then
echo " port $port" >> ${TMP_CONF_FILE}
append_conf " port $port"
fi
local cert
local peer_verify
config_get cert $section cert
if [ -n "$cert" ]; then
echo " tls.crt_file $cert" >> ${TMP_CONF_FILE}
append_conf " tls.crt_file $cert"
config_get peer_verify $section peer_verify
if [ "$peer_verify" == "1" ]; then
echo " tls.verify on" >> ${TMP_CONF_FILE}
config_get_bool peer_verify $section peer_verify
if [ "$peer_verify" = "1" ]; then
append_conf " tls.verify on"
fi
fi
append_conf ""
}
resolve_source_section() {
local src_section="$1"
local linker="$2"
local src_name syslog_en kernel_en
config_get src_name "$src_section" name
[ "$src_name" = "$linker" ] || return
config_get_bool syslog_en "$src_section" system_messages 1
config_get_bool kernel_en "$src_section" kernel_messages 1
# create an input section using /dev/log or kmsg
# and store the tag in a variable
# so that later a regex can be made to match this tag
# which will be used in output section
if [ "$syslog_en" = "1" ]; then
source_tag_syslog="SL$src_name"
create_input_section "$source_tag_syslog"
fi
if [ "$kernel_en" = "1" ]; then
source_tag_kmsg="KM$src_name"
create_kmsg_input_section "$source_tag_kmsg"
fi
}
# get the value of option expression from the relevant section
resolve_template_section() {
local tmpl_section="$1"
local tmpl_name
config_get tmpl_name "$tmpl_section" name
[ "$tmpl_name" = "$template_ref" ] || return
config_get template_expr "$tmpl_section" expression
[ -n "$template_expr" ] && echo "$template_expr"
}
# loop over template sections and get the value of option expression from the relevant section
get_template_expression() {
local template_ref="$1"
[ -n "$template_ref" ] && config_foreach resolve_template_section template
}
# build a regex that will match all the tags supplied to this function
build_match_regex() {
local tags="$1"
local first=1
local regex="^("
for tag in $tags; do
[ "$first" -eq 1 ] && first=0 || regex="$regex|"
regex="$regex$tag"
done
regex="$regex)\$"
echo "$regex"
}
handle_filter_conf() {
local section="$1" # config filter
local filter_name="$2"
local name
config_get name $section name
[ "$name" = "$filter_name" ] || return
populate_allowed_logs "$filter_name"
}
handle_action() {
local section="$1"
local tag_regex filter source_ref template_ref source_sec log_template finst
local action_section="$1"
local source_tag_syslog source_tag_kmsg
local filter
config_get filter $section filter
# shared variables set by populate_allowed_logs
match_pattern=""
facilities=""
all_facilities=0
kern_facility=1
severities=""
sev_compare=1
sev_action=0
# use config action option name as tag for input
local tag
config_get tag $section name
if [ -z "$tag" ]; then
return
fi
config_get action_name "$action_section" name
config_get filter "$action_section" filter
config_get source_ref "$action_section" source
config_get template_ref "$action_section" template
create_input_section $tag
[ -z "$action_name" ] && return
[ -z "$source_ref" ] && return
# read filter section and populate relevant variables
# these variables will be used by create_kmsg_input_section
# generate_syslog_filter, and generate_pattern_filter functions
if [ -n "$filter" ]; then
# the only fluentbit filter that is useful for the datamodel is
# grep. Also, fluentbit does not seem to handle multiple instances
# of FILTER of same kind. Hence, each filter section corresponding
# to an action entry in the uci would translate for us into a set of
# regex/exclude values instead of individual FILTER section per uci
# section filter is a list, treat according
create_filter_section $tag
IFS=" "
for finst in $filter; do
handle_filter_ref $finst
config_foreach handle_filter_conf filter "$finst"
done
fi
# handle output, each action can be associated with a out_log and out_syslog
# Resolve referenced source sections
for source_sec in $source_ref; do
config_foreach resolve_source_section source "$source_sec"
done
# build a regex that will match all the sources for this action
tag_regex=$(build_match_regex "$source_tag_syslog $source_tag_kmsg")
if [ -n "$filter" ]; then
generate_pattern_filter "$tag_regex" "$match_pattern"
generate_syslog_filter
fi
# get the template expression if any is present
log_template="$(get_template_expression "$template_ref")"
# handle output, each action can be associated with an out_log and out_syslog
# section so figure out if any out_log or out_syslog section is associated
# with this and action and setup output accordingly.
config_foreach handle_log_file log_file "$tag"
config_foreach handle_log_remote log_remote "$tag"
config_foreach handle_log_file log_file "$action_name" "$tag_regex" "$log_template"
config_foreach handle_log_remote log_remote "$action_name" "$tag_regex"
}
handle_action_section() {
@@ -320,13 +506,14 @@ logmngr_init() {
create_config_file
create_service_section
create_default_filters
handle_action_section
if [ -f /lib/logmngr/logrotate.sh ]; then
logrotate_init
fi
if [ "$enabled" == "0" ]; then
if [ "$enabled" = "0" ]; then
return
fi
@@ -340,9 +527,4 @@ logmngr_init() {
fi
procd_set_param respawn
procd_close_instance
procd_open_instance klogd
procd_set_param command /usr/libexec/logmngr-klogd
procd_set_param respawn
procd_close_instance
}

View File

@@ -1,7 +0,0 @@
#!/bin/sh
until [ -S /dev/log ]; do
sleep 1
done
exec /sbin/klogd -n

View File

@@ -5,9 +5,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map-agent
PKG_VERSION:=6.3.6.7
PKG_VERSION:=6.3.6.15
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=f611be0c05e3f4fb3d35a5a1ad51f5a4ad6406ca
PKG_SOURCE_VERSION:=7b05d265776fca2ff84a63188fcec55c08057e33
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
PKG_LICENSE:=BSD-3-Clause

View File

@@ -258,6 +258,6 @@ map_genconf () {
config_foreach mapcontroller_remove_mld_id ap
}
fi
uci -q commit mapcontroller
ubus -t 5 call uci commit '{"config":"mapcontroller"}'
fi
}

View File

@@ -6,9 +6,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map-controller
PKG_VERSION:=6.4.0.11
PKG_VERSION:=6.4.2.9
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=db314c0fb388a3de47a9e6db5d944d7fabc832c6
PKG_SOURCE_VERSION:=c427bbaa53ce470a45a59326281f214f1111c3f7
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@genexis.eu>
LOCAL_DEV=0

View File

@@ -2,7 +2,7 @@ config controller 'controller'
option enabled '1' # may be modified by other package start-up scripts (i.e. map-agent)
option profile '3'
option registrar '2 5 6'
option debug '0'
option debug '2'
option bcn_metrics_max_num '10'
option initial_channel_scan '0'
option enable_ts '0'

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map-plugins
PKG_VERSION:=0.0.4
PKG_VERSION:=1.0.32
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=74bf151851112ecee731d447af016c8dc668adcf
PKG_SOURCE_VERSION:=d8b310edad1b9777aed805682394e3f9bb300d81
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/map-plugins.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
@@ -31,7 +31,8 @@ MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS) -Wall"
plugins := \
$(if $(CONFIG_PACKAGE_map-plugins-steer-rate),steer-rate)
$(if $(CONFIG_PACKAGE_map-plugins-steer-rate),steer-rate) \
$(if $(CONFIG_PACKAGE_map-plugins-bsteer),bsteer)
ppkg:=$(patsubst plugins/%.mk,map-plugins-%,$(wildcard plugins/*.mk))
@@ -52,7 +53,7 @@ define Package/map-plugins
endef
define Package/map-plugins/description
Provides extra Multi-AP services viz. steering, channel-planning etc.
Provides extra Multi-AP services viz. steering, channel-planning, self-organizing network etc.
endef
define Package/map-plugins/install
@@ -60,9 +61,8 @@ define Package/map-plugins/install
endef
define Build/Compile
$(foreach p,$(ppkg),$(call Build/Compile/$(p),$(1)))
$(foreach p,$(plugins),$(call Build/Compile/map-plugins-$(p), $(1)))
endef
$(eval $(call BuildPackage,map-plugins))
$(eval $(foreach p,$(ppkg),$(call BuildPackage,$(p))))

View File

@@ -0,0 +1,20 @@
define Package/map-plugins-bsteer
$(call Package/map-plugins/Default)
TITLE:=Wi-Fi backhaul steering plugin based on maximizing backhaul throughput
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
+libjson-c +libblobmsg-json +map-controller \
+map-plugins
endef
define Package/map-plugins-bsteer/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/mapcontroller
$(CP) $(PKG_BUILD_DIR)/steer/bsteer/bsteer.so $(1)/usr/lib/mapcontroller/bsteer.so
endef
define Build/Compile/map-plugins-bsteer
$(MAKE) -C $(PKG_BUILD_DIR)/steer/bsteer \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)";
endef

View File

@@ -16,5 +16,5 @@ define Build/Compile/map-plugins-steer-rate
$(MAKE) -C $(PKG_BUILD_DIR)/steer/rate \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
LDFLAGS="$(TARGET_LDFLAGS)";
endef

View File

@@ -19,13 +19,8 @@ config OBUSPA_CONTROLLER_MTP_VERIFY
bool "Enable verification of controller MTP before processing the message"
default n
config OBUSPA_ENABLE_TEST_CONTROLLER
bool "Adds a test controller by default"
default n
select OBUSPA_ENABLE_TEST_CONTROLLER_LOCAL
config OBUSPA_ENABLE_TEST_CONTROLLER_LOCAL
bool "Adds a test controller by default (local access only)"
config OBUSPA_LOCAL_MQTT_LISTENER
bool "Configures local mqtt broker for local usp connections"
default n
config OBUSPA_MAX_CONTROLLERS_NUM

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=obuspa
PKG_VERSION:=10.0.0.14
PKG_VERSION:=10.0.0.16
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
PKG_SOURCE_VERSION:=aeda0145e269cad49d326800fbd39d87c0d30087
PKG_SOURCE_VERSION:=479ffb3582aa245a84829502d9412ca2539eefca
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
@@ -33,8 +33,7 @@ define Package/obuspa
TITLE:=USP agent
MENU:=1
DEPENDS:=+libopenssl +libuci +libblobmsg-json +libcurl +libsqlite3 +libubox +libubus +libmosquitto-ssl +libwebsockets-openssl +ca-certificates \
+OBUSPA_ENABLE_TEST_CONTROLLER_LOCAL:mosquitto-ssl +OBUSPA_ENABLE_TEST_CONTROLLER_LOCAL:mosquitto-client-ssl \
+OBUSPA_ENABLE_TEST_CONTROLLER:mosquitto-auth-shadow +libjson-c
+OBUSPA_LOCAL_MQTT_LISTENER:mosquitto-ssl +libjson-c
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
endef
@@ -132,27 +131,23 @@ define Package/obuspa/install
$(INSTALL_DATA) ./files/etc/users/roles/*.json $(1)/etc/users/roles/
$(INSTALL_DATA) ./files/etc/obuspa/usp_utils.sh $(1)/etc/obuspa/
echo "$(VENDOR_PREFIX)" > $(1)/etc/obuspa/vendor_prefix
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/60-generate-ctrust-defaults $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/obuspa-set-dhcp-option $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/92-obuspa_firewall $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/93-obuspa_mdns_adv $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/94-obuspa_set_credential $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/60-generate-ctrust-defaults $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/obuspa-set-dhcp-option $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/92-obuspa_firewall $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/93-obuspa_mdns_adv $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/94-obuspa_set_credential $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/firewall.usp $(1)/etc/
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user $(1)/etc/udhcpc.user.d/
ifeq ($(CONFIG_OBUSPA_CWMP_DATAMODEL_SUPPORT),y)
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/libuspagentdm.so $(1) $(PKG_NAME)
endif
ifeq ($(CONFIG_OBUSPA_ENABLE_TEST_CONTROLLER),y)
$(INSTALL_BIN) ./files/etc/uci-defaults/54-test-usp-remote $(1)/etc/uci-defaults/
endif
ifeq ($(CONFIG_OBUSPA_ENABLE_TEST_CONTROLLER_LOCAL),y)
$(INSTALL_BIN) ./files/etc/init.d/usptest $(1)/etc/init.d/
$(INSTALL_BIN) ./files/etc/uci-defaults/55-test-usp-controller $(1)/etc/uci-defaults/
ifeq ($(CONFIG_OBUSPA_LOCAL_MQTT_LISTENER),y)
$(INSTALL_DATA) ./files/etc/uci-defaults/55-obuspa-local-mqtt-usp-connection $(1)/etc/uci-defaults/
endif
ifeq ($(CONFIG_OBUSPA_OVERRIDE_CT_ROLE),y)
$(INSTALL_BIN) ./files/etc/uci-defaults/61-override-ct-roles $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/61-override-ct-roles $(1)/etc/uci-defaults/
endif
endef

View File

@@ -1,75 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
STOP=01
USE_PROCD=1
log()
{
echo "$*"|logger -t usptest -p debug
}
get_oui_from_db()
{
db -q get device.deviceinfo.ManufacturerOUI
}
get_serial_from_db()
{
db -q get device.deviceinfo.SerialNumber
}
publish_endpoint()
{
local AgentEndpointID serial oui user pass
if ! uci -q get obuspa.testmqtt; then
return 0;
fi
# return if mosquitto_pub is not present
if [ ! "$(command -v mosquitto_pub)" ]; then
log "mosquitto_pub not present can't publish EndpointID"
return 0;
fi
sleep 2
# Get endpoint id from obuspa config first
config_load obuspa
config_get AgentEndpointID localagent EndpointID ""
if [ -z "${AgentEndpointID}" ]; then
serial=$(get_serial_from_db)
oui=$(get_oui_from_db)
AgentEndpointID="os::${oui}-${serial//+/%2B}"
fi
config_get user testmqtt Username ""
config_get pass testmqtt Password ""
# publish Agent's EndpointID in mosquito broker for discovery by usp-js
# This is a work around till obuspa adds supports for mDNS discovery
if [ -n "${user}" ] && [ -n "${pass}" ]; then
log "Publishing EndpointID ${AgentEndpointID} to local mqtt broker with username, password"
mosquitto_pub -r -t "obuspa/EndpointID" -m "${AgentEndpointID}" -u "${user}" -P "${pass}"
elif [ -n "${user}" ]; then
log "Publishing EndpointID ${AgentEndpointID} to local mqtt broker with username only"
mosquitto_pub -r -t "obuspa/EndpointID" -m "${AgentEndpointID}" -u "${user}"
else
log "Publishing EndpointID ${AgentEndpointID} to local mqtt broker"
mosquitto_pub -r -t "obuspa/EndpointID" -m "${AgentEndpointID}"
fi
}
start_service() {
procd_open_instance usptest
publish_endpoint
procd_close_instance
}
reload_service() {
publish_endpoint
}
service_triggers() {
procd_add_reload_trigger "mosquitto" "obuspa"
}

View File

@@ -1,20 +0,0 @@
#!/bin/sh
. /lib/functions.sh
if [ ! -f "/etc/config/mosquitto" ]; then
echo "Local mosquitto broker not available"
return 0
fi
add_usp_test()
{
uci_add mosquitto listener usptest
uci_set mosquitto usptest enabled 1
uci_set mosquitto usptest port '9004'
uci_set mosquitto usptest protocol 'websockets'
uci_set mosquitto usptest auth_plugin '/usr/lib/mosquitto_auth_shadow.so'
}
# Install test MQTT over WS listener
add_usp_test

View File

@@ -0,0 +1,21 @@
#!/bin/sh
. /lib/functions.sh
if [ ! -f "/etc/config/mosquitto" ]; then
echo "Local mosquitto broker not available"
return 0
fi
add_mqtt_obuspa_listener()
{
uci_add mosquitto listener obuspa
uci_set mosquitto obuspa enabled 1
uci_set mosquitto obuspa port '1883'
uci_set mosquitto obuspa no_remote_access '1'
uci_set mosquitto obuspa allow_anonymous '1'
}
# Add mosquitto listener for obuspa connection
# apps/controller should add controller definitions separately
add_mqtt_obuspa_listener

View File

@@ -1,57 +0,0 @@
#!/bin/sh
. /lib/functions.sh
if [ ! -f "/etc/config/obuspa" ]; then
echo "Local obuspa not available"
return 0
fi
if [ ! -f "/etc/config/mosquitto" ]; then
echo "Local mosquitto broker not available"
return 0
fi
add_obuspa_test_mtp()
{
uci_add obuspa mtp test_mtp
uci_set obuspa test_mtp Protocol 'MQTT'
uci_set obuspa test_mtp ResponseTopicConfigured '/usp/endpoint'
uci_set obuspa test_mtp mqtt 'testmqtt'
}
add_obuspa_test_mqtt()
{
# Adds Device.MQTT.Client.
uci_add obuspa mqtt testmqtt
uci_set obuspa testmqtt BrokerAddress '127.0.0.1'
uci_set obuspa testmqtt BrokerPort '1883'
uci_set obuspa testmqtt TransportProtocol 'TCP/IP'
}
add_obuspa_test_controller()
{
# Adds Device.LocalAgent.Controller.
uci_add obuspa controller testcontroller
uci_set obuspa testcontroller EndpointID 'proto::interop-usp-controller'
uci_set obuspa testcontroller Protocol 'MQTT'
uci_set obuspa testcontroller Topic '/usp/controller'
uci_set obuspa testcontroller mqtt 'testmqtt'
uci_set obuspa testcontroller assigned_role_name 'full_access'
}
add_obuspa_config()
{
uci_add mosquitto listener obuspa
uci_set mosquitto obuspa enabled 1
uci_set mosquitto obuspa port '1883'
uci_set mosquitto obuspa no_remote_access '1'
uci_set mosquitto obuspa allow_anonymous '1'
}
# Install test usp controller config
add_obuspa_config
add_obuspa_test_mtp
add_obuspa_test_mqtt
add_obuspa_test_controller

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=parental-control
PKG_VERSION:=1.2.1
PKG_VERSION:=1.3.1
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/parental-control.git
PKG_SOURCE_VERSION:=120dbcd6508b817d2ce3d579a1bfbd5bfd1a44cb
PKG_SOURCE_VERSION:=b1e5b3f81f08271bdaf9cb4bda8a7696a27be3c6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -81,19 +81,20 @@ define Package/parental-control/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DATA) ./files/etc/uci-defaults/95-firewall_parentalcontrol.ucidefaults $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/95-migrate_urlfilter.ucidefaults $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/35-migrate_urlfilter.ucidefaults $(1)/etc/uci-defaults/
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/parentalcontrol $(1)/lib/upgrade/keep.d/parentalcontrol
$(BBFDM_REGISTER_SERVICES) -v ${VENDOR_PREFIX} ./bbfdm_service.json $(1) parentalcontrol
$(INSTALL_DATA) ./files/etc/uci-defaults/40-parental_control_update_bundle_path $(1)/etc/uci-defaults/
ifeq ($(CONFIG_PARENTAL_CONTROL_URLFILTERING),y)
$(INSTALL_DATA) ./files/etc/uci-defaults/55-add-default-bundles $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/50-parental_control_add_bundles $(1)/etc/uci-defaults/
$(CP) ./files/urlbundle_override.json $(1)/etc/parentalcontrol/
else
$(BBFDM_INSTALL_MS_PLUGIN) -v ${VENDOR_PREFIX} ./files/urlbundle_override.json $(1) parentalcontrol
$(INSTALL_DATA) ./files/etc/uci-defaults/50-parental_control_urlfilter $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/50-parental_control_disable_urlfilter $(1)/etc/uci-defaults/
endif
endef

View File

@@ -1,4 +1,3 @@
config globals 'globals'
option enable '0'
option enable '1'
option loglevel '3'
option urlfilter '1'

View File

@@ -5,19 +5,16 @@
enabled="$(uci -q get parentalcontrol.globals.enable)"
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
# if parentalcontrol is enabled, add the rules, else remove them
# if parentalcontrol is enabled, add the rules, else remove them
if [ "${enabled}" -eq "1" ]; then
# this is for internet_access and profile_bedtime_schedule sections
add_internet_schedule_rules
# this is for urlfilter daemon
add_iptables_nfqueue_rules
if [ "${urlfilter}" -eq "1" ]; then
# this for internet_access and profile_bedtime_schedule sections
add_internet_schedule_rules
add_iptables_nfqueue_rules
fi
else
# remove urlfilter daemon rules
# remove internet_access and profile_bedtime_schedule rules
remove_internet_schedule_rules
remove_iptables_nfqueue_rules
if [ "${urlfilter}" -eq "1" ]; then
# remove internet_access and profile_bedtime_schedule rules
remove_internet_schedule_rules
fi
fi

View File

@@ -44,9 +44,11 @@ configure_fw_rules() {
else
# Now flush the existing connections, otherwise,
# URL filtering cannot be performed on already open sites.
if [ -n "$(which conntrack)" ]; then
sleep 5
conntrack -F
if which hw_nat > /dev/null 2>&1; then
hw_nat -! > /dev/null 2>&1
fi
if which conntrack > /dev/null 2>&1; then
conntrack -F > /dev/null 2>&1
fi
# this is for urlfilter daemon
@@ -83,14 +85,13 @@ start_service() {
config_load parentalcontrol
validate_global_section
[ -n "${bundle_path}" ] && mkdir -p ${bundle_path}
# add default bundles
process_default_bundles
# add firewall rules
configure_fw_rules
if [ "${urlfilter}" -eq "1" ]; then
# add default bundles
[ -n "${bundle_path}" ] && mkdir -p ${bundle_path}
process_default_bundles
enable_urlfilter_dm
else
disable_urlfilter_dm
@@ -100,7 +101,7 @@ start_service() {
# then /tmp/dhcp.leases will be empty until clients try to get a lease,
# in that case, hostnames will not be processed by the daemon,
# for this we copy /tmp/dhcp.leases to /etc/parentalcontrol/dhcp.leases
# which will be persistent acrros reboots and upgrade where settings are kept
# which will be persistent across reboots and upgrade (with keep settings)
# and will be used as a backup in case /tmp/dhcp.leases is empty
copy_dhcp_leases

View File

@@ -2,6 +2,8 @@
. /lib/functions.sh
[ ! -f "/etc/config/urlfilter" ] && exit 0
# Convert URL filter to parental control format
urlfilter_config="/etc/config/urlfilter"
parentalcontrol_config="/etc/config/parentalcontrol"

View File

@@ -0,0 +1,38 @@
#!/bin/sh
[ ! -f "/etc/config/parentalcontrol" ] && exit 0
APPS_DIR="/apps"
check_mounted_app_partition() {
local free
if [ ! -d "${APPS_DIR}" ]; then
return 1
fi
# Check free space in disk
free="$(df -P "${APPS_DIR}"|tail -n 1|awk '{print $4}')"
# disable if free storage is less then 300M
if [ "${free}" -lt 307200 ]; then
return 1
fi
return 0
}
if check_mounted_app_partition; then
uci -q set parentalcontrol.globals.bundle_path="${APPS_DIR}/parentalcontrol"
# configure the urlfilter if not configured
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
if [ -z "${urlfilter}" ]; then
uci -q set parentalcontrol.globals.urlfilter='1'
fi
else
uci -q set parentalcontrol.globals.urlfilter='0'
fi
exit 0

View File

@@ -0,0 +1,43 @@
#!/bin/sh
[ ! -f "/etc/config/parentalcontrol" ] && exit 0
COUNT=1
add_urlbundle()
{
local name url
url="${1}"; shift
name="$*"
uci -q set parentalcontrol.urlbundle_${COUNT}=urlbundle
uci -q set parentalcontrol.urlbundle_${COUNT}.name="${name}"
uci -q set parentalcontrol.urlbundle_${COUNT}.download_url="${url}"
COUNT="$((COUNT+1))"
}
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
if [ "${urlfilter}" -eq "1" ]; then
add_urlbundle "https://blocklistproject.github.io/Lists/alt-version/abuse-nl.txt" "Abuse"
add_urlbundle "https://blocklistproject.github.io/Lists/alt-version/ads-nl.txt" "Ads"
add_urlbundle "https://blocklistproject.github.io/Lists/alt-version/crypto-nl.txt" "Crypto"
add_urlbundle "https://blocklistproject.github.io/Lists/alt-version/drugs-nl.txt" "Drugs"
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/everything-nl.txt' "Everything else"
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/facebook-nl.txt' 'Facebook/Instagram'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/fraud-nl.txt' 'Fraud'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/gambling-nl.txt' 'Gambling'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/malware-nl.txt' 'Malware'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/phishing-nl.txt' 'Phishing'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/piracy-nl.txt' 'Piracy'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/porn-nl.txt' 'Porn'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/ransomware-nl.txt' 'Ransomware'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/redirect-nl.txt' 'Redirect'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/scam-nl.txt' 'Scam'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/tiktok-nl.txt' 'TikTok'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/torrent-nl.txt' 'Torrent'
add_urlbundle 'https://blocklistproject.github.io/Lists/alt-version/tracking-nl.txt' 'Tracking'
fi
exit 0

View File

@@ -0,0 +1,14 @@
#!/bin/sh
. /lib/functions.sh
[ ! -f "/etc/config/parentalcontrol" ] && exit 0
uci -q set parentalcontrol.globals.urlfilter='0'
_delete_urlbundle() {
uci_remove parentalcontrol "${1}"
}
config_load "parentalcontrol"
config_foreach _delete_urlbundle urlbundle

View File

@@ -1,7 +0,0 @@
#!/bin/sh
. /lib/functions.sh
[ ! -f "/etc/config/parentalcontrol" ] && exit 0
uci -q set parentalcontrol.globals.urlfilter='0'

View File

@@ -1,40 +0,0 @@
#!/bin/sh
COUNT=1
add_urlbundle()
{
local enabled name url
enabled="${1}"; shift
url="${1}"; shift
name="${@}"
uci -q set parentalcontrol.urlbundle_${COUNT}=urlbundle
uci -q set parentalcontrol.urlbundle_${COUNT}.enable="${enabled}"
uci -q set parentalcontrol.urlbundle_${COUNT}.name="${name}"
uci -q set parentalcontrol.urlbundle_${COUNT}.download_url="${url}"
COUNT="$((COUNT+1))"
}
add_urlbundle "0" "https://blocklistproject.github.io/Lists/alt-version/abuse-nl.txt" "Abuse"
add_urlbundle "0" "https://blocklistproject.github.io/Lists/alt-version/ads-nl.txt" "Ads"
add_urlbundle "0" "https://blocklistproject.github.io/Lists/alt-version/crypto-nl.txt" "Crypto"
add_urlbundle "1" "https://blocklistproject.github.io/Lists/alt-version/drugs-nl.txt" "Drugs"
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/everything-nl.txt' "Everything else"
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/facebook-nl.txt' 'Facebook/Instagram'
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/fraud-nl.txt' 'Fraud'
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/gambling-nl.txt' 'Gambling'
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/malware-nl.txt' 'Malware'
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/phishing-nl.txt' 'Phishing'
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/piracy-nl.txt' 'Piracy'
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/porn-nl.txt' 'Porn'
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/ransomware-nl.txt' 'Ransomware'
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/redirect-nl.txt' 'Redirect'
add_urlbundle "1" 'https://blocklistproject.github.io/Lists/alt-version/scam-nl.txt' 'Scam'
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/tiktok-nl.txt' 'TikTok'
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/torrent-nl.txt' 'Torrent'
add_urlbundle "0" 'https://blocklistproject.github.io/Lists/alt-version/tracking-nl.txt' 'Tracking'
exit 0

View File

@@ -13,7 +13,10 @@ IP_RULE=""
ACL_FILE=""
parentalcontrol_ipv4_forward=""
parentalcontrol_ipv6_forward=""
default_bundle_dir="/tmp/parentalcontrol/default/"
bundle_path="$(uci -q get parentalcontrol.globals.bundle_path)"
default_bundle_dir="${bundle_path}/default/"
bundle_archive="/etc/parentalcontrol/urlbundles.tar.xz"
log() {
@@ -255,7 +258,9 @@ handle_schedule() {
schedule_added="1"
fi
target="ACCEPT"
# internet_access has been updated to be internet_break
# so drop traffic during the schedule, and allow outside the schedule
target="DROP"
config_get local_start_time "$schedule_section" "start_time" "00:00"
config_get duration "$schedule_section" "duration"
@@ -362,11 +367,6 @@ handle_internet_break() {
config_load "schedules"
config_foreach handle_schedule schedule "schedule" "$schedule_ref"
fi
# for access rule to work, need to have default drop rule as last rule
if [ "$schedule_added" = "1" ]; then
add_access_rule "$ACCESS_RULE" "" "" "" "DROP"
fi
done
}
@@ -438,15 +438,31 @@ add_internet_schedule_rules() {
}
add_iptables_nfqueue_rules() {
iptables -w -nL FORWARD|grep -iqE "NFQUEUE"
if [ "$?" -ne 0 ]; then
# setup netfilter queue 0, use queue bypass so that if no application is
# listening to this queue then traffic is unaffected.
iptables -w -I FORWARD 1 -p tcp --match multiport --ports 80,443,53 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -I FORWARD 1 -p udp --match multiport --ports 80,443,53 -j NFQUEUE --queue-num 0 --queue-bypass
local filter_used
iptables -w -I INPUT 1 -p tcp --match multiport --ports 53 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -I INPUT 1 -p udp --match multiport --ports 53 -j NFQUEUE --queue-num 0 --queue-bypass
# Check if urlfilter used
if ! uci show parentalcontrol | grep -q profile_urlfilter; then
return
fi
# IPv4 rules
iptables -w -nL FORWARD | grep -iqE "NFQUEUE"
if [ "$?" -ne 0 ]; then
# capture DNS responses (UDP/TCP sport 53) in FORWARD
iptables -w -I FORWARD 1 -p tcp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -I FORWARD 1 -p udp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
# INPUT: DNS replies to router, skip loopback
iptables -w -I INPUT 1 -p tcp --sport 53 ! -i lo -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -I INPUT 1 -p udp --sport 53 ! -i lo -j NFQUEUE --queue-num 0 --queue-bypass
# OUTPUT: DNS replies from router, skip loopback
iptables -w -I OUTPUT 1 -p tcp --sport 53 ! -o lo -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -I OUTPUT 1 -p udp --sport 53 ! -o lo -j NFQUEUE --queue-num 0 --queue-bypass
# HTTP/HTTPS flows for urlfilter
iptables -w -I FORWARD 1 -p tcp --match multiport --ports 80,443 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -I FORWARD 1 -p udp --match multiport --ports 80,443 -j NFQUEUE --queue-num 0 --queue-bypass
# disable acceleration for https packet so that they can be read by urlfilter
ebtables --concurrent -A FORWARD -p ip --ip-protocol 6 --ip-destination-port 443 -j SKIPLOG 2> /dev/null
@@ -454,14 +470,24 @@ add_iptables_nfqueue_rules() {
ebtables --concurrent -A FORWARD -p ip --ip-protocol 17 --ip-source-port 53 -j SKIPLOG 2> /dev/null
fi
ip6tables -w -nL FORWARD|grep -iqE "NFQUEUE"
# IPv6 rules
ip6tables -w -nL FORWARD | grep -iqE "NFQUEUE"
if [ "$?" -ne 0 ]; then
#ip6table rules
ip6tables -w -I FORWARD 1 -p tcp --match multiport --ports 80,443,53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -I FORWARD 1 -p udp --match multiport --ports 80,443,53 -j NFQUEUE --queue-num 0 --queue-bypass
# capture DNS responses (UDP/TCP sport 53) in FORWARD
ip6tables -w -I FORWARD 1 -p tcp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -I FORWARD 1 -p udp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -I INPUT 1 -p tcp --match multiport --ports 53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -I INPUT 1 -p udp --match multiport --ports 53 -j NFQUEUE --queue-num 0 --queue-bypass
# INPUT: DNS replies to router, skip loopback
ip6tables -w -I INPUT 1 -p tcp --sport 53 ! -i lo -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -I INPUT 1 -p udp --sport 53 ! -i lo -j NFQUEUE --queue-num 0 --queue-bypass
# OUTPUT: DNS replies from router, skip loopback
ip6tables -w -I OUTPUT 1 -p tcp --sport 53 ! -o lo -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -I OUTPUT 1 -p udp --sport 53 ! -o lo -j NFQUEUE --queue-num 0 --queue-bypass
# HTTP/HTTPS flows for urlfilter
ip6tables -w -I FORWARD 1 -p tcp --match multiport --ports 80,443 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -I FORWARD 1 -p udp --match multiport --ports 80,443 -j NFQUEUE --queue-num 0 --queue-bypass
# disable acceleration for https packet so that they can be read by urlfilter
ebtables --concurrent -A FORWARD -p ip6 --ip6-protocol 6 --ip6-destination-port 443 -j SKIPLOG 2> /dev/null
@@ -471,26 +497,38 @@ add_iptables_nfqueue_rules() {
}
remove_iptables_nfqueue_rules() {
iptables -w -nL FORWARD|grep -iqE "NFQUEUE"
iptables -w -nL FORWARD | grep -iqE "NFQUEUE"
if [ "$?" -eq 0 ]; then
iptables -w -D FORWARD -p tcp --match multiport --ports 80,443,53 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D FORWARD -p udp --match multiport --ports 80,443,53 -j NFQUEUE --queue-num 0 --queue-bypass
# DNS response rules
iptables -w -D FORWARD -p tcp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D FORWARD -p udp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D INPUT -p tcp --sport 53 ! -i lo -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D INPUT -p udp --sport 53 ! -i lo -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D OUTPUT -p tcp --sport 53 ! -o lo -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D OUTPUT -p udp --sport 53 ! -o lo -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D INPUT -p tcp --match multiport --ports 53 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D INPUT -p udp --match multiport --ports 53 -j NFQUEUE --queue-num 0 --queue-bypass
# HTTP/HTTPS
iptables -w -D FORWARD -p tcp --match multiport --ports 80,443 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -w -D FORWARD -p udp --match multiport --ports 80,443 -j NFQUEUE --queue-num 0 --queue-bypass
ebtables --concurrent -D FORWARD -p ip --ip-protocol 6 --ip-destination-port 443 -j SKIPLOG 2> /dev/null
ebtables --concurrent -D FORWARD -p ip --ip-protocol 6 --ip-source-port 53 -j SKIPLOG 2> /dev/null
ebtables --concurrent -D FORWARD -p ip --ip-protocol 17 --ip-source-port 53 -j SKIPLOG 2> /dev/null
fi
ip6tables -w -nL FORWARD|grep -iqE "NFQUEUE"
if [ "$?" -eq 0 ]; then
#ip6table rules
ip6tables -w -D FORWARD -p tcp --match multiport --ports 80,443,53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D FORWARD -p udp --match multiport --ports 80,443,53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D INPUT -p tcp --match multiport --ports 53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D INPUT -p udp --match multiport --ports 53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -nL FORWARD | grep -iqE "NFQUEUE"
if [ "$?" -eq 0 ]; then
# DNS response rules
ip6tables -w -D FORWARD -p tcp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D FORWARD -p udp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D INPUT -p tcp --sport 53 ! -i lo -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D INPUT -p udp --sport 53 ! -i lo -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D OUTPUT -p tcp --sport 53 ! -o lo -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D OUTPUT -p udp --sport 53 ! -o lo -j NFQUEUE --queue-num 0 --queue-bypass
# HTTP/HTTPS
ip6tables -w -D FORWARD -p tcp --match multiport --ports 80,443 -j NFQUEUE --queue-num 0 --queue-bypass
ip6tables -w -D FORWARD -p udp --match multiport --ports 80,443 -j NFQUEUE --queue-num 0 --queue-bypass
ebtables --concurrent -D FORWARD -p ip6 --ip6-protocol 6 --ip6-destination-port 443 -j SKIPLOG 2> /dev/null
ebtables --concurrent -D FORWARD -p ip6 --ip6-protocol 6 --ip6-source-port 53 -j SKIPLOG 2> /dev/null

View File

@@ -3,12 +3,31 @@
. /lib/functions.sh
LOCKFILE="/tmp/sync_bundles.lock"
log_level="$(uci -q get parentalcontrol.globals.loglevel)"
log_level="${log_level:-1}"
DEBUG=0
log_err() {
logger -t urlfilter.sync -p error "$*"
if [ "${DEBUG}" -eq "1" ]; then
echo "#ERR# $* #" >/dev/console
fi
}
log_info() {
if [ "${log_level}" -gt 3 ]; then
logger -t urlfilter.sync -p info "$*"
fi
if [ "${DEBUG}" -eq "1" ]; then
echo "#INFO# $* #" >/dev/console
fi
}
# this script handles syncing bundles
# if its a remote file, then it would be downloaded and placed in bundle_dir
bundle_path="$(uci -q get parentalcontrol.globals.bundle_path)"
if [ -z "${bundle_path}" ]; then
bundle_path="/tmp/parentalcontrol"
return 0
fi
stringstore_dir="${bundle_path}/stringstore"
@@ -38,15 +57,15 @@ update_bundle_file_from_url() {
available_memory=$(df "$bundle_dir" | tail -n 1 | awk '{print $(NF-2)}') # Available memory in 1K blocks
local needed_blocks=$((bundle_file_size / 1024)) # Convert bundle_file_size to 1K blocks
local max_size=$((10 * 1024 * 1024)) # 10MB in bytes
local max_size=$((50 * 1024 * 1024)) # 50MB in bytes
if [ "$available_memory" -le "$needed_blocks" ]; then
logger -p info "Error: Not enough disk space for bundle: ${bundle_name}"
log_info "Error: Not enough disk space for bundle: ${bundle_name}"
return 1
fi
if [ "$bundle_file_size" -gt "$max_size" ]; then
logger -p info "update_bundle_file_from_url: Error: File size for ${bundle_name} exceeds 10MB"
log_info "update_bundle_file_from_url: Error: File size for ${bundle_name} exceeds 10MB"
return 1
fi
@@ -57,7 +76,7 @@ update_bundle_file_from_url() {
else
# Random delay (0-5s) before starting the download
local delay=$((RANDOM % 6))
logger -p info "update_bundle_file_from_url: Waiting ${delay}s before downloading..."
log_info "update_bundle_file_from_url: Waiting ${delay}s before downloading..."
sleep "$delay"
# Retry logic with exponential backoff
@@ -65,12 +84,11 @@ update_bundle_file_from_url() {
local attempt=1
local success=0
while [ $attempt -le 3 ]; do
curl -s -o "$temp_file" "$download_url"
if [ $? -eq 0 ]; then
if curl -s -o "$temp_file" "$download_url"; then
success=1
break
else
logger -p info "update_bundle_file_from_url: Download failed. Retrying $attempt ..."
log_info "update_bundle_file_from_url: Download failed. Retrying $attempt ..."
local backoff=$(( (2 ** attempt) + (RANDOM % 3) )) # Exponential backoff + 0-2s jitter
sleep "$backoff"
fi
@@ -78,7 +96,7 @@ update_bundle_file_from_url() {
done
if [ $success -ne 1 ]; then
logger -p info "update_bundle_file_from_url: Failed to download bundle: ${bundle_name}"
log_info "update_bundle_file_from_url: Failed to download bundle: ${bundle_name}"
rm -f "$temp_file"
return 1
fi
@@ -89,7 +107,7 @@ update_bundle_file_from_url() {
local final_path="${bundle_dir}/${bundle_file_name}"
if [[ "$file_path" =~ \.xz$ ]]; then
if ! xz -dc "$file_path" > "$final_path"; then
logger -p info "update_bundle_file_from_url: Decompression failed."
log_info "update_bundle_file_from_url: Decompression failed."
rm -f "$final_path"
rm -f "$file_path"
return 1
@@ -98,7 +116,7 @@ update_bundle_file_from_url() {
rm -f "$file_path"
elif [[ "$file_path" =~ \.gz$ ]]; then
if ! gzip -dc "$file_path" > "$final_path"; then
logger -p info "update_bundle_file_from_url: Decompression failed."
log_info "update_bundle_file_from_url: Decompression failed."
rm -f "$final_path"
rm -f "$file_path"
return 1
@@ -134,7 +152,6 @@ handle_download_url() {
local file_name="${sanitized_url##*/}" # Get everything after the last '/'
local bundle_file_name="${file_name}.urlbundle"
local unprocessed_file=0
local file_path="${sanitized_url#file://}"
if echo "$sanitized_url" | grep -qE "^https?://|^file://"; then
@@ -153,7 +170,7 @@ handle_download_url() {
fi
if [ -n "$previous_bundle_size" ] && [ "$bundle_file_size" -eq "$previous_bundle_size" ]; then
return
return 0
fi
if echo "$sanitized_url" | grep -q "^file://" && ! echo "$sanitized_url" | grep -Eq "\.(xz|gz)$"; then
@@ -161,7 +178,7 @@ handle_download_url() {
sed -i "/^${bundle_file_name} /d" "$bundle_sizes"
echo "$bundle_file_name $bundle_file_size" >> "$bundle_sizes"
ubus send "parentalcontrol.bundle.update" "{\"bundle_file_path\":\"${file_path}\",\"bundle_name\":\"${bundle_name}\"}"
return
return 0
fi
# Remove existing entries
@@ -173,11 +190,9 @@ handle_download_url() {
update_bundle_file_from_url "$sanitized_url" "$bundle_file_name" "$bundle_file_size" "$bundle_name" "$file_name"
return $?
else
logger -p info "Error: Unsupported URL format for ${bundle_file_name}"
log_info "Error: Unsupported URL format for ${bundle_file_name}"
return 1
fi
return 0
}
cleanup_bundle_files() {
@@ -189,7 +204,7 @@ cleanup_bundle_files() {
get_download_url() {
local section="$1"
config_get url "$section" download_url
config_get_bool enable "$1" enable 0
config_get_bool enable "$1" enable 1
if [ "${enable}" -eq 0 ]; then
# bundle is disabled
@@ -222,46 +237,56 @@ cleanup_bundle_files() {
done
}
cleanup_bundle_sizes() {
downloaded_bundle_names="$(cat "$bundle_sizes" | cut -d '.' -f 1)"
for name in $downloaded_bundle_names; do
if ls ${stringstore_dir}/${name}* 2>&1 | grep -qF '.store'; then
if ls ${stringstore_dir}/${name}* 2>&1 | grep -q cmph; then
continue
fi
fi
sed -i "/$name/d" "$bundle_sizes"
done
}
# Main handler for all profile URL bundles
handle_filter_for_bundles() {
local urlfilter
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
# if urlfilter is not enabled, then return
if [ "${urlfilter}" -ne "1" ]; then
logger -p info "urlbundle not supported"
return
fi
ubus -t 20 wait_for bbfdm.parentalcontrol
if [ "$?" -ne 0 ]; then
logger -p error "bbfdm.parentalcontrol object not found"
return
log_info "urlfilter feature not enabled"
return 0
fi
initialize_environment
cleanup_bundle_files "$bundle_dir"
cleanup_bundle_files "$stringstore_dir"
cleanup_bundle_sizes
config_load parentalcontrol
config_get_bool enable globals enable 0
if [ "${enable}" -eq 0 ]; then
log_info "parental-control feature not enabled"
# Parental control is disabled
return 0
fi
local profile enable bundles bundle_name download_url
check_bundle_exists() {
local cfg="$1"
local enable download_url name cfg
cfg="$1"
config_get name "$cfg" name
config_get_bool enable "$cfg" enable 0
config_get_bool enable "$cfg" enable 1
config_get download_url "$cfg" download_url
if [ "${enable}" -eq 0 ]; then
# bundle is disabled
log_info "Skipping bundle ${name} not enabled"
return 0
fi
@@ -282,6 +307,6 @@ handle_filter_for_bundles() {
# Open file descriptor 200 for locking
exec 200>"$LOCKFILE"
# Try to acquire an exclusive lock; exit if another instance is running
flock -n 200 || { logger -p info "sync_bundles.sh is already running, exiting."; exit 1; }
flock -n 200 || { log_info "sync_bundles.sh is already running, exiting."; exit 1; }
handle_filter_for_bundles

View File

@@ -434,4 +434,6 @@ hw_commit_all() {
/userfs/bin/ifc add vip pbit $pbit
done
fi
hw_nat -! > /dev/null 2>&1
}

View File

@@ -22,6 +22,10 @@ ip_rule_get_converted_tos() {
echo $con_tos
}
flush_hw_nat() {
hw_nat -! > /dev/null 2>&1
}
configure_qos() {
# queue configuration is being done after shaper configuration,
# If port shapingrate configuration on DISC device is called after queue configuration then
@@ -33,8 +37,9 @@ configure_qos() {
configure_policer
configure_classify
if [ -f "/tmp/qos/classify.ebtables" ]; then
sh /tmp/qos/classify.ebtables
sh /tmp/qos/classify.ebtables
fi
flush_hw_nat
}
reload_qos() {
@@ -65,6 +70,7 @@ reload_qos() {
;;
esac
hw_commit_all
flush_hw_nat
}
reload_qos_service() {

View File

@@ -14,11 +14,13 @@ PREV_LINKSPEED=$(cat ${LINKSPEED_FILE} 2>/dev/null)
[ -z "${PREV_LINKSPEED}" ] && PREV_LINKSPEED=0
if [ $((LINKSPEED)) -ne $((PREV_LINKSPEED)) -a $((LINKSPEED)) -ne 0 ]; then
if [ $((LINKSPEED)) -ge 10000 ]; then
if [ $((LINKSPEED)) -ge 100 ]; then
/userfs/bin/qosrule discpline Rate uplink-bandwidth $((LINKSPEED*1000*999/1000))
else
/userfs/bin/qosrule discpline Rate uplink-bandwidth $((LINKSPEED*1000))
/userfs/bin/qosrule discpline Rate uplink-bandwidth $((LINKSPEED*1000*990/1000))
fi
mkdir -p "/tmp/qos"
echo ${LINKSPEED} > ${LINKSPEED_FILE}
hw_nat -! > /dev/null 2>&1
fi

View File

@@ -1,11 +1,30 @@
interfaces=$(uci show wireless | grep "ifname=" | awk -F'[.,=]' '{print$2}')
for int in $interfaces; do
mode=$(uci get "wireless.${int}.mode")
. /lib/functions.sh
handle_interface() {
local config="${1}"
local prefix="${2}"
config_get ifname "${config}" ifname
config_get mode ${config} mode
if [ "$mode" = "ap" ] ; then
ap_int=$(uci get "wireless.${int}.ifname")
echo "Get assoc list for ${ap_int}"
ubus call "wifi.ap.${ap_int}" assoclist
echo "Get station info for ${ap_int}"
ubus call "wifi.ap.${ap_int}" stations
echo "Get assoc list for ${ifname}"
ubus call "${prefix}.${ifname}" assoclist
echo "Get station info for ${ifname}"
ubus call "${prefix}.${ifname}" stations
fi
done
}
handle_wifi_interface() {
handle_interface "$1" "wifi.ap"
}
handle_mld_interface() {
handle_interface "$1" "wifi.apmld"
}
config_load wireless
echo "Get associated stations information for non-MLD interfaces"
config_foreach handle_wifi_interface wifi-iface
echo "Get associated stations information for MLD interfaces"
config_foreach handle_mld_interface wifi-mld

View File

@@ -22,3 +22,4 @@ handle_interface() {
config_load wireless
config_foreach handle_interface wifi-iface
config_foreach handle_interface wifi-mld

View File

@@ -0,0 +1,36 @@
. /lib/functions.sh
handle_interface() {
local config="${1}"
local prefix="${2}"
config_get ifname "${config}" ifname
config_get mode ${config} mode
if [ "$mode" = "ap" ] ; then
echo "Get status for ${ifname}"
ubus call "${prefix}.${ifname}" status
elif [ "$mode" = "sta" ] ; then
echo "Get status for bSTA ${ifname}"
ubus call "wifi.bsta.${ifname}" status
fi
}
handle_wifi_interface() {
handle_interface "$1" "wifi.ap"
}
handle_mld_interface() {
handle_interface "$1" "wifi.apmld"
}
config_load wireless
echo "Get wifi status"
ubus call wifi status
echo "Get wifi status for ap & bsta interfaces"
config_foreach handle_wifi_interface wifi-iface
echo "Get wifi status for apmld interfaces"
config_foreach handle_mld_interface wifi-mld

View File

@@ -13,7 +13,8 @@
},
{
"description": "WiFi Status",
"cmd": "ubus call wifi status"
"cmd": "sh /usr/share/self-diagnostics/helper/wifi_status.sh",
"timeout": 10
},
{
"description": "WiFi Radio Status",

View File

@@ -5,11 +5,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-base
PKG_VERSION:=5.0.4
PKG_VERSION:=5.1.2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
PKG_SOURCE_VERSION:=47f52fb0fe4a9824590c8be9ee7b8985631c39cf
PKG_SOURCE_VERSION:=6ee43863415b54c312a56e113a7a91d5ae25df28
PKG_MIRROR_HASH:=skip
SULU_MOD:=core

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-builder
PKG_VERSION:=5.0.4
PKG_VERSION:=5.1.2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
PKG_SOURCE_VERSION:=ef5345ea0275e632f021dfcf3b62c8d09fbb5800
PKG_SOURCE_VERSION:=cca6a777e46584c888a1a06fafa75f7a063b803d
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(PKG_VERSION)/sulu-builder-$(PKG_SOURCE_VERSION)
@@ -28,7 +28,8 @@ define Package/sulu/default
CATEGORY:=Utilities
SUBMENU:=SULU
TITLE:=SULU-CE
DEPENDS:=+mosquitto-auth-shadow +usermngr +jq +userinterface +obuspa +qrencode
DEPENDS:=+mosquitto-auth-shadow +usermngr +userinterface +obuspa +sulu-vendorext
DEPENDS+=+@OBUSPA_LOCAL_MQTT_LISTENER
EXTRA_DEPENDS:=nginx
endef
@@ -95,24 +96,25 @@ endef
define Package/sulu/install/Default
$(INSTALL_DIR) $(1)/sulu/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_BIN) ./files/etc/config/sulu $(1)/etc/config/sulu
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/sulu $(1)/etc/init.d/sulu
$(INSTALL_DIR) $(1)/etc/sulu
$(INSTALL_DATA) ./files/maintenance.html $(1)/sulu/
$(LN) /tmp/sulu $(1)/sulu/connection
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
$(INSTALL_BIN) ./files/etc/sulu/sulu_watcher.sh $(1)/etc/sulu/
$(INSTALL_DIR) $(1)/etc/users/roles
$(INSTALL_DATA) ./files/etc/users/roles/*.json $(1)/etc/users/roles/
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-config $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/40-add-sulu-config $(1)/etc/uci-defaults/
ifneq ($(CONFIG_SULU_DEFAULT_UI)$(CONFIG_SULU_BUILDER_DEFAULT_UI),)
$(INSTALL_BIN) ./files/etc/uci-defaults/41-make-sulu-default-ui $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/etc/uci-defaults/41-make-sulu-default-ui $(1)/etc/uci-defaults/
endif
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/sulu $(1)/etc/init.d/
endef
define Package/sulu/install/Post
@@ -128,7 +130,6 @@ define Package/sulu/install
$(Package/sulu/install/Post)
endef
define Package/sulu-builder/install
$(Package/sulu/install/Default)
$(INSTALL_DIR) $(1)/sulu/presets

View File

@@ -1,2 +0,0 @@
config global 'global'
option enabled '1'

51
sulu/sulu-builder/files/etc/init.d/sulu Executable file → Normal file
View File

@@ -1,48 +1,15 @@
#!/bin/sh /etc/rc.common
START=9
STOP=01
USE_PROCD=1
START=90
STOP=01
PROG=/etc/sulu/sulu_watcher.sh
. /lib/functions.sh
log() {
echo "${@}" | logger -t sulu.init -p debug
}
validate_sulu_global_section() {
uci_validate_section sulu global global \
'enabled:bool:1'
}
start_service() {
local enabled
config_load sulu
procd_open_instance sulu
validate_sulu_global_section || return 0
# append sulu connection injection
if [ "${enabled}" -eq "0" ]; then
procd_close_instance
return 0
fi
if [ "${1}" = "update" ]; then
log "Reloading related services"
/etc/sulu/sulu.sh -r
fi
/etc/sulu/sulu.sh -q
procd_close_instance
}
reload_service() {
stop
start update
}
service_triggers() {
procd_add_reload_trigger "sulu" "userinterface" "mosquitto"
procd_add_reload_trigger "config.change" "mapcontroller" /etc/sulu/sulu.sh -q
start_service()
{
procd_open_instance "sulu"
procd_set_param command ${PROG}
procd_close_instance "sulu"
}

View File

@@ -8,6 +8,10 @@ location /sitemap.xml {
return 200 "User-agent: *\nDisallow: /\n";
}
location /maintenance.html {
internal;
}
location /wss {
proxy_pass_request_headers on;
proxy_cache off;
@@ -23,7 +27,9 @@ location /wss {
proxy_set_header X-Forwarded-Proto $scheme;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header Pragma 'no-cache';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
expires 0;
proxy_pass http://websocket;
}
@@ -44,6 +50,10 @@ location / {
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
expires -1;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if (!-f $document_root/connection/ready) {
return 503;
}
expires 0;
}

View File

@@ -4,18 +4,16 @@
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
. /lib/functions/iopsys-environment.sh
#. /lib/functions/iopsys-environment.sh
RESTART_REQ=0
_RESTART_SERVICES="0"
mkdir -p /tmp/sulu/
function slog() {
slog() {
echo "$*" | logger -t sulu.sh -p debug
}
function _get_agent_id() {
_get_agent_id() {
local oui serial endpointid
endpointid="$(uci_get obuspa localagent EndpointID)"
@@ -30,7 +28,7 @@ function _get_agent_id() {
fi
}
function _get_sulu_user_roles() {
_get_sulu_user_roles() {
roles=$(uci -q get userinterface._sulu_s.role)
for role in ${roles}; do
@@ -41,35 +39,32 @@ function _get_sulu_user_roles() {
sulu_user_roles=$(echo -e "${sulu_user_roles// /\\n}" | sort | uniq)
fi
echo ${sulu_user_roles}
echo "${sulu_user_roles}"
}
function _get_sulu_root() {
_get_sulu_root() {
local root
root="$(uci -q get nginx._sulu_s.root)"
echo "${root:-/sulu}"
}
function _get_sulu_connection_config() {
_get_sulu_connection_config() {
local config
config="$(_get_sulu_root)/presets/connection-config.json"
echo "${config}"
}
function _get_sulu_session_mode() {
echo "$(uci -q get sulu.global.SessionMode)"
_get_sulu_session_mode() {
uci -q get sulu.global.SessionMode
}
function _get_sulu_acl_file() {
local file
file="$(uci -q get mosquitto.sulu.acl_file)"
echo "${file}"
_get_sulu_acl_file() {
uci -q get mosquitto.sulu.acl_file
}
function generate_sulu_conn_config() {
generate_sulu_conn_config() {
local users SCONFIG session
users="$(_get_sulu_user_roles)"
@@ -109,10 +104,10 @@ function generate_sulu_conn_config() {
json_close_object
}
json_dump >${SCONFIG}
json_dump >"${SCONFIG}"
}
function _update_obuspa_config_rbac() {
_update_obuspa_config_rbac() {
local agent users session
agent="$(_get_agent_id)"
@@ -124,45 +119,45 @@ function _update_obuspa_config_rbac() {
# Add mqtt
section="mqtt_sulu_${user}"
if ! uci_get obuspa ${section} >/dev/null 2>&1; then
uci_add obuspa mqtt ${section}
uci_set obuspa ${section} BrokerAddress "127.0.0.1"
uci_set obuspa ${section} BrokerPort "1883"
uci_set obuspa ${section} TransportProtocol "TCP/IP"
if ! uci_get obuspa "${section}" >/dev/null 2>&1; then
uci_add obuspa mqtt "${section}"
uci_set obuspa "${section}" BrokerAddress "127.0.0.1"
uci_set obuspa "${section}" BrokerPort "1883"
uci_set obuspa "${section}" TransportProtocol "TCP/IP"
RESTART_REQ=1
fi
# Add mtp
section="mtp_sulu_${user}"
if ! uci_get obuspa ${section} >/dev/null 2>&1; then
uci_add obuspa mtp ${section}
uci_set obuspa ${section} Protocol "MQTT"
uci_set obuspa ${section} ResponseTopicConfigured "/usp/${agent}/${user}/endpoint"
uci_set obuspa ${section} mqtt "mqtt_sulu_$user"
if ! uci_get obuspa "${section}" >/dev/null 2>&1; then
uci_add obuspa mtp "${section}"
uci_set obuspa "${section}" Protocol "MQTT"
uci_set obuspa "${section}" ResponseTopicConfigured "/usp/${agent}/${user}/endpoint"
uci_set obuspa "${section}" mqtt "mqtt_sulu_$user"
RESTART_REQ=1
fi
# Add controller
section="controller_sulu_${user}"
if ! uci_get obuspa ${section} >/dev/null 2>&1; then
uci_add obuspa controller ${section}
uci_set obuspa ${section} EndpointID "self::sulu-${user}"
uci_set obuspa ${section} Protocol "MQTT"
uci_set obuspa ${section} Topic "/usp/${agent}/${user}/controller"
uci_set obuspa ${section} mqtt "mqtt_sulu_$user"
uci_set obuspa ${section} assigned_role_name "$user"
if ! uci_get obuspa "${section}" >/dev/null 2>&1; then
uci_add obuspa controller "${section}"
uci_set obuspa "${section}" EndpointID "self::sulu-${user}"
uci_set obuspa "${section}" Protocol "MQTT"
uci_set obuspa "${section}" Topic "/usp/${agent}/${user}/controller"
uci_set obuspa "${section}" mqtt "mqtt_sulu_$user"
uci_set obuspa "${section}" assigned_role_name "$user"
RESTART_REQ=1
fi
obMode="$(uci_get obuspa ${section} SessionMode)"
obMode="$(uci_get obuspa "${section}" SessionMode)"
if [ "${session}" != "${obMode}" ]; then
uci_set obuspa ${section} SessionMode "${session}"
uci_set obuspa "${section}" SessionMode "${session}"
RESTART_REQ=1
fi
done
}
function _create_mosquitto_acl() {
_create_mosquitto_acl() {
local agentid users
local ACL_FILE acl_users
@@ -175,9 +170,9 @@ function _create_mosquitto_acl() {
users="$(_get_sulu_user_roles)"
if [ -f "${ACL_FILE}" ]; then
acl_users="$(awk '/^user/ {print $2}' ${ACL_FILE})"
acl_users="$(awk '/^user/ {print $2}' "${ACL_FILE}")"
for user in ${users}; do
if ! grep -q "$user" ${acl_users}; then
if ! grep -q "$user" "${acl_users}"; then
rm -f "${ACL_FILE}"
fi
done
@@ -186,84 +181,38 @@ function _create_mosquitto_acl() {
agentid="$(_get_agent_id)"
for user in ${users}; do
if ! grep -q "user $user" ${ACL_FILE}; then
echo "user ${user}" >>${ACL_FILE}
echo "topic read /usp/${agentid}/${user}/controller/reply-to/#" >>${ACL_FILE}
echo "topic write /usp/${agentid}/${user}/endpoint/#" >>${ACL_FILE}
echo "topic read /usp/${agentid}/${user}/controller/#" >>${ACL_FILE}
echo "" >>${ACL_FILE}
if ! grep -q "user $user" "${ACL_FILE}"; then
{
echo "user ${user}"
echo "topic read /usp/${agentid}/${user}/controller/reply-to"
echo "topic write /usp/${agentid}/${user}/endpoint"
echo "topic read /usp/${agentid}/${user}/controller"
echo ""
} >> "${ACL_FILE}"
RESTART_REQ="1"
fi
done
if [ "${_RESTART_SERVICES}" -eq "1" -a "${RESTART_REQ}" -gt "0" ]; then
if [ "${_RESTART_SERVICES}" -eq "1" ] && [ "${RESTART_REQ}" -gt "0" ]; then
slog "Restarting mosquitto..."
ubus call uci commit '{"config":"mosquitto"}'
fi
}
function update_obuspa_config() {
update_obuspa_config() {
RESTART_REQ=0
uci_load obuspa
_update_obuspa_config_rbac
uci_commit obuspa
if [ "${_RESTART_SERVICES}" -eq "1" -a "${RESTART_REQ}" -gt "0" ]; then
if [ "${_RESTART_SERVICES}" -eq "1" ] && [ "${RESTART_REQ}" -gt "0" ]; then
slog "Restarting obuspa..."
ubus call uci commit '{"config":"obuspa"}'
fi
}
generate_qr_code() {
local NA="UNKNOWN"
local TMP="/tmp/wifi_qr.svg"
local QR="/sulu/assets/QR.svg"
local SSID=""
local KEY=""
which qrencode || return
local PASS="$(get_user_password)"
if [ -z "$PASS" ]; then
PASS="$NA"
fi
get_ssid_and_key() {
local sec="$1"
local filter_vid="$2"
if [ "$SSID" != "" ]; then
return
fi
config_get type "$sec" type
if [ "$type" != "fronthaul" ]; then
return
fi
if [ "$filter_vid" = "1" ]; then
config_get vid "$sec" vid
if [ "$vid" != "1" ]; then
return
fi
fi
config_get ssid "$sec" ssid
config_get key "$sec" key
SSID="$ssid"
KEY="$key"
}
config_load mapcontroller
config_foreach get_ssid_and_key "ap" "0"
if [ "$SSID" == "" ]; then
config_foreach get_ssid_and_key "ap" "1"
fi
SSID=${SSID:-$NA}
KEY=${KEY:-$NA}
PASS=${PASS:-$NA}
qrencode -t svg -m 0 -o "$TMP" "WIFI:S:$SSID;T:WPA;P:$KEY;;GNX:U:user;Q:$PASS;;"
if [ "$(sha256sum "$TMP" | cut -d ' ' -f1)" != "$(sha256sum "$QR" | cut -d ' ' -f1)" ]; then
mv "$TMP" "$QR"
else
rm "$TMP"
fi
}
function configure_sulu() {
configure_sulu() {
_create_mosquitto_acl
update_obuspa_config
generate_sulu_conn_config
@@ -274,10 +223,6 @@ while getopts ":rq" opt; do
r)
_RESTART_SERVICES="1"
;;
q)
generate_qr_code
exit 0
;;
*)
slog "Invalid option: ${OPTARG}"
exit 1

View File

@@ -0,0 +1,29 @@
#!/bin/sh
if ! command -v obuspa >/dev/null 2>&1; then
exit 0
fi
USP_PATH="/tmp/sulu/"
log() {
logger -t sulu_watcher "$*"
}
wait_for_obuspa() {
while true; do
ENDPOINTID="$(obuspa -c get Device.LocalAgent.EndpointID |grep Device.|awk '{print $3}')"
sleep 2
if [ -n "${ENDPOINTID}" ]; then
break;
fi
done
}
mark_usp_ready() {
mkdir -p "${USP_PATH}"
touch ${USP_PATH}/ready
}
wait_for_obuspa
mark_usp_ready

View File

@@ -12,23 +12,17 @@ if [ ! -f "${UCI_TEMPLATE}" ]; then
return 0
fi
function _get_usp_upstream_port() {
local port
port="$(uci -q get mosquitto.sulu.port)"
echo "${port:-9009}"
}
update_nginx_uci_template()
{
local port
UCI_TEMPLATE="/etc/nginx/uci.conf.template"
port="$(_get_usp_upstream_port)"
if ! grep -q "upstream websocket" ${UCI_TEMPLATE}; then
port="$(uci -q get mosquitto.sulu.port)"
port="${port:-9009}"
if ! grep -q "upstream websocket" ${UCI_TEMPLATE}; then
sed -i '/#UCI_HTTP_CONFIG$/i\ map $http_upgrade $connection_upgrade { default upgrade; "" close; }' ${UCI_TEMPLATE}
sed -i "/#UCI_HTTP_CONFIG$/i\ upstream websocket { server 127.0.0.1:${port}; }" ${UCI_TEMPLATE}
fi
fi
}
add_sulu_config_to_mosquitto()
@@ -39,24 +33,11 @@ add_sulu_config_to_mosquitto()
uci_set mosquitto sulu port '9009'
uci_set mosquitto sulu no_remote_access '1'
uci_set mosquitto sulu protocol 'websockets'
uci_set mosquitto sulu require_certificates '0'
uci_set mosquitto sulu auth_plugin '/usr/lib/mosquitto_auth_shadow.so'
uci_set mosquitto sulu acl_file '/etc/sulu/mqtt.acl'
fi
}
add_obuspa_config_to_mosquitto()
{
uci_load mosquitto
if ! uci_get mosquitto obuspa >/dev/null 2>&1; then
uci_add mosquitto listener obuspa
uci_set mosquitto obuspa enabled 1
uci_set mosquitto obuspa port '1883'
uci_set mosquitto obuspa no_remote_access '1'
uci_set mosquitto obuspa allow_anonymous '1'
fi
}
add_sulu_userinterface_uci()
{
uci_load userinterface
@@ -67,10 +48,11 @@ add_sulu_userinterface_uci()
uci_set userinterface _sulu_s port '8443'
uci_add_list userinterface _sulu_s _nginx_include '/etc/sulu/nginx.locations'
uci_set userinterface _sulu_s _nginx_uci_manage_ssl 'self-signed'
uci_set userinterface _sulu_s _nginx_ssl_certificate '/etc/nginx/conf.d/_lan.crt'
uci_set userinterface _sulu_s _nginx_ssl_certificate_key '/etc/nginx/conf.d/_lan.key'
uci_set userinterface _sulu_s _nginx_ssl_session_cache 'none'
uci_set userinterface _sulu_s protocol 'HTTPS'
uci_set userinterface _sulu_s _nginx_ssl_certificate '/etc/nginx/conf.d/_lan.crt'
uci_set userinterface _sulu_s _nginx_ssl_certificate_key '/etc/nginx/conf.d/_lan.key'
uci_set userinterface _sulu_s _nginx_ssl_session_cache 'none'
uci_set userinterface _sulu_s _nginx_error_page '503 /maintenance.html'
uci_set userinterface _sulu_s protocol 'HTTPS'
uci_add_list userinterface _sulu_s role 'admin'
uci_add_list userinterface _sulu_s role 'user'
fi
@@ -78,14 +60,13 @@ add_sulu_userinterface_uci()
if ! uci_get userinterface _suluredirect >/dev/null 2>&1; then
uci_add userinterface http_access _suluredirect
uci_set userinterface _suluredirect redirect '_sulu_s'
uci_set userinterface _suluredirect protocol 'HTTP'
uci_set userinterface _suluredirect protocol 'HTTP'
uci_set userinterface _suluredirect port "8080"
fi
}
add_obuspa_config_to_mosquitto
add_sulu_config_to_mosquitto
update_nginx_uci_template
add_sulu_userinterface_uci
update_nginx_uci_template
/etc/sulu/sulu.sh

View File

View File

@@ -6,554 +6,7 @@
"permission": [
{
"object": "Device.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Reboot()",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.SelfTestDiagnostics()",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.FactoryReset()",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DeviceInfo.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Time.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.UPnP.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Bridging.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Ethernet.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DHCPv4.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DHCPv4.Server.Pool.{i}.StaticAddress.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DHCPv6.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Hosts.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.{BBF_VENDOR_PREFIX}ParentalControl.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.{BBF_VENDOR_PREFIX}OpenVPN.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.NAT.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Firewall.",
"perm": [
"PERMIT_GET",
"PERMIT_OBJ_INFO",
"PERMIT_SET",
"PERMIT_SUBS_VAL_CHANGE"
]
},
{
"object": "Device.Firewall.DMZ.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.PPP.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Routing.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.IEEE1905.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.InterfaceStack.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DynamicDNS.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.LANConfigSecurity.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Security.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.RouterAdvertisement.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Services.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.UserInterface.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.PeriodicStatistics.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.SoftwareModules.",
"perm": ["PERMIT_NONE"]
},
{
"object": "Device.Users.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.LocalAgent.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.LocalAgent.Subscription.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.WiFi.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DNS.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.IP.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.SSH.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.LEDs.LED.{i}.CycleElement.{i}.Brightness",
"perm": ["PERMIT_GET", "PERMIT_SET", "PERMIT_GET_INST"]
"perm": ["PERMIT_ALL"]
}
]
}

View File

@@ -2,533 +2,11 @@
"tr181": {
"name": "user",
"instance": 5,
"secure_role": true,
"permission": [
{
"object": "Device.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Reboot()",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.SelfTestDiagnostics()",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.FactoryReset()",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DeviceInfo.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Time.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.UPnP.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Bridging.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Ethernet.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DHCPv4.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DHCPv4.Server.Pool.{i}.StaticAddress.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DHCPv6.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Hosts.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.{BBF_VENDOR_PREFIX}ParentalControl.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.{BBF_VENDOR_PREFIX}OpenVPN.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.NAT.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Firewall.",
"perm": [
"PERMIT_GET",
"PERMIT_OBJ_INFO",
"PERMIT_SET",
"PERMIT_SUBS_VAL_CHANGE"
]
},
{
"object": "Device.Firewall.DMZ.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.PPP.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Routing.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.IEEE1905.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.InterfaceStack.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DynamicDNS.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.LANConfigSecurity.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Security.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.RouterAdvertisement.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.Services.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.UserInterface.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.PeriodicStatistics.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.SoftwareModules.",
"perm": ["PERMIT_NONE"]
},
{
"object": "Device.Users.User.",
"perm": ["PERMIT_NONE"]
},
{
"object": "Device.LocalAgent.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.LocalAgent.Subscription.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.WiFi.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.DNS.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_ADD",
"PERMIT_DEL",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.IP.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SET",
"PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object": "Device.SSH.",
"perm": ["PERMIT_NONE"]
},
{
"object": "Device.LEDs.LED.{i}.CycleElement.{i}.Brightness",
"perm": ["PERMIT_GET", "PERMIT_SET", "PERMIT_GET_INST"]
"perm": ["PERMIT_ALL"]
}
]
}

View File

@@ -0,0 +1,248 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Router Interface Loading...</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
sans-serif;
background: linear-gradient(135deg, #3399ff 0%, #012669 100%);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
}
.container {
text-align: center;
padding: 2rem;
background: rgba(255, 255, 255, 0.1);
border-radius: 20px;
backdrop-filter: blur(10px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 90%;
}
.spinner {
width: 60px;
height: 60px;
margin: 0 auto 2rem;
position: relative;
}
.spinner::before,
.spinner::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #fff;
animation: spin 1.5s ease-in-out infinite;
}
.spinner::after {
animation-delay: 0.15s;
border-top-color: rgba(255, 255, 255, 0.5);
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
h1 {
font-size: 1.8rem;
margin-bottom: 1rem;
font-weight: 600;
}
p {
font-size: 1rem;
opacity: 0.9;
line-height: 1.5;
margin-bottom: 1rem;
}
.status {
font-size: 0.9rem;
opacity: 0.8;
margin-top: 1.5rem;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
.status-dot {
width: 8px;
height: 8px;
background: #fff;
border-radius: 50%;
animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
0%,
100% {
opacity: 0.3;
}
50% {
opacity: 1;
}
}
.retry-count {
font-size: 0.85rem;
opacity: 0.7;
margin-top: 0.5rem;
}
.error-message {
background: rgba(255, 59, 48, 0.2);
border: 1px solid rgba(255, 59, 48, 0.5);
padding: 0.75rem;
border-radius: 8px;
margin-top: 1rem;
font-size: 0.9rem;
display: none;
}
</style>
</head>
<body>
<div class="container">
<div class="spinner"></div>
<h1>Router Starting Up</h1>
<p>
The web interface is initializing. You'll be redirected automatically
once it's ready.
</p>
<div class="status">
<span class="status-dot"></span>
<span id="statusText">Checking availability...</span>
</div>
<div class="retry-count" id="retryCount"></div>
<div class="error-message" id="errorMessage"></div>
</div>
<script>
let retryCount = 0;
let checkInterval = 2000; // Start with 2 seconds
let maxInterval = 10000; // Max 10 seconds between checks
let consecutiveFailures = 0;
let maxConsecutiveFailures = 100; // Stop after 100 consecutive failures (~8-10 minutes)
function updateStatus(message) {
document.getElementById("statusText").textContent = message;
}
function updateRetryCount() {
retryCount++;
const retryElement = document.getElementById("retryCount");
retryElement.textContent = `Attempt ${retryCount}`;
}
function showError(message) {
const errorElement = document.getElementById("errorMessage");
errorElement.textContent = message;
errorElement.style.display = "block";
}
async function checkAvailability() {
updateRetryCount();
updateStatus("Connecting to router...");
try {
// Try to fetch the index page
const response = await fetch("/index.html", {
method: "HEAD", // Use HEAD to minimize bandwidth
cache: "no-cache",
mode: "no-cors", // Allow checking even with CORS restrictions
});
// If we get any response (even 404), the server is responding
// For a router, we typically want to redirect on 200 or 304
if (response.ok || response.status === 304) {
updateStatus("Router ready! Redirecting...");
consecutiveFailures = 0;
// Small delay for user feedback
setTimeout(() => {
window.location.reload();
}, 500);
return true;
} else if (response.status !== 503) {
// Server is responding but page not ready yet
updateStatus(`Server responding (${response.status}), waiting...`);
consecutiveFailures = 0;
}
} catch (error) {
// Network error - server not reachable
consecutiveFailures++;
if (consecutiveFailures > maxConsecutiveFailures) {
updateStatus("Connection timeout");
showError(
"Unable to connect to router. Please check your connection and refresh this page.",
);
return true; // Stop checking
}
updateStatus("Router not ready yet...");
// Implement exponential backoff
if (consecutiveFailures > 5) {
checkInterval = Math.min(checkInterval * 1.2, maxInterval);
}
}
return false;
}
async function startChecking() {
// Initial check
const isReady = await checkAvailability();
if (isReady) return;
// Continue checking
const intervalId = setInterval(async () => {
const isReady = await checkAvailability();
if (isReady) {
clearInterval(intervalId);
}
}, checkInterval);
}
// Start checking when page loads
window.addEventListener("DOMContentLoaded", () => {
// Small initial delay to show the UI
setTimeout(startChecking, 500);
});
// Also try to check if user clicks anywhere on the page
document.addEventListener("click", () => {
checkAvailability();
});
</script>
</body>
</html>

View File

@@ -5,11 +5,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-theme-genexis
PKG_VERSION:=5.0.3
PKG_VERSION:=5.1.2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/gnx/sulu-theme-genexis
PKG_SOURCE_VERSION:=69b72c2e589a3f73db3cb219ee7f59ab40b1bf48
PKG_SOURCE_VERSION:=bf58defd238eaf4d9e42df68942df2c8f7c4f136
PKG_MIRROR_HASH:=skip
include ../sulu-builder/sulu.mk

View File

@@ -0,0 +1,39 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-vendorext
PKG_VERSION:=0.0.1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=none
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
define Package/sulu-vendorext
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Adds sulu-vendorext extensions
endef
define Build/Compile
endef
define Package/sulu-vendorext/install
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_CWMP.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_extra_info.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_guest_wifi_5.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_mesh.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_voip.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_wan.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_guest_wifi_2_4.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_firewall.json $(1) firewallmngr
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,sulu-vendorext))

View File

@@ -0,0 +1,16 @@
{
"daemon": {
"enable": "1",
"service_name": "hostmngr",
"unified_daemon": false,
"services": [
{
"parent_dm": "Device.",
"object": "Hosts"
}
],
"config": {
"loglevel": "3"
}
}
}

View File

@@ -0,0 +1,140 @@
{
"Device.DeviceInfo.X_GENEXIS_EU.": {
"type": "object",
"version": "1.00",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"is_primary_node": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "routeragent"
},
"option": {
"name": "is_master"
}
}
}
]
},
"meshmode": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "meshmode",
"method": "status",
"key": "mode"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "meshmode",
"method": "change_meshmode",
"args": {
"mode": "@Value"
}
}
}
]
},
"wizardHasBeenUsed": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "settings"
},
"option": {
"name": "wizard_executed"
}
}
}
]
},
"LocalTimeZone": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "system",
"section": {
"name": "@system[0]"
},
"option": {
"name": "timezone"
}
}
}
]
},
"LocalTimeZoneName": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "system",
"section": {
"name": "@system[0]"
},
"option": {
"name": "zonename"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,182 @@
{
"Device.DeviceInfo.X_GENEXIS_EU.CWMPManagementServer.": {
"type": "object",
"protocols": [
"usp"
],
"access": false,
"array": false,
"dependency": "file:/etc/config/cwmp",
"EnableCWMP": {
"type": "boolean",
"version": "2.15",
"read": true,
"write": true,
"protocols": [
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "cpe"
},
"option": {
"name": "enable"
}
}
}
]
},
"log_to_console": {
"type": "boolean",
"version": "2.15",
"read": true,
"write": true,
"protocols": [
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "cpe"
},
"option": {
"name": "log_to_console"
}
}
}
]
}
},
"Device.DeviceInfo.X_GENEXIS_EU.CWMPManagementServer.acs.": {
"type": "object",
"version": "2.15",
"protocols": [
"usp"
],
"access": false,
"array": false,
"dependency": "file:/etc/config/cwmp",
"url": {
"type": "string",
"version": "2.15",
"read": true,
"write": true,
"protocols": [
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "acs"
},
"option": {
"name": "url"
}
}
}
]
},
"userid": {
"type": "string",
"version": "2.15",
"read": true,
"write": true,
"protocols": [
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "acs"
},
"option": {
"name": "userid"
}
}
}
]
},
"password": {
"type": "string",
"version": "2.15",
"read": true,
"write": true,
"protocols": [
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "acs"
},
"option": {
"name": "passwd"
}
}
}
]
},
"periodic_interval_enable": {
"type": "boolean",
"version": "2.15",
"read": true,
"write": true,
"protocols": [
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "acs"
},
"option": {
"name": "periodic_inform_enable"
}
}
}
]
},
"periodic_inform_interval": {
"type": "int",
"version": "2.15",
"read": true,
"write": true,
"protocols": [
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "acs"
},
"option": {
"name": "periodic_inform_interval"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,180 @@
{
"Device.DeviceInfo.X_GENEXIS_EU.external_info.": {
"type": "object",
"version": "1.00",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"support_link": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "help_support"
},
"option": {
"name": "support_link"
}
}
}
]
},
"faq_link": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "help_support"
},
"option": {
"name": "faq_link"
}
}
}
]
},
"contact_link": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "help_support"
},
"option": {
"name": "contact_link"
}
}
}
]
},
"contact_phone": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "help_support"
},
"option": {
"name": "contact_phone"
}
}
}
]
},
"contact_times": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "help_support"
},
"option": {
"name": "contact_times"
}
}
}
]
},
"livechat_link": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "help_support"
},
"option": {
"name": "livechat_link"
}
}
}
]
},
"extra_info": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "heimgard",
"section": {
"name": "help_support"
},
"option": {
"name": "extra_info"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,723 @@
{
"Device.Firewall.X_GENEXIS_EU.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"Mode": {
"type": "string",
"enumerations": [
"Low",
"low",
"Medium",
"medium",
"High",
"high",
"Custom",
"custom"
],
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "firewall_mode",
"method": "get",
"key": "mode"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "firewall_mode",
"method": "set",
"args": {
"mode": "@Value"
}
}
}
]
},
"Input": {
"type": "string",
"enumerations": [
"ACCEPT",
"REJECT",
"DROP"
],
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"name": "@defaults[0]"
},
"option": {
"name": "input"
}
}
}
]
},
"Forward": {
"type": "string",
"enumerations": [
"ACCEPT",
"REJECT",
"DROP"
],
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"name": "@defaults[0]"
},
"option": {
"name": "forward"
}
}
}
]
},
"Output": {
"type": "string",
"enumerations": [
"ACCEPT",
"REJECT",
"DROP"
],
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"name": "@defaults[0]"
},
"option": {
"name": "output"
}
}
}
]
},
"Drop_invalid": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"name": "@defaults[0]"
},
"option": {
"name": "drop_invalid"
}
}
}
]
},
"Synflood_protect": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"name": "@defaults[0]"
},
"option": {
"name": "synflood_protect"
}
}
}
]
},
"ZoneNumberOfEntries": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": false,
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.Firewall.X_GENEXIS_EU.Zone.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone"
},
"dmmapfile": "dmmap_firewall"
}
},
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "name"
}
}
}
]
},
"Network": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string"
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "network"
}
}
}
]
},
"Masq": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "masq"
}
}
}
]
},
"Masq_src": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string"
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "masq_src"
}
}
}
]
},
"Masq_dest": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string"
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "masq_dest"
}
}
}
]
},
"Masq_allow_invalid": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "masq_allow_invalid"
}
}
}
]
},
"Mtu_fix": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"description": "MSS clamping",
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "mtu_fix"
}
}
}
]
},
"Input": {
"type": "string",
"enumerations": [
"ACCEPT",
"REJECT",
"DROP"
],
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "input"
}
}
}
]
},
"Forward": {
"type": "string",
"enumerations": [
"ACCEPT",
"REJECT",
"DROP"
],
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "forward"
}
}
}
]
},
"Output": {
"type": "string",
"enumerations": [
"ACCEPT",
"REJECT",
"DROP"
],
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "output"
}
}
}
]
},
"Family": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "family"
}
}
}
]
},
"Log": {
"type": "unsignedInt",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "log"
}
}
}
]
},
"Device": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string"
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "device"
}
}
}
]
},
"Subnet": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string"
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "subnet"
}
}
}
]
},
"Auto_helper": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "zone",
"index": "@i-1"
},
"option": {
"name": "auto_helper"
}
}
}
]
}
},
"ForwardingNumberOfEntries": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": false,
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "forwarding"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.Firewall.X_GENEXIS_EU.Forwarding.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "forwarding"
},
"dmmapfile": "dmmap_firewall"
}
},
"Src": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "forwarding",
"index": "@i-1"
},
"option": {
"name": "src"
}
}
}
]
},
"Dest": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"type": "forwarding",
"index": "@i-1"
},
"option": {
"name": "dest"
}
}
}
]
}
}
}
}

View File

@@ -0,0 +1,168 @@
{
"Device.DeviceInfo.X_GENEXIS_EU.guest2.": {
"type": "object",
"version": "1.00",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"ssid": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest2"
},
"option": {
"name": "ssid"
}
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest2"
},
"option": {
"name": "ssid"
}
}
}
]
},
"encryption": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest2"
},
"option": {
"name": "encryption"
}
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest2"
},
"option": {
"name": "encryption"
}
}
}
]
},
"key": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest2"
},
"option": {
"name": "key"
}
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest2"
},
"option": {
"name": "key"
}
}
}
]
},
"enabled": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest2"
},
"option": {
"name": "enabled"
}
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest2"
},
"option": {
"name": "enabled"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,167 @@
{
"Device.DeviceInfo.X_GENEXIS_EU.guest5.": {
"type": "object",
"version": "1.00",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"ssid": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest5"
},
"option": {
"name": "ssid"
}
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest5"
},
"option": {
"name": "ssid"
}
}
}
]
},
"encryption": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest5"
},
"option": {
"name": "encryption"
}
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest5"
},
"option": {
"name": "encryption"
}
}
}
]
},
"key": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest5"
},
"option": {
"name": "key"
}
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest5"
},
"option": {
"name": "key"
}
}
}
]
},
"enabled": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest5"
},
"option": {
"name": "enabled"
}
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "guest5"
},
"option": {
"name": "enabled"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,416 @@
{
"Device.DeviceInfo.X_GENEXIS_EU_mesh.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"meshmode": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "meshmode",
"method": "status",
"key": "mode"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "meshmode",
"method": "change_meshmode",
"args": {
"mode": "@Value"
}
}
}
]
},
"easymesh_controller_enabled": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"default": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "controller"
},
"option": {
"name": "enabled"
}
}
}
]
},
"enable_sta_steer": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "@sta_steering[0]"
},
"option": {
"name": "enable_sta_steer"
}
}
}
]
},
"use_bcn_metrics": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "@sta_steering[0]"
},
"option": {
"name": "use_bcn_metrics"
}
}
}
]
},
"sta_steering_enabled": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"name": "@sta_steering[0]"
},
"option": {
"name": "enabled"
}
}
}
]
},
"ApNumberOfEntries": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": false,
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.DeviceInfo.X_GENEXIS_EU_mesh.ap.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap"
},
"dmmapfile": "dmmap_mapcontroller"
}
},
"ssid": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap",
"index": "@{i-1}"
},
"option": {
"name": "ssid"
}
}
}
]
},
"band": {
"type": "unsignedInt",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"enumerations": [
"2",
"5",
"6"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap",
"index": "@{i-1}"
},
"option": {
"name": "band"
}
}
}
]
},
"encryption": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"enumerations": [
"sae",
"sae+aes",
"psk2",
"psk2+aes",
"sae-mixed",
"sae-mixed+aes",
"none",
"psk-mixed",
"psk-mixed+aes",
"psk",
"psk+aes"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap",
"index": "@{i-1}"
},
"option": {
"name": "encryption"
}
}
}
]
},
"key": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap",
"index": "@{i-1}"
},
"option": {
"name": "key"
}
}
}
]
},
"vid": {
"type": "unsignedInt",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap",
"index": "@{i-1}"
},
"option": {
"name": "vid"
}
}
}
]
},
"ap_type": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"enumerations": [
"fronthaul",
"backhaul",
"combined"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap",
"index": "@{i-1}"
},
"option": {
"name": "type"
}
}
}
]
},
"builtin": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap",
"index": "@{i-1}"
},
"option": {
"name": "builtin"
}
}
}
]
},
"enabled": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"default": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "mapcontroller",
"section": {
"type": "ap",
"index": "@{i-1}"
},
"option": {
"name": "enabled"
}
}
}
]
}
}
}
}

View File

@@ -0,0 +1,73 @@
{
"json_plugin_version": 2,
"Device.Services.VoiceService.{i}.SIP.Client.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"X_GENEXIS_EU_reset": {
"type": "string",
"read": false,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "voip",
"method": "reset",
"args": {
"sip": "@Value"
}
}
}
]
},
"X_GENEXIS_EU_reset()": {
"type": "command",
"async": true,
"protocols": [
"usp"
],
"input": {
"sip": {
"type": "string",
"read": "true",
"write": "true",
"protocols": [
"usp"
]
}
},
"output": {
"result": {
"type": "string",
"read": "true",
"write": "false",
"protocols": [
"usp"
]
}
},
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "voip",
"method": "reset",
"args": {
"sip": "@Input.sip"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,487 @@
{
"Device.DeviceInfo.X_GENEXIS_EU.Wan.": {
"type": "object",
"version": "1.00",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"proto": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "get",
"args": {
"param": "proto"
},
"key": "proto"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "set",
"args": {
"param": "proto",
"value": "@Value"
}
}
}
]
},
"ipaddr": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "status",
"args": {},
"key": "ipaddr"
}
},
{
"rpc": "set",
"type": "uci",
"uci": {
"file": "network",
"section": {
"name": "wan"
},
"option": {
"name": "ipaddr"
}
}
}
]
},
"netmask": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "status",
"args": {},
"key": "netmask"
}
},
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"name": "wan"
},
"option": {
"name": "netmask"
}
}
}
]
},
"gateway": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "status",
"args": {},
"key": "gateway"
}
},
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"name": "wan"
},
"option": {
"name": "gateway"
}
}
}
]
},
"peerdns": {
"type": "boolean",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"name": "wan"
},
"option": {
"name": "peerdns"
}
}
}
]
},
"dns": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"name": "wan"
},
"option": {
"name": "dns"
}
}
}
]
},
"hostname": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"name": "wan"
},
"option": {
"name": "hostname"
}
}
}
]
},
"NAT": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "firewall",
"section": {
"name": "wan"
},
"option": {
"name": "masq"
}
}
}
]
},
"mtu": {
"type": "unsignedInt",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"name": "wan"
},
"option": {
"name": "mtu"
}
}
}
]
},
"vid": {
"type": "unsignedInt",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "get",
"args": {
"param": "vid"
},
"key": "vid"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "set",
"args": {
"param": "vid",
"value": "@Value"
}
}
}
]
},
"username": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "get",
"args": {
"param": "username"
},
"key": "username"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "set",
"args": {
"param": "username",
"value": "@Value"
}
}
}
]
},
"password": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "get",
"args": {
"param": "password"
},
"key": "password"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "set",
"args": {
"param": "password",
"value": "@Value"
}
}
}
]
},
"service": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "get",
"args": {
"param": "service"
},
"key": "service"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "set",
"args": {
"param": "service",
"value": "@Value"
}
}
}
]
},
"ac": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "get",
"args": {
"param": "ac"
}
},
"key": "ac"
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "set",
"args": {
"param": "ac",
"value": "@Value"
}
}
}
]
},
"keepalive": {
"type": "string",
"version": "1.00",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"rpc": "get",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "get",
"args": {
"param": "keepalive"
},
"key": "keepalive"
}
},
{
"rpc": "set",
"type": "ubus",
"ubus": {
"object": "genexis.wan",
"method": "set",
"args": {
"param": "keepalive",
"value": "@Value"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,36 @@
config ota 'ota'
# Allow firmware upgrades, defaults true
option firmware 'true'
# Allow download of arbituary files
option file_download 'true'
# Allow to download software packages
option software 'false'
# Allow to download personalization files (isp/customer settings)
option customer_settings 'false'
option mirror_url '$fwenv$upgrade_ota_url|https://upgradeserver$'
option crontab_entry "$(date +%M) * * * *"
list softwarelist 'ping_container'
list softwarelist 'pingcom_ota'
option interval 'nightly'
option registry_service_enabled '$fwenv$registry_service_enabled|1$'
option registry_service_url '$fwenv$registry_service_url|https://registry.hc-apis.com$'
option verbose_level '6'
config routeragent 'routeragent'
option is_master 'false'
option onboarded 'false'
config containers 'containers'
list 'cnt_list' 'f-secure'
list 'cnt_list' 'lxc_hello_world'
config services 'state'
option mwan3 'disable'
config links 'help_support'
option support_link 'https://genexis.eu/solutions/support-services/'
option faq_link ''
option contact_link 'https://genexis.eu/contact'
option contact_phone ''
option livechat_link ''
option contact_times 'Monday Friday from 09:00 17:00'

View File

@@ -0,0 +1,92 @@
#!/bin/sh /etc/rc.common
START=97
USE_PROCD=1
start_service() {
# --- STEP 1: process fronthaul APs with mld_id ---
mld_ids=$(uci show mapcontroller | grep "^mapcontroller.@ap\[" | cut -d'=' -f1 | while read -r ap; do
[ "$(uci -q get "$ap.type")" = "fronthaul" ] || continue
uci -q get "$ap.mld_id"
done | sort -u | grep -v '^$')
for mld_id in $mld_ids; do
ap_list=""
ssid_ref=""
key_ref=""
ssid_mismatch=0
# collect all fronthaul APs with this mld_id
for ap in $(uci show mapcontroller | grep "^mapcontroller.@ap\[" | cut -d'=' -f1); do
[ "$(uci -q get "$ap.type")" = "fronthaul" ] || continue
cur_id=$(uci -q get "$ap.mld_id")
[ "$cur_id" = "$mld_id" ] || continue
cur_ssid=$(uci -q get "$ap.ssid")
cur_key=$(uci -q get "$ap.key")
ap_list="$ap_list $ap"
if [ -z "$ssid_ref" ]; then
ssid_ref="$cur_ssid"
key_ref="$cur_key"
elif [ "$cur_ssid" != "$ssid_ref" ]; then
ssid_mismatch=1
fi
done
if [ "$ssid_mismatch" -eq 1 ]; then
for ap in $ap_list; do
logger -t mldsync "Removing mld_id from $ap due to SSID mismatch"
uci -q delete "$ap.mld_id"
done
else
for mld in $(uci show mapcontroller | grep "^mapcontroller.@mld\[" | cut -d'=' -f1); do
[ "$(uci -q get "$mld.id")" = "$mld_id" ] || continue
logger -t mldsync "Updating $mld with ssid=$ssid_ref and key=$key_ref"
uci -q set "$mld.ssid=$ssid_ref"
uci -q set "$mld.key=$key_ref"
done
fi
done
# --- STEP 2: handle fronthaul APs with no mld_id but same SSID ---
for ssid in $(uci show mapcontroller | grep "^mapcontroller.@ap\[" | cut -d'=' -f1 | while read -r ap; do
[ "$(uci -q get "$ap.type")" = "fronthaul" ] || continue
[ -z "$(uci -q get "$ap.mld_id")" ] || continue
uci -q get "$ap.ssid"
done | sort | uniq); do
ap_group=""
key_ref=""
count=0
for ap in $(uci show mapcontroller | grep "^mapcontroller.@ap\[" | cut -d'=' -f1); do
[ "$(uci -q get "$ap.type")" = "fronthaul" ] || continue
[ "$(uci -q get "$ap.ssid")" = "$ssid" ] || continue
[ -z "$(uci -q get "$ap.mld_id")" ] || continue
ap_group="$ap_group $ap"
key_ref=$(uci -q get "$ap.key")
count=$((count + 1))
done
[ "$count" -lt 2 ] && continue
for ap in $ap_group; do
logger -t mldsync "Assigning mld_id=1 to $ap (ssid=$ssid)"
uci -q set "$ap.mld_id=1"
done
for mld in $(uci show mapcontroller | grep "^mapcontroller.@mld\[" | cut -d'=' -f1); do
[ "$(uci -q get "$mld.id")" = "1" ] || continue
logger -t mldsync "Updating $mld with ssid=$ssid and key=$key_ref (from unassigned group)"
uci -q set "$mld.ssid=$ssid"
uci -q set "$mld.key=$key_ref"
done
done
uci -q commit mapcontroller
}
service_triggers() {
procd_add_reload_trigger "mapcontroller"
}

View File

@@ -0,0 +1,63 @@
#!/bin/sh /etc/rc.common
#
# This script will hide sulu widgets depending on router mode.
# This is achieved by creating a widget-presets.json file
# overriding the visibilityControl for each hidden widget.
#
# Note: widget names must be unique!
#
START=61
HIDDEN_WIDGETS_PPPOE=""
HIDDEN_WIDGETS_BRIDGE="wan-dash wan heimgard-dhcp heimgard-static-lease heimgard-firewall heimgard-internet-access heimgard-upnp"
HIDDEN_WIDGETS_ROUTER=""
output_file="/sulu/widget-presets/widget-presets.json"
start() {
local mode hidden_widgets
mode=$(ubus call meshmode status | jsonfilter -e '@.mode')
case "$mode" in
pppoe)
hidden_widgets=$HIDDEN_WIDGETS_PPPOE
;;
bridge)
hidden_widgets=$HIDDEN_WIDGETS_BRIDGE
;;
router)
hidden_widgets=$HIDDEN_WIDGETS_ROUTER
;;
default)
logger -t "Sulu widgets" "Unable to determine device mode"
return 1
;;
esac
output_dir=$(dirname "$output_file")
if [ ! -d "$output_dir" ]; then
mkdir -p "$output_dir"
fi
echo "{" > "$output_file"
first=1
for widget in $hidden_widgets; do
if [ $first -eq 0 ]; then
echo " ," >> "$output_file"
fi
first=0
echo ' "'$widget'": {' >> "$output_file"
echo ' "visibilityControl": "hide"' >> "$output_file"
echo ' }' >> "$output_file"
done
echo "}" >> "$output_file"
}
reload() {
start
}

View File

@@ -0,0 +1,166 @@
#!/bin/sh
# shellcheck disable=SC1091,SC3043,SC3043
. /usr/share/libubox/jshn.sh
persistent_file="/opconf/user.json"
init_json() {
json_init
[ -f "${persistent_file}" ] && json_load_file "${persistent_file}"
json_add_int "schema_version" "1"
if ! json_select "network" >/dev/null; then
json_add_object "network"
fi
if ! json_select "wan" >/dev/null; then
json_add_array "wan"
fi
json_close_object
json_close_object
if ! json_select "netmode" >/dev/null; then
json_add_object "netmode"
fi
json_close_object
}
save_and_exit() {
json_dump >"${persistent_file}"
exit 0
}
save_userconf() {
json_dump >"${persistent_file}"
opconf "${persistent_file}"
ubus call uci commit '{"config": "network"}'
}
# Create skeleton file if it doesn't exists after that load in user.json
init_json
go_L2() {
logger -s -p user.info -t "netmode" "User has manually chosen L2; switching to Layer2 mode"
local old_cb
json_set_namespace set_wan_param old_cb
init_json
json_select "netmode"
json_add_string "current" "layer2"
json_select ..
save_userconf
json_set_namespace old_cb
}
# Set netmode in uboot to correct mode, remove marker so network config is regenerated and reboot
go_L3() {
logger -p user.info -t "netmode" "User has manually chosen L3; switching to Layer3/Full mode"
local old_cb
json_set_namespace set_wan_param old_cb
init_json
json_select "network"
json_select "wan"
if ! json_is_a 1 object; then
json_add_object
else
json_select 1
fi
json_add_string "name" "wan"
json_add_string "proto" "dhcp"
json_add_int "vlan_id" 0
json_close_object
json_select ..
json_select ..
json_select "netmode"
json_add_string "current" "layer3"
json_select ..
save_userconf
json_set_namespace old_cb
}
go_pppoe() {
local username="${1}"
local password="${2}"
local enable_vid="${3:-1}"
local vid="${4:-0}"
local mtu="${5:-1500}"
local old_cb
json_set_namespace set_wan_param old_cb
init_json
logger -p user.info -t "netmode" "User has manually chosen pppoe; switching to pppoe mode"
logger -p user.info -t "netmode" "params - username:${username} password:${password} enable:${enable_vid} vid:${vid} mtu:${mtu}"
json_select "network"
json_select "wan"
if ! json_is_a 1 object; then
json_add_object
else
json_select 1
fi
json_add_string "name" "wan"
json_add_string "proto" "pppoe"
json_add_int "vlan_id" "${vid}"
json_add_string "username" "${username}"
json_add_string "password" "${password}"
json_add_int "mtu" "${mtu}"
json_close_object
json_select ..
json_select ..
json_select "netmode"
json_add_string "current" "pppoe"
save_userconf
json_set_namespace old_cb
}
# shellcheck disable=SC3043
set_wan_param() {
local name="${1:?}"
local value="${2:?}"
# shellcheck disable=SC2034
local old_cb
json_set_namespace set_wan_param old_cb
init_json
json_select "network"
json_select "wan"
if ! json_is_a 1 object; then
json_add_object
else
json_select 1
fi
json_add_string "name" "wan"
case "${name}" in
proto | username | password)
json_add_string "${name}" "${value}"
;;
vid | vland_id)
json_add_int "vlan_id" "${value}"
;;
*)
logger "sulu_functions: Unkown name '${name}' in set_wan_param"
;;
esac
json_close_object
json_select ..
json_select ..
logger -s "Name: '${name}'='${value}'"
save_userconf
json_set_namespace old_cb
}
# shellcheck disable=SC3043
# Parses all jsons in /opconf, returns active variable_name
get_wan_value() {
local variable_name="${1:?}"
local value_from_opconf=""
local final_config=""
local json_file=""
case "${variable_name}" in
"vid")
variable_name="vlan_id"
;;
*) ;;
esac
for json_file in /opconf/*.json; do
value_from_opconf="$(jsonfilter -e "@.network.wan[@.name='wan'].${variable_name}" <"${json_file}")"
[ -n "${value_from_opconf}" ] && final_config="${value_from_opconf}"
done
echo "${final_config}"
}

View File

@@ -0,0 +1,144 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
get_fwmode() {
uci -q get firewall.globals.mode || echo "custom"
}
set_fwmode() {
local mode=$1
local allow_gw_rule="allow_gw_in"
local services="http https smtp pop3 imap ssh"
local ports="80 443 25 110 143 22"
uci set firewall.globals.mode="$mode"
# Set some defaults and start from a clean slate
uci set firewall.lan.input='ACCEPT'
uci set firewall.lan.output='ACCEPT'
uci set firewall.lan.forward='ACCEPT'
uci set firewall.wan.input='REJECT'
uci set firewall.wan.output='ACCEPT'
uci set firewall.wan.forward='REJECT'
# remove rules from low mode
uci -q delete firewall.${allow_gw_rule}
# remove rules from high mode
for service in $services; do
uci -q delete firewall.allow_${service}_out
done
# handle any custom zones and forwardings
for zone in $(uci show firewall | grep "=zone" | cut -d'.' -f2 | cut -d'=' -f1); do
if [ "$zone" == "lan" ] || [ "$zone" == "wan" ]; then
continue
fi
if [ "$mode" == "custom" ]; then
uci set firewall.${zone}.enabled=1
else
uci set firewall.${zone}.enabled=0
fi
done
for forwarding in $(uci show firewall | grep "=forwarding" | cut -d'.' -f2 | cut -d'=' -f1); do
if [ "$forwarding" == "default_fwd_1" ]; then
continue
fi
if [ "$mode" == "custom" ]; then
uci set firewall.${forwarding}.enabled=1
else
uci set firewall.${forwarding}.enabled=0
fi
done
# Now set mode specific presets
case "$mode" in
low)
# add rule for incoming gateway
json_load "$(ubus call heimgard.wan status)"
json_get_var gateway gateway
uci set firewall.${allow_gw_rule}=rule
uci set firewall.${allow_gw_rule}.name='Allow-Gateway-In'
uci set firewall.${allow_gw_rule}.src='wan'
uci set firewall.${allow_gw_rule}.src_ip="$gateway"
uci set firewall.${allow_gw_rule}.target='ACCEPT'
uci reorder firewall.${allow_gw_rule}=1
;;
medium)
uci set firewall.wan.input='DROP'
uci set firewall.wan.forward='DROP'
;;
high)
uci set firewall.wan.input='DROP'
uci set firewall.wan.output='REJECT'
uci set firewall.wan.forward='DROP'
# add rules for outgoing services
i=1
for service in $services; do
port=$(echo $ports | cut -d' ' -f$i)
uci set firewall.allow_${service}_out=rule
uci set firewall.allow_${service}_out.name="Allow-${service}-Out"
uci set firewall.allow_${service}_out.src='lan'
uci set firewall.allow_${service}_out.dest='wan'
uci set firewall.allow_${service}_out.proto='tcp'
uci set firewall.allow_${service}_out.dest_port="$port"
uci set firewall.allow_${service}_out.target='ACCEPT'
uci reorder firewall.allow_${service}_out=1
i=$((i + 1))
done
;;
custom)
uci -q delete firewall.globals.mode # keep or not keep?
# in custom mode we will get additional usp calls to set config directly towards uci
;;
esac
ubus call uci commit '{"config": "firewall"}'
logger -t "firewall.ubus" "Commited and applied new firewall config"
}
fwmode="$(get_fwmode)"
case "$1" in
list)
echo '{ "get" : {}, "set" : {"mode":"String"}}'
;;
call)
case "$2" in
get)
if [ -n "$fwmode" ]; then
echo '{"mode": "'"$fwmode"'"}'
else
echo '{"error": "Could not detect mode"}'
fi
;;
set)
# Read the JSON object provided for the arguments
read -r input
json_load "${input}"
json_get_var mode mode
mode=$(echo "$mode" | tr 'A-Z' 'a-z')
case "$mode" in
low | medium | high | custom)
if [ "$mode" == "$fwmode" ]; then
echo '{"status": "No change"}'
return
fi
set_fwmode "$mode"
echo '{"status": "Ok"}'
;;
*)
echo '{"error": "Incorrect mode ('"$mode"')"}'
;;
esac
;;
esac
;;
esac

View File

@@ -0,0 +1,110 @@
#!/bin/sh
# shellcheck disable=SC3043,SC1091,SC2140
. /usr/share/libubox/jshn.sh
. /lib/functions/network.sh
. /lib/sulu_functions.sh
cidr_to_netmask() {
value=$((0xffffffff ^ ((1 << (32 - $1)) - 1)))
echo "$(((value >> 24) & 0xff)).$(((value >> 16) & 0xff)).$(((value >> 8) & 0xff)).$((value & 0xff))"
}
# setValue() - Set the value of the given WAN parameter.
#
# Args:
# $1 - The parameter name.
# $2 - The new value of the parameter.
#
# Notes:
# If the parameter name is "vid", the value of the "vid" option is read from
# the appropriate section (based on the value of the "device" option in the
# "network.wan" section). Otherwise, the value of the parameter is read from
# the "network.wan" section.
#
# If the parameter name is "vid", it is checked if the value is 0, 1 or empty.
# If so, it does not create a new vlan interface. Otherwise, it creates a new
# vlan interface with the given vid.
setValue() {
local paramName="${1}"
local paramValue="${2}"
local default_gw_interface=""
network_find_wan default_gw_interface
if [ -z "${default_gw_interface}" ]; then
default_gw_interface=wan
fi
case "$paramName" in
"vid")
set_wan_param "vid" "$paramValue"
;;
"username")
set_wan_param "username" "$paramValue"
;;
"password")
set_wan_param "password" "$paramValue"
;;
"mtu")
set_wan_param "mtu" "$paramValue"
;;
"proto")
set_wan_param "proto" "${paramValue}"
touch /tmp/netmode_changed
;;
*)
;;
esac
}
case "$1" in
list)
json_init
json_add_object "status"
json_close_object
json_add_object "get"
json_add_string "param" ""
json_close_object
json_add_object "set"
json_add_string "param" ""
json_close_object
json_dump
;;
call)
case "$2" in
status)
network_find_wan default_gw_interface
wan_json="$(ubus call network.interface."${default_gw_interface}" status)"
ipaddr="$(echo "$wan_json" | jsonfilter -e '@["ipv4-address"][0].address')"
netmask="$(echo "$wan_json" | jsonfilter -e '@["ipv4-address"][0].mask')"
gateway="$(echo "$wan_json" | jsonfilter -e '@["route"][0].nexthop')"
if [ -n "$netmask" ]; then
netmask=$(cidr_to_netmask "$netmask")
fi
json_init
json_add_string ipaddr "$ipaddr"
json_add_string netmask "$netmask"
json_add_string gateway "$gateway"
json_dump
;;
get)
read -r input
_param=$(echo "$input" | jsonfilter -e '@.param')
value="$(get_wan_value "$_param")"
json_init
json_add_string "$_param" "${value}"
json_dump
;;
set)
read -r input
_param="$(echo "$input" | jsonfilter -e '@.param')"
value="$(echo "$input" | jsonfilter -e '@.value')"
logger -t "heimgard.wan" "_param: ${_param} value: ${value}"
json_init
reply="$(set_wan_param "$_param" "$value")"
json_add_string "status" "${reply}"
json_dump
;;
esac
;;
esac

View File

@@ -0,0 +1,94 @@
#!/bin/sh
# shellcheck disable=SC3043,SC1091
. /usr/share/libubox/jshn.sh
. /lib/sulu_functions.sh
init_json
get_netmode() {
local _netmode
local persistent_file="/opconf/user.json"
if [ -f "${persistent_file}" ]; then
json_init
json_load_file '/opconf/user.json'
if json_select netmode; then
json_get_var _netmode current "unknown"
json_select ..
fi
else
_netmode="unknown"
fi
case "${_netmode}" in
extender | layer2)
echo "bridge"
;;
layer3)
echo "router"
;;
pppoe)
echo "pppoe"
;;
*)
ifstatus wan >/dev/null 2>&1 && echo "router" || echo "unknown"
;;
esac
}
netmode="$(get_netmode)"
case "$1" in
list)
echo '{ "status" : {}, "change_meshmode" : {"mode":"String"}}'
;;
call)
mode=""
case "$2" in
status)
if [ -z "${netmode}" ]; then
echo "{\"status\":\"Mode unknown\"}"
else
echo "{\"mode\":\"${netmode}\"}"
fi
;;
change_meshmode)
# Read the JSON object provided for the arguments
read -r input
json_load "${input}"
json_get_var mode mode
if [ "${mode}" = "${netmode}" ] && [ "${mode}" != "pppoe" ] && [ ! -f /tmp/netmode_changed ]; then
echo '{"status":"no_change"}' && return
fi
if [ "${mode}" = "bridge" ]; then
echo '{"status": "ok"}'
go_L2
elif [ "${mode}" = "router" ]; then
echo '{"status": "ok"}'
go_L3
elif [ "${mode}" = "pppoe" ]; then
username="$(get_wan_value "username")"
password="$(get_wan_value "password")"
vid="$(get_wan_value "vlan_id")"
mtu="$(get_wan_value "mtu")"
enable=0
if [ "${vid}" -gt 0 ]; then
enable=1
fi
echo '{"status": "ok"}'
logger "'${username}' '${password}' '${enable}' '${vid}' '${mtu}'"
go_pppoe "${username}" "${password}" "${enable}" "${vid}" "${mtu}"
else
echo '{"status":"Wrong value"}'
fi
;;
*) ;;
esac
;;
*) ;;
esac

View File

@@ -0,0 +1,32 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
case "$1" in
list)
echo '{ "reset" : {"sip": "string"} }'
;;
call)
case "$2" in
reset)
read input;
sip=`echo $input | jsonfilter -e '@.sip'`
if [ "$sip" == "" ] || [ ! $(uci -q get asterisk.$sip) ]; then
result="incorrect parameter $input"
else
ubus call uci set '{"config":"asterisk", "section":"'$sip'", "values": {"enable":"0"}}'
ubus call uci commit '{"config":"asterisk"}'
ubus call uci set '{"config":"asterisk", "section":"'$sip'", "values": {"enable":"1"}}'
ubus call uci commit '{"config":"asterisk"}'
result="ok"
fi
json_init
json_add_string "status" "$result"
json_dump
;;
esac
;;
esac

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=tr104
PKG_VERSION:=1.0.37
PKG_VERSION:=1.0.37.2
LOCAL_DEV:=0
ifeq ($(LOCAL_DEV),0)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/voice/tr104.git
PKG_SOURCE_VERSION:=2b286b48942f108447923892a7112f3036aea5db
PKG_SOURCE_VERSION:=eb8f4878451318bcfcba5716282e72d5a84adae6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=tr143
PKG_VERSION:=1.1.3
PKG_VERSION:=1.1.3.1
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/tr143d.git
PKG_SOURCE_VERSION:=33ad5cb86a09800510eb7faefc3edf30b56be41a
PKG_SOURCE_VERSION:=1a10867d639afeb535d6c639b95b25648eb4ef7b
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=userinterface
PKG_VERSION:=1.1.7
PKG_VERSION:=1.1.9
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/userinterface.git
PKG_SOURCE_VERSION:=02bedd40e083cc456b2abed8f711b45c93061815
PKG_SOURCE_VERSION:=a5970a83b8ac79c4577edc6a994b850cdbe1c82f
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -28,7 +28,7 @@ define Package/userinterface
SUBMENU:=TRx69
TITLE:=Package to add Device.UserInterface. datamodel support using bbfdm
DEPENDS:=+USERINTERFACE_HTTPACCESS_BACKEND_NGINX:nginx
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service +libeasy
MENU:=1
endef

View File

@@ -6,14 +6,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=usp-js
PKG_VERSION:=1.2.7
PKG_VERSION:=1.2.9
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/usp-js.git
PKG_SOURCE_VERSION:=a4be8f6d8442d56c632514abb16f3de0817fb22f
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_VERSION:=31d652f91e8581d19840a8fdde1f87b0acca44ed
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
@@ -23,7 +25,7 @@ define Package/usp-js
SECTION:=libs
CATEGORY:=Libraries
TITLE:=A JS library for USP(TR369) protocol
DEPENDS:=+quickjs +quickjs-websocket +@OBUSPA_ENABLE_TEST_CONTROLLER_LOCAL
DEPENDS:=+quickjs +quickjs-websocket +@OBUSPA_LOCAL_MQTT_LISTENER
EXTRA_DEPENDS:=obuspa mosquitto-ssl
endef
@@ -32,7 +34,7 @@ define Package/usp-js/description
endef
define Build/Compile
cd $(PKG_BUILD_DIR) && yarn install && yarn qjs
cd $(PKG_BUILD_DIR) && [ -d "./qjs" ] || (yarn install && yarn qjs)
endef
define Package/usp-js/install

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=wifidmd
PKG_VERSION:=1.1.33
PKG_VERSION:=1.1.33.2
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/wifidmd.git
PKG_SOURCE_VERSION:=dc65d6ec9082f836e499b29e09bacff3c608f3d0
PKG_SOURCE_VERSION:=900fdca6e18dce382c99fbfcbca81b7e90cc5598
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -25,13 +25,11 @@ reload_service()
stop
start
else
ubus send wifidmd.reload
procd_send_signal wifidmd '*' SIGUSR1
fi
return 0
}
service_triggers()
{
procd_add_reload_trigger wifidmd
procd_add_reload_trigger wifidmd mapcontroller
}

View File

@@ -6,12 +6,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=wifimngr
PKG_VERSION:=17.7.5
PKG_VERSION:=17.7.6
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=e9b13032b3574bbd341fa653276a65c9975bb5a5
PKG_SOURCE_VERSION:=e16058225dc5e9fb819029fff48cb3a5cc658a98
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/wifimngr.git
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@genexis.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz

View File

@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=xmppc
PKG_VERSION:=2.2.13
PKG_VERSION:=2.2.13.1
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/xmppc.git
PKG_SOURCE_VERSION:=5dc59fec17f9259ce40959b3fc0fc344322d5435
PKG_SOURCE_VERSION:=5816db95f9b99efa1c0e10e16df35b6bc09cebde
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif