mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-20 01:20:35 +08:00
Compare commits
172 Commits
sysmngr_co
...
7.3-dynami
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3f83bf364 | ||
|
|
170c394d05 | ||
|
|
b1805bc8c9 | ||
|
|
7848a0cecc | ||
|
|
324280cf8f | ||
|
|
49874bc3ef | ||
|
|
8820fc7d73 | ||
|
|
018c6ef9c4 | ||
|
|
da51891a58 | ||
|
|
c794673a8a | ||
|
|
cae61fd18b | ||
|
|
7e5b565190 | ||
|
|
4ca088bea5 | ||
|
|
b1bbb6e056 | ||
|
|
daca8e977f | ||
|
|
061bede64d | ||
|
|
177dab28d1 | ||
|
|
ae769b4dee | ||
|
|
0ef82d3d0f | ||
|
|
fdbe5689e2 | ||
|
|
30cafc9b45 | ||
|
|
e8a683a8ac | ||
|
|
502dec56b3 | ||
|
|
3f5a3cb200 | ||
|
|
fea1da3b53 | ||
|
|
7405571200 | ||
|
|
21a1a32f27 | ||
|
|
fa402fdb2e | ||
|
|
6f85fbd7ca | ||
|
|
058bfb4c8a | ||
|
|
3003cb98f4 | ||
|
|
762835179d | ||
|
|
29beb2dd33 | ||
|
|
1a20be1c9d | ||
|
|
52b92afac7 | ||
|
|
edff254a69 | ||
|
|
58cc602f8f | ||
|
|
1f4e445894 | ||
|
|
3460ddd956 | ||
|
|
b6f0dc71e4 | ||
|
|
74a1470463 | ||
|
|
d31a9abd2f | ||
|
|
ee74a4a06b | ||
|
|
5ec644e052 | ||
|
|
0787af4769 | ||
|
|
66aa4bf8de | ||
|
|
98d0c9b490 | ||
|
|
b853cc5bfb | ||
|
|
458938d614 | ||
|
|
d6514f0128 | ||
|
|
3bab7956a3 | ||
|
|
5e19d4aa13 | ||
|
|
49b4528cc9 | ||
|
|
60b009b24c | ||
|
|
8ee4951532 | ||
|
|
9c93a7157e | ||
|
|
46f4f18888 | ||
|
|
8da087908c | ||
|
|
3094ca245f | ||
|
|
0b2321a306 | ||
|
|
fe03fe073f | ||
|
|
815ddf9f7a | ||
|
|
bb47ceff49 | ||
|
|
e57a60bab3 | ||
|
|
ad4869ac85 | ||
|
|
16034d1c98 | ||
|
|
caae5d92f4 | ||
|
|
e64cfa29e4 | ||
|
|
d358cf56bd | ||
|
|
b86902dcbd | ||
|
|
ed7bf0fab1 | ||
|
|
8e5bf24ab0 | ||
|
|
9e518aa011 | ||
|
|
f654b5c350 | ||
|
|
cb4620da03 | ||
|
|
2a4594b30c | ||
|
|
df87055d04 | ||
|
|
32848d7f69 | ||
|
|
fd842a5638 | ||
|
|
0acfc03ce7 | ||
|
|
715ac12974 | ||
|
|
22f0aa3ea7 | ||
|
|
01e4ff2c8b | ||
|
|
2aa679f209 | ||
|
|
2a2ce30792 | ||
|
|
d5eb8f6335 | ||
|
|
0c09c1044c | ||
|
|
34670fb071 | ||
|
|
d7c9fdf574 | ||
|
|
61e6d6e6d0 | ||
|
|
07d3d98709 | ||
|
|
ea3805e531 | ||
|
|
712e05fbeb | ||
|
|
bfb51eb501 | ||
|
|
7ccc61effe | ||
|
|
3a85319a74 | ||
|
|
95c50f0808 | ||
|
|
fda7416852 | ||
|
|
f25274d726 | ||
|
|
6ba197ce98 | ||
|
|
0e2dc2f81c | ||
|
|
34a285bc6b | ||
|
|
da455c0808 | ||
|
|
07ac62e428 | ||
|
|
ccf5a26c17 | ||
|
|
f9e1decc9a | ||
|
|
21170ae143 | ||
|
|
9dbf0bc0e5 | ||
|
|
b5707298be | ||
|
|
a73b9b1dec | ||
|
|
bd830ca37b | ||
|
|
014f35b7ab | ||
|
|
0a9f5c30c9 | ||
|
|
c05e258ceb | ||
|
|
b318a5b6f2 | ||
|
|
1070248a0d | ||
|
|
9d3f965e62 | ||
|
|
ed690caaf1 | ||
|
|
ae5af97107 | ||
|
|
60b474355b | ||
|
|
1faed9afbd | ||
|
|
e6f090c9e6 | ||
|
|
532da477d9 | ||
|
|
ef281267db | ||
|
|
51f19923c0 | ||
|
|
6cf78059d7 | ||
|
|
a913f05342 | ||
|
|
83fb8b879b | ||
|
|
af3cbff6d1 | ||
|
|
45dcdc7783 | ||
|
|
8997c156d9 | ||
|
|
25e01248c5 | ||
|
|
2e70d12fd7 | ||
|
|
e47d128902 | ||
|
|
bb755d5774 | ||
|
|
250a89ca1d | ||
|
|
f139834fc7 | ||
|
|
0a8fb82fa8 | ||
|
|
0c8626ef5e | ||
|
|
dbd0fc3e17 | ||
|
|
267a855faf | ||
|
|
cea30db473 | ||
|
|
532aab72ee | ||
|
|
1a6a42b0ca | ||
|
|
2d21fa7e95 | ||
|
|
8a120f056a | ||
|
|
6e2083e30e | ||
|
|
9c50c4c41b | ||
|
|
689905913c | ||
|
|
c17d03ef56 | ||
|
|
0c65d03dca | ||
|
|
aeca33ecae | ||
|
|
150730e3e2 | ||
|
|
bc5d99459d | ||
|
|
2e4b1c84ac | ||
|
|
49a823a046 | ||
|
|
7ba428e4b2 | ||
|
|
f215dd2fb8 | ||
|
|
e9f91b465f | ||
|
|
6f4e3daffb | ||
|
|
9ecc88fc72 | ||
|
|
a9a44c2b13 | ||
|
|
71316b37e3 | ||
|
|
bb3267649f | ||
|
|
ae630fc142 | ||
|
|
9f71023857 | ||
|
|
8a86868513 | ||
|
|
91edc0fc99 | ||
|
|
a2bbe00934 | ||
|
|
3861cb8714 | ||
|
|
c94232f071 | ||
|
|
9cdc3e8265 |
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.4.23
|
||||
PKG_VERSION:=1.4.23.19
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=c10303fc51a1034cb87040e0eaf23c95d2b1c658
|
||||
PKG_SOURCE_VERSION:=bfd50fe626d97f325bda6ea66fd57b0e9dd97ba9
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -160,6 +160,8 @@ endif
|
||||
define Package/libbbfdm-api/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/libbbfdm-api.so $(1)/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/scripts/bbf.config $(1)/usr/libexec/rpcd/bbf.config
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default/install
|
||||
@@ -195,12 +197,14 @@ define Package/bbfdmd/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/input.json $(1)/etc/bbfdm/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
|
||||
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
|
||||
$(INSTALL_BIN) ./files/etc/bbfdm/bbfdm_services.sh $(1)/etc/bbfdm/
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_lease_start_time.user $(1)/etc/udhcpc.user.d/udhcpc_lease_start_time.user
|
||||
endef
|
||||
|
||||
define Package/userinterface/install
|
||||
|
||||
@@ -2,71 +2,40 @@
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t firewall.dnat -p info
|
||||
}
|
||||
|
||||
exec_cmd() {
|
||||
if ! eval "$*"; then
|
||||
log "Failed to run [$*]"
|
||||
fi
|
||||
}
|
||||
|
||||
reorder_dnat_rules() {
|
||||
nat_chains=$(iptables -t nat -S | grep -E "^-N zone[a-zA-Z0-9_]+prerouting$" | cut -d' ' -f 2)
|
||||
|
||||
for chain in ${nat_chains}; do
|
||||
# Collect empty remote host & empty dport rules
|
||||
EMPTY_HOST_PORT=$(iptables -t nat -S ${chain} | grep -E "REDIRECT|DNAT" | grep -v "\-\-dport" | grep -v "\-s ")
|
||||
if [ -n "${EMPTY_HOST_PORT}" ]; then
|
||||
echo "${EMPTY_HOST_PORT}" | while read cmd; do
|
||||
cmd1="iptables -t nat $(echo $cmd | sed 's/-A /-D /g')"
|
||||
exec_cmd $cmd1
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect empty remote host but non empty dport rules
|
||||
EMPTY_HOST=$(iptables -t nat -S ${chain} | grep -E "REDIRECT|DNAT" | grep "\-\-dport" | grep -v "\-s ")
|
||||
if [ -n "${EMPTY_HOST}" ]; then
|
||||
echo "${EMPTY_HOST}" | while read cmd; do
|
||||
cmd1="iptables -t nat $(echo $cmd | sed 's/-A /-D /g')"
|
||||
exec_cmd $cmd1
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect non empty remote host but empty dport rules
|
||||
EMPTY_PORT=$(iptables -t nat -S ${chain} | grep -E "REDIRECT|DNAT" | grep -v "\-\-dport" | grep "\-s ")
|
||||
if [ -n "${EMPTY_PORT}" ]; then
|
||||
echo "${EMPTY_PORT}" | while read cmd; do
|
||||
cmd1="iptables -t nat $(echo $cmd | sed 's/-A /-D /g')"
|
||||
exec_cmd $cmd1
|
||||
done
|
||||
fi
|
||||
|
||||
# Now add rules as per datamodel precedence shown below
|
||||
## Non empty remote host, empty dport
|
||||
## empty remote host, non empty dport
|
||||
## empty remote host, empty dport
|
||||
if [ -n "${EMPTY_PORT}" ]; then
|
||||
echo "${EMPTY_PORT}" | while read cmd; do
|
||||
cmd1="iptables -t nat $(echo $cmd)"
|
||||
exec_cmd $cmd1
|
||||
done
|
||||
fi
|
||||
# Skip this chain if no matching rules were found
|
||||
[ -n "${EMPTY_HOST_PORT}" -o -n "${EMPTY_HOST}" -o -n "${EMPTY_PORT}" ] || continue
|
||||
|
||||
if [ -n "${EMPTY_HOST}" ]; then
|
||||
echo "${EMPTY_HOST}" | while read cmd; do
|
||||
cmd1="iptables -t nat $(echo $cmd)"
|
||||
exec_cmd $cmd1
|
||||
done
|
||||
fi
|
||||
(
|
||||
echo '*nat'
|
||||
|
||||
if [ -n "${EMPTY_HOST_PORT}" ]; then
|
||||
echo "${EMPTY_HOST_PORT}" | while read cmd; do
|
||||
cmd1="iptables -t nat $(echo $cmd)"
|
||||
exec_cmd $cmd1
|
||||
done
|
||||
fi
|
||||
# Delete collected rules
|
||||
[ -n "${EMPTY_HOST_PORT}" ] && echo "${EMPTY_HOST_PORT}" | sed 's/^-A /-D /'
|
||||
[ -n "${EMPTY_HOST}" ] && echo "${EMPTY_HOST}" | sed 's/^-A /-D /'
|
||||
[ -n "${EMPTY_PORT}" ] && echo "${EMPTY_PORT}" | sed 's/^-A /-D /'
|
||||
|
||||
# Now add rules as per datamodel precedence shown below
|
||||
## Non empty remote host, empty dport
|
||||
## empty remote host, non empty dport
|
||||
## empty remote host, empty dport
|
||||
[ -n "${EMPTY_PORT}" ] && echo "${EMPTY_PORT}"
|
||||
[ -n "${EMPTY_HOST}" ] && echo "${EMPTY_HOST}"
|
||||
[ -n "${EMPTY_HOST_PORT}" ] && echo "${EMPTY_HOST_PORT}"
|
||||
|
||||
echo 'COMMIT'
|
||||
) | iptables-restore -w -n
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ log() {
|
||||
}
|
||||
|
||||
exec_cmd() {
|
||||
if ! eval "$*"; then
|
||||
if ! "$@"; then
|
||||
log "Failed to run [$*]"
|
||||
echo "-1"
|
||||
return 0
|
||||
@@ -73,7 +73,7 @@ add_iptable_rule() {
|
||||
fi
|
||||
|
||||
if [ -z "${src_prefix}" ]; then
|
||||
res=$(exec_cmd "iptables ${cmd} -m comment --comment IPtables_service_rule -j ${action}")
|
||||
res=$(exec_cmd iptables -w ${cmd} -m comment --comment IPtables_service_rule -j "${action}")
|
||||
else
|
||||
#Add ipv4 sources if any
|
||||
src_list=""
|
||||
@@ -86,7 +86,7 @@ add_iptable_rule() {
|
||||
|
||||
if [ -n "$src_list" ]; then
|
||||
src_list=$(echo "${src_list}" | sed "s/,$//")
|
||||
res=$(exec_cmd "iptables -s $src_list ${cmd} -m comment --comment IPtables_service_rule -j ${action}")
|
||||
res=$(exec_cmd iptables -w -s "$src_list" ${cmd} -m comment --comment IPtables_service_rule -j "${action}")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -97,7 +97,7 @@ add_iptable_rule() {
|
||||
fi
|
||||
|
||||
if [ -z "${src_prefix}" ]; then
|
||||
res=$(exec_cmd "ip6tables ${cmd} -m comment --comment IP6tables_service_rule -j ${action}")
|
||||
res=$(exec_cmd ip6tables -w ${cmd} -m comment --comment IP6tables_service_rule -j "${action}")
|
||||
else
|
||||
#Add ipv6 sources if any
|
||||
src_list=""
|
||||
@@ -110,7 +110,7 @@ add_iptable_rule() {
|
||||
|
||||
if [ -n "$src_list" ]; then
|
||||
src_list=$(echo "${src_list}" | sed "s/,$//")
|
||||
res=$(exec_cmd "ip6tables -s $src_list ${cmd} -m comment --comment IP6tables_service_rule -j ${action}")
|
||||
res=$(exec_cmd ip6tables -w -s "$src_list" ${cmd} -m comment --comment IP6tables_service_rule -j "${action}")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
14
bbfdm/files/etc/udhcpc.user.d/udhcpc_lease_start_time.user
Normal file
14
bbfdm/files/etc/udhcpc.user.d/udhcpc_lease_start_time.user
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
leasestarttime="$(awk -F'.' '{print $1}' /proc/uptime 2> /dev/null)"
|
||||
target_file=/tmp/dhcp_client_info
|
||||
target_str="$INTERFACE $lease $leasestarttime"
|
||||
|
||||
# if this interface is present in file, then replace it
|
||||
if grep -q "$INTERFACE" "$target_file" 2> /dev/null; then
|
||||
# replace the whole line if pattern matches
|
||||
sed -i "/${INTERFACE}/c\\${target_str}" "$target_file"
|
||||
else
|
||||
# interface info was not present, append it to the file
|
||||
echo "$target_str" >> "$target_file"
|
||||
fi
|
||||
64
csmngr/Makefile
Normal file
64
csmngr/Makefile
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=csmngr
|
||||
PKG_VERSION:=1.0.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=92c62f8df86066bd1718a6a6036195b113e74032
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/csmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_PACKAGE_libwifiutils \
|
||||
CONFIG_PACKAGE_libwifi
|
||||
|
||||
PKG_BUILD_DEPENDS := libwifi
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/csmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=WiFi channel selection manager
|
||||
DEPENDS:=+libwifiutils +libwifi +libuci +libubox +ubus +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/csmngr/description
|
||||
WiFi Auto Channel Selection manager.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/csmngr/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/csmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/csmngr $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,csmngr))
|
||||
21
csmngr/files/etc/init.d/csmngr
Executable file
21
csmngr/files/etc/init.d/csmngr
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=95
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/csmngr
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command ${PROG}
|
||||
# procd_set_param stderr 1 #for debugging only
|
||||
# procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=decollector
|
||||
PKG_VERSION:=4.2.1.1
|
||||
PKG_VERSION:=4.2.1.1.2
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ae836adb0779979686d0dad34b941f319ffed1b8
|
||||
PKG_SOURCE_VERSION:=caa2c1dc89c5f75455a0346f44ae80097b8e2e29
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.6.4
|
||||
PKG_VERSION:=3.6.5
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=d9cc11c81ce1ff625e4e789afa180b301c7fcf74
|
||||
PKG_SOURCE_VERSION:=192e74db2082e3f89f6defe9d752d752b0b09079
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018 iopsys Software Solutions AB
|
||||
# Copyright (C) 2018-2024 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@@ -8,14 +8,15 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dslmngr
|
||||
PKG_VERSION:=1.2.0
|
||||
PKG_VERSION:=1.2.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=43dec92b1c86be7859521da337e7bd1168848b26
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dslmngr.git
|
||||
PKG_SOURCE_VERSION:=cb8b8fd2549751bcd38808391b76a1a9a908c4de
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/dslmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -59,7 +60,7 @@ MAKE_FLAGS += \
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/dslmngr/ $(PKG_BUILD_DIR)/
|
||||
rsync -r --exclude=.* ./dslmngr/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
#
|
||||
# Copyright (C) 2020 Iopsys
|
||||
# Copyright (C) 2020-2024 Iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethmngr
|
||||
PKG_VERSION:=2.1.1
|
||||
PKG_VERSION:=2.1.3
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b81d06867d895245ef47004c6949f9d6dedd10ef
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ethmngr.git
|
||||
|
||||
PKG_SOURCE_VERSION:=5b40a8167d3e0e5c8fc9229abccd5c6acecbe814
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/ethmngr.git
|
||||
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
@@ -32,6 +35,12 @@ define Package/ethmngr/description
|
||||
It uses APIs from the libethernet.so library.
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ./ethmngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostmngr
|
||||
PKG_VERSION:=1.1.4
|
||||
PKG_VERSION:=1.1.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=edb5bbe57c5bc83035e217c73071c9b3e878dc22
|
||||
PKG_SOURCE_VERSION:=79a6649995752da3501808debeed9e3ddfdf4d59
|
||||
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
|
||||
@@ -57,7 +57,7 @@ endif
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/hostmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(CP) ./files/etc $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/hostmngr/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/hostmngr $(1)/usr/sbin/
|
||||
|
||||
@@ -218,11 +218,15 @@ process_ac_schedule() {
|
||||
iptables -w -F hosts_forward
|
||||
ip6tables -w -F hosts_forward
|
||||
|
||||
hosts_forward=$(iptables -t filter --list | grep hosts_forward)
|
||||
if [ -z "$hosts_forward" ]; then
|
||||
hosts_ipv4_forward=$(iptables -t filter --list -n | grep hosts_forward)
|
||||
if [ -z "$hosts_ipv4_forward" ]; then
|
||||
iptables -w -t filter -N hosts_forward
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && iptables -w -t filter -I FORWARD -j hosts_forward
|
||||
fi
|
||||
|
||||
hosts_ipv6_forward=$(ip6tables -t filter --list -n | grep hosts_forward)
|
||||
if [ -z "$hosts_ipv6_forward" ]; then
|
||||
ip6tables -w -t filter -N hosts_forward
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && ip6tables -w -t filter -I FORWARD -j hosts_forward
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.5.29
|
||||
PKG_VERSION:=9.5.29.12
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
|
||||
PKG_SOURCE_VERSION:=f9a7bb027a754710353172fa1aec095c08c90832
|
||||
PKG_SOURCE_VERSION:=9c85416648a1da63c1085a5c2dc635ed13776ef2
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -102,10 +102,9 @@ define Package/icwmp/default/install
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/95-set-random-inform-time $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/uci_stuck_workaround.sh $(1)/etc/icwmpd/uci_stuck_workaround.sh
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
|
||||
$(call BbfdmInstallPlugin,$(1),./files/etc/bbfdm/json/CWMPManagementServer.json)
|
||||
$(call BbfdmInstallPlugin,$(1),$(PKG_BUILD_DIR)/libcwmpdm.so)
|
||||
endef
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
log()
|
||||
{
|
||||
logger -t cwmp.hacks "$@"
|
||||
}
|
||||
|
||||
timeout 2 uci -c /var/state show icwmp >/dev/null 2>&1
|
||||
if [ "$?" -eq "143" ]; then
|
||||
log "Seems uci got stuck, restarting cwmp ...."
|
||||
/etc/init.d/icwmpd restart
|
||||
fi
|
||||
@@ -537,17 +537,10 @@ start_service() {
|
||||
procd_append_param command -b
|
||||
fi
|
||||
|
||||
# Add crontab job to check uci stuck
|
||||
if ! grep -q "uci_stuck_workaround.sh" /etc/crontabs/root; then
|
||||
echo "*/1 * * * * /etc/icwmpd/uci_stuck_workaround.sh" >>/etc/crontabs/root
|
||||
ubus call uci commit '{"config":"cron"}'
|
||||
fi
|
||||
|
||||
procd_set_param respawn \
|
||||
"${respawn_threshold:-5}" \
|
||||
"${respawn_timeout:-10}" "${respawn_retry:-3}"
|
||||
|
||||
procd_set_param watch network.interface
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
@@ -575,6 +568,20 @@ reload_service() {
|
||||
log "Reloading cwmp service ..."
|
||||
stop
|
||||
start
|
||||
return 0
|
||||
fi
|
||||
|
||||
tr069_status="$(ubus -t 1 call tr069 status)"
|
||||
ret="$?"
|
||||
if [ "$ret" = "7" ]; then
|
||||
# ubus timed out may be due to uloop is busy in some task so return
|
||||
log "Skipping ubus reload due to ubus timeout"
|
||||
return 0
|
||||
fi
|
||||
|
||||
status="$(echo "${tr069_status}" | jsonfilter -qe '@.cwmp.status')"
|
||||
if [ "$status" = "up" ]; then
|
||||
ubus -t 1 call tr069 command '{"command":"reload"}'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
139
icwmp/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
Normal file
139
icwmp/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
Normal file
@@ -0,0 +1,139 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
CLASS=""
|
||||
OUI=""
|
||||
SERIAL=""
|
||||
|
||||
get_vivsoi() {
|
||||
# opt125 environment variable has data in below format
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | enterprise-number1 |
|
||||
# | |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | data-len1 | |
|
||||
# +-+-+-+-+-+-+-+-+ option-data1 |
|
||||
# / /
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -----
|
||||
# | enterprise-number2 | ^
|
||||
# | | |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
# | data-len2 | | optional
|
||||
# +-+-+-+-+-+-+-+-+ option-data2 | |
|
||||
# / / |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
# ~ ... ~ V
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -----
|
||||
|
||||
# Enterprise Id Len Sub Op SLen Data Sub Op SLen Data Sub Op SLen Data
|
||||
# +-------------+-----+------+------+----+------+-----+----+-----+------+-----+----+
|
||||
# | id | n | 1 | n1 | D1 | 2 | n2 | D2 | ... | 6 | n6 | D6 |
|
||||
# +-------------+-----+------+------+----+------+-----+----+-----+------+-----+----+
|
||||
|
||||
local opt125="$1"
|
||||
local len="$2"
|
||||
local ent_id
|
||||
|
||||
#hex-string 2 character=1 Byte
|
||||
# length in hex string will be twice of actual Byte length
|
||||
[ "$len" -gt "8" ] || return
|
||||
|
||||
data="${opt125}"
|
||||
rem_len="${len}"
|
||||
while [ $rem_len -gt 0 ]; do
|
||||
ent_id=${data:0:8}
|
||||
ent_id=$(printf "%d\n" "0x$ent_id")
|
||||
|
||||
if [ $ent_id -ne 3561 ]; then
|
||||
len_val=${data:8:2}
|
||||
data_len=$(printf "%d\n" "0x$len_val")
|
||||
# add 4 byte for ent_id and 1 byte for len
|
||||
data_len=$(( data_len * 2 + 10 ))
|
||||
# move ahead data to next enterprise id
|
||||
data=${data:"${data_len}":"${rem_len}"}
|
||||
rem_len=$(( rem_len - $data_len ))
|
||||
continue
|
||||
fi
|
||||
|
||||
# read the length of enterprise data
|
||||
len_val=${data:8:2}
|
||||
data_len=$(printf "%d\n" "0x$len_val")
|
||||
# add 4 byte for ent_id and 1 byte for len
|
||||
data_len=$(( data_len * 2 + 10 ))
|
||||
|
||||
opt_len=$(printf "%d\n" "0x$len_val")
|
||||
[ $opt_len -eq 0 ] && return
|
||||
|
||||
# populate the option data of enterprise id
|
||||
sub_data_len=$(( opt_len * 2))
|
||||
# starting 10 means ahead of length field
|
||||
sub_data=${data:10:"${sub_data_len}"}
|
||||
|
||||
# parsing of suboption of option 125
|
||||
while [ $sub_data_len -gt 0 ]; do
|
||||
# get the suboption id
|
||||
sub_opt_id=${sub_data:0:2}
|
||||
sub_opt_id=$(printf "%d\n" "0x$sub_opt_id")
|
||||
|
||||
# get the length of suboption
|
||||
sub_opt_len=${sub_data:2:2}
|
||||
sub_opt_len=$(printf "%d\n" "0x$sub_opt_len")
|
||||
sub_opt_len=$(( sub_opt_len * 2 ))
|
||||
|
||||
# get the value of sub option starting 4 means starting after length
|
||||
sub_opt_val=${sub_data:4:${sub_opt_len}}
|
||||
|
||||
# assign the value found in sub option
|
||||
case "${sub_opt_id}" in
|
||||
"4") OUI=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"5") SERIAL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"6") CLASS=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
esac
|
||||
|
||||
# add 2 bytes for sub_opt id and sub_opt len field
|
||||
sub_opt_end=$(( sub_opt_len + 4 ))
|
||||
|
||||
# update the remaining sub option hex string length
|
||||
sub_data_len=$((sub_data_len - sub_opt_end))
|
||||
|
||||
# fetch next sub option hex string
|
||||
sub_data=${sub_data:${sub_opt_end}:${sub_data_len}}
|
||||
done
|
||||
|
||||
# move ahead data to next enterprise id
|
||||
data=${data:"${data_len}":"${rem_len}"}
|
||||
rem_len=$(( rem_len - data_len ))
|
||||
done
|
||||
}
|
||||
|
||||
config_load cwmp
|
||||
config_get_bool enable_cwmp cpe enable 1
|
||||
config_get wan_intf cpe default_wan_interface "wan"
|
||||
|
||||
if [ "$enable_cwmp" = "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
if [ -n "$opt125" ]; then
|
||||
len=$(printf "$opt125"|wc -c)
|
||||
get_vivsoi "$opt125" "$len"
|
||||
fi
|
||||
|
||||
mkdir -p /var/state
|
||||
touch /var/state/icwmp
|
||||
sec=$(uci -q -c /var/state get icwmp.gatewayinfo)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q -c /var/state add icwmp gatewayinfo)
|
||||
uci -q -c /var/state rename icwmp."${sec}"="gatewayinfo"
|
||||
fi
|
||||
|
||||
uci -q -c /var/state set icwmp.gatewayinfo.class="$CLASS"
|
||||
uci -q -c /var/state set icwmp.gatewayinfo.oui="$OUI"
|
||||
uci -q -c /var/state set icwmp.gatewayinfo.serial="$SERIAL"
|
||||
uci -q -c /var/state commit icwmp
|
||||
fi
|
||||
141
icwmp/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
Normal file
141
icwmp/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
Normal file
@@ -0,0 +1,141 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
DHCP_ACS_URL=""
|
||||
DHCP_PROV_CODE=""
|
||||
MIN_WAIT_INVL=""
|
||||
INVL_MULTIPLIER=""
|
||||
|
||||
log() {
|
||||
echo "$@" |logger -t cwmp.update -p info
|
||||
}
|
||||
|
||||
get_opt43() {
|
||||
# Check if option value is in encapsulated form
|
||||
local opt43="$1"
|
||||
local len="$2"
|
||||
|
||||
[ "$len" -gt "2" ] || return
|
||||
|
||||
first_byte=${opt43:0:2}
|
||||
first_byte=$(printf "%d\n" "0x$first_byte")
|
||||
|
||||
if [ $len -ge 4 ] && [ $first_byte -ge 1 ] && [ $first_byte -le 4 ]; then
|
||||
# it is in encapsulated form
|
||||
# opt43 encapsulated vendor-specific option has data in below format
|
||||
# Code Len Data item Code Len Data item Code
|
||||
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
# | T1 | n | d1 | d2 | ... | T2 | n | D1 | D2 | ... | ... |
|
||||
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
|
||||
|
||||
#hex-string 2 character=1 Byte
|
||||
# length in hex string will be twice of actual Byte length
|
||||
|
||||
data="${opt43}"
|
||||
rem_len="${len}"
|
||||
# parsing of suboption of option 43
|
||||
while [ $rem_len -gt 0 ]; do
|
||||
# get the suboption id
|
||||
sub_opt_id=${data:0:2}
|
||||
sub_opt_id=$(printf "%d\n" "0x$sub_opt_id")
|
||||
|
||||
# get the length of suboption
|
||||
sub_opt_len=${data:2:2}
|
||||
sub_opt_len=$(printf "%d\n" "0x$sub_opt_len")
|
||||
sub_opt_len=$(( sub_opt_len * 2 ))
|
||||
|
||||
# get the value of sub option starting 4 means starting after length
|
||||
sub_opt_val=${data:4:${sub_opt_len}}
|
||||
|
||||
# assign the value found in sub option
|
||||
case "${sub_opt_id}" in
|
||||
"1") DHCP_ACS_URL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"2") DHCP_PROV_CODE=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"3") MIN_WAIT_INVL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"4") INVL_MULTIPLIER=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
esac
|
||||
|
||||
# add 2 bytes for sub_opt id and sub_opt len field
|
||||
sub_opt_end=$(( sub_opt_len + 4 ))
|
||||
|
||||
# fetch next sub option hex string
|
||||
data=${data:${sub_opt_end}:${len}}
|
||||
|
||||
# update the remaining sub option hex string length
|
||||
rem_len=$((rem_len - sub_opt_end))
|
||||
done
|
||||
else
|
||||
DHCP_ACS_URL=$(echo -n $opt43 | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
fi
|
||||
}
|
||||
|
||||
config_load cwmp
|
||||
config_get wan_intf cpe default_wan_interface "wan"
|
||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
config_get dhcp_url acs dhcp_url ""
|
||||
config_get min_wait_intvl acs dhcp_retry_min_wait_interval "0"
|
||||
config_get intvl_multi acs dhcp_retry_interval_multiplier "0"
|
||||
|
||||
config_change=0
|
||||
discovery_enable=0
|
||||
|
||||
if [ "$dhcp_discovery" = "1" ] || [ "$dhcp_discovery" = "true" ] || [ "$dhcp_discovery" = "enable" ]; then
|
||||
discovery_enable=1
|
||||
fi
|
||||
|
||||
if [ "$discovery_enable" = "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
if [ -n "$opt43" ]; then
|
||||
len=$(printf "$opt43"|wc -c)
|
||||
get_opt43 "$opt43" "$len"
|
||||
fi
|
||||
|
||||
if [ -z "$DHCP_ACS_URL" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
sec=$(uci -q get cwmp.acs)
|
||||
|
||||
if [ -z "${sec}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${dhcp_url}" != "${DHCP_ACS_URL}" ]; then
|
||||
uci -q set cwmp.acs.dhcp_url="$DHCP_ACS_URL"
|
||||
config_change=1
|
||||
fi
|
||||
|
||||
if [ -n "$MIN_WAIT_INVL" ] && [ "${MIN_WAIT_INVL}" != "${min_wait_intvl}" ]; then
|
||||
uci -q set cwmp.acs.dhcp_retry_min_wait_interval="$MIN_WAIT_INVL"
|
||||
config_change=1
|
||||
fi
|
||||
|
||||
if [ -n "$INVL_MULTIPLIER" ] && [ "${INVL_MULTIPLIER}" != "${intvl_multi}" ]; then
|
||||
uci -q set cwmp.acs.dhcp_retry_interval_multiplier="$INVL_MULTIPLIER"
|
||||
config_change=1
|
||||
fi
|
||||
|
||||
sec=$(uci -q get cwmp.cpe)
|
||||
|
||||
if [ -n "${sec}" ] && [ -n "$DHCP_PROV_CODE" ]; then
|
||||
uci -q set cwmp.cpe.dhcp_provisioning_code="$DHCP_PROV_CODE"
|
||||
config_change=1
|
||||
fi
|
||||
|
||||
if [ $config_change -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# ACS url has been set, inform icwmpd to reload new configuration
|
||||
sleep 10 # wait for some time to avoid interface fluctuation
|
||||
|
||||
ubus call uci commit '{"config":"cwmp"}'
|
||||
fi
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=8.3.4
|
||||
PKG_VERSION:=8.3.4.10
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=526690993c93720ee1707bba6b7a08e8c28f2dd9
|
||||
PKG_SOURCE_VERSION:=4231e9496e63fb6d0ab74870c06f9345b001c5bf
|
||||
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
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2016 iopsys
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=inbd
|
||||
PKG_VERSION:=1.2.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=d4e910a31039e0c0b7a539311eafcd716c36be77
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/inbd
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# support parallel build
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/inbd
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=iopsys Netlink Bridge Daemon
|
||||
URL:=
|
||||
DEPENDS:=+libuci +libubus +libblobmsg-json +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/inbd/description
|
||||
Application handling netlink messages from kernel and sending them out on ubus.
|
||||
endef
|
||||
|
||||
define Package/inbd/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inbd $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/files/etc/init.d/inbd $(1)/etc/init.d/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,inbd))
|
||||
10
iop/config
10
iop/config
@@ -64,7 +64,6 @@ CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/"
|
||||
################
|
||||
|
||||
# EasySoC HAL #
|
||||
CONFIG_PACKAGE_inbd=y
|
||||
CONFIG_PACKAGE_qosmngr=y
|
||||
CONFIG_PACKAGE_libwifiutils=y
|
||||
CONFIG_PACKAGE_wifimngr=y
|
||||
@@ -80,6 +79,7 @@ CONFIG_PACKAGE_map-controller=y
|
||||
# Network #
|
||||
CONFIG_PACKAGE_hostmngr=y
|
||||
CONFIG_PACKAGE_netmode=y
|
||||
CONFIG_PACKAGE_testnet=y
|
||||
CONFIG_PACKAGE_urlfilter=y
|
||||
|
||||
# System #
|
||||
@@ -143,7 +143,6 @@ CONFIG_PACKAGE_wwan=y
|
||||
CONFIG_PACKAGE_xl2tpd=y
|
||||
|
||||
# Services #
|
||||
CONFIG_PACKAGE_atftp=y
|
||||
CONFIG_PACKAGE_atftpd=y
|
||||
CONFIG_PACKAGE_ddns-scripts=y
|
||||
CONFIG_PACKAGE_dnsmasq=y
|
||||
@@ -179,6 +178,8 @@ CONFIG_PACKAGE_iptables-mod-ipmark=y
|
||||
CONFIG_PACKAGE_iptables-mod-ipopt=y
|
||||
CONFIG_PACKAGE_iptables-mod-nflog=y
|
||||
CONFIG_PACKAGE_iptables-mod-nfqueue=y
|
||||
CONFIG_PACKAGE_iputils-arping=y
|
||||
CONFIG_PACKAGE_iputils-ping=y
|
||||
CONFIG_PACKAGE_ndisc6=y
|
||||
CONFIG_PACKAGE_rdisc6=y
|
||||
CONFIG_PACKAGE_resolveip=y
|
||||
@@ -248,7 +249,6 @@ CONFIG_PACKAGE_nginx-mod-luci=y
|
||||
|
||||
CONFIG_BUSYBOX_CUSTOM=y
|
||||
CONFIG_BUSYBOX_CONFIG_ADDUSER=y
|
||||
CONFIG_BUSYBOX_CONFIG_ARPING=y
|
||||
CONFIG_BUSYBOX_CONFIG_ASH_IDLE_TIMEOUT=y
|
||||
CONFIG_BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT=y
|
||||
CONFIG_BUSYBOX_CONFIG_CTTYHACK=y
|
||||
@@ -330,3 +330,7 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y
|
||||
CONFIG_BUSYBOX_CONFIG_TIMEOUT=y
|
||||
CONFIG_BUSYBOX_CONFIG_NOHUP=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512"
|
||||
# CONFIG_BUSYBOX_CONFIG_ARPING is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_PING is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_PING6 is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_FANCY_PING is not set
|
||||
|
||||
@@ -61,7 +61,7 @@ function feeds_update {
|
||||
(
|
||||
echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update'
|
||||
echo 'FEED_DEVICES_DIRS:='
|
||||
find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h'
|
||||
find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h\n'
|
||||
) > target/linux/feed-devices/feed-devices-list.mk || exit 1
|
||||
|
||||
# targets need to be installed explicitly
|
||||
|
||||
@@ -365,11 +365,27 @@ function genconfig {
|
||||
echo "" >> .config
|
||||
fi
|
||||
# hack to support custom-devices until we have deprecated this genconfig-script...
|
||||
if [ -f "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" ]; then
|
||||
cat "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
|
||||
local custom_found=false
|
||||
local used_config_file
|
||||
|
||||
for config_file in feeds/*/devices/$target/config/$BOARDTYPE/config; do
|
||||
if [ "$custom_found" = "true" ]; then
|
||||
echo
|
||||
echo "Error was found!"
|
||||
echo "Please use only one path."
|
||||
echo "Two instances of $target/config/$BOARDTYPE exists:"
|
||||
echo "Path 1: $used_config_file"
|
||||
echo "Path 2: $config_file"
|
||||
return 1
|
||||
fi
|
||||
if [ -f "$config_file" ]; then
|
||||
cat "$config_file" >> .config
|
||||
echo "" >> .config
|
||||
custom_found=true
|
||||
used_config_file=$config_file
|
||||
fi
|
||||
done
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | mediatek | brcmbca | ipq95xx | ipq53xx)
|
||||
@@ -415,6 +431,15 @@ function genconfig {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Ensure strict file permissions, for when provided through the above
|
||||
if [ -f "$FILEDIR/etc/shadow" ]; then
|
||||
v "chmod 0600 $FILEDIR/etc/shadow"
|
||||
chmod 0600 "$FILEDIR/etc/shadow"
|
||||
fi
|
||||
if [ -d "$FILEDIR/etc/ssl/private" ]; then
|
||||
v "find $FILEDIR/etc/ssl/private -type d -exec chmod 0700 '{}' ';' -o -type f -exec chmod 0600 '{}' ';'"
|
||||
find "$FILEDIR/etc/ssl/private" -type d -exec chmod 0700 '{}' ';' -o -type f -exec chmod 0600 '{}' ';'
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local git_version
|
||||
|
||||
@@ -339,10 +339,26 @@ function genconfig_min {
|
||||
echo "" >> .config
|
||||
fi
|
||||
# hack to support custom-devices until we have deprecated this genconfig-script...
|
||||
if [ -f "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" ]; then
|
||||
cat "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
local custom_found=false
|
||||
local used_config_file
|
||||
|
||||
for config_file in feeds/*/devices/$target/config/$BOARDTYPE/config; do
|
||||
if [ "$custom_found" = "true" ]; then
|
||||
echo
|
||||
echo "Error was found!"
|
||||
echo "Please use only one path."
|
||||
echo "Two instances of $target/config/$BOARDTYPE exists:"
|
||||
echo "Path 1: $used_config_file"
|
||||
echo "Path 2: $config_file"
|
||||
return 1
|
||||
fi
|
||||
if [ -f "$config_file" ]; then
|
||||
cat "$config_file" >> .config
|
||||
echo "" >> .config
|
||||
custom_found=true
|
||||
used_config_file=$config_file
|
||||
fi
|
||||
done
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
@@ -389,6 +405,15 @@ function genconfig_min {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Ensure strict file permissions, for when provided through the above
|
||||
if [ -f "$FILEDIR/etc/shadow" ]; then
|
||||
v "chmod 0600 $FILEDIR/etc/shadow"
|
||||
chmod 0600 "$FILEDIR/etc/shadow"
|
||||
fi
|
||||
if [ -d "$FILEDIR/etc/ssl/private" ]; then
|
||||
v "find $FILEDIR/etc/ssl/private -type d -exec chmod 0700 '{}' ';' -o -type f -exec chmod 0600 '{}' ';'"
|
||||
find "$FILEDIR/etc/ssl/private" -type d -exec chmod 0700 '{}' ';' -o -type f -exec chmod 0600 '{}' ';'
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local git_version
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libeasy
|
||||
PKG_VERSION:=7.4.2
|
||||
PKG_VERSION:=7.4.3
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=11eb263666556c419220e2a50c3a67422e79f884
|
||||
PKG_SOURCE_VERSION:=0f16f1bd7d995427f0c4601b4e1e595224321df2
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libeasy.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libethernet
|
||||
PKG_VERSION:=7.2.107
|
||||
PKG_VERSION:=7.2.109
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=9c0e9ecd62b79d4e89b4f013f04124870d237395
|
||||
PKG_SOURCE_VERSION:=cc72f5ab0171cd0fc29bb48dafff6751ab2f0d9c
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libethernet.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-airoha
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0.10
|
||||
PKG_VERSION:=1.0.12
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@@ -17,7 +17,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=e6ba6fca814f6c83a3d6ff4a5b7560fbc36d3101
|
||||
PKG_SOURCE_VERSION:=a9ea70b6c0adb246685f7632e38853e0d803a7c3
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
21
libvoice-airoha/files/etc/uci-defaults/99-asterisk
Executable file
21
libvoice-airoha/files/etc/uci-defaults/99-asterisk
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
hasVoice=$(db -q get hw.board.hasVoice)
|
||||
|
||||
[ "$hasVoice" = "1" ] || { rm -f "/etc/config/asterisk"; return; }
|
||||
|
||||
source /lib/voice/config_asterisk.sh
|
||||
|
||||
default_asterisk_config
|
||||
|
||||
SLIC=`cat /proc/device-tree/airoha-voice/slic-type`
|
||||
[ "${SLIC#pef}" != "${SLIC}" ] || return
|
||||
|
||||
echo Configure TxGain and RxGain for MXL SLIC $SLIC
|
||||
|
||||
ports=$(db -q get hw.board.VoicePorts)
|
||||
for p in $(seq 0 $((ports-1))); do
|
||||
uci set asterisk.extension${p}.txgain='10'
|
||||
uci set asterisk.extension${p}.rxgain='-15'
|
||||
done
|
||||
uci commit asterisk
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-broadcom
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0.8
|
||||
PKG_VERSION:=1.0.9
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@@ -17,7 +17,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=e1de60c2c05935fb2f4adfc1f73feba0bb32ade6
|
||||
PKG_SOURCE_VERSION:=99ed0ea5ef83cebb444d135909573ccb2b37fe45
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
10
libvoice-broadcom/files/etc/uci-defaults/99-asterisk
Executable file
10
libvoice-broadcom/files/etc/uci-defaults/99-asterisk
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
hasVoice=$(db -q get hw.board.hasVoice)
|
||||
|
||||
[ "$hasVoice" = "1" ] || { rm -f "/etc/config/asterisk"; return; }
|
||||
|
||||
source /lib/voice/config_asterisk.sh
|
||||
|
||||
default_asterisk_config
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libwifi
|
||||
PKG_VERSION:=7.4.16
|
||||
PKG_VERSION:=7.4.16.13
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=dfafd5f7ea387d6119a9eb692e435f98b16f75a3
|
||||
PKG_SOURCE_VERSION:=38b946b847a6d8e12dbc12a2b1a8f16b9c59ae33
|
||||
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
|
||||
|
||||
@@ -55,5 +55,8 @@ config AGENT_OPER_CHANNEL_CHANGE_RELAY_MCAST
|
||||
config AGENT_USE_LIBDPP
|
||||
bool "Depend on libdpp for DPP EasyConnect"
|
||||
|
||||
config DYNBHD_DYNAMICALLY_PERSIST_CONTROLLER
|
||||
bool "Let dynbhd through AP-Autoconfiguration Search and DHCP Discovery determine the controller or agent role"
|
||||
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=4.5.0.10
|
||||
PKG_VERSION:=4.5.0.21
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=a03ea6bee6856000496d858f3b4c8d161612472d
|
||||
PKG_SOURCE_VERSION:=04c7eee40442677eba79efce50669a0464ea8b14
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -105,6 +105,10 @@ ifeq ($(CONFIG_AGENT_OPER_CHANNEL_CHANGE_RELAY_MCAST),y)
|
||||
TARGET_CFLAGS += -DOPER_CHAN_CHANGE_RELAY_MCAST
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DYNBHD_DYNAMICALLY_PERSIST_CONTROLLER),y)
|
||||
TARGET_CFLAGS += -DPERSIST_CONTROLLER
|
||||
endif
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/map-agent/install
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
config agent 'agent'
|
||||
option enabled '0'
|
||||
option enabled '1'
|
||||
option debug '0'
|
||||
option profile '3'
|
||||
option al_bridge 'br-lan'
|
||||
option netdev 'wlan'
|
||||
option island_prevention '0'
|
||||
option island_prevention '1'
|
||||
option eth_onboards_wifi_bhs '1'
|
||||
option scan_on_boot_only '0'
|
||||
option chan_ch_relay_mcast '1'
|
||||
option guest_isolation '1'
|
||||
option dyn_cntlr_sync '0'
|
||||
list map_port 'all'
|
||||
# option controller_macaddr '0a:1b:2c:3d:4e:50'
|
||||
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/network/utils.sh
|
||||
|
||||
conn_ports_file="/var/run/multiap/map.connected.ports"
|
||||
map_bh_file="/var/run/multiap/multiap.backhaul"
|
||||
|
||||
# Exit if AL Bridge is not configured to be a bridge device
|
||||
al_bridge="$(uci -q get mapagent.agent.al_bridge)"
|
||||
[ "${al_bridge:0:3}" = "br-" ] || exit 0
|
||||
al_brnet="${al_bridge:3}"
|
||||
|
||||
# Exit if the PORT is not member of the AL Bridge
|
||||
[ "$(get_network_of $PORT)" = "$al_brnet" ] || exit 0
|
||||
port_bridge_sec="$(uci show network | grep -w $PORT | grep '\.ports' | cut -d'.' -f2)"
|
||||
port_bridge_name="$(uci -q get network.$port_bridge_sec.name)"
|
||||
[ "$port_bridge_name" = "$al_bridge" ] || exit 0
|
||||
|
||||
# Exit if the device is not operating in extender/repeater mode
|
||||
al_brnet="${al_bridge:3}"
|
||||
[ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ] || exit 0
|
||||
|
||||
############## Dynamic Backhaul Daemon ##############
|
||||
@@ -69,7 +71,7 @@ fi
|
||||
|
||||
remove_from_bridge() {
|
||||
config_get ifname "$section" ifname
|
||||
[ -n "$ifname" ] && ubus call network.interface.${al_brnet} remove_device '{"name":"$ifname"}'
|
||||
[ -n "$ifname" ] && brctl delif ${al_bridge} ${ifname}
|
||||
}
|
||||
|
||||
update_bstas() {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
generate_mapagent_config=0
|
||||
generate_wireless_sta_config=0
|
||||
|
||||
network_mode="$(fw_printenv -n netmode)"
|
||||
multiap_mode="$(fw_printenv -n multiap_mode)"
|
||||
network_mode="$(fw_printenv -n netmode)" # default is layer3
|
||||
multiap_mode="$(fw_printenv -n multiap_mode)" # default is full
|
||||
|
||||
is_airoha() {
|
||||
[ -f /proc/device-tree/compatible ] || return
|
||||
@@ -181,20 +181,19 @@ map_genconf () {
|
||||
elif [ "$multiap_mode" == "auto" ]; then
|
||||
uci -q set mapagent.@controller_select[0].autostart=1
|
||||
uci -q set mapagent.@controller_select[0].local=0
|
||||
elif [ "$multiap_mode" == "full" ]; then
|
||||
uci -q set mapagent.@controller_select[0].autostart=1
|
||||
uci -q set mapagent.@controller_select[0].local=1
|
||||
elif [ "$multiap_mode" == "none" ]; then
|
||||
uci set mapagent.agent.enabled="0"
|
||||
else # default to full
|
||||
uci -q set mapagent.@controller_select[0].autostart=1
|
||||
uci -q set mapagent.@controller_select[0].local=1
|
||||
fi
|
||||
uci -q commit mapagent
|
||||
fi
|
||||
|
||||
|
||||
if [ "$multiap_mode" == "agent" -o "$multiap_mode" == "none" ]; then
|
||||
uci set mapcontroller.controller.enabled="0"
|
||||
else
|
||||
uci set mapcontroller.controller.enabled="1"
|
||||
if [ "$multiap_mode" == "agent" -o "$multiap_mode" == "none" ]; then
|
||||
uci set mapcontroller.controller.enabled="0"
|
||||
else
|
||||
uci set mapcontroller.controller.enabled="1"
|
||||
fi
|
||||
uci -q commit mapcontroller
|
||||
fi
|
||||
uci -q commit mapcontroller
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=4.5.0.2
|
||||
PKG_VERSION:=4.5.0.7
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=3c915f5f17ff339487a3b8533d384a23888b9c9a
|
||||
PKG_SOURCE_VERSION:=f232f934bcfea0c5900598988e039a4e110ecaf6
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
LOCAL_DEV=0
|
||||
|
||||
@@ -49,7 +49,7 @@ config_snooping_upstream_interface() {
|
||||
*.*)
|
||||
port="$(echo "$dev" | cut -d'.' -f 1)"
|
||||
if [ $port == $ethwan ]; then
|
||||
ifconfig $dev | grep RUNNING >/dev/null && $snooping_upstream_intf="$dev" && break
|
||||
ifconfig $dev | grep RUNNING >/dev/null && snooping_upstream_intf="$dev" && break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -91,7 +91,7 @@ interfaces_ok(){
|
||||
for itf in $up_interf; do
|
||||
# check if there exist a interface section for this upstream interface, if yes the
|
||||
# do nothing, if no then generate config as mcast config is outdated
|
||||
local dev_section=$(uci show network | grep -E "\.device=\'$itf\'" | cut -d'.' -f2)
|
||||
local dev_section=$(uci show network | grep -E "\.device=\'$itf\'" | head -n 1 | cut -d'.' -f2)
|
||||
|
||||
# mcast config is outdated, simply generate as per new logic
|
||||
if [ -z "$dev_section" ]; then
|
||||
|
||||
@@ -62,7 +62,7 @@ read_snooping() {
|
||||
local proto
|
||||
|
||||
config_get sec_enable "$config" enable 0
|
||||
config_get proto "$config" proto
|
||||
config_get proto "$config" proto "igmp"
|
||||
|
||||
if [ "$sec_enable" == "0" ]; then
|
||||
return
|
||||
@@ -103,7 +103,7 @@ read_proxy() {
|
||||
local proto
|
||||
|
||||
config_get sec_enable "$config" enable 0
|
||||
config_get proto "$config" proto
|
||||
config_get proto "$config" proto "igmp"
|
||||
|
||||
if [ "$sec_enable" == "0" ]; then
|
||||
return
|
||||
|
||||
@@ -15,7 +15,7 @@ snooping_bridges=
|
||||
|
||||
__device_is_bridge() {
|
||||
local device="$2"
|
||||
local devsec__="$(uci show network | grep name=.*$device | grep -v ifname | cut -d'.' -f2)"
|
||||
local devsec__="$(uci show network | grep -F ".name='$device'" | cut -d'.' -f2)"
|
||||
local sectype="$(uci -q get network.$devsec__)"
|
||||
local devtype="$(uci -q get network.$devsec__.type)"
|
||||
[ "$sectype" != "device" -o "$devtype" != "bridge" ] && return 1
|
||||
@@ -46,9 +46,6 @@ device_has_ip() {
|
||||
# Read the openwrt interface for the device.
|
||||
# Device can have multiple logical interfaces like wan and wan6
|
||||
# but same l3 device
|
||||
# NB. Don't use 'get_network_of' here.
|
||||
# This function fails in some uci configurations for interfaces that refer
|
||||
# to a device indirectly.
|
||||
local ifaces=$(ubus call network.interface dump | jsonfilter -e "@.interface[@.device='$device'].interface")
|
||||
for iface in $ifaces; do
|
||||
local ip=
|
||||
@@ -120,6 +117,7 @@ config_sysfs_mcast_snooping() {
|
||||
|
||||
for downstream in $downstreams; do
|
||||
if device_is_bridge "$downstream"; then
|
||||
echo 0 > /sys/class/net/$downstream/bridge/multicast_snooping
|
||||
echo $snooping > /sys/class/net/$downstream/bridge/multicast_snooping
|
||||
fi
|
||||
done
|
||||
@@ -302,7 +300,12 @@ config_mcproxy_instance() {
|
||||
# for snooping to work we should enable it on the bridge, doing it from
|
||||
# here instead of from inside network config
|
||||
if [ "$downstreams" != "$snooping_bridges" ]; then
|
||||
config_sysfs_mcast_snooping "$downstreams" 1
|
||||
if [ "$mcast_mode" == "0" ]; then
|
||||
config_sysfs_mcast_snooping "$downstreams" 0
|
||||
else
|
||||
config_sysfs_mcast_snooping "$downstreams" 1
|
||||
fi
|
||||
|
||||
[ -n $fast_leave ] &&
|
||||
config_sysfs_mcast_fastleave "$downstreams" "$fast_leave"
|
||||
config_sysfs_mcast_flood "$downstreams" "$mcast_mode"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netmode
|
||||
PKG_VERSION:=0.3.0
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
config netmode global
|
||||
option enabled 0
|
||||
# option mode 'router'
|
||||
|
||||
#config testnet testnet
|
||||
# option enabled 1
|
||||
# option destination '8.8.8.8'
|
||||
|
||||
#config shiftrange shiftrange
|
||||
# option enabled 1
|
||||
|
||||
@@ -1,252 +0,0 @@
|
||||
#!/bin/sh
|
||||
# this scripts shifts the lan network prefixes
|
||||
# if a wan interface has the same network prefix.
|
||||
|
||||
# do not shift range if the feature is explicitly disabled
|
||||
[ "$(uci -q get netmode.shiftrange.enabled)" == "0" ] && exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
|
||||
LOCKFILE="/tmp/70-shiftrange.lock"
|
||||
RESTRICTED_NETS=""
|
||||
ALL_NETS=""
|
||||
|
||||
#####
|
||||
##### initial functions
|
||||
#####
|
||||
|
||||
initial_check()
|
||||
{
|
||||
# run only on ifup
|
||||
[ "$ACTION" == "ifup" ] || exit 0
|
||||
|
||||
# run only for uplink (not is_lan) interfaces
|
||||
local islan="$(uci -q get network.$INTERFACE.is_lan)"
|
||||
[ "$islan" != "1" ] || exit 0
|
||||
|
||||
# run only if the uplink interface has a configured protocol
|
||||
local proto="$(uci -q get network.$INTERFACE.proto)"
|
||||
[ "$proto" != "none" ] || exit 0
|
||||
}
|
||||
|
||||
finish()
|
||||
{
|
||||
lock -u $LOCKFILE
|
||||
rm -f $LOCKFILE
|
||||
}
|
||||
|
||||
# just one instance of this script at a time
|
||||
just_one_instance()
|
||||
{
|
||||
local counter=0
|
||||
local limit=10
|
||||
|
||||
#wait for the lock to become free
|
||||
while [ -e $LOCKFILE ] ; do
|
||||
sleep 1
|
||||
counter=$((counter + 1))
|
||||
[ "$counter" -gt "$limit" ] && exit 1
|
||||
done
|
||||
|
||||
lock $LOCKFILE
|
||||
trap finish EXIT INT TERM
|
||||
}
|
||||
|
||||
|
||||
#####
|
||||
##### helper functions
|
||||
#####
|
||||
|
||||
#given a an ip and a mask in the form of "192.168.1.1/24"
|
||||
#return the network address like "192.168.1.0/24"
|
||||
get_network_address()
|
||||
{
|
||||
local ip="$1"
|
||||
[ -z "$ip" ] && return
|
||||
|
||||
local prefix=${ip##*/}
|
||||
|
||||
local ip1=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip2=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip3=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip4=${ip%%/*}
|
||||
|
||||
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
|
||||
local mask=$((0xFFFFFFFF >> (32 - $prefix) << (32 - $prefix)))
|
||||
local network=$(($ip & $mask))
|
||||
|
||||
local n1=$((($network & 0xFF000000) >> 24))
|
||||
local n2=$((($network & 0x00FF0000) >> 16))
|
||||
local n3=$((($network & 0x0000FF00) >> 8))
|
||||
local n4=$(( $network & 0x000000FF))
|
||||
|
||||
echo "$n1.$n2.$n3.$n4/$prefix"
|
||||
}
|
||||
|
||||
#given a network address (192.168.1.0/24)
|
||||
#find the next network address (192.168.2.0/24)
|
||||
next_network_address()
|
||||
{
|
||||
local ip=$1
|
||||
local prefix=${ip##*/}
|
||||
|
||||
local ip1=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip2=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip3=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip4=${ip%%/*}
|
||||
|
||||
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
|
||||
local one="$((1 << (32-$prefix)))"
|
||||
local new=$(($ip + $one))
|
||||
|
||||
local n1=$((($new & 0xFF000000) >> 24))
|
||||
local n2=$((($new & 0x00FF0000) >> 16))
|
||||
local n3=$((($new & 0x0000FF00) >> 8))
|
||||
local n4=$(( $new & 0x000000FF))
|
||||
|
||||
echo "$n1.$n2.$n3.$n4/$prefix"
|
||||
}
|
||||
|
||||
# given a network address and a prefix (192.168.2.0/24)
|
||||
# return the first host ip available (192.168.2.1)
|
||||
first_host_in_network ()
|
||||
{
|
||||
local ip=$1
|
||||
local prefix=${ip##*/}
|
||||
|
||||
local ip1=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip2=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip3=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip4=${ip%%/*}
|
||||
|
||||
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
|
||||
local new=$(($ip + 1))
|
||||
|
||||
local n1=$((($new & 0xFF000000) >> 24))
|
||||
local n2=$((($new & 0x00FF0000) >> 16))
|
||||
local n3=$((($new & 0x0000FF00) >> 8))
|
||||
local n4=$(( $new & 0x000000FF))
|
||||
|
||||
echo "$n1.$n2.$n3.$n4"
|
||||
}
|
||||
|
||||
# given a network address,
|
||||
# find the next available network address.
|
||||
shift_range()
|
||||
{
|
||||
local net="$1"
|
||||
while true ; do
|
||||
if [ "$RESTRICTED_NETS" == "${RESTRICTED_NETS//$net/}" ] && [ "$ALL_NETS" == "${ALL_NETS//$net/}" ]; then
|
||||
# found a net that is not in restricted nets nor in all nets
|
||||
break
|
||||
fi
|
||||
net=$(next_network_address $net)
|
||||
done
|
||||
|
||||
echo "$net"
|
||||
}
|
||||
|
||||
|
||||
#####
|
||||
##### parse all interfaces section
|
||||
#####
|
||||
|
||||
# RESTRICTED_NETS = all the IPs on wan interfaces
|
||||
# ALL_NETS = all the IPs on any interface
|
||||
parse_interface()
|
||||
{
|
||||
local interface=$1
|
||||
local nets="" # "192.168.1.1/24"
|
||||
local networks="" # "192.168.1.0/24"
|
||||
|
||||
config_get is_lan $interface is_lan
|
||||
network_get_subnets nets $interface
|
||||
|
||||
for n in $nets ; do
|
||||
networks="$networks $(get_network_address $n)"
|
||||
done
|
||||
|
||||
[ "$is_lan" != "1" ] && RESTRICTED_NETS="$RESTRICTED_NETS $networks"
|
||||
ALL_NETS="$ALL_NETS $networks"
|
||||
}
|
||||
|
||||
# parse all the interfaces
|
||||
# get all the IPs on wan interfaces and store them in restrict_nets
|
||||
# get all the IPs on all interfaces and store them in ALL_NETS
|
||||
parse_interfaces()
|
||||
{
|
||||
config_foreach parse_interface "interface"
|
||||
}
|
||||
|
||||
|
||||
#####
|
||||
##### parse all lan interfaces section
|
||||
#####
|
||||
|
||||
parse_lan()
|
||||
{
|
||||
local interface=$1
|
||||
local nets=""
|
||||
local ips=""
|
||||
local newips=""
|
||||
local ips_changed=0
|
||||
|
||||
[ "$interface" == "loopback" ] && return
|
||||
config_get is_lan $interface is_lan
|
||||
[ "$is_lan" == "1" ] || return
|
||||
|
||||
network_get_subnets ips $interface
|
||||
|
||||
for ip in $ips ; do
|
||||
net="$(get_network_address $ip)"
|
||||
|
||||
if [ "$RESTRICTED_NETS" == "${RESTRICTED_NETS//$net/}" ] ; then
|
||||
# net is not in restricted nets
|
||||
# append ip to newips
|
||||
[ -z "$newips" ] && newips="${ip%/*}" || newips="$newips ${ip%/*}"
|
||||
continue
|
||||
fi
|
||||
|
||||
#net is in RESTRICTED_NETS
|
||||
local newnet=$(shift_range $net)
|
||||
local newip="$(first_host_in_network $newnet)"
|
||||
# append newip to newips
|
||||
[ -z "$newips" ] && newips="$newip" || newips="$newips $newip"
|
||||
|
||||
ips_changed=1
|
||||
logger "$0: Changing the ip on interface $interface from $ip to $newip/${newnet##*/}"
|
||||
echo "$0: Changing the ip on interface $interface from $ip to $newip/${newnet##*/}" >/dev/console
|
||||
done
|
||||
|
||||
#assign the new ips
|
||||
if [ "$ips_changed" == "1" ] ; then
|
||||
uci -q set network.$interface.ipaddr="$newips"
|
||||
fi
|
||||
}
|
||||
|
||||
# parse all the interface with is_lan=1
|
||||
parse_lans()
|
||||
{
|
||||
config_foreach parse_lan "interface"
|
||||
}
|
||||
|
||||
#####
|
||||
##### main
|
||||
#####
|
||||
|
||||
main()
|
||||
{
|
||||
initial_check
|
||||
just_one_instance
|
||||
|
||||
config_load network
|
||||
parse_interfaces
|
||||
parse_lans
|
||||
|
||||
if [ -n "$(uci changes network)" ] ; then
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
||||
114
netmode/files/etc/uci-defaults/netmode.l2mode
Normal file
114
netmode/files/etc/uci-defaults/netmode.l2mode
Normal file
@@ -0,0 +1,114 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
source "/etc/device_info"
|
||||
|
||||
l2_mcast_config() {
|
||||
# configure L2 mcast config for snooping
|
||||
logger -s -p user.info -t "netmode" "Generating L2 mcast configuration"
|
||||
|
||||
# remove proxy sections
|
||||
uci -q delete mcast.igmp_proxy_1
|
||||
uci -q delete mcast.mc_proxy_MLD
|
||||
|
||||
# add igmp_snooping section
|
||||
uci -q set mcast.igmp_snooping_1=snooping
|
||||
uci -q set mcast.igmp_snooping_1.enable='1'
|
||||
uci -q set mcast.igmp_snooping_1.proto='igmp'
|
||||
uci -q set mcast.igmp_snooping_1.version='2'
|
||||
uci -q set mcast.igmp_snooping_1.robustness='2'
|
||||
uci -q set mcast.igmp_snooping_1.query_interval='125'
|
||||
uci -q set mcast.igmp_snooping_1.query_response_interval='100'
|
||||
uci -q set mcast.igmp_snooping_1.last_member_query_interval='10'
|
||||
uci -q set mcast.igmp_snooping_1.fast_leave='1'
|
||||
uci -q set mcast.igmp_snooping_1.snooping_mode='2'
|
||||
uci -q set mcast.igmp_snooping_1.interface='br-lan'
|
||||
uci -q add_list mcast.igmp_snooping_1.filter='239.0.0.0/8'
|
||||
|
||||
# add mld_snooping section
|
||||
uci -q set mcast.mld_snooping_1=snooping
|
||||
uci -q set mcast.mld_snooping_1.enable='1'
|
||||
uci -q set mcast.mld_snooping_1.proto='mld'
|
||||
uci -q set mcast.mld_snooping_1.version='2'
|
||||
uci -q set mcast.mld_snooping_1.robustness='2'
|
||||
uci -q set mcast.mld_snooping_1.query_interval='125'
|
||||
uci -q set mcast.mld_snooping_1.query_response_interval='100'
|
||||
uci -q set mcast.mld_snooping_1.last_member_query_interval='10'
|
||||
uci -q set mcast.mld_snooping_1.fast_leave='1'
|
||||
uci -q set mcast.mld_snooping_1.snooping_mode='2'
|
||||
uci -q set mcast.mld_snooping_1.interface='br-lan'
|
||||
|
||||
uci -q commit mcast
|
||||
}
|
||||
|
||||
l2_network_config() {
|
||||
logger -s -p user.info -t "netmode" "Generating L2 network configuration"
|
||||
|
||||
# Configure L2 Network Mode
|
||||
uci -q delete network.lan
|
||||
uci -q delete network.wan
|
||||
uci -q delete network.wan6
|
||||
uci -q set network.lan=interface
|
||||
uci -q set network.lan.proto='dhcp'
|
||||
uci -q set network.lan.device='br-lan'
|
||||
uci -q set network.lan.force_link='1'
|
||||
uci -q set network.lan6=interface
|
||||
uci -q set network.lan6.proto='dhcpv6'
|
||||
uci -q set network.lan6.device='@lan'
|
||||
uci -q set network.lan6.reqprefix='no'
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
|
||||
add_port_to_br_lan() {
|
||||
port="$1"
|
||||
[ -n "$port" -a -d /sys/class/net/$port ] || continue
|
||||
uci add_list network.br_lan.ports="$port"
|
||||
}
|
||||
|
||||
if [ -f /etc/board.json ]; then
|
||||
json_load_file /etc/board.json
|
||||
json_select network
|
||||
json_select lan
|
||||
if json_is_a ports array; then
|
||||
json_for_each_item add_port_to_br_lan ports
|
||||
else
|
||||
json_get_var device device
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
fi
|
||||
json_select ..
|
||||
json_select wan 2>/dev/null
|
||||
json_get_var device device
|
||||
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
|
||||
json_cleanup
|
||||
fi
|
||||
|
||||
uci -q commit network
|
||||
|
||||
# Disable DHCP Server
|
||||
uci -q set dhcp.lan.ignore=1
|
||||
uci -q commit dhcp
|
||||
/etc/init.d/odhcpd disable
|
||||
|
||||
# Disable SSDPD
|
||||
uci -q set ssdpd.ssdp.enabled="0"
|
||||
uci -q commit ssdpd
|
||||
|
||||
# Update CWMP Agent WAN Interface
|
||||
uci -q set cwmp.cpe.default_wan_interface="lan"
|
||||
uci -q commit cwmp
|
||||
|
||||
# disable firewall
|
||||
uci -q set firewall.globals.enabled="0"
|
||||
uci -q commit firewall
|
||||
}
|
||||
|
||||
network_mode="$(fw_printenv -n netmode 2>/dev/null)"
|
||||
|
||||
case "$network_mode" in
|
||||
layer2|extender)
|
||||
l2_network_config
|
||||
l2_mcast_config
|
||||
;;
|
||||
esac
|
||||
@@ -22,4 +22,12 @@ config OBUSPA_CONTROLLER_MTP_VERIFY
|
||||
config OBUSPA_ENABLE_TEST_CONTROLLER
|
||||
bool "Adds a test controller by default"
|
||||
default n
|
||||
|
||||
config OBUSPA_MAX_CONTROLLERS_NUM
|
||||
int "The maximum number of controllers to be supported"
|
||||
range 1 10
|
||||
default 5
|
||||
help
|
||||
This value must be in range of 1 to 10. (default 5)
|
||||
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=7.0.5.5
|
||||
PKG_VERSION:=7.0.5.6.3
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||
PKG_SOURCE_VERSION:=ad32d70ccbe3942b945bf6caf74988bd5660cf96
|
||||
PKG_SOURCE_VERSION:=0bb1ddd46e4a2abf93dadfc34e6bc44bf6a3f063
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -32,7 +32,7 @@ define Package/obuspa
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=USP agent
|
||||
MENU:=1
|
||||
DEPENDS:=+libopenssl +libuci +libblobmsg-json +libcurl +libsqlite3 +libubox +libubus +libmosquitto-ssl +libwebsockets-openssl
|
||||
DEPENDS:=+libopenssl +libuci +libblobmsg-json +libcurl +libsqlite3 +libubox +libubus +libmosquitto-ssl +libwebsockets-openssl +ca-certificates
|
||||
endef
|
||||
|
||||
define Package/obuspa/description
|
||||
@@ -81,10 +81,14 @@ else
|
||||
CMAKE_OPTIONS += -DENABLE_WEBSOCKETS=OFF
|
||||
endif
|
||||
|
||||
ifdef $(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
|
||||
TARGET_CFLAGS += -DOBUSPA_MAX_CONTROLLERS_NUM=$(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
|
||||
$(Build/Patch)
|
||||
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
|
||||
$(Build/Patch)
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ config obuspa 'global'
|
||||
option db_file '/etc/obuspa/usp.db'
|
||||
option role_file '/etc/obuspa/roles.json'
|
||||
option dm_caching_exclude '/etc/obuspa/dmcaching_exclude.json'
|
||||
#option trust_cert '/etc/obuspa/rootCA.pem'
|
||||
#option trust_cert '/etc/ssl/cert.pem'
|
||||
#option client_cert '/etc/obuspa/client.pem'
|
||||
#option log_dest '/tmp/obuspa.log'
|
||||
|
||||
|
||||
@@ -92,10 +92,10 @@ get_base_path()
|
||||
count=0
|
||||
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
path=$(grep "${refpath}\d.Alias \"${value}\"" ${DB_DUMP})
|
||||
path=$(grep -E "${refpath}\d+.Alias \"${value}\"" ${DB_DUMP})
|
||||
path=${path%.*}
|
||||
if [ -z "${path}" ]; then
|
||||
path=$(grep -o "${refpath}\d" ${DB_DUMP} |sort -r|head -n 1)
|
||||
path=$(grep -oE "${refpath}\d+" ${DB_DUMP} |sort -r|head -n 1)
|
||||
if [ -n "${path}" ]; then
|
||||
count=${path##*.}
|
||||
count=$(( count + 1 ))
|
||||
@@ -122,9 +122,9 @@ get_refrence_path()
|
||||
path=""
|
||||
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
path=$(grep "${dmref}\d.Alias " ${DB_DUMP}|grep -w "${value}")
|
||||
path=$(grep -E "${dmref}\d+.Alias " ${DB_DUMP}|grep -w "${value}")
|
||||
elif [ -f "${RESET_FILE}" ]; then
|
||||
path=$(grep "${dmref}\d.Alias " ${RESET_FILE}|grep -w "${value}")
|
||||
path=$(grep -E "${dmref}\d+.Alias " ${RESET_FILE}|grep -w "${value}")
|
||||
fi
|
||||
path=${path%.*}
|
||||
echo "${path}"
|
||||
@@ -217,12 +217,10 @@ validate_controller_section()
|
||||
'Enable:bool:1' \
|
||||
'EndpointID:string' \
|
||||
'assigned_role_name:string' \
|
||||
'AssignedRole:string' \
|
||||
'Protocol:or("STOMP","CoAP","MQTT", "WebSocket")' \
|
||||
'Destination:string' \
|
||||
'Topic:string' \
|
||||
'ParameterName:list(string)' \
|
||||
'Reference:string' \
|
||||
'mqtt:string' \
|
||||
'stomp:string' \
|
||||
'Host:string' \
|
||||
@@ -230,7 +228,7 @@ validate_controller_section()
|
||||
'Path:string' \
|
||||
'EnableEncryption:bool' \
|
||||
'PeriodicNotifInterval:uinteger' \
|
||||
'SessionMode:string:Allow' \
|
||||
'SessionMode:string' \
|
||||
'ProvisioningCode:string'
|
||||
}
|
||||
|
||||
@@ -255,7 +253,6 @@ validate_mtp_section()
|
||||
'Path:string' \
|
||||
'mqtt:string' \
|
||||
'stomp:string' \
|
||||
'Reference:string' \
|
||||
'PublishQoS:uinteger' \
|
||||
'EnableEncryption:bool'
|
||||
}
|
||||
@@ -324,7 +321,7 @@ configure_controller()
|
||||
local EndpointID Enable
|
||||
local Protocol Destination
|
||||
local Topic mqtt stomp assigned_role_name AssignedRole ParameterName ProvisioningCode
|
||||
local Host Port Path EnableEncryption Reference SessionMode PeriodicNotifInterval
|
||||
local Host Port Path EnableEncryption PeriodicNotifInterval
|
||||
local dm_ref sec
|
||||
|
||||
sec="${1}"
|
||||
@@ -346,16 +343,12 @@ configure_controller()
|
||||
fi
|
||||
|
||||
dm_ref=""
|
||||
if [ -z "${Reference}" ]; then
|
||||
if [ "${Protocol}" = "STOMP" ]; then
|
||||
stomp="${stomp/stomp_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||
elif [ "${Protocol}" = "MQTT" ]; then
|
||||
mqtt="${mqtt/mqtt_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||
fi
|
||||
else
|
||||
dm_ref="${Reference}"
|
||||
if [ "${Protocol}" = "STOMP" ]; then
|
||||
stomp="${stomp/stomp_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||
elif [ "${Protocol}" = "MQTT" ]; then
|
||||
mqtt="${mqtt/mqtt_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.Alias" "${sec}"
|
||||
@@ -370,16 +363,15 @@ configure_controller()
|
||||
db_set "${BASEPATH}.PeriodicNotifInterval" "${PeriodicNotifInterval}"
|
||||
fi
|
||||
|
||||
if [ -n "${SessionMode}" ]; then
|
||||
db_set "${BASEPATH}.E2ESession.SessionMode" "${SessionMode}"
|
||||
fi
|
||||
#if [ -n "${SessionMode}" ]; then
|
||||
# db_set "${BASEPATH}.E2ESession.SessionMode" "${SessionMode}"
|
||||
#fi
|
||||
|
||||
if [ -n "${assigned_role_name}" ]; then
|
||||
AssignedRole=$(get_role_index "${assigned_role_name}")
|
||||
fi
|
||||
|
||||
if [ -n "${AssignedRole}" ]; then
|
||||
db_set "${BASEPATH}.AssignedRole" "${AssignedRole}"
|
||||
if [ -n "${AssignedRole}" ]; then
|
||||
db_set "${BASEPATH}.AssignedRole" "${AssignedRole}"
|
||||
fi
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.MTP.1.Alias" "${sec}"
|
||||
@@ -559,16 +551,12 @@ configure_mtp() {
|
||||
fi
|
||||
|
||||
dm_ref=""
|
||||
if [ -z "${Reference}" ]; then
|
||||
if [ "${Protocol}" = "STOMP" ]; then
|
||||
stomp="${stomp/stomp_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||
elif [ "${Protocol}" = "MQTT" ]; then
|
||||
mqtt="${mqtt/mqtt_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||
fi
|
||||
else
|
||||
dm_ref="${Reference}"
|
||||
if [ "${Protocol}" = "STOMP" ]; then
|
||||
stomp="${stomp/stomp_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||
elif [ "${Protocol}" = "MQTT" ]; then
|
||||
mqtt="${mqtt/mqtt_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.Alias" "${sec}"
|
||||
@@ -728,13 +716,13 @@ get_instances_from_db_dump()
|
||||
{
|
||||
local obj inst
|
||||
|
||||
obj="${1}\d"
|
||||
obj="${1}\d+"
|
||||
if [ ! -f "${DB_DUMP}" ]; then
|
||||
echo ""
|
||||
return 0;
|
||||
fi
|
||||
|
||||
inst="$(grep -oe "${obj}" "${DB_DUMP}"|uniq)"
|
||||
inst="$(grep -oE "${obj}" "${DB_DUMP}"|uniq)"
|
||||
echo "$inst"
|
||||
}
|
||||
|
||||
@@ -776,8 +764,8 @@ sync_db_controller()
|
||||
{
|
||||
local cntrs copts sec pvalue protocol
|
||||
|
||||
copts="Enable EndpointID AssignedRole PeriodicNotifInterval"
|
||||
popts="Destination Topic Reference Host Port Path EnableEncryption"
|
||||
copts="Enable EndpointID PeriodicNotifInterval"
|
||||
popts="Destination Topic Host Port Path EnableEncryption"
|
||||
|
||||
cntrs="$(get_instances_from_db_dump Device.LocalAgent.Controller.)"
|
||||
for cntr in $cntrs; do
|
||||
@@ -809,8 +797,7 @@ sync_db_localagent_mtp()
|
||||
local mtps opts popts sec pvalue protocol
|
||||
|
||||
opts="Enable"
|
||||
popts="ResponseTopicConfigured Destination Port Path Reference EnableEncryption PublishQoS"
|
||||
ropts="mqtt stomp"
|
||||
popts="ResponseTopicConfigured Destination Port Path EnableEncryption PublishQoS"
|
||||
|
||||
mtps="$(get_instances_from_db_dump Device.LocalAgent.MTP.)"
|
||||
for inst in $mtps; do
|
||||
@@ -833,9 +820,6 @@ sync_db_localagent_mtp()
|
||||
pvalue="$(get_param_value_from_dump "${inst}"."${protocol}"."${param}")"
|
||||
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
||||
done
|
||||
for param in ${ropts}; do
|
||||
uci_set obuspa "${sec}" "${param}" ""
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
@@ -942,7 +926,7 @@ check_n_delete_db()
|
||||
r="${3}"
|
||||
sec="${sec/${t}_/cpe-}"
|
||||
|
||||
path=$(grep "${r}\d.Alias \"${sec}\"" ${DB_DUMP})
|
||||
path=$(grep -E "${r}\d+.Alias \"${sec}\"" ${DB_DUMP})
|
||||
path=${path%.*}
|
||||
|
||||
delete_sql_db_entry_with_pattern "${path}"
|
||||
@@ -1002,6 +986,9 @@ db_init()
|
||||
reverse_update_db_with_uci
|
||||
fi
|
||||
|
||||
# Remove ControllerTrust.Role., if present in db for backward compatibility
|
||||
delete_sql_db_entry_with_pattern "Device.LocalAgent.ControllerTrust.Role."
|
||||
|
||||
# Remove reset file if present
|
||||
[ -f "${RESET_FILE}" ] && mv ${RESET_FILE} ${RESET_FILE}.old
|
||||
|
||||
@@ -1034,11 +1021,17 @@ db_init()
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled
|
||||
local enabled role_file
|
||||
|
||||
mkdir -p /tmp/obuspa/
|
||||
config_load obuspa
|
||||
config_get_bool enabled global enabled 0
|
||||
config_get role_file global role_file ""
|
||||
# Use the default role file if not defined in uci, but present in path
|
||||
if [ -z "${role_file}" ] && [ -f "/etc/obuspa/roles.json" ] ; then
|
||||
uci -q set obuspa.global.role_file="/etc/obuspa/roles.json"
|
||||
uci_commit obuspa
|
||||
fi
|
||||
|
||||
procd_open_instance ${CONFIGURATION}
|
||||
if [ "${enabled}" -eq 1 ]; then
|
||||
|
||||
@@ -82,6 +82,17 @@
|
||||
"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": [
|
||||
@@ -544,6 +555,23 @@
|
||||
"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"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -553,8 +581,7 @@
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_NONE",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
"PERMIT_NONE"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -567,66 +594,6 @@
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Time.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.UPnP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Bridging.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Ethernet.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DHCPv4.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DHCPv6.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Hosts.",
|
||||
"perm": [
|
||||
@@ -638,34 +605,18 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.NAT.",
|
||||
"object":"Device.Hosts.AccessControl.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.PPP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Routing.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -679,13 +630,12 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.InterfaceStack.",
|
||||
"object": "Device.IP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
"PERMIT_CMD_INFO"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -698,56 +648,6 @@
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.LANConfigSecurity.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Security.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.RouterAdvertisement.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Services.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.UserInterface.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.PeriodicStatistics.",
|
||||
"perm": [
|
||||
@@ -758,27 +658,6 @@
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.SoftwareModules.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Users.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.Subscription.",
|
||||
"perm": [
|
||||
@@ -805,30 +684,16 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DNS.",
|
||||
"object": "Device.WiFi.AccessPoint.{i}.WPS.InitiateWPSPBC()",
|
||||
"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.IP.",
|
||||
"object": "Device.WiFi.DataElements.Network.SetSSID()",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,29 +1,69 @@
|
||||
--- a/src/core/cli_server.c
|
||||
+++ b/src/core/cli_server.c
|
||||
@@ -787,6 +787,7 @@ int ExecuteCli_Set(char *arg1, char *arg
|
||||
@@ -780,6 +780,7 @@ int ExecuteCli_Set(char *arg1, char *arg
|
||||
goto exit;
|
||||
}
|
||||
|
||||
+ SetControllerRoleForInternal();
|
||||
// Iterate over all objects to set
|
||||
for (i=0; i < objects.num_entries; i++)
|
||||
{
|
||||
// Exit if unable to start a transaction
|
||||
err = DM_TRANS_Start(&trans);
|
||||
if (err != USP_ERR_OK)
|
||||
@@ -865,6 +866,7 @@ int ExecuteCli_Add(char *arg1, char *arg
|
||||
goto exit;
|
||||
}
|
||||
|
||||
+ SetControllerRoleForInternal();
|
||||
// Exit if unable to start a transaction
|
||||
err = DM_TRANS_Start(&trans);
|
||||
if (err != USP_ERR_OK)
|
||||
@@ -976,6 +978,7 @@ int ExecuteCli_Del(char *arg1, char *arg
|
||||
goto exit;
|
||||
}
|
||||
|
||||
+ SetControllerRoleForInternal();
|
||||
// Exit if unable to start a transaction
|
||||
err = DM_TRANS_Start(&trans);
|
||||
if (err != USP_ERR_OK)
|
||||
--- a/src/core/data_model.h
|
||||
+++ b/src/core/data_model.h
|
||||
@@ -325,6 +325,7 @@ void DATA_MODEL_DumpSchema(void);
|
||||
@@ -325,6 +325,8 @@ void DATA_MODEL_DumpSchema(void);
|
||||
void DATA_MODEL_DumpInstances(void);
|
||||
char DATA_MODEL_GetJSONParameterType(char *path);
|
||||
int DATA_MODEL_SetParameterInDatabase(char *path, char *value);
|
||||
+void SetControllerRoleForInternal();
|
||||
+void SetControllerDummyID();
|
||||
|
||||
int DM_PRIV_InitSetRequest(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst, char *new_value);
|
||||
void DM_PRIV_RequestInit(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst);
|
||||
--- a/src/core/dm_exec.c
|
||||
+++ b/src/core/dm_exec.c
|
||||
@@ -1207,6 +1207,7 @@ void ProcessMessageQueueSocketActivity(s
|
||||
return;
|
||||
}
|
||||
|
||||
+ SetControllerDummyID(); // To make sure session handler does not break with internal services
|
||||
switch(msg.type)
|
||||
{
|
||||
case kDmExecMsg_ProcessUspRecord:
|
||||
--- a/src/core/msg_handler.c
|
||||
+++ b/src/core/msg_handler.c
|
||||
@@ -902,6 +902,20 @@ char *MtpSendItemToString(mtp_send_item_
|
||||
@@ -902,6 +902,34 @@ char *MtpSendItemToString(mtp_send_item_
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
+** SetControllerDummyID
|
||||
+**
|
||||
+** Sets the role for internal user
|
||||
+**
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+void SetControllerDummyID()
|
||||
+{
|
||||
+ cur_msg_controller_info.endpoint_id = "CLI_Utility";
|
||||
+}
|
||||
+
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** SetControllerRoleForInternal
|
||||
+**
|
||||
+** Sets the role for internal user
|
||||
@@ -34,6 +74,7 @@
|
||||
+{
|
||||
+ cur_msg_combined_role.inherited = kCTrustRole_Untrusted;
|
||||
+ cur_msg_combined_role.assigned = kCTrustRole_FullAccess;
|
||||
+ SetControllerDummyID();
|
||||
+}
|
||||
+
|
||||
+/*********************************************************************//**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/core/bdc_exec.c
|
||||
+++ b/src/core/bdc_exec.c
|
||||
@@ -547,11 +547,19 @@ int StartSendingReport(bdc_connection_t
|
||||
@@ -547,11 +547,19 @@
|
||||
|
||||
// Set the list of headers
|
||||
bc->headers = NULL;
|
||||
@@ -25,7 +25,7 @@
|
||||
{
|
||||
--- a/src/core/bdc_exec.h
|
||||
+++ b/src/core/bdc_exec.h
|
||||
@@ -53,6 +53,9 @@ void BDC_EXEC_ScheduleExit(void);
|
||||
@@ -53,6 +53,9 @@
|
||||
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
|
||||
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
|
||||
#define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post.
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
|
||||
// Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
@@ -153,6 +156,7 @@ static char *profile_push_event_args[] =
|
||||
@@ -153,6 +156,7 @@
|
||||
typedef struct
|
||||
{
|
||||
int num_retained_failed_reports;
|
||||
@@ -60,7 +60,7 @@
|
||||
char report_timestamp[33];
|
||||
char url[1025];
|
||||
char username[257];
|
||||
@@ -161,6 +165,11 @@ typedef struct
|
||||
@@ -161,6 +165,11 @@
|
||||
char method[9];
|
||||
bool use_date_header;
|
||||
char report_format[20];
|
||||
@@ -72,7 +72,7 @@
|
||||
} profile_ctrl_params_t;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -208,6 +217,7 @@ int Validate_BulkDataEncodingType(dm_req
|
||||
@@ -208,6 +217,7 @@
|
||||
int Validate_BulkDataReportingInterval(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReference(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReportFormat(dm_req_t *req, char *value);
|
||||
@@ -80,7 +80,7 @@
|
||||
int Validate_BulkDataReportTimestamp(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataCompression(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
|
||||
@@ -236,6 +246,8 @@ bulkdata_profile_t *bulkdata_find_profil
|
||||
@@ -236,6 +246,8 @@
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
|
||||
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
|
||||
char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
|
||||
@@ -89,15 +89,16 @@
|
||||
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
|
||||
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
|
||||
int bulkdata_start_profile(bulkdata_profile_t *bp);
|
||||
@@ -250,6 +262,7 @@ char *bulkdata_platform_calc_uri_query_s
|
||||
@@ -250,6 +262,8 @@
|
||||
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
|
||||
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv);
|
||||
void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map);
|
||||
+void append_string_to_target(char *str, char **output);
|
||||
+char *csv_encode(const char *str);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
@@ -282,7 +295,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
@@ -282,7 +296,7 @@
|
||||
err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT);
|
||||
err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols));
|
||||
@@ -106,7 +107,7 @@
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT);
|
||||
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT);
|
||||
@@ -297,7 +310,7 @@ int DEVICE_BULKDATA_Init(void)
|
||||
@@ -297,7 +311,7 @@
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING);
|
||||
@@ -115,7 +116,7 @@
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME);
|
||||
|
||||
@@ -312,6 +325,13 @@ int DEVICE_BULKDATA_Init(void)
|
||||
@@ -312,6 +326,13 @@
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
|
||||
|
||||
@@ -129,7 +130,7 @@
|
||||
// Device.BulkData.Profile.{i}.HTTP
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
|
||||
@@ -591,9 +611,10 @@ int Validate_BulkDataProtocol(dm_req_t *
|
||||
@@ -591,9 +612,10 @@
|
||||
int Validate_BulkDataEncodingType(dm_req_t *req, char *value)
|
||||
{
|
||||
// Exit if trying to set a value outside of the range we accept
|
||||
@@ -142,7 +143,7 @@
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -676,6 +697,32 @@ int Validate_BulkDataReportFormat(dm_req
|
||||
@@ -676,6 +698,32 @@
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
@@ -175,7 +176,7 @@
|
||||
** Validate_BulkDataReportTimestamp
|
||||
**
|
||||
** Validates Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
@@ -1970,6 +2017,14 @@ int bulkdata_platform_get_profile_contro
|
||||
@@ -1970,6 +2018,14 @@
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -190,7 +191,7 @@
|
||||
// Exit if unable to get ReportTimestamp
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
|
||||
@@ -1986,6 +2041,46 @@ int bulkdata_platform_get_profile_contro
|
||||
@@ -1986,6 +2042,46 @@
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -237,7 +238,7 @@
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
@@ -2222,7 +2317,7 @@ void bulkdata_process_profile_http(bulkd
|
||||
@@ -2222,7 +2318,7 @@
|
||||
{
|
||||
int err;
|
||||
report_t *cur_report;
|
||||
@@ -246,7 +247,7 @@
|
||||
profile_ctrl_params_t ctrl;
|
||||
unsigned char *compressed_report;
|
||||
int compressed_len;
|
||||
@@ -2261,10 +2356,23 @@ void bulkdata_process_profile_http(bulkd
|
||||
@@ -2261,10 +2357,23 @@
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
@@ -274,7 +275,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2273,14 +2381,14 @@ void bulkdata_process_profile_http(bulkd
|
||||
@@ -2273,14 +2382,14 @@
|
||||
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
|
||||
if (enable_protocol_trace)
|
||||
{
|
||||
@@ -293,7 +294,7 @@
|
||||
}
|
||||
// NOTE: From this point on, only the compressed_report exists
|
||||
|
||||
@@ -2310,9 +2418,15 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2310,9 +2419,15 @@
|
||||
kv_vector_t event_args;
|
||||
kv_pair_t kv;
|
||||
report_t *cur_report;
|
||||
@@ -310,7 +311,7 @@
|
||||
|
||||
// Exit if the MTP has not been connected to successfully after bootup
|
||||
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
|
||||
@@ -2321,20 +2435,62 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2321,20 +2436,62 @@
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -384,7 +385,7 @@
|
||||
}
|
||||
|
||||
// When sending via USP events, only one report is ever sent in each USP event
|
||||
@@ -2354,10 +2510,16 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2354,10 +2511,16 @@
|
||||
bp->num_retained_reports = 1;
|
||||
|
||||
// Exit if unable to generate the report
|
||||
@@ -404,7 +405,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2365,15 +2527,15 @@ void bulkdata_process_profile_usp_event(
|
||||
@@ -2365,15 +2528,15 @@
|
||||
|
||||
// Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add()
|
||||
kv.key = "Data";
|
||||
@@ -423,10 +424,37 @@
|
||||
|
||||
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them
|
||||
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
|
||||
@@ -2835,6 +2997,219 @@ char *bulkdata_generate_json_report(bulk
|
||||
@@ -2835,6 +2998,319 @@
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
+** safe_asprintf
|
||||
+**
|
||||
+** Wrapper around asprintf that calls terminate in case of error
|
||||
+**
|
||||
+** \param strp -- pointer to the output string
|
||||
+** \param fmt -- printing format
|
||||
+**
|
||||
+** \return None
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+static void safe_asprintf(char **strp, const char *fmt, ...)
|
||||
+{
|
||||
+ int ret;
|
||||
+ va_list argp;
|
||||
+
|
||||
+ va_start(argp, fmt);
|
||||
+ ret = vasprintf(strp, fmt, argp);
|
||||
+ va_end(argp);
|
||||
+
|
||||
+ if (ret == -1) {
|
||||
+ USP_ERR_Terminate("%s (%d): asprintf(%s) failed",
|
||||
+ __FUNCTION__, __LINE__, fmt);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** append_string_to_target
|
||||
+**
|
||||
+** concatenates the src string with target string in newly allocated memory
|
||||
@@ -454,10 +482,70 @@
|
||||
+ }
|
||||
+
|
||||
+ assert(tmp != NULL);
|
||||
+ asprintf(output, "%s%s", tmp, str);
|
||||
+ safe_asprintf(output, "%s%s", tmp, str);
|
||||
+ free(tmp);
|
||||
+}
|
||||
+
|
||||
+/*************************************************************************
|
||||
+**
|
||||
+** csv_encode
|
||||
+**
|
||||
+** encodes the src string to CSV specification RFC4180 compliance string
|
||||
+** and assign back the new pointer.
|
||||
+**
|
||||
+** \param str - pointer to the src string
|
||||
+** \return address of the pointer that points to the target string or NULL
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+char *csv_encode(const char *str)
|
||||
+{
|
||||
+ if (str == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ int len = strlen(str);
|
||||
+ if (len == 0)
|
||||
+ return strdup(str);
|
||||
+
|
||||
+ char *temp = NULL;
|
||||
+ // Get the number of '\"' present in the string
|
||||
+ int quote_count = 0;
|
||||
+
|
||||
+ temp = strchr(str, '\"');
|
||||
+ while (temp) {
|
||||
+ quote_count++;
|
||||
+ temp = strchr(temp+1, '\"');
|
||||
+ }
|
||||
+
|
||||
+ int encode_size = len + quote_count + 3; // added 3 for initial quote, end quote & null at end
|
||||
+ temp = (char *)malloc(sizeof(char) * encode_size);
|
||||
+
|
||||
+ if (!temp)
|
||||
+ return NULL;
|
||||
+
|
||||
+ memset(temp, 0, sizeof(char) * encode_size);
|
||||
+
|
||||
+ int i = 0, j = 0;
|
||||
+
|
||||
+ temp[j++] = '\"';
|
||||
+ for (i = 0; i < len; i++) {
|
||||
+ if (str[i] == '\"') {
|
||||
+ if (j > (encode_size - 3))
|
||||
+ break;
|
||||
+
|
||||
+ temp[j++] = '\"';
|
||||
+ }
|
||||
+
|
||||
+ if (j > (encode_size - 3))
|
||||
+ break;
|
||||
+
|
||||
+ temp[j++] = str[i];
|
||||
+ }
|
||||
+
|
||||
+ temp[j] = '\"';
|
||||
+
|
||||
+ return temp;
|
||||
+}
|
||||
+
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** bulkdata_generate_csv_report
|
||||
@@ -502,9 +590,9 @@
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
|
||||
+ if (strcmp(row_timestamp, "None") == 0)
|
||||
+ asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
|
||||
+ safe_asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
|
||||
+ else
|
||||
+ asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
|
||||
+ safe_asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &output);
|
||||
@@ -521,14 +609,18 @@
|
||||
+ // Add Collection time to each csv report element (only if specified and not 'None')
|
||||
+ if (strcmp(row_timestamp, "Unix-Epoch")==0)
|
||||
+ {
|
||||
+ asprintf(×tamp, "%lld", (long long int)report->collection_time);
|
||||
+ safe_asprintf(×tamp, "%lld", (long long int)report->collection_time);
|
||||
+ }
|
||||
+ else if (strcmp(row_timestamp, "ISO-8601")==0)
|
||||
+ {
|
||||
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
+ if (result != NULL)
|
||||
+ {
|
||||
+ asprintf(×tamp, "%s", buf);
|
||||
+ char *val = csv_encode(buf);
|
||||
+ if (val) {
|
||||
+ safe_asprintf(×tamp, "%s", buf);
|
||||
+ free(val);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -579,11 +671,14 @@
|
||||
+ }
|
||||
+
|
||||
+ if (type) {
|
||||
+ char *p_path = csv_encode(param_path);
|
||||
+ char *p_value = csv_encode(param_value);
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
|
||||
+ if (timestamp == NULL)
|
||||
+ asprintf(&str, "%s%c%s%c%s%c", param_path, separator, param_value, separator, type, rowseparator);
|
||||
+ safe_asprintf(&str, "%s%c%s%c%s%c", p_path, separator, p_value, separator, type, rowseparator);
|
||||
+ else
|
||||
+ asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, param_path, separator, param_value, separator, type, rowseparator);
|
||||
+ safe_asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, p_path, separator, p_value, separator, type, rowseparator);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &output);
|
||||
@@ -591,9 +686,9 @@
|
||||
+ str = NULL;
|
||||
+ } else {
|
||||
+ if (str1 == NULL || strlen(str1) == 0)
|
||||
+ asprintf(&str, "%s", param_path);
|
||||
+ safe_asprintf(&str, "%s", p_path);
|
||||
+ else
|
||||
+ asprintf(&str, "%c%s", separator, param_path);
|
||||
+ safe_asprintf(&str, "%c%s", separator, p_path);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str1);
|
||||
@@ -601,15 +696,21 @@
|
||||
+ str = NULL;
|
||||
+
|
||||
+ if (str2 == NULL || strlen(str2) == 0)
|
||||
+ asprintf(&str, "%s", param_value);
|
||||
+ safe_asprintf(&str, "%s", p_value);
|
||||
+ else
|
||||
+ asprintf(&str, "%c%s", separator, param_value);
|
||||
+ safe_asprintf(&str, "%c%s", separator, p_value);
|
||||
+
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str2);
|
||||
+ free(str);
|
||||
+ str = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (p_path)
|
||||
+ free(p_path);
|
||||
+
|
||||
+ if (p_value)
|
||||
+ free(p_value);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -620,7 +721,7 @@
|
||||
+ }
|
||||
+
|
||||
+ if (strcasecmp(csv_format, "ParameterPerColumn") == 0) {
|
||||
+ asprintf(&str, "%c", rowseparator);
|
||||
+ safe_asprintf(&str, "%c", rowseparator);
|
||||
+ assert(str != NULL);
|
||||
+ append_string_to_target(str, &str1);
|
||||
+ append_string_to_target(str, &str2);
|
||||
@@ -643,7 +744,7 @@
|
||||
** bulkdata_compress_report
|
||||
**
|
||||
** Compresses the report to send
|
||||
@@ -2986,9 +3361,18 @@ int bulkdata_schedule_sending_http_repor
|
||||
@@ -2986,9 +3462,18 @@
|
||||
flags |= BDC_FLAG_DATE_HEADER;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c
|
||||
index 8e44f59..a77bd71 100755
|
||||
--- a/src/core/device_bulkdata.c
|
||||
+++ b/src/core/device_bulkdata.c
|
||||
@@ -2995,6 +2995,33 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
return result;
|
||||
}
|
||||
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** safe_asprintf
|
||||
+**
|
||||
+** Wrapper around asprintf that calls terminate in case of error
|
||||
+**
|
||||
+** \param strp -- pointer to the output string
|
||||
+** \param fmt -- printing format
|
||||
+**
|
||||
+** \return None
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+static void safe_asprintf(char **strp, const char *fmt, ...)
|
||||
+{
|
||||
+ int ret;
|
||||
+ va_list argp;
|
||||
+
|
||||
+ va_start(argp, fmt);
|
||||
+ ret = vasprintf(strp, fmt, argp);
|
||||
+ va_end(argp);
|
||||
+
|
||||
+ if (ret == -1) {
|
||||
+ USP_ERR_Terminate("%s (%d): asprintf(%s) failed",
|
||||
+ __FUNCTION__, __LINE__, fmt);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** append_string_to_target
|
||||
@@ -3024,7 +3051,7 @@ void append_string_to_target(char *str, char **output)
|
||||
}
|
||||
|
||||
assert(tmp != NULL);
|
||||
- asprintf(output, "%s%s", tmp, str);
|
||||
+ safe_asprintf(output, "%s%s", tmp, str);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
@@ -3072,9 +3099,9 @@ char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator
|
||||
|
||||
if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
|
||||
if (strcmp(row_timestamp, "None") == 0)
|
||||
- asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
|
||||
+ safe_asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
|
||||
else
|
||||
- asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
|
||||
+ safe_asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
|
||||
|
||||
assert(str != NULL);
|
||||
append_string_to_target(str, &output);
|
||||
@@ -3091,14 +3118,14 @@ char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator
|
||||
// Add Collection time to each csv report element (only if specified and not 'None')
|
||||
if (strcmp(row_timestamp, "Unix-Epoch")==0)
|
||||
{
|
||||
- asprintf(×tamp, "%lld", (long long int)report->collection_time);
|
||||
+ safe_asprintf(×tamp, "%lld", (long long int)report->collection_time);
|
||||
}
|
||||
else if (strcmp(row_timestamp, "ISO-8601")==0)
|
||||
{
|
||||
char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
|
||||
if (result != NULL)
|
||||
{
|
||||
- asprintf(×tamp, "%s", buf);
|
||||
+ safe_asprintf(×tamp, "%s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3151,9 +3178,9 @@ char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator
|
||||
if (type) {
|
||||
if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
|
||||
if (timestamp == NULL)
|
||||
- asprintf(&str, "%s%c%s%c%s%c", param_path, separator, param_value, separator, type, rowseparator);
|
||||
+ safe_asprintf(&str, "%s%c%s%c%s%c", param_path, separator, param_value, separator, type, rowseparator);
|
||||
else
|
||||
- asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, param_path, separator, param_value, separator, type, rowseparator);
|
||||
+ safe_asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, param_path, separator, param_value, separator, type, rowseparator);
|
||||
|
||||
assert(str != NULL);
|
||||
append_string_to_target(str, &output);
|
||||
@@ -3161,9 +3188,9 @@ char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator
|
||||
str = NULL;
|
||||
} else {
|
||||
if (str1 == NULL || strlen(str1) == 0)
|
||||
- asprintf(&str, "%s", param_path);
|
||||
+ safe_asprintf(&str, "%s", param_path);
|
||||
else
|
||||
- asprintf(&str, "%c%s", separator, param_path);
|
||||
+ safe_asprintf(&str, "%c%s", separator, param_path);
|
||||
|
||||
assert(str != NULL);
|
||||
append_string_to_target(str, &str1);
|
||||
@@ -3171,9 +3198,9 @@ char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator
|
||||
str = NULL;
|
||||
|
||||
if (str2 == NULL || strlen(str2) == 0)
|
||||
- asprintf(&str, "%s", param_value);
|
||||
+ safe_asprintf(&str, "%s", param_value);
|
||||
else
|
||||
- asprintf(&str, "%c%s", separator, param_value);
|
||||
+ safe_asprintf(&str, "%c%s", separator, param_value);
|
||||
|
||||
assert(str != NULL);
|
||||
append_string_to_target(str, &str2);
|
||||
@@ -3190,7 +3217,7 @@ char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator
|
||||
}
|
||||
|
||||
if (strcasecmp(csv_format, "ParameterPerColumn") == 0) {
|
||||
- asprintf(&str, "%c", rowseparator);
|
||||
+ safe_asprintf(&str, "%c", rowseparator);
|
||||
assert(str != NULL);
|
||||
append_string_to_target(str, &str1);
|
||||
append_string_to_target(str, &str2);
|
||||
42
obuspa/patches/0011-max_controllers.patch
Normal file
42
obuspa/patches/0011-max_controllers.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
|
||||
index 04a1a9c..8cb2ad7 100644
|
||||
--- a/src/core/mqtt.c
|
||||
+++ b/src/core/mqtt.c
|
||||
@@ -234,6 +234,8 @@ void HandleMqttDisconnect(mqtt_client_t *client);
|
||||
#define DEFINE_MQTT_TrustCertVerifyCallbackIndex(index) \
|
||||
int MQTT_TrustCertVerifyCallback_##index (int preverify_ok, X509_STORE_CTX *x509_ctx) \
|
||||
{\
|
||||
+ if (index >= MAX_MQTT_CLIENTS) \
|
||||
+ return 0; \
|
||||
return DEVICE_SECURITY_TrustCertVerifyCallbackWithCertChain(preverify_ok, x509_ctx, &mqtt_clients[index].cert_chain);\
|
||||
}
|
||||
|
||||
@@ -244,6 +246,11 @@ DEFINE_MQTT_TrustCertVerifyCallbackIndex(1);
|
||||
DEFINE_MQTT_TrustCertVerifyCallbackIndex(2);
|
||||
DEFINE_MQTT_TrustCertVerifyCallbackIndex(3);
|
||||
DEFINE_MQTT_TrustCertVerifyCallbackIndex(4);
|
||||
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(5);
|
||||
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(6);
|
||||
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(7);
|
||||
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(8);
|
||||
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(9);
|
||||
// Add more, with incrementing indexes here, if you change MAX_MQTT_CLIENTS
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
@@ -254,10 +261,15 @@ ssl_verify_callback_t* mqtt_verify_callbacks[] = {
|
||||
MQTT_TrustCertVerifyCallbackIndex(2),
|
||||
MQTT_TrustCertVerifyCallbackIndex(3),
|
||||
MQTT_TrustCertVerifyCallbackIndex(4),
|
||||
+ MQTT_TrustCertVerifyCallbackIndex(5),
|
||||
+ MQTT_TrustCertVerifyCallbackIndex(6),
|
||||
+ MQTT_TrustCertVerifyCallbackIndex(7),
|
||||
+ MQTT_TrustCertVerifyCallbackIndex(8),
|
||||
+ MQTT_TrustCertVerifyCallbackIndex(9),
|
||||
// Add more, with incrementing indexes here, if you change MAX_MQTT_CLIENTS
|
||||
};
|
||||
|
||||
-USP_COMPILEASSERT( ((sizeof(mqtt_verify_callbacks)/sizeof(ssl_verify_callback_t*)) == MAX_MQTT_CLIENTS),
|
||||
+USP_COMPILEASSERT( ((sizeof(mqtt_verify_callbacks)/sizeof(ssl_verify_callback_t*)) >= MAX_MQTT_CLIENTS),
|
||||
"There must be MAX_MQTT_CLIENTS callbacks defined");
|
||||
|
||||
/*********************************************************************//**
|
||||
95
obuspa/patches/0012-check_mqtt_host_alive.patch
Normal file
95
obuspa/patches/0012-check_mqtt_host_alive.patch
Normal file
@@ -0,0 +1,95 @@
|
||||
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
|
||||
index 04a1a9c..00b95a4 100644
|
||||
--- a/src/core/mqtt.c
|
||||
+++ b/src/core/mqtt.c
|
||||
@@ -2124,6 +2124,75 @@ exit:
|
||||
}
|
||||
}
|
||||
|
||||
+static int _check_host_rechability(CURL *handle, curl_infotype type, char *data, size_t size, void *userp)
|
||||
+{
|
||||
+ bool *palive = (bool *)userp;
|
||||
+
|
||||
+ USP_ASSERT(palive != NULL);
|
||||
+ switch(type) {
|
||||
+ case CURLINFO_HEADER_OUT:
|
||||
+ case CURLINFO_HEADER_IN:
|
||||
+ *palive = true;
|
||||
+ break;
|
||||
+ case CURLINFO_TEXT:
|
||||
+ {
|
||||
+ USP_LOG_Debug("CURL DATA:: [%s]", data);
|
||||
+ if (strstr(data, "Connected to ") != NULL) {
|
||||
+ *palive = true;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int check_mqtt_host_reachability(mqtt_client_t *client)
|
||||
+{
|
||||
+ CURL *curl;
|
||||
+ mqtt_conn_params_t *cparam = &client->conn_params;
|
||||
+ char buffer[128] = {0};
|
||||
+ int ret = USP_ERR_INTERNAL_ERROR;
|
||||
+ bool is_alive = false;
|
||||
+
|
||||
+ curl = curl_easy_init();
|
||||
+ if(curl) {
|
||||
+ USP_SNPRINTF(buffer, 128, "mqtt://%s:%d", cparam->host, cparam->port);
|
||||
+ curl_easy_setopt(curl, CURLOPT_URL, buffer);
|
||||
+
|
||||
+ if (strlen(cparam->username) > 0) {
|
||||
+ curl_easy_setopt(curl, CURLOPT_USERNAME, cparam->username);
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(cparam->password) > 0) {
|
||||
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, cparam->password);
|
||||
+ }
|
||||
+
|
||||
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
+ curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &is_alive);
|
||||
+ curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, _check_host_rechability);
|
||||
+
|
||||
+ /* complete within 2 seconds */
|
||||
+ curl_easy_setopt(curl, CURLOPT_TIMEOUT, 2L);
|
||||
+
|
||||
+ ret = curl_easy_perform(curl);
|
||||
+ /* Check for errors */
|
||||
+ if(ret == CURLE_OK || ret == CURLE_URL_MALFORMAT || is_alive == true) {
|
||||
+ USP_LOG_Debug("CURL MQTT host %s, ret %d, alive %d ...", buffer, ret, is_alive);
|
||||
+ ret = USP_ERR_OK;
|
||||
+ } else {
|
||||
+ USP_LOG_Info("# CURL MQTT host %s unreachable: %d=>%s ...", buffer, ret, curl_easy_strerror(ret));
|
||||
+ }
|
||||
+
|
||||
+ /* always cleanup */
|
||||
+ curl_easy_cleanup(curl);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** PerformMqttClientConnect
|
||||
@@ -2193,6 +2262,14 @@ int PerformMqttClientConnect(mqtt_client_t *client)
|
||||
keep_alive = 5;
|
||||
}
|
||||
|
||||
+ // Below function is a workaround to check the host reachability with a timeout
|
||||
+ // mosquitto_connect_* API block the thread for 2 mins if host is not reachable,
|
||||
+ // which halts other clients connectivity
|
||||
+ err = check_mqtt_host_reachability(client);
|
||||
+ if (err != USP_ERR_OK) {
|
||||
+ err = USP_ERR_INTERNAL_ERROR;
|
||||
+ goto exit;
|
||||
+ }
|
||||
// Release the access mutex temporarily whilst performing the connect call
|
||||
// We do this to prevent the data model thread from potentially being blocked, whilst the connect call is taking place
|
||||
OS_UTILS_UnlockMutex(&mqtt_access_mutex);
|
||||
9
periodicstats/Config.in
Normal file
9
periodicstats/Config.in
Normal file
@@ -0,0 +1,9 @@
|
||||
if PACKAGE_periodicstats
|
||||
config PERIODICSTAT_INTERNAL_SAMPLING_RATE
|
||||
int "Number of times statistics will be measured within a sample interval"
|
||||
range 3 10
|
||||
default 3
|
||||
depends on PACKAGE_periodicstats
|
||||
help
|
||||
This value must be in range of 3 to 10. (default 3)
|
||||
endif
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=periodicstats
|
||||
PKG_VERSION:=1.5.3
|
||||
PKG_VERSION:=1.5.8.2
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/periodicstats.git
|
||||
PKG_SOURCE_VERSION:=28bea5be686013af0ba8e54cf4871f10015e4b06
|
||||
PKG_SOURCE_VERSION:=6bee158e3a4d56d573fb8f26fe06fe59b75138ca
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -32,6 +32,12 @@ define Package/periodicstats/description
|
||||
Manage periodic statistics
|
||||
endef
|
||||
|
||||
define Package/periodicstats/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DINTERNAL_SAMPLING_RATE=$(CONFIG_PERIODICSTAT_INTERNAL_SAMPLING_RATE)
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/periodicstats/* $(PKG_BUILD_DIR)/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
config globals 'globals'
|
||||
option enable '0'
|
||||
option enable '1'
|
||||
option base_interval '5'
|
||||
|
||||
|
||||
@@ -17,16 +17,19 @@ start_service() {
|
||||
|
||||
bbfdm_add_service "bbfdm.periodicstats" "${PERIODICSTATS_JSON_INPUT}"
|
||||
|
||||
if [ "${enable}" -ne "1" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
procd_open_instance periodicstatsd
|
||||
procd_set_param command ${PROG}
|
||||
procd_set_param respawn
|
||||
if [ "${enable}" -eq "1" ]; then
|
||||
procd_set_param command ${PROG}
|
||||
procd_set_param respawn
|
||||
fi
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger periodicstats
|
||||
}
|
||||
|
||||
@@ -3,39 +3,34 @@
|
||||
. /lib/functions.sh
|
||||
|
||||
set_serial_number() {
|
||||
vendor_id=$1
|
||||
vssn=$2
|
||||
local vendor_id="$1"
|
||||
local vssn="$2"
|
||||
|
||||
# Vendor id is not taken from serial automatically, propagate it as well
|
||||
/userfs/bin/omcicfgCmd set vendorId ${vendor_id}
|
||||
/userfs/bin/omcicfgCmd set sn ${vendor_id}${vssn}
|
||||
/userfs/bin/omcicfgCmd set vendorId "${vendor_id}"
|
||||
/userfs/bin/omcicfgCmd set sn "${vendor_id}${vssn}"
|
||||
}
|
||||
|
||||
set_equipment_id() {
|
||||
local eqid=$1
|
||||
local eq_id_default="KE2.119.241R2B"
|
||||
local eqid="$1"
|
||||
|
||||
if [ -z "$eqid" ]; then
|
||||
if [ -z "${eqid}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$eqid" = "$eq_id_default" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
/userfs/bin/omcicfgCmd set equipmentId ${eqid}
|
||||
/userfs/bin/omcicfgCmd set equipmentId "${eqid}"
|
||||
}
|
||||
|
||||
set_loid_authentication() {
|
||||
local loid=$1
|
||||
local loid_pwd=$2
|
||||
local loid="$1"
|
||||
local loid_pwd="$2"
|
||||
|
||||
[ -z "$loid" ] && return
|
||||
[ -z "${loid}" ] && return
|
||||
|
||||
/userfs/bin/omcicfgCmd set loid ${loid}
|
||||
/userfs/bin/omcicfgCmd set loid "${loid}"
|
||||
|
||||
if [ -n "$loid_pwd" ]; then
|
||||
/userfs/bin/omcicfgCmd set loid_password ${loid_pwd}
|
||||
if [ -n "${loid_pwd}" ]; then
|
||||
/userfs/bin/omcicfgCmd set loidPasswd "${loid_pwd}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -3,37 +3,39 @@
|
||||
. /lib/functions.sh
|
||||
|
||||
set_serial_number() {
|
||||
vendor_id=$1
|
||||
vssn=$2
|
||||
local vendor_id="$1"
|
||||
local vssn="$2"
|
||||
|
||||
vendor_id="$(echo $vendor_id | hexdump -e '4/1 "%02X" "\n"')"
|
||||
vendor_id=${vendor_id:0:8}
|
||||
vendor_id="$(echo "${vendor_id}" | hexdump -e '4/1 "%02X" "\n"')"
|
||||
vendor_id="${vendor_id:0:8}"
|
||||
|
||||
bs /b/c gpon onu_sn={vendor_id=$vendor_id,vendor_specific=$vssn}
|
||||
}
|
||||
|
||||
set_equipment_id() {
|
||||
equipment_id=$1
|
||||
local equipment_id="$1"
|
||||
[ -z "$equipment_id" ] && return
|
||||
|
||||
json_add_string "equipment_id" $equipment_id
|
||||
json_add_string "equipment_id" "$equipment_id"
|
||||
}
|
||||
|
||||
set_loid_authentication() {
|
||||
loid=$1
|
||||
loid_password=$2
|
||||
local loid="$1"
|
||||
local loid_password="$2"
|
||||
|
||||
[ -z "$loid" ] && return
|
||||
|
||||
json_add_string "loid" $loid
|
||||
json_add_string "loid_password" $loid_password
|
||||
json_add_string "loid" "$loid"
|
||||
json_add_string "loid_password" "$loid_password"
|
||||
}
|
||||
|
||||
apply_xpon_uci_config() {
|
||||
local sn
|
||||
|
||||
json_init
|
||||
json_add_object 'ani'
|
||||
sn="$(uci -q get xpon.ani.serial_number)"
|
||||
json_add_string "serial_number" $sn
|
||||
json_add_string "serial_number" "$sn"
|
||||
configure_loid_authentication
|
||||
configure_equipment_id
|
||||
json_close_object
|
||||
|
||||
@@ -11,21 +11,21 @@ include /lib/xpon
|
||||
configure_serial_number() {
|
||||
# serial number generation is taken care in the uci defaults, so if
|
||||
# serial number is not found here its a misconfig
|
||||
serial_number="$(uci -q get xpon.ani.serial_number)"
|
||||
local serial_number="$(uci -q get xpon.ani.serial_number)"
|
||||
if [ ${#serial_number} -eq 12 ]; then
|
||||
vendor_id="${serial_number:0:4}"
|
||||
vssn="${serial_number:4:8}"
|
||||
local vendor_id="${serial_number:0:4}"
|
||||
local vssn="${serial_number:4:8}"
|
||||
else
|
||||
logger -s -t "xpon" "Serial number not found in uci, ont will probably not be registered at the olt"
|
||||
logger -s -t "xpon" "Please configure a valid serial number"
|
||||
logger -s -t "xpon" "Serial number not found in UCI, ONT will probably not be registered at the OLT."
|
||||
logger -s -t "xpon" "Please configure a valid serial number."
|
||||
return
|
||||
fi
|
||||
|
||||
set_serial_number $vendor_id $vssn
|
||||
set_serial_number "${vendor_id}" "${vssn}"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
if [ "$(uci -q get xpon.ani.enable)" == "1" ]; then
|
||||
if [ "$(uci -q get xpon.ani.enable)" = "1" ]; then
|
||||
configure_serial_number
|
||||
apply_xpon_uci_config
|
||||
init_xpon
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
|
||||
configure_serial_number() {
|
||||
# check if serial number is present in the production data
|
||||
production_sn="$(fw_printenv -n gponsn)"
|
||||
local production_sn="$(fw_printenv -n gponsn)"
|
||||
if [ ${#production_sn} -eq 12 ]; then
|
||||
uci set xpon.ani.serial_number=$production_sn
|
||||
uci set xpon.ani.serial_number="${production_sn}"
|
||||
else
|
||||
macaddr="$(fw_printenv -n ethaddr | tr -d ':' | tr 'a-z' 'A-Z')"
|
||||
vendor_id="IOPS"
|
||||
vssn="${macaddr:4:8}"
|
||||
uci set xpon.ani.serial_number=$vendor_id$vssn
|
||||
local macaddr="$(fw_printenv -n ethaddr | tr -d ':' | tr 'a-z' 'A-Z')"
|
||||
local vendor_id="IOPS"
|
||||
local vssn="${macaddr:4:8}"
|
||||
|
||||
uci set xpon.ani.serial_number="${vendor_id}${vssn}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -18,37 +19,38 @@ configure_loid_authentication() {
|
||||
local production_loid
|
||||
local production_loidpwd
|
||||
|
||||
loid="$(uci -q get xpon.ani.loid)"
|
||||
loidpwd="$(uci -q get xpon.ani.loid_password)"
|
||||
if [ -z $loid ]; then
|
||||
local loid="$(uci -q get xpon.ani.loid)"
|
||||
local loidpwd="$(uci -q get xpon.ani.loid_password)"
|
||||
|
||||
if [ -z "${loid}" ]; then
|
||||
production_loid="$(fw_printenv -n gponloid)"
|
||||
fi
|
||||
if [ -z $loidpwd ]; then
|
||||
if [ -z "${loidpwd}" ]; then
|
||||
production_loidpwd="$(fw_printenv -n gponloid_password)"
|
||||
fi
|
||||
|
||||
if [ -n $production_loid ]; then
|
||||
uci set xpon.ani.loid=$production_loid
|
||||
if [ -n "${production_loid}" ]; then
|
||||
uci set xpon.ani.loid="${production_loid}"
|
||||
fi
|
||||
if [ -n $production_loidpwd ]; then
|
||||
uci set xpon.ani.loid_password=$production_loidpwd
|
||||
if [ -n "${production_loidpwd}" ]; then
|
||||
uci set xpon.ani.loid_password="${production_loidpwd}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
if [ -s "/etc/config/xpon" ]; then
|
||||
if uci -q get xpon.ani >/dev/null; then
|
||||
# generate serial number in case its not present and return
|
||||
serial_number="$(uci -q get xpon.ani.serial_number)"
|
||||
if [ ${#serial_number} -ne 12 ]; then
|
||||
if uci -q get xpon.ani >/dev/null; then
|
||||
# generate serial number in case its not present and return
|
||||
SERIAL_NUMBER="$(uci -q get xpon.ani.serial_number)"
|
||||
if [ ${#SERIAL_NUMBER} -ne 12 ]; then
|
||||
configure_serial_number
|
||||
fi
|
||||
configure_loid_authentication
|
||||
exit
|
||||
else
|
||||
rm -f /etc/config/xpon
|
||||
fi
|
||||
fi
|
||||
exit
|
||||
else
|
||||
rm -f /etc/config/xpon
|
||||
fi
|
||||
fi
|
||||
touch /etc/config/xpon
|
||||
|
||||
uci set xpon.ani=ani
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
configure_equipment_id() {
|
||||
eqid="$(uci -q get xpon.ani.equipment_id)"
|
||||
set_equipment_id $eqid
|
||||
}
|
||||
|
||||
configure_loid_authentication() {
|
||||
loid="$(uci -q get xpon.ani.loid)"
|
||||
loid_pwd="$(uci -q get xpon.ani.loid_password)"
|
||||
set_loid_authentication $loid $loid_pwd
|
||||
configure_equipment_id() {
|
||||
local eqid="$(uci -q get xpon.ani.equipment_id)"
|
||||
|
||||
set_equipment_id "${eqid}"
|
||||
}
|
||||
|
||||
configure_loid_authentication() {
|
||||
local loid="$(uci -q get xpon.ani.loid)"
|
||||
local loid_pwd="$(uci -q get xpon.ani.loid_password)"
|
||||
|
||||
set_loid_authentication "${loid}" "${loid_pwd}"
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ broute_rule_set_traffic_class() {
|
||||
fi
|
||||
}
|
||||
|
||||
broute_filter_on_dscp() {
|
||||
BR_RULE="$BR_RULE --ip-tos $1"
|
||||
}
|
||||
|
||||
broute_ipv4_rule_options()
|
||||
{
|
||||
local cid="$1"
|
||||
@@ -25,7 +29,12 @@ broute_ipv4_rule_options()
|
||||
set_ip_addr "$cid" ebt_match_src_ip ebt_match_dst_ip
|
||||
|
||||
if [ -n "$dscp_filter" ]; then
|
||||
echo "DSCP filter is not supporter"
|
||||
local tos_val
|
||||
local tos_hex
|
||||
|
||||
tos_val=$((dscp_filter<<2))
|
||||
tos_hex=$(printf "%x" $tos_val)
|
||||
broute_filter_on_dscp "$tos_hex"
|
||||
fi
|
||||
|
||||
if [ -n "$protocol" ]; then
|
||||
|
||||
@@ -15,10 +15,6 @@ include /lib/ethernet
|
||||
. /lib/qos/shaper.sh
|
||||
. /lib/qos/airoha.sh
|
||||
|
||||
get_rate_per_queue() {
|
||||
echo "0"
|
||||
}
|
||||
|
||||
get_burst_size_per_queue() {
|
||||
echo "0"
|
||||
}
|
||||
|
||||
@@ -34,10 +34,6 @@ get_port_number() {
|
||||
done
|
||||
}
|
||||
|
||||
get_rate_per_queue() {
|
||||
echo "0"
|
||||
}
|
||||
|
||||
get_burst_size_per_queue() {
|
||||
echo "0"
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ generate_queue(){
|
||||
uci set qos.@queue[-1].ifname="$ifname"
|
||||
uci set qos.@queue[-1].precedence="$order"
|
||||
uci set qos.@queue[-1].scheduling="SP"
|
||||
uci set qos.@queue[-1].rate=$(get_rate_per_queue)
|
||||
uci set qos.@queue[-1].rate="0"
|
||||
uci set qos.@queue[-1].burst_size=$(get_burst_size_per_queue)
|
||||
uci set qos.@queue[-1].weight="1"
|
||||
done
|
||||
|
||||
@@ -15,10 +15,6 @@ Q_COUNT=0
|
||||
SP_Q_PRIO=7
|
||||
SOQ_wgt=0
|
||||
|
||||
get_rate_per_queue() {
|
||||
echo "1000000"
|
||||
}
|
||||
|
||||
get_burst_size_per_queue() {
|
||||
echo "1500"
|
||||
}
|
||||
@@ -224,12 +220,7 @@ ebt_match_ipv6_dscp() {
|
||||
}
|
||||
|
||||
broute_filter_on_dscp() {
|
||||
# The broadcom option --ip-dscp-extend actually accepts tos
|
||||
# and not dscp and that too in hex, hence, perform the conversion
|
||||
# from dscp in uci to tos first and then convert to hex
|
||||
tos_val=$(($1<<2))
|
||||
tos_hex=$(printf "%x" $tos_val)
|
||||
BR_RULE="$BR_RULE --ip-dscp-extend $tos_hex"
|
||||
BR_RULE="$BR_RULE --ip-tos $1"
|
||||
}
|
||||
|
||||
broute_ipv4_rule_options()
|
||||
@@ -241,7 +232,12 @@ broute_ipv4_rule_options()
|
||||
set_ip_addr $cid ebt_match_src_ip ebt_match_dst_ip
|
||||
|
||||
if [ ! -z $dscp_filter ]; then
|
||||
broute_filter_on_dscp "$dscp_filter"
|
||||
local tos_val
|
||||
local tos_hex
|
||||
|
||||
tos_val=$((dscp_filter<<2))
|
||||
tos_hex=$(printf "%x" $tos_val)
|
||||
broute_filter_on_dscp "$tos_hex"
|
||||
fi
|
||||
|
||||
if [ ! -z $protocol ]; then
|
||||
@@ -405,18 +401,20 @@ pre_configure_queue() {
|
||||
}
|
||||
|
||||
get_link_rate() {
|
||||
intf="$1"
|
||||
speed=1000
|
||||
local ifname="$1"
|
||||
local phycap="$(ethtool $ifname | grep -A 10 "Supported link modes" | grep 00 | tail -n 1 | awk '{print$NF}')"
|
||||
local speed=1000
|
||||
|
||||
if [ -d "/sys/class/net/$intf/" ]; then
|
||||
speed=$(cat /sys/class/net/$intf/speed 2>/dev/null)
|
||||
[ -z "$speed" ] & speed=1000
|
||||
fi
|
||||
|
||||
if [ $speed -le 0 ]; then
|
||||
# assuming default 1000
|
||||
speed=1000
|
||||
fi
|
||||
# Get the max capability of this port
|
||||
case "$phycap" in
|
||||
10000*) speed=10000 ;;
|
||||
5000*) speed=5000 ;;
|
||||
2500*) speed=2500 ;;
|
||||
1000*) speed=1000 ;;
|
||||
100*) speed=100 ;;
|
||||
10*) speed=10 ;;
|
||||
*) speed=1000 ;;
|
||||
esac
|
||||
|
||||
echo "$speed"
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rulengd
|
||||
PKG_VERSION:=1.2.9
|
||||
PKG_VERSION:=1.2.11
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/rulengd.git
|
||||
PKG_SOURCE_VERSION:=1a3bf130d99ed275152c7d29b309d12c4400613d
|
||||
PKG_SOURCE_VERSION:=8fabf294cc056fd9a85cad06e81bd11df64e23a3
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=stunc
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.3.3
|
||||
PKG_VERSION:=1.3.3.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/stunc.git
|
||||
PKG_SOURCE_VERSION:=7984a54a1e5dd95db0f4657ae974671ba7f37f27
|
||||
PKG_SOURCE_VERSION:=242326500576f644e7c730f556ce4a896c47be8c
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-base
|
||||
PKG_VERSION:=3.1.42
|
||||
PKG_VERSION:=3.1.53
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=6a0cc2795607895bbe8c8e3598e3f5f435af3499
|
||||
PKG_SOURCE_VERSION:=0108f9c192a168936ee223dbf4d85a7ceba7093d
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
SULU_MOD:=core
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=3.1.42
|
||||
PKG_VERSION:=3.1.53
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=76cb288b1496756e8ed43368348127ecfef5751d
|
||||
PKG_SOURCE_VERSION:=5d0336f678a116cdf4c73fec7c0d8ab06c0f65d6
|
||||
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)
|
||||
@@ -179,7 +179,13 @@ endef
|
||||
|
||||
define Package/sulu-builder/install
|
||||
$(Package/sulu/install/Default)
|
||||
$(INSTALL_DIR) $(1)/sulu/presets
|
||||
$(INSTALL_DIR) $(1)/sulu/settings
|
||||
$(INSTALL_DIR) $(1)/sulu/widget-presets
|
||||
$(CP) $(PKG_BUILD_DIR)/build/dist/* $(1)/sulu
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/device/presets/*.json $(1)/sulu/presets/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/device/settings/*.json $(1)/sulu/settings/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/device/widget-presets/*.json $(1)/sulu/widget-presets/
|
||||
$(Package/sulu/install/Post)
|
||||
endef
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-lcm
|
||||
PKG_VERSION:=3.1.27
|
||||
PKG_VERSION:=3.1.52
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-lcm.git
|
||||
PKG_SOURCE_VERSION:=6b1d30d7918adeb19c5177dd7c5472cb0dac9896
|
||||
PKG_SOURCE_VERSION:=af612edb4ea186d9c71fc2157883bf686b14e376
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-multi-ap
|
||||
PKG_VERSION:=3.1.42
|
||||
PKG_VERSION:=3.1.52
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-multi-ap.git
|
||||
PKG_SOURCE_VERSION:=e209cbc04a92494b96c74cee443e1b385c6687fe
|
||||
PKG_SOURCE_VERSION:=ac4a73768844796be5678559b64269e6fe073192
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-parental-control
|
||||
PKG_VERSION:=3.1.38
|
||||
PKG_VERSION:=3.1.52
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-parental-control.git
|
||||
PKG_SOURCE_VERSION:=dd9dab9fb8aca87991cd2cc02c5fedd8baee3b97
|
||||
PKG_SOURCE_VERSION:=e1c5b4473fba9d42ef7d1e95e634416585bf5887
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.5.3
|
||||
PKG_VERSION:=2.5.3.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/lcm/swmodd.git
|
||||
PKG_SOURCE_VERSION:=80d8a2f0dddc8e1575c0a6dee1e496c52104d033
|
||||
PKG_SOURCE_VERSION:=d8cc9a7a3749975720c9b748adadb2b6c920acdc
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
16
swmodd/files/etc/init.d/crun
Normal file → Executable file
16
swmodd/files/etc/init.d/crun
Normal file → Executable file
@@ -56,8 +56,8 @@ configure_lxc_container() {
|
||||
}
|
||||
|
||||
configure_crun_container() {
|
||||
local name type autostart du_status requested_state url username password
|
||||
local BRIDGE BUNDLE BOOT
|
||||
local name type autostart du_status requested_state url username password capability
|
||||
local BRIDGE BUNDLE BOOT PERM
|
||||
local RUNNER="/etc/swmodd/run.sh"
|
||||
|
||||
BUNDLE="${2}"
|
||||
@@ -73,6 +73,10 @@ configure_crun_container() {
|
||||
config_get url "${1}" url ""
|
||||
config_get username "${1}" username ""
|
||||
config_get password "${1}" password ""
|
||||
config_get capability "${1}" capability ""
|
||||
if [ -n "${capability}" ]; then
|
||||
PERM="-p ${capability// /,}"
|
||||
fi
|
||||
|
||||
if [ -z "${name}" ] || [ -z "${type}" ] || [ -z "${du_status}" ]; then
|
||||
return 0;
|
||||
@@ -148,7 +152,7 @@ configure_crun_container() {
|
||||
|
||||
if [ "${BOOT}" -eq "1" ]; then
|
||||
if [ "${autostart}" -eq 1 ]; then
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}" ${PERM}
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" description "${result}"
|
||||
@@ -178,10 +182,10 @@ configure_crun_container() {
|
||||
fi
|
||||
elif [ "${requested_state}" = "Active" ]; then
|
||||
if is_container_running "${name}"; then
|
||||
${RUNNER} -u -n "${name}" -i "${BRIDGE}"
|
||||
${RUNNER} -u -n "${name}" -i "${BRIDGE}" ${PERM}
|
||||
crun resume "${name}"
|
||||
else
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}" ${PERM}
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" description "${result}"
|
||||
@@ -207,7 +211,7 @@ configure_crun_container() {
|
||||
procd_set_param stderr 1
|
||||
procd_set_param command "${RUNNER}"
|
||||
procd_append_param command -b "${BUNDLE}" -n "${name}" -i "${BRIDGE}"
|
||||
procd_set_param respawn
|
||||
#procd_set_param respawn
|
||||
procd_close_instance "${name}"
|
||||
}
|
||||
|
||||
|
||||
@@ -22,20 +22,20 @@ validate_globals_section()
|
||||
}
|
||||
|
||||
start_lxc_container() {
|
||||
local root
|
||||
local root_dir
|
||||
|
||||
config_get name "${1}" name ""
|
||||
config_get type "${1}" type ""
|
||||
config_get autostart "${1}" autostart "0"
|
||||
config_get timeout "${1}" timeout "300"
|
||||
root="${2}"
|
||||
root_dir="${2}"
|
||||
|
||||
if [ -z "${name}" ] || [ -z "${type}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
# workaround to install lxc container with installdu and autostart them
|
||||
if [ -f "${root}/$name/config" ]; then
|
||||
if [ -f "${root_dir}/$name/config" ]; then
|
||||
type=lxc
|
||||
fi
|
||||
|
||||
@@ -43,7 +43,7 @@ start_lxc_container() {
|
||||
return 0;
|
||||
fi
|
||||
|
||||
state=$(lxc-ls -f | tail -n +2 | grep -w "${name}" | cut -d " " -f 2)
|
||||
state=$(lxc-info -n "$name" -s -H)
|
||||
if [ -z "${state}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
@@ -81,31 +81,29 @@ start_service() {
|
||||
local enabled debug log_level sock root
|
||||
|
||||
config_load swmodd
|
||||
|
||||
validate_globals_section || {
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ "${enabled}" -eq 0 ] && return 0
|
||||
|
||||
# crun default runtime directory /run, if not present then create
|
||||
[ ! -d "/run" ] && ln -fs /var/run /run
|
||||
if [ ! -d "${root}" ]; then
|
||||
log "# Not staring root [${root}] not present/defined"
|
||||
return 1
|
||||
fi
|
||||
|
||||
env_name=""
|
||||
execenvs=$(uci show swmodd | grep "=execenv" | cut -d'=' -f 1 | cut -d'.' -f 2)
|
||||
for env in ${execenvs}; do
|
||||
name=$(uci get swmodd.${env}.name)
|
||||
if [ -n "${name}" ]; then
|
||||
env_name="${name}"
|
||||
break
|
||||
if [ ! -d "${root}" ]; then
|
||||
log "# root [${root}] not present, creating ..."
|
||||
if [ -n "${root}" ]; then
|
||||
mkdir -p "${root}"
|
||||
else
|
||||
log "# Not starting, root [${root}] not defined"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Currently only one execenv supported
|
||||
env_name="$(uci -q get swmodd.@execenv[0].name)"
|
||||
if [ -z "${env_name}" ]; then
|
||||
log "# Not starting execenv name [${env_name}] not defined"
|
||||
log "# Not starting, execenv name [${env_name}] not defined"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -115,10 +113,14 @@ start_service() {
|
||||
fi
|
||||
|
||||
bundle_root="${bundle_root}${env_name}"
|
||||
if [ ! -d "${bundle_root}" ]; then
|
||||
log "# Not staring execenv [${bundle_root}] not present"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -d "${bundle_root}" ]; then
|
||||
if [ -n "${bundle_root}" ]; then
|
||||
mkdir -p "${bundle_root}"
|
||||
else
|
||||
log "# Not starting, execenv [${bundle_root}] not defined"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
procd_open_instance swmodd
|
||||
procd_set_param command ${PROG}
|
||||
@@ -154,5 +156,5 @@ reload_service() {
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "swmodd"
|
||||
procd_add_reload_trigger "swmodd"
|
||||
}
|
||||
|
||||
62
swmodd/files/etc/swmodd/run.sh
Normal file → Executable file
62
swmodd/files/etc/swmodd/run.sh
Normal file → Executable file
@@ -123,12 +123,57 @@ update_config_json() {
|
||||
fi
|
||||
cd "${BUNDLE}/${NAME}"
|
||||
if cat config.json |jq '.linux.namespaces[] |select (.type == "network") |.path' |grep -q ${NAME}; then
|
||||
exit 0;
|
||||
# If netns already configured and no additional permission bit assigned, exit from here
|
||||
if [ -z "${PERM}" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
fi
|
||||
|
||||
mv config.json config_orig.json
|
||||
json_init
|
||||
json_load_file "config_orig.json"
|
||||
|
||||
# update hostname to container name
|
||||
if [ -n "${NAME}" ]; then
|
||||
json_add_string hostname "${NAME}"
|
||||
fi
|
||||
|
||||
# Update cabalities
|
||||
if [ -n "${PERM}" ]; then
|
||||
log "Updating Permission in the json ..."
|
||||
PERM="${PERM//,/ }"
|
||||
json_select process
|
||||
json_select capabilities
|
||||
json_select bounding
|
||||
for p in ${PERM}; do
|
||||
json_add_string "" ${p}
|
||||
done
|
||||
json_select ..
|
||||
json_select effective
|
||||
for p in ${PERM}; do
|
||||
json_add_string "" ${p}
|
||||
done
|
||||
json_select ..
|
||||
json_select inheritable
|
||||
for p in ${PERM}; do
|
||||
json_add_string "" ${p}
|
||||
done
|
||||
json_select ..
|
||||
json_select permitted
|
||||
for p in ${PERM}; do
|
||||
json_add_string "" ${p}
|
||||
done
|
||||
json_select ..
|
||||
json_select ambient
|
||||
for p in ${PERM}; do
|
||||
json_add_string "" ${p}
|
||||
done
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select ..
|
||||
fi
|
||||
|
||||
# update additional capabilities
|
||||
json_select linux
|
||||
json_for_each_item update_network_ns namespaces
|
||||
json_dump >config.json
|
||||
@@ -212,16 +257,19 @@ pull_image_from_registry() {
|
||||
clean=0
|
||||
net_update=0
|
||||
update_json=0
|
||||
while getopts b:n:i:r:l:t:cuU options
|
||||
PERM=""
|
||||
|
||||
while getopts b:n:i:r:l:t:p:cuU options
|
||||
do
|
||||
case "${options}" in
|
||||
b) BUNDLE=${OPTARG};;
|
||||
n) NAME=${OPTARG};;
|
||||
c) clean=1;;
|
||||
i) BRIDGE=${OPTARG};;
|
||||
n) NAME=${OPTARG};;
|
||||
p) PERM="${OPTARG}";;
|
||||
r) REGURL=${OPTARG};;
|
||||
l) LOGIN=${OPTARG};;
|
||||
t) TIMEOUT=${OPTARG};;
|
||||
c) clean=1;;
|
||||
u) net_update=1;;
|
||||
U) update_json=1;;
|
||||
*) log "Invalid options";;
|
||||
@@ -233,7 +281,7 @@ if [ -z "${NAME}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${update_json}" -eq 1 ]; then
|
||||
if [ "${update_json}" -eq "1" ]; then
|
||||
update_config_json
|
||||
return 0;
|
||||
fi
|
||||
@@ -243,7 +291,7 @@ if [ -n "${REGURL}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "$clean" -eq 1 ]; then
|
||||
if [ "$clean" -eq "1" ]; then
|
||||
clean_container_network "${NAME}"
|
||||
return 0;
|
||||
fi
|
||||
@@ -253,7 +301,7 @@ if [ -z "${BRIDGE}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${net_update}" -eq 1 ]; then
|
||||
if [ "${net_update}" -eq "1" ]; then
|
||||
get_veth_name "${NAME}"
|
||||
brctl addif "${BRIDGE}" "${VETHNAME}"
|
||||
return 0;
|
||||
|
||||
27
testnet/Makefile
Normal file
27
testnet/Makefile
Normal file
@@ -0,0 +1,27 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=testnet
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/testnet
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Check WAN IP Connection
|
||||
DEPENDS:=+ndisc6
|
||||
endef
|
||||
|
||||
define Package/testnet/description
|
||||
Check WAN IP connection
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/testnet/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,testnet))
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# do not start testnet if the feature is explicitly disabled
|
||||
[ "$(uci -q get netmode.testnet.enabled)" = "0" ] && exit 0
|
||||
[ "$(uci -q get testnet.global.enabled)" = "0" ] && exit 0
|
||||
|
||||
[ "$ACTION" == "ifup" -o "$ACTION" == "ifdown" ] || exit 0
|
||||
|
||||
@@ -14,8 +14,4 @@ interface_check() {
|
||||
}
|
||||
|
||||
interface_check
|
||||
if [ -n "$(pgrep -f testnet)" ]; then
|
||||
testnet once
|
||||
else
|
||||
testnet &
|
||||
fi
|
||||
/etc/init.d/testnet reload
|
||||
23
testnet/files/etc/init.d/testnet
Executable file
23
testnet/files/etc/init.d/testnet
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=21
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
TESTNET=$(which testnet)
|
||||
|
||||
start_service() {
|
||||
# do not start testnet if the feature is explicitly disabled
|
||||
[ "$(uci -q get testnet.global.enabled)" = "0" ] && return 0
|
||||
|
||||
[ -n "$TESTNET" ] && {
|
||||
procd_open_instance
|
||||
procd_set_param command "$TESTNET"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
procd_send_signal testnet
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/network/utils.sh
|
||||
RELOAD=0
|
||||
WAITING=0
|
||||
|
||||
NETCON=0
|
||||
LASTSTATUS=""
|
||||
@@ -14,29 +14,32 @@ test_connection() {
|
||||
local defroute="$(ip r | grep default | awk '{print$3}' | head -1)"
|
||||
local def6route="$(ip -f inet6 r | grep default | awk '{print$3}')"
|
||||
local ping6dev="$(ip -f inet6 r | grep default | awk '{print$5}')"
|
||||
local resolvfile="$(uci -q get 'dhcp.@dnsmasq[0].resolvfile')"
|
||||
|
||||
if [ -n "$addr" ]; then
|
||||
ping -q -w 5 -c 1 $addr >/dev/null 2>&1 && return 0
|
||||
ping -q -w 5 -c 1 "$addr" >/dev/null 2>&1 && return 0
|
||||
elif [ -n "$defroute" ]; then
|
||||
ping -q -w 5 -c 1 $defroute >/dev/null 2>&1 && return 0
|
||||
for nmsrv in $(grep nameserver /var/resolv.conf.auto | awk '{print$2}'); do
|
||||
ping -q -w 5 -c 1 $nmsrv >/dev/null 2>&1 && return 0
|
||||
done
|
||||
ping -q -w 5 -c 1 "$defroute" >/dev/null 2>&1 && return 0
|
||||
if [ -e "$resolvfile" ]; then
|
||||
for nmsrv in $(grep nameserver "$resolvfile" | awk '{print$2}'); do
|
||||
ping -q -w 5 -c 1 "$nmsrv" >/dev/null 2>&1 && return 0
|
||||
done
|
||||
fi
|
||||
elif [ -n "$def6route" -a -n "$ping6dev" ]; then
|
||||
ndisc6 -w 5 -1 $def6route $ping6dev >/dev/null 2>&1 && return 0
|
||||
ndisc6 -w 5 -1 "$def6route" "$ping6dev" >/dev/null 2>&1 && return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
internet_test() {
|
||||
local link dest
|
||||
local dest
|
||||
|
||||
# use the destination address given in config for connectivity check
|
||||
dest="$(uci -q get netmode.testnet.destination)"
|
||||
dest="$(uci -q get testnet.global.destination)"
|
||||
# for backwards compatibility
|
||||
[ -n "$dest" ] || dest="$(uci -q get diagnostics.@connectivity[0].destination)"
|
||||
[ -n "$dest" ] || dest="$(uci -q get 'system.@system[0].netping_addr')"
|
||||
|
||||
test_connection $dest
|
||||
test_connection "$dest"
|
||||
|
||||
if [ "$?" -eq 0 ]; then
|
||||
NETCON=1
|
||||
@@ -50,7 +53,7 @@ internet_test() {
|
||||
connectivity_test() {
|
||||
internet_test
|
||||
|
||||
if [ $NETCON -eq 1 ]; then
|
||||
if [ "$NETCON" -eq 1 ]; then
|
||||
CURSTATUS=1
|
||||
[ "$CURSTATUS" == "$LASTSTATUS" ] || ubus send internet '{"status" : "online"}'
|
||||
LASTSTATUS=1
|
||||
@@ -61,12 +64,14 @@ connectivity_test() {
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" == "once" ]; then
|
||||
connectivity_test
|
||||
exit 0
|
||||
fi
|
||||
trap RELOAD=1 HUP
|
||||
|
||||
while true; do
|
||||
if [ "$WAITING" -eq 0 ]; then
|
||||
sleep "$SLEEP_TIME" &
|
||||
WAITING=1
|
||||
fi
|
||||
RELOAD=0
|
||||
connectivity_test
|
||||
sleep $SLEEP_TIME
|
||||
[ "$RELOAD" -eq 0 ] && wait && WAITING=0
|
||||
done
|
||||
@@ -1,7 +1,7 @@
|
||||
config TR104_RUNAS_BBFDM_MICROSERVICE
|
||||
bool "Use bbfdmd datamodel microservice to run tr104, preferred if TR104 and BBFDMD are on different base"
|
||||
depends on PACKAGE_tr104
|
||||
default n
|
||||
default y
|
||||
|
||||
config TR104_VENDOR_EXTENSIONS
|
||||
bool "Use TR104 vendor extensions"
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=tr104
|
||||
PKG_VERSION:=1.0.12
|
||||
PKG_VERSION:=1.0.13.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifeq ($(LOCAL_DEV),0)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/voice/tr104.git
|
||||
PKG_SOURCE_VERSION:=393ad165e64413067de84b452126aebf4bcbcb2d
|
||||
PKG_SOURCE_VERSION:=9d8e68f237207723b446f614a2233dccf3c4dc09
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -32,7 +32,7 @@ define Package/$(PKG_NAME)
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=TR104 Datamodel Daemon
|
||||
MENU:=1
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +asterisk
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +asterisk +libcurl +PACKAGE_libbbfdm-api:libbbfdm-api
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
@@ -54,7 +54,7 @@ CMAKE_OPTIONS += \
|
||||
-DTR104_EXTENSION_DIR:String="iowrt"
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUNAS_BBFDM_MICROSERVICE),y)
|
||||
ifeq ($(CONFIG_TR104_RUNAS_BBFDM_MICROSERVICE),y)
|
||||
MAKE_PATH:=libdm
|
||||
EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/libbbfdm-api
|
||||
CMAKE_OPTIONS += -DRUNAS_BBFDM_MICROSERVICE:BOOL=ON
|
||||
@@ -76,7 +76,7 @@ define Package/$(PKG_NAME)/install
|
||||
ifeq ($(CONFIG_TR104_VENDOR_EXTENSIONS),y)
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libdm/extensions/iowrt/libtr104ext.so $(1)/etc/tr104/plugins/
|
||||
endif
|
||||
ifeq ($(CONFIG_RUNAS_BBFDM_MICROSERVICE),y)
|
||||
ifeq ($(CONFIG_TR104_RUNAS_BBFDM_MICROSERVICE),y)
|
||||
$(INSTALL_BIN) ./files/etc/init.d/tr104d.bbfdm $(1)/etc/init.d/tr104d
|
||||
else
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
@@ -6,13 +6,13 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=urlfilter
|
||||
PKG_VERSION:=1.1.8
|
||||
PKG_VERSION:=1.1.14
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/urlfilter.git
|
||||
PKG_SOURCE_VERSION:=a726e4ce9fa3322e135cb0dd961f31b4fd7ae22a
|
||||
PKG_SOURCE_VERSION:=ebf8afb44ff808d3b99c45a7c636fb12a774f357
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -21,7 +21,7 @@ configure_firewall()
|
||||
iptables -w -I INPUT 2 -p udp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
|
||||
|
||||
# disable acceleration for https packet so that they can be read by urlfilter
|
||||
ebtables -A FORWARD -p ip --ip-protocol 6 --ip-destination-port 443 -j SKIPLOG
|
||||
ebtables -A FORWARD -p ip --ip-protocol 6 --ip-destination-port 443 -j SKIPLOG 2> /dev/null
|
||||
fi
|
||||
ip6tables -w -nL FORWARD|grep -iqE "NFQUEUE"
|
||||
if [ "$?" -ne 0 ]; then
|
||||
@@ -62,7 +62,7 @@ stop_service() {
|
||||
iptables -w -D FORWARD -p udp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
|
||||
iptables -w -D INPUT -p udp --dport 53 -j NFQUEUE --queue-num 0 --queue-bypass
|
||||
iptables -w -D INPUT -p udp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass
|
||||
ebtables -D FORWARD -p ip --ip-protocol 6 --ip-destination-port 443 -j SKIPLOG
|
||||
ebtables -D FORWARD -p ip --ip-protocol 6 --ip-destination-port 443 -j SKIPLOG 2> /dev/null
|
||||
fi
|
||||
ip6tables -w -nL FORWARD|grep -iqE "NFQUEUE"
|
||||
if [ "$?" -eq 0 ]; then
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=usp-js
|
||||
PKG_VERSION:=1.2.3
|
||||
PKG_VERSION:=1.2.4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/usp-js.git
|
||||
PKG_SOURCE_VERSION:=61cf7adb3258820f12f5dc02c69c5bdd612ed4cd
|
||||
PKG_SOURCE_VERSION:=fa4586a0fc5fe13bc83165c8401e63d84db89e72
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=voicemngr
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.2
|
||||
PKG_VERSION:=1.1.8
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@@ -19,7 +19,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=25571796f18c91a2070f98881bd1205f15575fea
|
||||
PKG_SOURCE_VERSION:=3eff99d3bd62cbbc176c71f77a2df495f4e46e62
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wifimngr
|
||||
PKG_VERSION:=16.2.1
|
||||
PKG_VERSION:=16.2.1.5
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=48082bc03ef03e0c3a9e843523482b017e8676e1
|
||||
PKG_SOURCE_VERSION:=5696f739e765e221e2f882a659cf509296572250
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wifimngr.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
Reference in New Issue
Block a user