mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-11 15:14:17 +08:00
Compare commits
126 Commits
obuspa_v8
...
dynamic-co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6a542e151 | ||
|
|
9c81aacd88 | ||
|
|
298d4dcb97 | ||
|
|
190544d3c4 | ||
|
|
2412a29226 | ||
|
|
c80b487052 | ||
|
|
4ca4047418 | ||
|
|
c30151607a | ||
|
|
6df48c0f7f | ||
|
|
d67c459153 | ||
|
|
47f5aade80 | ||
|
|
e06e1db9b0 | ||
|
|
6bfc426e63 | ||
|
|
04be1d3efd | ||
|
|
4b57a9dcd5 | ||
|
|
0a065403d5 | ||
|
|
0b598ddfb1 | ||
|
|
b5ef7c7278 | ||
|
|
8ed348342c | ||
|
|
aeb966b798 | ||
|
|
0d9ca4aa94 | ||
|
|
3529860fd2 | ||
|
|
a03ee39fd7 | ||
|
|
dca448d139 | ||
|
|
8947c5b8c7 | ||
|
|
572570b0f1 | ||
|
|
95d200bf3d | ||
|
|
3f58dd2dd2 | ||
|
|
c60672a710 | ||
|
|
16b6469277 | ||
|
|
cf18df1a94 | ||
|
|
ce6766ba9f | ||
|
|
0f517dd0e7 | ||
|
|
d3be3f9c4f | ||
|
|
efd1537a07 | ||
|
|
33c9290916 | ||
|
|
853c6a8452 | ||
|
|
5526fdb02c | ||
|
|
df05c3a3d6 | ||
|
|
40d414f791 | ||
|
|
0cf8492eab | ||
|
|
4619bf1722 | ||
|
|
6c52598bfb | ||
|
|
69330c5799 | ||
|
|
67781c7f18 | ||
|
|
482ddb50e8 | ||
|
|
6b937f3248 | ||
|
|
04ddc46cd5 | ||
|
|
51ce00eebe | ||
|
|
611c1414dc | ||
|
|
5ad1bea18b | ||
|
|
57339f81be | ||
|
|
82762ede0d | ||
|
|
4e324f3d18 | ||
|
|
8ab10fb3a1 | ||
|
|
f9a9543726 | ||
|
|
62223cebfd | ||
|
|
6104c14cfd | ||
|
|
6fb7284483 | ||
|
|
7c373c2edb | ||
|
|
82390070c1 | ||
|
|
c5bfa7332a | ||
|
|
e0e9dffee8 | ||
|
|
b5cfd5410e | ||
|
|
7b0e49753e | ||
|
|
6a04e6e29a | ||
|
|
9b2ca1bf90 | ||
|
|
2f2089e114 | ||
|
|
b78a542d28 | ||
|
|
08ce89a394 | ||
|
|
e4416db22b | ||
|
|
b5e195499a | ||
|
|
eb1d8deeff | ||
|
|
cb37cc60b9 | ||
|
|
83277d8a0c | ||
|
|
e28f1a653c | ||
|
|
c23c0248e1 | ||
|
|
82c064d4d9 | ||
|
|
5dc2d1ea7b | ||
|
|
f072dc5ba3 | ||
|
|
370af9b5fa | ||
|
|
aff71647aa | ||
|
|
b6ffbdae70 | ||
|
|
214c588bc1 | ||
|
|
da91ccda1c | ||
|
|
1d64b9e958 | ||
|
|
bbe507c740 | ||
|
|
c36da1cf8e | ||
|
|
54172e7065 | ||
|
|
5a145b69f8 | ||
|
|
20d861bd21 | ||
|
|
dc2ba58371 | ||
|
|
e800a445ae | ||
|
|
eadfc0feb3 | ||
|
|
bf5a6f6c3b | ||
|
|
4862dec4d9 | ||
|
|
56960ef0c0 | ||
|
|
3d5c8467c2 | ||
|
|
3fb8a697a0 | ||
|
|
c165587b54 | ||
|
|
e661570fbd | ||
|
|
28ff0a01df | ||
|
|
86075ea908 | ||
|
|
9ed638eb6b | ||
|
|
4054f8d273 | ||
|
|
d44a9e2634 | ||
|
|
e0cdb4020d | ||
|
|
74dadc162f | ||
|
|
e53c25807f | ||
|
|
ca64bded7c | ||
|
|
0709b46a63 | ||
|
|
e3be97f48e | ||
|
|
82f0db990f | ||
|
|
b2d17c0704 | ||
|
|
47fd6bd077 | ||
|
|
8837dc7a6c | ||
|
|
e35f05d037 | ||
|
|
5b3d595030 | ||
|
|
dfa9e7357e | ||
|
|
1a63ffbe5a | ||
|
|
5238b0776a | ||
|
|
28cfda6b96 | ||
|
|
eeae93881d | ||
|
|
5ef2db2754 | ||
|
|
d3a1612294 | ||
|
|
ee619a99a6 |
@@ -10,14 +10,6 @@ config BBF_OBFUSCATION_KEY
|
||||
string "Obfuscation key"
|
||||
default "371d530c95a17d1ca223a29b7a6cdc97e1135c1e0959b51106cca91a0b148b5e42742d372a359760742803f2a44bd88fca67ccdcfaeed26d02ce3b6049cb1e04"
|
||||
|
||||
config BBF_TR143
|
||||
bool "Enable TR-143 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBF_TR471
|
||||
bool "Enable TR-471 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBF_MAX_OBJECT_INSTANCES
|
||||
int "Maximum number of instances per object"
|
||||
default 255
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.8.14
|
||||
PKG_VERSION:=1.8.26
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=681c49fae176845ae0421c66cdb342f608a740e0
|
||||
PKG_SOURCE_VERSION:=6df8fecbcc72e55f2ba06ae933dcddb6f725b204
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -37,8 +37,7 @@ define Package/libbbfdm
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Library for broadband forum data model support
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api \
|
||||
+BBF_TR471:obudpst +libopenssl
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libopenssl
|
||||
endef
|
||||
|
||||
define Package/bbfdmd
|
||||
@@ -69,17 +68,6 @@ endif
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR181=ON
|
||||
-DBBF_WIFI_DATAELEMENTS=ON
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR143),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR143=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR471),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR471=ON
|
||||
endif
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \
|
||||
@@ -121,12 +109,10 @@ define Package/libbbfdm/install
|
||||
ifeq ($(findstring iopsys,$(CONFIG_BBF_VENDOR_LIST)),iopsys)
|
||||
$(BBFDM_INSTALL_CORE_PLUGIN) $(PKG_BUILD_DIR)/libbbfdm/dmtree/vendor/iopsys/libbbfdm_iopsys_ext.so $(1)
|
||||
endif
|
||||
ifeq ($(CONFIG_BBF_TR143),y)
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm/scripts/
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm/scripts/* $(1)/usr/share/bbfdm/scripts/
|
||||
$(LN) /usr/share/bbfdm/scripts/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/prerm
|
||||
|
||||
@@ -8,8 +8,6 @@ bbfdm provides few compile time configuration options and compile time help util
|
||||
| ----------------------- | ------------- | ----------- |
|
||||
| CONFIG_BBF_VENDOR_LIST | List of vendor extension directories | iopsys |
|
||||
| CONFIG_BBF_VENDOR_PREFIX | Prefix for Vendor extension datamodel objects/parameters | X_IOPSYS_EU_ |
|
||||
| CONFIG_BBF_TR143 | Enable/Add TR-143 Data Model Support | y |
|
||||
| CONFIG_BBF_TR471 | Enable/Add TR-471 Data Model Support | y |
|
||||
| CONFIG_BBF_MAX_OBJECT_INSTANCES | Maximum number of instances per object | 255 |
|
||||
| BBF_OBFUSCATION_KEY | Hash used to encode/decode in `bbf.secure` object | 371d530c95a17d1ca223a29b7a6cdc97e1135c1e0959b51106cca91a0b148b5e42742d372a359760742803f2a44bd88fca67ccdcfaeed26d02ce3b6049cb1e04 |
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ BBFDM_INSTALL_CORE_PLUGIN:=$(BBFDM_DIR)/tools/bbfdm.sh -p
|
||||
# Note:
|
||||
# - There could be only one main plugin file, so its bind to PKG_NAME
|
||||
# - Micro-service input.json will be auto generated with this call
|
||||
# - Use -u (optional argument) to overwrite ubus object name
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_MS_DM $(PKG_BUILD_DIR)/libcwmp.so $(1) $(PKG_NAME)
|
||||
@@ -69,6 +70,23 @@ BBFDM_INSTALL_MS_DM:=$(BBFDM_DIR)/tools/bbfdm.sh -m
|
||||
#
|
||||
BBFDM_INSTALL_MS_PLUGIN:=$(BBFDM_DIR)/tools/bbfdm.sh -m -p
|
||||
|
||||
# Utility to install the helper scripts in default bbfdm script path
|
||||
#
|
||||
# Use Case:
|
||||
# User want to install some script for running diagnostics
|
||||
#
|
||||
# ARGS:
|
||||
# $1 => Script with complete path
|
||||
# $2 => package install directory
|
||||
#
|
||||
# Note:
|
||||
# - Use with -d option to install script in bbf.diag directory
|
||||
#
|
||||
# Example:
|
||||
# BBFDM_INSTALL_SCRIPT $(PKG_BUILD_DIR)/download $(1)
|
||||
# BBFDM_INSTALL_SCRIPT -d $(PKG_BUILD_DIR)/ipping $(1)
|
||||
#
|
||||
BBFDM_INSTALL_SCRIPT:=$(BBFDM_DIR)/tools/bbfdm.sh -s
|
||||
|
||||
# Deprecated functions errors
|
||||
define BbfdmInstallPluginInMicroservice
|
||||
|
||||
@@ -35,7 +35,7 @@ _add_microservice()
|
||||
name="$(basename ${path})"
|
||||
name="${name//.json}"
|
||||
|
||||
enable="$(jq '.daemon.enable//1' ${path})"
|
||||
enable="$(jq -r '.daemon.enable//1' ${path})"
|
||||
if [ "${enable}" -eq "0" ]; then
|
||||
log "datamodel micro-service ${name} not enabled"
|
||||
return 0
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
|
||||
BBFDM_BASE_DM_PATH="usr/share/bbfdm"
|
||||
BBFDM_INPUT_PATH="etc/bbfdm/micro_services"
|
||||
INPUT_TEMPLATE='{"daemon":{"service_name":"template","config":{"loglevel":"1"}}}'
|
||||
INPUT_TEMPLATE='{"daemon":{"enable":"1","service_name":"template","config":{"loglevel":"1"}}}'
|
||||
OUT_NAME=""
|
||||
|
||||
MICRO_SERVICE=0
|
||||
SCRIPT=0
|
||||
DIAG=0
|
||||
PLUGIN=0
|
||||
DEST=""
|
||||
TOOLS="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
SRC=""
|
||||
|
||||
while getopts ":mp" opt; do
|
||||
while getopts ":mpsdu:" opt; do
|
||||
case ${opt} in
|
||||
m)
|
||||
MICRO_SERVICE=1
|
||||
@@ -18,6 +21,15 @@ while getopts ":mp" opt; do
|
||||
p)
|
||||
PLUGIN=1
|
||||
;;
|
||||
s)
|
||||
SCRIPT=1
|
||||
;;
|
||||
d)
|
||||
DIAG=1
|
||||
;;
|
||||
u)
|
||||
OUT_NAME="${OPTARG}"
|
||||
;;
|
||||
?)
|
||||
echo "Invalid option: ${OPTARG}"
|
||||
exit 1
|
||||
@@ -99,7 +111,12 @@ bbfdm_generate_input()
|
||||
ser=${2}
|
||||
dest=${dest_dir}/${ser}.json
|
||||
|
||||
echo ${INPUT_TEMPLATE} | jq --arg service "$ser" '.daemon.service_name = $service' > ${dest}
|
||||
if [ -n "${OUT_NAME}" ]; then
|
||||
echo ${INPUT_TEMPLATE} | jq --arg service "${ser}" --arg OUT "${OUT_NAME}" '.daemon |= (.service_name = $service |.output.name = $OUT)' > ${dest}
|
||||
else
|
||||
echo ${INPUT_TEMPLATE} | jq --arg service "${ser}" '.daemon.service_name = $service' > ${dest}
|
||||
fi
|
||||
|
||||
chmod 466 ${dest}
|
||||
}
|
||||
|
||||
@@ -108,6 +125,17 @@ if [ -z "$SRC" ] || [ -z "${DEST}" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${SCRIPT}" -eq "1" ]; then
|
||||
if [ "${DIAG}" -eq "1" ]; then
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/bbf_diag
|
||||
install_bin ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/bbf_diag/
|
||||
else
|
||||
install_dir ${DEST}/${BBFDM_BASE_DM_PATH}/scripts
|
||||
install_bin ${SRC} ${DEST}/${BBFDM_BASE_DM_PATH}/scripts/
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${MICRO_SERVICE}" -eq "1" ]; then
|
||||
if [ -z "${DATA}" ]; then
|
||||
echo "# service_name[${DATA}] not provided"
|
||||
|
||||
53
bridgemngr/Makefile
Normal file
53
bridgemngr/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bridgemngr
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/bridgemngr
|
||||
PKG_SOURCE_VERSION:=9cddf87b527ef1614a8a39db67e6578ff1810031
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/bridgemngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Bridge Manager
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libbbfdm-api
|
||||
endef
|
||||
|
||||
define Package/bridgemngr/description
|
||||
Package to add Device.Bridging. data model support.
|
||||
endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\"
|
||||
|
||||
define Package/bridgemngr/install
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libbridgemngr.so $(1) $(PKG_NAME)
|
||||
ifeq ($(findstring iopsys,$(CONFIG_BBF_VENDOR_LIST)),iopsys)
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libbridgeext.so $(1) $(PKG_NAME)
|
||||
endif
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) ~/git/bridgemngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,bridgemngr))
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=csmngr
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=92c62f8df86066bd1718a6a6036195b113e74032
|
||||
PKG_SOURCE_VERSION:=5e50fe388fff29b08d895c1c580152cccfa290ad
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/csmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddnsmngr
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_VERSION:=1.0.5
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ddnsmngr.git
|
||||
PKG_SOURCE_VERSION:=d0d37df44644ef2c1a0b11d3a4f92dc694ae1010
|
||||
PKG_SOURCE_VERSION:=f3c818322747922035a9eafe5de05d148ce15b4b
|
||||
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:=decollector
|
||||
PKG_VERSION:=6.0.0.1
|
||||
PKG_VERSION:=6.0.0.9
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=aaf79b36c05d7ac7a7d704db03a9c97905452025
|
||||
PKG_SOURCE_VERSION:=08cd179438b8085c19e7d7523c9b26adfcb93129
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dhcpmngr
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_VERSION:=1.0.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dhcpmngr.git
|
||||
PKG_SOURCE_VERSION:=cf8ef8ce1db100e5a34957ed1b09e28d417bf6d1
|
||||
PKG_SOURCE_VERSION:=d15d21766c1a1e5054b2391de1cfc4708be7a14c
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dnsmngr
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_VERSION:=1.0.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dnsmngr.git
|
||||
PKG_SOURCE_VERSION:=60e2f64f5584a3b47f1a4cd7fae0edb478607bd6
|
||||
PKG_SOURCE_VERSION:=03d8d79c1221adb92b5789c03e2489d26c6ae184
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -43,6 +43,7 @@ endif
|
||||
|
||||
define Package/dnsmngr/install
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libdnsmngr.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_SCRIPT) -d $(PKG_BUILD_DIR)/scripts/nslookup $(1)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dnsmngr))
|
||||
|
||||
80
ebtables-extensions/Makefile
Normal file
80
ebtables-extensions/Makefile
Normal file
@@ -0,0 +1,80 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ebtables-extensions
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=a23a70f5518a42d663156a156c1e3356f695b5ad
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ebtables-extensions.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/vlantranslation
|
||||
SUBMENU:=Other modules
|
||||
TITLE:=Kernel module for ebtables VLAN translation
|
||||
FILES:=$(PKG_BUILD_DIR)/src/ebt_vlantranslation.ko
|
||||
DEPENDS+=+kmod-ebtables
|
||||
AUTOLOAD:=$(call AutoLoad,30,ebt_vlantranslation,1)
|
||||
KCONFIG:=
|
||||
endef
|
||||
|
||||
define KernelPackage/dscp2pbit
|
||||
SUBMENU:=Other modules
|
||||
TITLE:=Kernel module for DSCP-to-Pbit mapping
|
||||
DEPENDS+=+kmod-ebtables
|
||||
FILES:=$(PKG_BUILD_DIR)/src/ebt_dscp2pbit.ko
|
||||
AUTOLOAD:=$(call AutoLoad,30,ebt_dscp2pbit,1)
|
||||
KCONFIG:=
|
||||
endef
|
||||
|
||||
define KernelPackage/vlantranslation/description
|
||||
Kernel module to enable VLAN translation for ebtables
|
||||
endef
|
||||
|
||||
define KernelPackage/dscp2pbit/description
|
||||
Kernel module to enableDSCP-to-Pbit mapping for ebtables
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
include ../../broadcom/bcmkernel/bcm-kernel-toolchain.mk
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ./src/* $(PKG_BUILD_DIR)/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_vlantranslation.h $(LINUX_DIR)/include/uapi/linux/netfilter_bridge/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_dscp2pbit.h $(LINUX_DIR)/include/uapi/linux/netfilter_bridge/
|
||||
endef
|
||||
else
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_vlantranslation.h $(LINUX_DIR)/include/uapi/linux/netfilter_bridge/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_dscp2pbit.h $(LINUX_DIR)/include/uapi/linux/netfilter_bridge/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/include/uapi/linux/netfilter_bridge/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_vlantranslation.h $(1)/include/uapi/linux/netfilter_bridge/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ebt_dscp2pbit.h $(1)/include/uapi/linux/netfilter_bridge/
|
||||
endef
|
||||
|
||||
KERNEL_MAKE_FLAGS += -I$(LINUX_DIR)/include
|
||||
|
||||
define Build/Compile
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/src" modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,vlantranslation))
|
||||
$(eval $(call KernelPackage,dscp2pbit))
|
||||
12
firewallmngr/Config.in
Normal file
12
firewallmngr/Config.in
Normal file
@@ -0,0 +1,12 @@
|
||||
if PACKAGE_firewallmngr
|
||||
|
||||
menu "Configuration"
|
||||
|
||||
config FIREWALLMNGR_PORT_TRIGGER
|
||||
bool "Include Device.NAT.PortTrigger"
|
||||
default y
|
||||
help
|
||||
Set this option to include support for PortTrigger object.
|
||||
|
||||
endmenu
|
||||
endif
|
||||
68
firewallmngr/Makefile
Normal file
68
firewallmngr/Makefile
Normal file
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Copyright (C) 2024 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=firewallmngr
|
||||
PKG_VERSION:=1.0.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/firewallmngr.git
|
||||
PKG_SOURCE_VERSION:=f5c3e2c93a8a992ab24291eb2c67adf77de7f896
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/firewallmngr
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Package to add Device.Firewall and Device.NAT. data model support.
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +firewall
|
||||
DEPENDS+=+FIREWALLMNGR_PORT_TRIGGER:kmod-ipt-trigger +FIREWALLMNGR_PORT_TRIGGER:kmod-ip6t-trigger
|
||||
DEPENDS+=+FIREWALLMNGR_PORT_TRIGGER:iptables-mod-nfqueue
|
||||
endef
|
||||
|
||||
define Package/firewallmngr/description
|
||||
Package to add Device.Firewall. and Device.NAT. data model support.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/firewallmngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FIREWALLMNGR_PORT_TRIGGER),y)
|
||||
TARGET_CFLAGS += -DINCLUDE_PORT_TRIGGER
|
||||
endif
|
||||
|
||||
define Package/firewallmngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
ifeq ($(CONFIG_FIREWALLMNGR_PORT_TRIGGER),y)
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/lib/port-trigger
|
||||
|
||||
$(INSTALL_BIN) ./files/port-trigger/etc/init.d/port-trigger $(1)/etc/init.d/
|
||||
$(INSTALL_DATA) ./files/port-trigger/etc/config/port-trigger $(1)/etc/config/
|
||||
$(INSTALL_DATA) ./files/port-trigger/lib/port-trigger/port_trigger.sh $(1)/lib/port-trigger/
|
||||
endif
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libfirewallmngr.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,firewallmngr))
|
||||
1
firewallmngr/files/port-trigger/etc/config/port-trigger
Normal file
1
firewallmngr/files/port-trigger/etc/config/port-trigger
Normal file
@@ -0,0 +1 @@
|
||||
#port trigger uci file
|
||||
21
firewallmngr/files/port-trigger/etc/init.d/port-trigger
Normal file
21
firewallmngr/files/port-trigger/etc/init.d/port-trigger
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=65
|
||||
STOP=20
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/port-trigger/port_trigger.sh
|
||||
|
||||
start_service() {
|
||||
port_trigger_handling
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger firewall
|
||||
procd_add_reload_trigger port-trigger
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
start
|
||||
}
|
||||
157
firewallmngr/files/port-trigger/lib/port-trigger/port_trigger.sh
Executable file
157
firewallmngr/files/port-trigger/lib/port-trigger/port_trigger.sh
Executable file
@@ -0,0 +1,157 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
process_port_trigger() {
|
||||
local rule_id="$1"
|
||||
local is_enabled=""
|
||||
local duration=""
|
||||
local trigger_dport=""
|
||||
local trigger_dport_end=""
|
||||
local protocol=""
|
||||
local interface=""
|
||||
local open_dport=""
|
||||
local open_dport_end=""
|
||||
local open_protocol=""
|
||||
local ptg_id=""
|
||||
local IP_RULE=""
|
||||
local IP6_RULE=""
|
||||
local IP_RULE_FWD=""
|
||||
|
||||
get_port_trigger() {
|
||||
local ptg_name
|
||||
config_get ptg_name "$1" "name"
|
||||
if [ "$ptg_name" == "$2" ]; then
|
||||
ptg_id="$1"
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
ptg_id=""
|
||||
config_get name "$rule_id" "port_trigger"
|
||||
config_foreach get_port_trigger "port_trigger" "$name"
|
||||
[ -z "$ptg_id" ] && return
|
||||
|
||||
is_enabled=$(uci -q get port-trigger."$ptg_id".enable)
|
||||
|
||||
if [ -z "$is_enabled" ] || [ "$is_enabled" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
protocol=$(uci -q get port-trigger."$ptg_id".protocol)
|
||||
[ -z "$protocol" ] && return
|
||||
|
||||
if [ "$protocol" = "UDP" ] || [ "$protocol" = "udp" ]; then
|
||||
IP_RULE="$IP_RULE -p udp"
|
||||
IP6_RULE="$IP6_RULE -p udp"
|
||||
IP_RULE_FWD="$IP_RULE_FWD -p udp"
|
||||
elif [ "$protocol" = "TCP" ] || [ "$protocol" = "tcp" ]; then
|
||||
IP_RULE="$IP_RULE -p tcp"
|
||||
IP6_RULE="$IP6_RULE -p tcp"
|
||||
IP_RULE_FWD="$IP_RULE_FWD -p tcp"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
trigger_dport=$(uci -q get port-trigger."$ptg_id".port)
|
||||
[ -z "$trigger_dport" ] && return
|
||||
IP_RULE="$IP_RULE --dport $trigger_dport"
|
||||
IP6_RULE="$IP6_RULE --dport $trigger_dport"
|
||||
|
||||
trigger_dport_end=$(uci -q get port-trigger."$ptg_id".end_port_range)
|
||||
if [ -n "$trigger_dport_end" ]; then
|
||||
IP_RULE="$IP_RULE:$trigger_dport"
|
||||
IP6_RULE="$IP6_RULE:$trigger_dport"
|
||||
fi
|
||||
|
||||
config_get open_protocol "$rule_id" "protocol"
|
||||
if [ "$open_protocol" = "UDP" ] || [ "$open_protocol" = "udp" ]; then
|
||||
IP_RULE="$IP_RULE -j TRIGGER --trigger-type out --trigger-proto udp"
|
||||
IP6_RULE="$IP6_RULE -j TRIGGER --trigger-type out --trigger-proto udp"
|
||||
elif [ "$open_protocol" = "TCP" ] || [ "$open_protocol" = "tcp" ]; then
|
||||
IP_RULE="$IP_RULE -j TRIGGER --trigger-type out --trigger-proto tcp"
|
||||
IP6_RULE="$IP6_RULE -j TRIGGER --trigger-type out --trigger-proto tcp"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
config_get open_dport "$rule_id" "port"
|
||||
[ -z "$open_dport" ] && return
|
||||
IP_RULE="$IP_RULE --trigger-match $open_dport"
|
||||
IP6_RULE="$IP6_RULE --trigger-match $open_dport"
|
||||
IP_RULE_FWD="$IP_RULE_FWD --dport $open_dport"
|
||||
|
||||
config_get open_dport_end "$rule_id" "end_port_range"
|
||||
if [ -z "$open_dport_end" ]; then
|
||||
IP_RULE="$IP_RULE --trigger-relate $open_dport"
|
||||
IP6_RULE="$IP6_RULE --trigger-relate $open_dport"
|
||||
else
|
||||
IP_RULE="$IP_RULE-$open_dport_end --trigger-relate $open_dport-$open_dport_end"
|
||||
IP6_RULE="$IP6_RULE-$open_dport_end --trigger-relate $open_dport-$open_dport_end"
|
||||
IP_RULE_FWD="$IP_RULE_FWD:$open_dport_end"
|
||||
fi
|
||||
|
||||
duration=$(uci -q get port-trigger."$ptg_id".auto_disable_duration)
|
||||
if [ -n "$duration" ]; then
|
||||
IP_RULE="$IP_RULE --trigger-timeout $duration"
|
||||
IP6_RULE="$IP6_RULE --trigger-timeout $duration"
|
||||
fi
|
||||
|
||||
interface=$(uci -q get port-trigger."$ptg_id".src)
|
||||
[ -z "$interface" ] && return
|
||||
device=$(uci -q get network.$interface.device)
|
||||
IP_RULE_1="iptables -w -t nat -A prerouting_porttrigger -i $device $IP_RULE"
|
||||
echo "$IP_RULE_1">>/tmp/port_trigger_iptables
|
||||
|
||||
IP_RULE_1="ip6tables -w -t nat -A prerouting_porttrigger -i $device $IP6_RULE"
|
||||
echo "$IP_RULE_1">>/tmp/port_trigger_ip6tables
|
||||
|
||||
if [ -n "$duration" ]; then
|
||||
echo "iptables -w -t filter -A forwarding_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type in --trigger-timeout $duration">>/tmp/port_trigger_iptables
|
||||
echo "ip6tables -w -t filter -A forwarding_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type in --trigger-timeout $duration">>/tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -A prerouting_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type dnat --trigger-timeout $duration">>/tmp/port_trigger_iptables
|
||||
else
|
||||
echo "iptables -w -t filter -A forwarding_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type in">>/tmp/port_trigger_iptables
|
||||
echo "ip6tables -w -t filter -A forwarding_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type in">>/tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -A prerouting_wan_porttrigger $IP_RULE_FWD -j TRIGGER --trigger-type dnat">>/tmp/port_trigger_iptables
|
||||
fi
|
||||
}
|
||||
|
||||
port_trigger_handling() {
|
||||
rm /tmp/port_trigger_iptables 2> /dev/null
|
||||
rm /tmp/port_trigger_ip6tables 2> /dev/null
|
||||
touch /tmp/port_trigger_iptables
|
||||
touch /tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -F prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t filter -F forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t nat -F prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "ip6tables -w -t nat -F prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
echo "ip6tables -w -t filter -F forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
|
||||
echo "iptables -w -t nat -N prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t nat -I PREROUTING -j prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t filter -N forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t filter -I forwarding_wan_rule -j forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
echo "iptables -w -t nat -N prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "iptables -w -t nat -I prerouting_wan_rule -j prerouting_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_iptables
|
||||
|
||||
echo "ip6tables -w -t nat -N prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "ip6tables -w -t nat -I PREROUTING -j prerouting_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
echo "ip6tables -w -t filter -N forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && echo "ip6tables -w -t filter -I forwarding_wan_rule -j forwarding_wan_porttrigger 2> /dev/null">>/tmp/port_trigger_ip6tables
|
||||
|
||||
# Load /etc/config/port-trigger UCI file
|
||||
config_load port-trigger
|
||||
config_foreach process_port_trigger rule
|
||||
|
||||
sh /tmp/port_trigger_iptables
|
||||
sh /tmp/port_trigger_ip6tables
|
||||
}
|
||||
@@ -28,7 +28,7 @@ define KernelPackage/$(PKG_NAME)
|
||||
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
|
||||
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
|
||||
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
|
||||
DEPENDS:= +(TARGET_brcmbca):bcmkernel
|
||||
DEPENDS:= +(TARGET_brcmbca):bcm963xx-bsp
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_URL:=
|
||||
endef
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostmngr
|
||||
PKG_VERSION:=1.2.4
|
||||
PKG_VERSION:=1.2.5
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b4990b384461f2d1ff75a122a7fa5d9276f211bb
|
||||
PKG_SOURCE_VERSION:=20402c9fb60afa0678d844b0401e1b89699ff8b3
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/hostmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.7.12
|
||||
PKG_VERSION:=9.7.15
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
|
||||
PKG_SOURCE_VERSION:=d2041138fc086dccf5f306d4426ab7a2f823ce86
|
||||
PKG_SOURCE_VERSION:=fb3c8833f3fce7fe3659395cab48e7078f2007d5
|
||||
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:=ieee1905
|
||||
PKG_VERSION:=8.4.0
|
||||
PKG_VERSION:=8.4.2
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=d631dc9520b3486efbe202241425118a603b6171
|
||||
PKG_SOURCE_VERSION:=4d60d4a9b55940fffa39b7799abf2a7962ae2113
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -22,6 +22,7 @@ PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
|
||||
define Package/ieee1905/Default
|
||||
@@ -38,7 +39,7 @@ define Package/libieee1905
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=libieee1905.so (library for CMDU and TLV handling)
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json
|
||||
+libjson-c +libblobmsg-json +libwifiutils
|
||||
endef
|
||||
|
||||
define Package/ieee1905
|
||||
@@ -46,7 +47,8 @@ define Package/ieee1905
|
||||
TITLE:=ieee1905d (daemon implementing 1905.1 and provides cli)
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ubus +libpthread \
|
||||
+libieee1905 +IEEE1905_PLATFORM_HAS_WIFI:libwifi
|
||||
+libieee1905 +IEEE1905_PLATFORM_HAS_WIFI:libwifi \
|
||||
+libwifiutils +libbbfdm-api
|
||||
endef
|
||||
|
||||
include $(wildcard plugins/*.mk)
|
||||
@@ -107,6 +109,7 @@ define Package/ieee1905/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ieee1905d $(1)/usr/sbin/
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/tr181/ieee1905dm.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
define Package/libieee1905/install
|
||||
|
||||
@@ -4,7 +4,7 @@ PKG_NAME:=iopsys-analytics
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=837c28bb2587b348fa7dd6b98135752aaf5f5212
|
||||
PKG_SOURCE_VERSION:=fb84c1019a8a0fbfb624d9df8eb3604806645510
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/iopsys-analytics.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -6,15 +6,24 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ipt-trigger
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=8d4b4520a2935a5717a27f486a3fc78357b2a0cd
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ipt-trigger.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/ipt-trigger
|
||||
SUBMENU:=Other modules
|
||||
TITLE:=Kernel module for iptables port trigger
|
||||
FILES:=$(PKG_BUILD_DIR)/ipv4/ipt_TRIGGER.ko
|
||||
FILES:=$(PKG_BUILD_DIR)/src/ipv4/ipt_TRIGGER.ko
|
||||
DEPENDS+=+kmod-nf-nat +xtables-legacy
|
||||
AUTOLOAD:=$(call AutoLoad,30,ipt_TRIGGER,1)
|
||||
KCONFIG:=
|
||||
@@ -24,7 +33,7 @@ define KernelPackage/ip6t-trigger
|
||||
SUBMENU:=Other modules
|
||||
TITLE:=Kernel module for ip6tables port trigger
|
||||
DEPENDS+=+kmod-nf-nat +xtables-legacy
|
||||
FILES:=$(PKG_BUILD_DIR)/ipv6/ip6t_TRIGGER.ko
|
||||
FILES:=$(PKG_BUILD_DIR)/src/ipv6/ip6t_TRIGGER.ko
|
||||
AUTOLOAD:=$(call AutoLoad,30,ip6t_TRIGGER,1)
|
||||
KCONFIG:=
|
||||
endef
|
||||
@@ -41,21 +50,28 @@ ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
include ../../broadcom/bcmkernel/bcm-kernel-toolchain.mk
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ./src/* $(PKG_BUILD_DIR)/
|
||||
$(CP) $(PKG_BUILD_DIR)/ipt_TRIGGER.h $(LINUX_DIR)/include/linux/netfilter_ipv4/
|
||||
$(CP) -rf ./ipt-trigger/* $(PKG_BUILD_DIR)/
|
||||
$(CP) ./ipt-trigger/include/ipt_TRIGGER.h $(LINUX_DIR)/include/linux/netfilter_ipv4/
|
||||
endef
|
||||
else
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
$(CP) $(PKG_BUILD_DIR)/include/ipt_TRIGGER.h $(LINUX_DIR)/include/linux/netfilter_ipv4/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/include/linux/netfilter_ipv4
|
||||
$(CP) $(PKG_BUILD_DIR)/ipt_TRIGGER.h $(1)/include/linux/netfilter_ipv4/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/ipt_TRIGGER.h $(1)/include/linux/netfilter_ipv4/
|
||||
endef
|
||||
|
||||
KERNEL_MAKE_FLAGS += -I$(LINUX_DIR)/include
|
||||
|
||||
define Build/Compile
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/ipv4/" modules
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/ipv6/" modules
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/src/ipv4/" modules
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/src/ipv6/" modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,ipt-trigger))
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef _IPT_TRIGGER_H_target
|
||||
#define _IPT_TRIGGER_H_target
|
||||
|
||||
#define TRIGGER_TIMEOUT 600 /* 600 secs */
|
||||
|
||||
enum ipt_trigger_type
|
||||
{
|
||||
IPT_TRIGGER_DNAT = 1,
|
||||
IPT_TRIGGER_IN = 2,
|
||||
IPT_TRIGGER_OUT = 3,
|
||||
IPT_TRIGGER_REFRESH = 4
|
||||
};
|
||||
|
||||
struct ipt_trigger_ports {
|
||||
u_int16_t mport[2]; /* Related destination port range */
|
||||
u_int16_t rport[2]; /* Port range to map related destination port range to */
|
||||
};
|
||||
|
||||
struct ipt_trigger_info {
|
||||
enum ipt_trigger_type type;
|
||||
u_int16_t proto; /* Related protocol */
|
||||
u_int16_t trigger_timeout; /* Auto disable duration */
|
||||
struct ipt_trigger_ports ports;
|
||||
};
|
||||
|
||||
#endif /*_IPT_TRIGGER_H_target*/
|
||||
@@ -1 +0,0 @@
|
||||
obj-m +=ipt_TRIGGER.o
|
||||
@@ -1,407 +0,0 @@
|
||||
/* Kernel module to match the port-ranges, trigger related port-ranges,
|
||||
* and alters the destination to a local IP address.
|
||||
*
|
||||
* Copyright (C) 2003, CyberTAN Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Description:
|
||||
* This is kernel module for port-triggering.
|
||||
*
|
||||
* The module follows the Netfilter framework, called extended packet
|
||||
* matching modules.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netfilter.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/inetdevice.h>
|
||||
#include <linux/list.h>
|
||||
#include <net/protocol.h>
|
||||
#include <net/checksum.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#include <linux/netfilter_ipv4.h>
|
||||
#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
#include <net/netfilter/nf_conntrack.h>
|
||||
#include <net/netfilter/nf_conntrack_core.h>
|
||||
#include <net/netfilter/nf_conntrack_tuple.h>
|
||||
#include <net/netfilter/nf_nat.h>
|
||||
#include <linux/netfilter_ipv4/ipt_TRIGGER.h>
|
||||
|
||||
/* This rwlock protects the main hash table, protocol/helper/expected
|
||||
* registrations, conntrack timers*/
|
||||
|
||||
|
||||
static DEFINE_SPINLOCK(nf_trigger_lock);
|
||||
|
||||
|
||||
|
||||
#define NF_IP_PRE_ROUTING 0
|
||||
#define NF_IP_FORWARD 2
|
||||
#define IPT_CONTINUE XT_CONTINUE
|
||||
|
||||
|
||||
|
||||
/***********************lock help**********************/
|
||||
#define MUST_BE_READ_LOCKED(l)
|
||||
#define MUST_BE_WRITE_LOCKED(l)
|
||||
|
||||
|
||||
#define LOCK_BH(l) spin_lock_bh(l)
|
||||
#define UNLOCK_BH(l) spin_unlock_bh(l)
|
||||
|
||||
#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&nf_trigger_lock)
|
||||
#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&nf_trigger_lock)
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************list help**********************/
|
||||
#define LIST_FIND(head, cmpfn, type, args...) \
|
||||
({ \
|
||||
const struct list_head *__i, *__j = NULL; \
|
||||
\
|
||||
ASSERT_READ_LOCK(head); \
|
||||
list_for_each(__i, (head)) \
|
||||
if (cmpfn((const type)__i , ## args)) { \
|
||||
__j = __i; \
|
||||
break; \
|
||||
} \
|
||||
(type)__j; \
|
||||
})
|
||||
|
||||
static inline int
|
||||
__list_cmp_same(const void *p1, const void *p2) { return p1 == p2; }
|
||||
|
||||
static inline void
|
||||
list_prepend(struct list_head *head, void *new)
|
||||
{
|
||||
ASSERT_WRITE_LOCK(head);
|
||||
list_add(new, head);
|
||||
}
|
||||
|
||||
#define list_named_find(head, name) \
|
||||
LIST_FIND(head, __list_cmp_name, void *, name)
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
|
||||
MODULE_DESCRIPTION("iptables trigger target module");
|
||||
|
||||
#if 0
|
||||
#define DEBUGP printk
|
||||
#else
|
||||
#define DEBUGP(format, args...)
|
||||
#endif
|
||||
|
||||
struct ipt_trigger {
|
||||
struct list_head list; /* Trigger list */
|
||||
struct timer_list timeout; /* Timer for list destroying */
|
||||
u_int32_t srcip; /* Outgoing source address */
|
||||
u_int32_t dstip; /* Outgoing destination address */
|
||||
u_int16_t mproto; /* Trigger protocol */
|
||||
u_int16_t rproto; /* Related protocol */
|
||||
u_int16_t trigger_timeout; /* Auto disable duration */
|
||||
struct ipt_trigger_ports ports; /* Trigger and related ports */
|
||||
u_int8_t reply; /* Confirm a reply connection */
|
||||
};
|
||||
|
||||
LIST_HEAD(ipt_trigger_list);
|
||||
|
||||
static void trigger_refresh(struct ipt_trigger *trig, unsigned long extra_jiffies)
|
||||
{
|
||||
DEBUGP("%s: \n", __FUNCTION__);
|
||||
LOCK_BH(&nf_trigger_lock);
|
||||
/* Need del_timer for race avoidance (may already be dying). */
|
||||
if (del_timer(&trig->timeout)) {
|
||||
trig->timeout.expires = jiffies + extra_jiffies;
|
||||
add_timer(&trig->timeout);
|
||||
}
|
||||
|
||||
UNLOCK_BH(&nf_trigger_lock);
|
||||
}
|
||||
|
||||
static void __del_trigger(struct ipt_trigger *trig)
|
||||
{
|
||||
DEBUGP("%s: \n", __FUNCTION__);
|
||||
MUST_BE_WRITE_LOCKED(&nf_trigger_lock);
|
||||
|
||||
/* delete from 'ipt_trigger_list' */
|
||||
list_del(&trig->list);
|
||||
kfree(trig);
|
||||
}
|
||||
|
||||
static void trigger_timeout(struct timer_list *t)
|
||||
{
|
||||
struct ipt_trigger *trig = from_timer(trig, t, timeout);
|
||||
|
||||
DEBUGP("trigger list %p timed out\n", trig);
|
||||
LOCK_BH(&nf_trigger_lock);
|
||||
__del_trigger(trig);
|
||||
UNLOCK_BH(&nf_trigger_lock);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
add_new_trigger(struct ipt_trigger *trig)
|
||||
{
|
||||
struct ipt_trigger *new = NULL;
|
||||
|
||||
DEBUGP("!!!!!!!!!!!! %s !!!!!!!!!!!\n", __FUNCTION__);
|
||||
|
||||
LOCK_BH(&nf_trigger_lock);
|
||||
new = (struct ipt_trigger *)
|
||||
kmalloc(sizeof(struct ipt_trigger), GFP_ATOMIC);
|
||||
|
||||
if (!new) {
|
||||
UNLOCK_BH(&nf_trigger_lock);
|
||||
DEBUGP("%s: OOM allocating trigger list\n", __FUNCTION__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(new, 0, sizeof(*trig));
|
||||
INIT_LIST_HEAD(&new->list);
|
||||
memcpy(new, trig, sizeof(*trig));
|
||||
|
||||
/* add to global table of trigger */
|
||||
list_prepend(&ipt_trigger_list, &new->list);
|
||||
|
||||
/* add and start timer if required */
|
||||
timer_setup(&new->timeout, trigger_timeout, 0);
|
||||
mod_timer(&new->timeout, jiffies + (trig->trigger_timeout * HZ));
|
||||
|
||||
UNLOCK_BH(&nf_trigger_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Service-Name OutBound InBound
|
||||
* 1. TMD UDP:1000 TCP/UDP:2000..2010
|
||||
* 2. WOKAO UDP:1000 TCP/UDP:3000..3010
|
||||
* 3. net2phone-1 UDP:6801 TCP:30000..30000
|
||||
* 4. net2phone-2 UDP:6801 UDP:30000..30000
|
||||
*
|
||||
* For supporting to use the same outgoing port to trigger different port rules,
|
||||
* it should check the inbound protocol and port range value. If all conditions
|
||||
* are matched, it is a same trigger item, else it needs to create a new one.
|
||||
*/
|
||||
static inline int trigger_out_matched(const struct ipt_trigger *i,
|
||||
const u_int16_t proto, const u_int16_t dport, const struct ipt_trigger_info *info)
|
||||
{
|
||||
DEBUGP("%s: i=%p, proto= %d, dport=%d.\n", __FUNCTION__, i, proto, dport);
|
||||
DEBUGP("%s: Got one, mproto= %d, mport[0..1]=%d, %d, ", __FUNCTION__,
|
||||
i->mproto, i->ports.mport[0], i->ports.mport[1]);
|
||||
DEBUGP("rproto= %d, rport[0..1]=%d, %d.\n",
|
||||
i->rproto, i->ports.rport[0], i->ports.rport[1]);
|
||||
|
||||
return ((i->mproto == proto) &&
|
||||
(i->ports.mport[0] <= dport) &&
|
||||
(i->ports.mport[1] >= dport) &&
|
||||
(i->rproto == info->proto) &&
|
||||
(i->ports.rport[0] == info->ports.rport[0]) &&
|
||||
(i->ports.rport[1] == info->ports.rport[1]));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
trigger_out(struct sk_buff *skb,
|
||||
unsigned int hooknum,
|
||||
const void *targinfo)
|
||||
{
|
||||
const struct ipt_trigger_info *info = targinfo;
|
||||
struct ipt_trigger trig, *found;
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
struct tcphdr *tcph = (void *)iph + iph->ihl*4; /* Might be TCP, UDP */
|
||||
|
||||
DEBUGP("############# %s ############\n", __FUNCTION__);
|
||||
/* Check if the trigger range has already existed in 'ipt_trigger_list'. */
|
||||
found = LIST_FIND(&ipt_trigger_list, trigger_out_matched,
|
||||
struct ipt_trigger *, iph->protocol, ntohs(tcph->dest), info);
|
||||
|
||||
|
||||
if (found) {
|
||||
/* Yeah, it exists. We need to update(delay) the destroying timer. */
|
||||
trigger_refresh(found, info->trigger_timeout * HZ);
|
||||
/* In order to allow multiple hosts use the same port range, we update
|
||||
the 'saddr' after previous trigger has a reply connection. */
|
||||
if (found->reply)
|
||||
found->srcip = iph->saddr;
|
||||
}
|
||||
else {
|
||||
/* Create new trigger */
|
||||
memset(&trig, 0, sizeof(trig));
|
||||
trig.srcip = iph->saddr;
|
||||
trig.mproto = iph->protocol;
|
||||
trig.rproto = info->proto;
|
||||
trig.trigger_timeout = info->trigger_timeout;
|
||||
memcpy(&trig.ports, &info->ports, sizeof(struct ipt_trigger_ports));
|
||||
add_new_trigger(&trig); /* Add the new 'trig' to list 'ipt_trigger_list'. */
|
||||
}
|
||||
|
||||
return IPT_CONTINUE; /* We don't block any packet. */
|
||||
}
|
||||
|
||||
static inline int trigger_in_matched(const struct ipt_trigger *i,
|
||||
const u_int16_t proto, const u_int16_t dport)
|
||||
{
|
||||
u_int16_t rproto = i->rproto;
|
||||
|
||||
DEBUGP("%s: i=%p, proto= %d, dport=%d.\n", __FUNCTION__, i, proto, dport);
|
||||
DEBUGP("%s: Got one, rproto= %d, rport[0..1]=%d, %d.\n", __FUNCTION__,
|
||||
i->rproto, i->ports.rport[0], i->ports.rport[1]);
|
||||
|
||||
if (!rproto)
|
||||
rproto = proto;
|
||||
|
||||
return ((rproto == proto) && (i->ports.rport[0] <= dport)
|
||||
&& (i->ports.rport[1] >= dport));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
trigger_in(struct sk_buff *skb,
|
||||
unsigned int hooknum,
|
||||
const void *targinfo)
|
||||
{
|
||||
const struct ipt_trigger_info *info = targinfo;
|
||||
struct ipt_trigger *found;
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
struct tcphdr *tcph = (void *)iph + iph->ihl*4; /* Might be TCP, UDP */
|
||||
/* Check if the trigger-ed range has already existed in 'ipt_trigger_list'. */
|
||||
found = LIST_FIND(&ipt_trigger_list, trigger_in_matched,
|
||||
struct ipt_trigger *, iph->protocol, ntohs(tcph->dest));
|
||||
if (found) {
|
||||
DEBUGP("############# %s ############\n", __FUNCTION__);
|
||||
/* Yeah, it exists. We need to update(delay) the destroying timer. */
|
||||
trigger_refresh(found, info->trigger_timeout * HZ);
|
||||
return NF_ACCEPT; /* Accept it, or the imcoming packet could be
|
||||
dropped in the FORWARD chain */
|
||||
}
|
||||
|
||||
return IPT_CONTINUE; /* Our job is the interception. */
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
trigger_dnat(struct sk_buff *skb,
|
||||
unsigned int hooknum,
|
||||
const void *targinfo)
|
||||
{
|
||||
struct ipt_trigger *found = NULL;
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
struct tcphdr *tcph = (void *)iph + iph->ihl*4; /* Might be TCP, UDP */
|
||||
struct nf_conn *ct = NULL;
|
||||
enum ip_conntrack_info ctinfo;
|
||||
struct nf_nat_range2 newrange;
|
||||
|
||||
DEBUGP("############# %s ############%d\n", __FUNCTION__, __LINE__);
|
||||
/* Check if the trigger-ed range has already existed in 'ipt_trigger_list'. */
|
||||
found = LIST_FIND(&ipt_trigger_list, trigger_in_matched,
|
||||
struct ipt_trigger *, iph->protocol, ntohs(tcph->dest));
|
||||
if (found) {
|
||||
DEBUGP("############# %s ############%d srcip:%d\n", __FUNCTION__, __LINE__, found->srcip);
|
||||
}
|
||||
|
||||
if (!found || !found->srcip)
|
||||
return IPT_CONTINUE; /* We don't block any packet. */
|
||||
|
||||
DEBUGP("############# %s ############\n", __FUNCTION__);
|
||||
found->reply = 1; /* Confirm there has been a reply connection. */
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
|
||||
DEBUGP("%s: got ", __FUNCTION__);
|
||||
|
||||
|
||||
/* Alter the destination of imcoming packet. */
|
||||
/* Transfer from original range. */
|
||||
memset(&newrange.min_addr, 0, sizeof(newrange.min_addr));
|
||||
memset(&newrange.max_addr, 0, sizeof(newrange.max_addr));
|
||||
memset(&newrange.min_proto, 0, sizeof(newrange.min_proto));
|
||||
memset(&newrange.max_proto, 0, sizeof(newrange.max_proto));
|
||||
newrange.flags = NF_NAT_RANGE_MAP_IPS;
|
||||
newrange.min_addr.ip = found->srcip;
|
||||
newrange.max_addr.ip = found->srcip;
|
||||
DEBUGP("%s: found->srcip = %x\n", __FUNCTION__, found->srcip);
|
||||
|
||||
/* Hand modified range to generic setup. */
|
||||
return nf_nat_setup_info(ct, &newrange, NF_NAT_MANIP_DST);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
trigger_target(struct sk_buff *skb,
|
||||
const struct xt_action_param *par)
|
||||
{
|
||||
const struct ipt_trigger_info *info = par->targinfo;
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
unsigned int hooknum = xt_hooknum(par);
|
||||
|
||||
DEBUGP("%s: type = %s\n", __FUNCTION__,
|
||||
(info->type == IPT_TRIGGER_DNAT) ? "dnat" :
|
||||
(info->type == IPT_TRIGGER_IN) ? "in" : "out");
|
||||
|
||||
/* The Port-trigger only supports TCP and UDP. */
|
||||
if ((iph->protocol != IPPROTO_TCP) && (iph->protocol != IPPROTO_UDP))
|
||||
return IPT_CONTINUE;
|
||||
|
||||
if (info->type == IPT_TRIGGER_OUT)
|
||||
return trigger_out(skb, hooknum, info);
|
||||
else if (info->type == IPT_TRIGGER_IN)
|
||||
return trigger_in(skb, hooknum, info);
|
||||
else if (info->type == IPT_TRIGGER_DNAT)
|
||||
return trigger_dnat(skb, hooknum, info);
|
||||
|
||||
return IPT_CONTINUE;
|
||||
}
|
||||
static int
|
||||
trigger_check(const struct xt_tgchk_param *par)
|
||||
{
|
||||
const struct ipt_trigger_info *info = par->targinfo;
|
||||
|
||||
if ((strcmp(par->table, "mangle") == 0)) {
|
||||
DEBUGP("trigger_check: bad table `%s'.\n", par->table);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (par->hook_mask & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_FORWARD))) {
|
||||
DEBUGP("trigger_check: bad hooks %x.\n", par->hook_mask);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (info->proto) {
|
||||
if (info->proto != IPPROTO_TCP && info->proto != IPPROTO_UDP) {
|
||||
DEBUGP("trigger_check: bad proto %d.\n", info->proto);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (info->type == IPT_TRIGGER_OUT) {
|
||||
if (!info->ports.mport[0] || !info->ports.rport[0]) {
|
||||
DEBUGP("trigger_check: Try 'iptbles -j TRIGGER -h' for help.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct xt_target redirect_reg = {
|
||||
.name = "TRIGGER",
|
||||
.family = NFPROTO_IPV4,
|
||||
.target = trigger_target,
|
||||
.targetsize = sizeof(struct ipt_trigger_info),
|
||||
.checkentry = trigger_check,
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init init(void)
|
||||
{
|
||||
return xt_register_target(&redirect_reg);
|
||||
}
|
||||
|
||||
static void __exit fini(void)
|
||||
{
|
||||
xt_unregister_target(&redirect_reg);
|
||||
}
|
||||
|
||||
module_init(init);
|
||||
module_exit(fini);
|
||||
@@ -1 +0,0 @@
|
||||
obj-m +=ip6t_TRIGGER.o
|
||||
@@ -1,429 +0,0 @@
|
||||
/* Kernel module to match the port-ranges, trigger related port-ranges,
|
||||
* and alters the destination to a local IPv6 address.
|
||||
*
|
||||
* Copyright (C) 2024, IOPSYS
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Description:
|
||||
* This is kernel module for port-triggering.
|
||||
*
|
||||
* The module follows the Netfilter framework, called extended packet
|
||||
* matching modules.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netfilter.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/inetdevice.h>
|
||||
#include <linux/list.h>
|
||||
#include <net/protocol.h>
|
||||
#include <net/checksum.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#include <linux/netfilter_ipv6.h>
|
||||
#include <linux/netfilter_ipv6/ip6_tables.h>
|
||||
#include <net/netfilter/nf_conntrack.h>
|
||||
#include <net/netfilter/nf_conntrack_core.h>
|
||||
#include <net/netfilter/nf_conntrack_tuple.h>
|
||||
#include <net/netfilter/nf_nat.h>
|
||||
#include <linux/netfilter_ipv4/ipt_TRIGGER.h>
|
||||
|
||||
/* This rwlock protects the main hash table, protocol/helper/expected
|
||||
* registrations, conntrack timers*/
|
||||
|
||||
|
||||
static DEFINE_SPINLOCK(nf_trigger_lock);
|
||||
|
||||
|
||||
|
||||
#define NF_IP_PRE_ROUTING 0
|
||||
#define NF_IP_FORWARD 2
|
||||
#define IPT_CONTINUE XT_CONTINUE
|
||||
|
||||
|
||||
|
||||
/***********************lock help**********************/
|
||||
#define MUST_BE_READ_LOCKED(l)
|
||||
#define MUST_BE_WRITE_LOCKED(l)
|
||||
|
||||
|
||||
#define LOCK_BH(l) spin_lock_bh(l)
|
||||
#define UNLOCK_BH(l) spin_unlock_bh(l)
|
||||
|
||||
#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&nf_trigger_lock)
|
||||
#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&nf_trigger_lock)
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************list help**********************/
|
||||
#define LIST_FIND(head, cmpfn, type, args...) \
|
||||
({ \
|
||||
const struct list_head *__i, *__j = NULL; \
|
||||
\
|
||||
ASSERT_READ_LOCK(head); \
|
||||
list_for_each(__i, (head)) \
|
||||
if (cmpfn((const type)__i , ## args)) { \
|
||||
__j = __i; \
|
||||
break; \
|
||||
} \
|
||||
(type)__j; \
|
||||
})
|
||||
|
||||
static inline int
|
||||
__list_cmp_same(const void *p1, const void *p2) { return p1 == p2; }
|
||||
|
||||
static inline void
|
||||
list_prepend(struct list_head *head, void *new)
|
||||
{
|
||||
ASSERT_WRITE_LOCK(head);
|
||||
list_add(new, head);
|
||||
}
|
||||
|
||||
#define list_named_find(head, name) \
|
||||
LIST_FIND(head, __list_cmp_name, void *, name)
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("IOPSYS Network Team");
|
||||
MODULE_DESCRIPTION("iptables trigger target module");
|
||||
|
||||
#if 0
|
||||
#define DEBUGP printk
|
||||
#else
|
||||
#define DEBUGP(format, args...)
|
||||
#endif
|
||||
|
||||
struct ipt_trigger {
|
||||
struct list_head list; /* Trigger list */
|
||||
struct timer_list timeout; /* Timer for list destroying */
|
||||
struct in6_addr srcip; /* Outgoing source address */
|
||||
struct in6_addr dstip; /* Outgoing destination address */
|
||||
u_int16_t mproto; /* Trigger protocol */
|
||||
u_int16_t rproto; /* Related protocol */
|
||||
u_int16_t trigger_timeout; /* Auto disable duration */
|
||||
struct ipt_trigger_ports ports; /* Trigger and related ports */
|
||||
u_int8_t reply; /* Confirm a reply connection */
|
||||
};
|
||||
|
||||
LIST_HEAD(ipt_trigger_list);
|
||||
|
||||
static unsigned char *ipv6_header_get_L4_header_offset(const struct ipv6hdr *ip6h_p)
|
||||
{
|
||||
unsigned int ext_head_count = 8;
|
||||
const struct ipv6_opt_hdr *ip_ext_p;
|
||||
unsigned int payload_offset = 0;
|
||||
char *tcpudp_hdr = NULL;
|
||||
uint8_t nextHdr_p;
|
||||
|
||||
nextHdr_p = ip6h_p->nexthdr;
|
||||
ip_ext_p = (const struct ipv6_opt_hdr *)(ip6h_p + 1);
|
||||
payload_offset = sizeof(struct ipv6hdr);
|
||||
|
||||
do {
|
||||
if ((nextHdr_p == IPPROTO_TCP) || (nextHdr_p == IPPROTO_UDP)) {
|
||||
tcpudp_hdr = (unsigned char *)ip6h_p + payload_offset;
|
||||
break;
|
||||
}
|
||||
|
||||
payload_offset += (ip_ext_p->hdrlen + 1U) << 3U;
|
||||
nextHdr_p = ip_ext_p->nexthdr;
|
||||
ip_ext_p = (struct ipv6_opt_hdr *)((uint8_t *)ip6h_p + payload_offset);
|
||||
ext_head_count--; /* at most 8 extension headers */
|
||||
} while (ext_head_count);
|
||||
|
||||
return tcpudp_hdr;
|
||||
}
|
||||
|
||||
static void trigger_refresh(struct ipt_trigger *trig, unsigned long extra_jiffies)
|
||||
{
|
||||
DEBUGP("%s: \n", __FUNCTION__);
|
||||
LOCK_BH(&nf_trigger_lock);
|
||||
/* Need del_timer for race avoidance (may already be dying). */
|
||||
if (del_timer(&trig->timeout)) {
|
||||
trig->timeout.expires = jiffies + extra_jiffies;
|
||||
add_timer(&trig->timeout);
|
||||
}
|
||||
|
||||
UNLOCK_BH(&nf_trigger_lock);
|
||||
}
|
||||
|
||||
static void __del_trigger(struct ipt_trigger *trig)
|
||||
{
|
||||
DEBUGP("%s: \n", __FUNCTION__);
|
||||
MUST_BE_WRITE_LOCKED(&nf_trigger_lock);
|
||||
|
||||
/* delete from 'ipt_trigger_list' */
|
||||
list_del(&trig->list);
|
||||
kfree(trig);
|
||||
}
|
||||
|
||||
static void trigger_timeout(struct timer_list *t)
|
||||
{
|
||||
struct ipt_trigger *trig = from_timer(trig, t, timeout);
|
||||
|
||||
DEBUGP("trigger list %p timed out\n", trig);
|
||||
LOCK_BH(&nf_trigger_lock);
|
||||
__del_trigger(trig);
|
||||
UNLOCK_BH(&nf_trigger_lock);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
add_new_trigger(struct ipt_trigger *trig)
|
||||
{
|
||||
struct ipt_trigger *new = NULL;
|
||||
|
||||
DEBUGP("!!!!!!!!!!!! %s !!!!!!!!!!!\n", __FUNCTION__);
|
||||
|
||||
LOCK_BH(&nf_trigger_lock);
|
||||
new = (struct ipt_trigger *)
|
||||
kmalloc(sizeof(struct ipt_trigger), GFP_ATOMIC);
|
||||
|
||||
if (!new) {
|
||||
UNLOCK_BH(&nf_trigger_lock);
|
||||
DEBUGP("%s: OOM allocating trigger list\n", __FUNCTION__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(new, 0, sizeof(*trig));
|
||||
INIT_LIST_HEAD(&new->list);
|
||||
memcpy(new, trig, sizeof(*trig));
|
||||
|
||||
/* add to global table of trigger */
|
||||
list_prepend(&ipt_trigger_list, &new->list);
|
||||
|
||||
/* add and start timer if required */
|
||||
timer_setup(&new->timeout, trigger_timeout, 0);
|
||||
mod_timer(&new->timeout, jiffies + (trig->trigger_timeout * HZ));
|
||||
|
||||
UNLOCK_BH(&nf_trigger_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Service-Name OutBound InBound
|
||||
* 1. TMD UDP:1000 TCP/UDP:2000..2010
|
||||
* 2. WOKAO UDP:1000 TCP/UDP:3000..3010
|
||||
* 3. net2phone-1 UDP:6801 TCP:30000..30000
|
||||
* 4. net2phone-2 UDP:6801 UDP:30000..30000
|
||||
*
|
||||
* For supporting to use the same outgoing port to trigger different port rules,
|
||||
* it should check the inbound protocol and port range value. If all conditions
|
||||
* are matched, it is a same trigger item, else it needs to create a new one.
|
||||
*/
|
||||
static inline int trigger_out_matched(const struct ipt_trigger *i,
|
||||
const u_int16_t proto, const u_int16_t dport, const struct ipt_trigger_info *info)
|
||||
{
|
||||
DEBUGP("%s: i=%p, proto= %d, dport=%d.\n", __FUNCTION__, i, proto, dport);
|
||||
DEBUGP("%s: Got one, mproto= %d, mport[0..1]=%d, %d, ", __FUNCTION__,
|
||||
i->mproto, i->ports.mport[0], i->ports.mport[1]);
|
||||
DEBUGP("rproto= %d, rport[0..1]=%d, %d.\n",
|
||||
i->rproto, i->ports.rport[0], i->ports.rport[1]);
|
||||
|
||||
return ((i->mproto == proto) &&
|
||||
(i->ports.mport[0] <= dport) &&
|
||||
(i->ports.mport[1] >= dport) &&
|
||||
(i->rproto == info->proto) &&
|
||||
(i->ports.rport[0] == info->ports.rport[0]) &&
|
||||
(i->ports.rport[1] == info->ports.rport[1]));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
trigger_out(struct sk_buff *skb,
|
||||
unsigned int hooknum,
|
||||
const void *targinfo)
|
||||
{
|
||||
const struct ipt_trigger_info *info = targinfo;
|
||||
struct ipt_trigger trig, *found;
|
||||
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
struct tcphdr *tcph = (struct tcphdr*)ipv6_header_get_L4_header_offset(ip6h); /* Might be TCP, UDP */
|
||||
|
||||
DEBUGP("############# %s ############\n", __FUNCTION__);
|
||||
/* Check if the trigger range has already existed in 'ipt_trigger_list'. */
|
||||
found = LIST_FIND(&ipt_trigger_list, trigger_out_matched,
|
||||
struct ipt_trigger *, ip6h->nexthdr, ntohs(tcph->dest), info);
|
||||
|
||||
|
||||
if (found) {
|
||||
/* Yeah, it exists. We need to update(delay) the destroying timer. */
|
||||
trigger_refresh(found, info->trigger_timeout * HZ);
|
||||
/* In order to allow multiple hosts use the same port range, we update
|
||||
the 'saddr' after previous trigger has a reply connection. */
|
||||
if (found->reply)
|
||||
found->srcip = ip6h->saddr;
|
||||
}
|
||||
else {
|
||||
/* Create new trigger */
|
||||
memset(&trig, 0, sizeof(trig));
|
||||
memcpy(&trig.srcip, &ip6h->saddr, sizeof(trig.srcip));
|
||||
trig.mproto = ip6h->nexthdr;
|
||||
trig.rproto = info->proto;
|
||||
trig.trigger_timeout = info->trigger_timeout;
|
||||
memcpy(&trig.ports, &info->ports, sizeof(struct ipt_trigger_ports));
|
||||
add_new_trigger(&trig); /* Add the new 'trig' to list 'ipt_trigger_list'. */
|
||||
}
|
||||
|
||||
return IPT_CONTINUE; /* We don't block any packet. */
|
||||
}
|
||||
|
||||
static inline int trigger_in_matched(const struct ipt_trigger *i,
|
||||
const u_int16_t proto, const u_int16_t dport)
|
||||
{
|
||||
u_int16_t rproto = i->rproto;
|
||||
|
||||
DEBUGP("%s: i=%p, proto= %d, dport=%d.\n", __FUNCTION__, i, proto, dport);
|
||||
DEBUGP("%s: Got one, rproto= %d, rport[0..1]=%d, %d.\n", __FUNCTION__,
|
||||
i->rproto, i->ports.rport[0], i->ports.rport[1]);
|
||||
|
||||
if (!rproto)
|
||||
rproto = proto;
|
||||
|
||||
return ((rproto == proto) && (i->ports.rport[0] <= dport)
|
||||
&& (i->ports.rport[1] >= dport));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
trigger_in(struct sk_buff *skb,
|
||||
unsigned int hooknum,
|
||||
const void *targinfo)
|
||||
{
|
||||
const struct ipt_trigger_info *info = targinfo;
|
||||
struct ipt_trigger *found;
|
||||
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
struct tcphdr *tcph =(struct tcphdr*)ipv6_header_get_L4_header_offset(ip6h); /* Might be TCP, UDP */
|
||||
/* Check if the trigger-ed range has already existed in 'ipt_trigger_list'. */
|
||||
found = LIST_FIND(&ipt_trigger_list, trigger_in_matched,
|
||||
struct ipt_trigger *, ip6h->nexthdr, ntohs(tcph->dest));
|
||||
if (found) {
|
||||
DEBUGP("############# %s ############\n", __FUNCTION__);
|
||||
/* Yeah, it exists. We need to update(delay) the destroying timer. */
|
||||
trigger_refresh(found, info->trigger_timeout * HZ);
|
||||
return NF_ACCEPT; /* Accept it, or the imcoming packet could be
|
||||
dropped in the FORWARD chain */
|
||||
}
|
||||
|
||||
return IPT_CONTINUE; /* Our job is the interception. */
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
trigger_dnat(struct sk_buff *skb,
|
||||
unsigned int hooknum,
|
||||
const void *targinfo)
|
||||
{
|
||||
struct ipt_trigger *found = NULL;
|
||||
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
struct tcphdr *tcph =(struct tcphdr*)ipv6_header_get_L4_header_offset(ip6h); /* Might be TCP, UDP */
|
||||
struct nf_conn *ct = NULL;
|
||||
enum ip_conntrack_info ctinfo;
|
||||
struct nf_nat_range2 newrange;
|
||||
|
||||
/* Check if the trigger-ed range has already existed in 'ipt_trigger_list'. */
|
||||
found = LIST_FIND(&ipt_trigger_list, trigger_in_matched,
|
||||
struct ipt_trigger *, ip6h->nexthdr, ntohs(tcph->dest));
|
||||
|
||||
if (!found)
|
||||
return IPT_CONTINUE; /* We don't block any packet. */
|
||||
|
||||
DEBUGP("############# %s ############\n", __FUNCTION__);
|
||||
found->reply = 1; /* Confirm there has been a reply connection. */
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
|
||||
DEBUGP("%s: got ", __FUNCTION__);
|
||||
|
||||
|
||||
/* Alter the destination of imcoming packet. */
|
||||
/* Transfer from original range. */
|
||||
memset(&newrange.min_addr, 0, sizeof(newrange.min_addr));
|
||||
memset(&newrange.max_addr, 0, sizeof(newrange.max_addr));
|
||||
memset(&newrange.min_proto, 0, sizeof(newrange.min_proto));
|
||||
memset(&newrange.max_proto, 0, sizeof(newrange.max_proto));
|
||||
newrange.flags = NF_NAT_RANGE_MAP_IPS;
|
||||
memcpy(&newrange.min_addr.ip, &found->srcip, sizeof(newrange.min_addr.ip));
|
||||
memcpy(&newrange.max_addr.ip, &found->srcip, sizeof(newrange.max_addr.ip));
|
||||
DEBUGP("%s: found->srcip = %x\n", __FUNCTION__, found->srcip);
|
||||
|
||||
/* Hand modified range to generic setup. */
|
||||
return nf_nat_setup_info(ct, &newrange, NF_NAT_MANIP_DST);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
trigger_target(struct sk_buff *skb,
|
||||
const struct xt_action_param *par)
|
||||
{
|
||||
const struct ipt_trigger_info *info = par->targinfo;
|
||||
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
unsigned int hooknum = xt_hooknum(par);
|
||||
|
||||
DEBUGP("%s: type = %s\n", __FUNCTION__,
|
||||
(info->type == IPT_TRIGGER_DNAT) ? "dnat" :
|
||||
(info->type == IPT_TRIGGER_IN) ? "in" : "out");
|
||||
|
||||
/* The Port-trigger only supports TCP and UDP. */
|
||||
if ((ip6h->nexthdr != IPPROTO_TCP) && (ip6h->nexthdr != IPPROTO_UDP))
|
||||
return IPT_CONTINUE;
|
||||
|
||||
if (info->type == IPT_TRIGGER_OUT)
|
||||
return trigger_out(skb, hooknum, info);
|
||||
else if (info->type == IPT_TRIGGER_IN)
|
||||
return trigger_in(skb, hooknum, info);
|
||||
else if (info->type == IPT_TRIGGER_DNAT)
|
||||
return trigger_dnat(skb, hooknum, info);
|
||||
|
||||
return IPT_CONTINUE;
|
||||
}
|
||||
static int
|
||||
trigger_check(const struct xt_tgchk_param *par)
|
||||
{
|
||||
const struct ipt_trigger_info *info = par->targinfo;
|
||||
|
||||
if ((strcmp(par->table, "mangle") == 0)) {
|
||||
DEBUGP("trigger_check: bad table `%s'.\n", par->table);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (par->hook_mask & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_FORWARD))) {
|
||||
DEBUGP("trigger_check: bad hooks %x.\n", par->hook_mask);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (info->proto) {
|
||||
if (info->proto != IPPROTO_TCP && info->proto != IPPROTO_UDP) {
|
||||
DEBUGP("trigger_check: bad proto %d.\n", info->proto);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (info->type == IPT_TRIGGER_OUT) {
|
||||
if (!info->ports.mport[0] || !info->ports.rport[0]) {
|
||||
DEBUGP("trigger_check: Try 'iptbles -j TRIGGER -h' for help.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct xt_target redirect_reg = {
|
||||
.name = "TRIGGER",
|
||||
.family = NFPROTO_IPV6,
|
||||
.target = trigger_target,
|
||||
.targetsize = sizeof(struct ipt_trigger_info),
|
||||
.checkentry = trigger_check,
|
||||
.me = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init init(void)
|
||||
{
|
||||
return xt_register_target(&redirect_reg);
|
||||
}
|
||||
|
||||
static void __exit fini(void)
|
||||
{
|
||||
xt_unregister_target(&redirect_reg);
|
||||
}
|
||||
|
||||
module_init(init);
|
||||
module_exit(fini);
|
||||
@@ -66,7 +66,7 @@ define Package/libethernet
|
||||
SUBMENU:=IOPSYS HAL libs
|
||||
MENU:=1
|
||||
TITLE:= Ethernet library (libethernet)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_airoha:ecnt_api +TARGET_brcmbca:bcmkernel
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_airoha:ecnt_api +TARGET_brcmbca:bcm963xx-bsp
|
||||
endef
|
||||
|
||||
define Package/libethernet/description
|
||||
|
||||
@@ -26,7 +26,7 @@ define Package/libpicoevent-bcm
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Libpicoevent-bcm
|
||||
URL:=
|
||||
DEPENDS:= +TARGET_brcmbca:bcmkernel
|
||||
DEPENDS:= +TARGET_brcmbca:bcm963xx-bsp
|
||||
include $(TOPDIR)/feeds/broadcom/bcmkernel/bcm-toolchain.mk
|
||||
endef
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libqos
|
||||
PKG_VERSION:=7.2.106
|
||||
PKG_VERSION:=7.2.107
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=0e54d7a992c506d6302d7cc32a39eb64e9b2c42e
|
||||
PKG_SOURCE_VERSION:=de659f50c0ae1cd4ec64315b301c53595eaf39de
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libqos.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -65,7 +65,7 @@ define Package/libqos
|
||||
SUBMENU:=IOPSYS HAL libs
|
||||
MENU:=1
|
||||
TITLE:= QoS library (libqos)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_brcmbca:bcmkernel
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_brcmbca:bcm963xx-bsp
|
||||
endef
|
||||
|
||||
define Package/libqos/config
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-broadcom
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0.12
|
||||
PKG_VERSION:=1.0.13
|
||||
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:=475aa02e4fb9f8241ac4c38f622e87464cfc7154
|
||||
PKG_SOURCE_VERSION:=f1509651217d027376b5b7fc3f64ca86662e9b2d
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-d2
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.10
|
||||
PKG_VERSION:=1.1.11
|
||||
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:=983528e257256ead689f58c7ee7157c00a9fcb14
|
||||
PKG_SOURCE_VERSION:=95fb29a31f7665abbe87af4a74cf52b7e5f22a29
|
||||
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:=libwifi
|
||||
PKG_VERSION:=7.4.63
|
||||
PKG_VERSION:=7.4.69
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=f3925af4cd2d8cf2ce805cd71f562639779a652e
|
||||
PKG_SOURCE_VERSION:=8a5d8b5defb7cedc5876bb5fbee5c1ad185de889
|
||||
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
|
||||
@@ -131,7 +131,7 @@ endef
|
||||
define Package/libwifi
|
||||
$(call Package/libwifi-common)
|
||||
TITLE:= WiFi library (libwifi)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +libwifiutils +TARGET_brcmbca:bcmkernel
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +libwifiutils +TARGET_brcmbca:bcm963xx-bsp
|
||||
endef
|
||||
|
||||
define Package/libwifi/config
|
||||
|
||||
@@ -59,5 +59,8 @@ config AGENT_CHECK_PARTIAL_WIFI_RELOAD
|
||||
bool "Option that allow SSID/PSK simple reload"
|
||||
default y
|
||||
|
||||
config DYNBHD_DYNAMICALLY_PERSIST_CONTROLLER
|
||||
bool "Let dynbhd through AP-Autoconfiguration Search and DHCP Discovery determine the controller or agent role"
|
||||
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=6.0.0.5
|
||||
PKG_VERSION:=6.1.1.2
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=e9c6515c053aa49b7cdcda86548904ff7fcdd6b0
|
||||
PKG_SOURCE_VERSION:=d0ff409ffe6bb03c97e14b34932f437f58f4e241
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -109,6 +109,10 @@ ifeq ($(CONFIG_AGENT_CHECK_PARTIAL_WIFI_RELOAD),y)
|
||||
TARGET_CFLAGS += -DCHECK_PARTIAL_WIFI_RELOAD
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DYNBHD_DYNAMICALLY_PERSIST_CONTROLLER),y)
|
||||
TARGET_CFLAGS += -DPERSIST_CONTROLLER
|
||||
endif
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/map-agent/install
|
||||
|
||||
@@ -86,9 +86,12 @@ generate_multiap_config() {
|
||||
[ "$disable_mlo" == "1" ] || {
|
||||
uci set wireless.$dev.mlo="1"
|
||||
uci set wireless.$dev.mlo_capable="1"
|
||||
}
|
||||
uci commit wireless
|
||||
|
||||
uci commit wireless
|
||||
# Disable for MLD/MLO
|
||||
uci set mapagent.agent.island_prevention="0"
|
||||
uci commit mapagent
|
||||
}
|
||||
else
|
||||
ifprefix="wlan%-"
|
||||
ifname="wlan$devidx"
|
||||
@@ -190,19 +193,19 @@ map_genconf () {
|
||||
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"
|
||||
[ "$disable_mlo" == "1" ] && {
|
||||
mapcontroller_disable_mld() {
|
||||
uci set mapcontroller.$1.enabled='0'
|
||||
if [ "$multiap_mode" == "agent" -o "$multiap_mode" == "none" ]; then
|
||||
uci set mapcontroller.controller.enabled="0"
|
||||
else
|
||||
uci set mapcontroller.controller.enabled="1"
|
||||
[ "$disable_mlo" == "1" ] && {
|
||||
mapcontroller_disable_mld() {
|
||||
uci set mapcontroller.$1.enabled='0'
|
||||
}
|
||||
config_load mapcontroller
|
||||
config_foreach mapcontroller_disable_mld mld
|
||||
}
|
||||
config_load mapcontroller
|
||||
config_foreach mapcontroller_disable_mld mld
|
||||
}
|
||||
fi
|
||||
uci -q commit mapcontroller
|
||||
fi
|
||||
uci -q commit mapcontroller
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=6.0.0.4
|
||||
PKG_VERSION:=6.1.1.2
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=882d1d9652ad5f3853edf26ef55c4c461620d9f9
|
||||
PKG_SOURCE_VERSION:=480a5304591632729212408d77d220f707cb9d6b
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
LOCAL_DEV=0
|
||||
|
||||
@@ -40,6 +40,7 @@ config ap
|
||||
option key '$WIFI_FH_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
|
||||
config ap
|
||||
option band '5'
|
||||
@@ -48,6 +49,7 @@ config ap
|
||||
option key '$WIFI_FH_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
|
||||
config ap
|
||||
option band '6'
|
||||
@@ -56,6 +58,7 @@ config ap
|
||||
option key '$WIFI_FH_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
|
||||
config ap
|
||||
option band '2'
|
||||
@@ -64,6 +67,7 @@ config ap
|
||||
option key '$WIFI_BH_KEY'
|
||||
option type 'backhaul'
|
||||
option vid '1'
|
||||
option mld_id '2'
|
||||
|
||||
config ap
|
||||
option band '5'
|
||||
@@ -72,6 +76,7 @@ config ap
|
||||
option key '$WIFI_BH_KEY'
|
||||
option type 'backhaul'
|
||||
option vid '1'
|
||||
option mld_id '2'
|
||||
|
||||
config ap
|
||||
option band '6'
|
||||
@@ -80,42 +85,22 @@ config ap
|
||||
option key '$WIFI_BH_KEY'
|
||||
option type 'backhaul'
|
||||
option vid '1'
|
||||
|
||||
config ap
|
||||
option band '2'
|
||||
option ssid '$DEVICE_MANUFACTURER-$BASEMAC_ADDR-2.4GHz-MLDlink'
|
||||
option encryption 'sae-mixed'
|
||||
option key '$WIFI_FH_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
|
||||
config ap
|
||||
option band '5'
|
||||
option ssid '$DEVICE_MANUFACTURER-$BASEMAC_ADDR-5GHz-MLDlink'
|
||||
option encryption 'sae-mixed'
|
||||
option key '$WIFI_FH_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
|
||||
config ap
|
||||
option band '6'
|
||||
option ssid '$DEVICE_MANUFACTURER-$BASEMAC_ADDR-6GHz-MLDlink'
|
||||
option encryption 'sae'
|
||||
option key '$WIFI_FH_KEY'
|
||||
option vid '1'
|
||||
option type 'fronthaul'
|
||||
option mld_id '1'
|
||||
option mld_id '2'
|
||||
|
||||
config mld
|
||||
option id '1'
|
||||
option ssid 'MAP-$BASEMAC_ADDR-MLD'
|
||||
option encryption 'sae'
|
||||
option ssid '$DEVICE_MANUFACTURER-$BASEMAC_ADDR'
|
||||
option key '$WIFI_FH_KEY'
|
||||
# option vid '1'
|
||||
option type 'fronthaul'
|
||||
|
||||
config mld
|
||||
option id '2'
|
||||
option ssid 'MAP-$BASEMAC_ADDR-BH'
|
||||
option key '$WIFI_BH_KEY'
|
||||
# option vid '1'
|
||||
option type 'backhaul'
|
||||
|
||||
# node and radio sections (per node) are auto
|
||||
# generated per Multi-AP Agent in the network
|
||||
#
|
||||
|
||||
@@ -6,14 +6,14 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=mcastmngr
|
||||
PKG_VERSION:=1.2.2
|
||||
PKG_VERSION:=1.2.3
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/mcastmngr.git
|
||||
PKG_SOURCE_VERSION:=fcdaa46f1c7467e82d612070ec583d8311ba2576
|
||||
PKG_SOURCE_VERSION:=117acf7a29e3a343756aab9b0ae330022892c15b
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -117,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
|
||||
|
||||
@@ -30,4 +30,25 @@ config OBUSPA_MAX_CONTROLLERS_NUM
|
||||
help
|
||||
This value must be in range of 1 to 10. (default 5)
|
||||
|
||||
config OBUSPA_DOWNLOAD_EXTENSION
|
||||
bool "Adds Device.LocalAgent.X_IOPSYS_EU_Download()"
|
||||
default y
|
||||
help
|
||||
Adds Device.LocalAgent.X_IOPSYS_EU_Download() operate command
|
||||
for local file download to cpe
|
||||
|
||||
config OBUSPA_UPLOAD_EXTENSION
|
||||
bool "Adds Device.LocalAgent.X_IOPSYS_EU_Upload()"
|
||||
default y
|
||||
help
|
||||
Adds Device.LocalAgent.X_IOPSYS_EU_Upload() operate command
|
||||
for pull a file from cpe
|
||||
|
||||
config OBUSPA_SESSION_EXTENSION
|
||||
bool "Adds Device.LocalAgent.X_IOPSYS_EU_Session."
|
||||
default y
|
||||
help
|
||||
Adds Device.LocalAgent.X_IOPSYS_EU_Session. object to simulate
|
||||
a CWMP like session
|
||||
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=8.0.1.1
|
||||
PKG_VERSION:=8.0.1.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||
PKG_SOURCE_VERSION:=a89ceda29b1e3ef4792d5b39a9cd0eca9c12149f
|
||||
PKG_SOURCE_VERSION:=0997eebe269d766eb738b80e4d5ccd40baf79090
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -81,6 +81,18 @@ else
|
||||
CMAKE_OPTIONS += -DENABLE_WEBSOCKETS=OFF
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_OBUSPA_DOWNLOAD_EXTENSION),y)
|
||||
TARGET_CFLAGS += -DOBUSPA_ENABLE_DOWNLOAD_EXT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_OBUSPA_UPLOAD_EXTENSION),y)
|
||||
TARGET_CFLAGS += -DOBUSPA_ENABLE_UPLOAD_EXT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_OBUSPA_SESSION_EXTENSION),y)
|
||||
TARGET_CFLAGS += -DOBUSPA_ENABLE_SESSION_EXT
|
||||
endif
|
||||
|
||||
ifdef $(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
|
||||
TARGET_CFLAGS += -DOBUSPA_MAX_CONTROLLERS_NUM=$(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
|
||||
endif
|
||||
@@ -96,20 +108,23 @@ define Package/obuspa/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/obuspa/roles
|
||||
$(INSTALL_DIR) $(1)/etc/obuspa
|
||||
$(INSTALL_DIR) $(1)/etc/users/roles
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/obuspa $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/obuspa $(1)/etc/init.d/
|
||||
$(INSTALL_DATA) ./files/etc/config/obuspa $(1)/etc/config/
|
||||
$(INSTALL_DATA) ./files/etc/obuspa/roles/*.json $(1)/etc/obuspa/roles/
|
||||
$(INSTALL_DATA) ./files/etc/users/roles/*.json $(1)/etc/users/roles/
|
||||
$(INSTALL_DATA) ./files/etc/obuspa/usp_utils.sh $(1)/etc/obuspa/
|
||||
echo "$(CONFIG_BBF_VENDOR_PREFIX)" > $(1)/etc/obuspa/vendor_prefix
|
||||
$(INSTALL_DATA) ./files/etc/obuspa/dmcaching_exclude.json $(1)/etc/obuspa/dmcaching_exclude.json
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/02-obuspa-dhcp-option $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/60-generate-ctrust-defaults $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/obuspa-set-dhcp-option $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user
|
||||
$(INSTALL_BIN) ./files/obuspa.hotplug $(1)/etc/hotplug.d/iface/21-obuspa
|
||||
$(BBFDM_INSTALL_CORE_PLUGIN) ./files/etc/bbfdm/json/USPAgent.json $(1)
|
||||
ifeq ($(CONFIG_OBUSPA_ENABLE_TEST_CONTROLLER),y)
|
||||
$(INSTALL_BIN) ./files/etc/init.d/usptest $(1)/etc/init.d/
|
||||
|
||||
@@ -1,541 +0,0 @@
|
||||
{
|
||||
"roles": [
|
||||
{
|
||||
"name": "admin",
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.Reboot()",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.SelfTestDiagnostics()",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.FactoryReset()",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DeviceInfo.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Time.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.UPnP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Bridging.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Ethernet.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DHCPv4.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DHCPv4.Server.Pool.{i}.StaticAddress.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DHCPv6.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Hosts.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.{BBF_VENDOR_PREFIX}URLFilter.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.{BBF_VENDOR_PREFIX}OpenVPN.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.NAT.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.PPP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Routing.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.IEEE1905.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.InterfaceStack.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DynamicDNS.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.LANConfigSecurity.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Security.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.RouterAdvertisement.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Services.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.UserInterface.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.PeriodicStatistics.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.SoftwareModules.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Users.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.Subscription.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DNS.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.IP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.SSH.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"roles": [
|
||||
{
|
||||
"name": "extender",
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_NONE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.SSH.",
|
||||
"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,15 +0,0 @@
|
||||
{
|
||||
"roles": [
|
||||
{
|
||||
"name": "full_access",
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_ALL"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
{
|
||||
"roles": [
|
||||
{
|
||||
"name": "user",
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_NONE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DeviceInfo.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Hosts.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.IEEE1905.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DynamicDNS.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.PeriodicStatistics.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.Subscription.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.AccessPoint.{i}.WPS.InitiateWPSPBC()",
|
||||
"perm": [
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.DataElements.Network.SetSSID()",
|
||||
"perm": [
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
CTRUST_RESET_FILE="/tmp/obuspa/ctrust_reset"
|
||||
VENDOR_PREFIX_FILE="/etc/obuspa/vendor_prefix"
|
||||
FW_DEFAULT_ROLE_DIR="/etc/obuspa/roles"
|
||||
FW_DEFAULT_ROLE_DIR="/etc/users/roles"
|
||||
|
||||
|
||||
# include jshn.sh
|
||||
@@ -175,14 +175,13 @@ configure_roles_dir()
|
||||
{
|
||||
local rinst rname
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Illegal number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rinst="${3}"
|
||||
json_select $2
|
||||
json_get_var rname name
|
||||
rname="${1}"
|
||||
rinst="${2}"
|
||||
|
||||
db_add Device.LocalAgent.ControllerTrust.Role.${rinst}.Alias cpe-${rinst}
|
||||
db_add Device.LocalAgent.ControllerTrust.Role.${rinst}.Enable 1
|
||||
@@ -190,7 +189,6 @@ configure_roles_dir()
|
||||
|
||||
json_for_each_item configure_permission permission "${name}" ${rinst}
|
||||
json_select ..
|
||||
break
|
||||
}
|
||||
|
||||
configure_ctrust_role()
|
||||
@@ -209,7 +207,8 @@ configure_ctrust_role()
|
||||
echo "Loading $f ....."
|
||||
json_init
|
||||
json_load_file "${FW_DEFAULT_ROLE_DIR}/${f}"
|
||||
json_for_each_item configure_roles_dir roles ${num}
|
||||
json_select tr181
|
||||
configure_roles_dir "${f/.json/}" "${num}"
|
||||
num=$((num + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
configure_dhcp_options() {
|
||||
local enabled inerface discovery
|
||||
config_load obuspa
|
||||
config_get_bool enabled global enabled 1
|
||||
config_get interface global interface "wan"
|
||||
config_get_bool discovery global dhcp_discovery 1
|
||||
|
||||
if [ "${enabled}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${discovery}" -eq 1 ]; then
|
||||
network_uci_update=0
|
||||
reqopts="$(uci -q get network."${interface}".reqopts)"
|
||||
proto="$(uci -q get network."${interface}".proto)"
|
||||
local req125_present=0
|
||||
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
125) req125_present=1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
sendopts="$(uci -q get network."${interface}".sendopts)"
|
||||
opt124="124:"
|
||||
send124_present=0
|
||||
for sopt in $sendopts; do
|
||||
if [[ "$sopt" == "$opt124"* ]]; then
|
||||
send124_present=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
uci -q set network."${interface}".reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
|
||||
if [ ${send124_present} -eq 0 ]; then
|
||||
newsendopts="${sendopts} 124:00:00:0D:E9:04:03:75:73:70"
|
||||
uci -q set network."${interface}".sendopts="$newsendopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${network_uci_update} -eq 1 ]; then
|
||||
uci commit network
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
configure_dhcp_options
|
||||
88
obuspa/files/etc/uci-defaults/obuspa-set-dhcp-option
Normal file
88
obuspa/files/etc/uci-defaults/obuspa-set-dhcp-option
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
get_access_role()
|
||||
{
|
||||
local mode lan_proto
|
||||
|
||||
lan_proto="$(uci -q get network.lan.proto)"
|
||||
|
||||
if [ "${lan_proto}" == "dhcp" ]; then
|
||||
mode="extender"
|
||||
else
|
||||
mode="full_access"
|
||||
fi
|
||||
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
configure_dhcp_options() {
|
||||
local enabled inerface discovery
|
||||
config_load obuspa
|
||||
config_get_bool enabled global enabled 1
|
||||
config_get interface global interface
|
||||
config_get_bool discovery global dhcp_discovery 1
|
||||
|
||||
if [ "${enabled}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${discovery}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
role="$(get_access_role)"
|
||||
|
||||
if [ "${role}" = "extender" ]; then
|
||||
interface="lan"
|
||||
uci -q set obuspa.global.interface="lan"
|
||||
uci commit obuspa
|
||||
else
|
||||
interface="wan"
|
||||
fi
|
||||
fi
|
||||
|
||||
network_uci_update=0
|
||||
reqopts="$(uci -q get network."${interface}".reqopts)"
|
||||
proto="$(uci -q get network."${interface}".proto)"
|
||||
local req125_present=0
|
||||
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
125) req125_present=1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
sendopts="$(uci -q get network."${interface}".sendopts)"
|
||||
opt124="124:"
|
||||
send124_present=0
|
||||
for sopt in $sendopts; do
|
||||
if [[ "$sopt" == "$opt124"* ]]; then
|
||||
send124_present=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
uci -q set network."${interface}".reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
|
||||
if [ ${send124_present} -eq 0 ]; then
|
||||
newsendopts="${sendopts} 124:00:00:0D:E9:04:03:75:73:70"
|
||||
uci -q set network."${interface}".sendopts="$newsendopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${network_uci_update} -eq 1 ]; then
|
||||
uci commit network
|
||||
fi
|
||||
}
|
||||
|
||||
configure_dhcp_options
|
||||
26
obuspa/files/etc/users/roles/extender.json
Normal file
26
obuspa/files/etc/users/roles/extender.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"tr181": {
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_NONE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.SSH.",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
12
obuspa/files/etc/users/roles/full_access.json
Normal file
12
obuspa/files/etc/users/roles/full_access.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"tr181": {
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_ALL"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
39
obuspa/files/obuspa.hotplug
Normal file
39
obuspa/files/obuspa.hotplug
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
get_access_role() {
|
||||
local mode lan_proto
|
||||
|
||||
lan_proto="$(uci -q get network.lan.proto)"
|
||||
|
||||
if [ "${lan_proto}" == "dhcp" ]; then
|
||||
mode="extender"
|
||||
else
|
||||
mode="full_access"
|
||||
fi
|
||||
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
config_load obuspa
|
||||
config_get_bool enable_obuspa global enabled 1
|
||||
config_get intf global interface
|
||||
|
||||
if [ "$enable_obuspa" = "0" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ -z "${intf}" ]; then
|
||||
role="$(get_access_role)"
|
||||
|
||||
if [ "${role}" = "extender" ]; then
|
||||
intf="lan"
|
||||
else
|
||||
intf="wan"
|
||||
fi
|
||||
fi
|
||||
|
||||
[ "$ACTION" = "ifup" -a "${intf}" = "${INTERFACE}" ] && {
|
||||
sleep 1
|
||||
obuspa -c event Device.LocalAgent.WakeUp!
|
||||
}
|
||||
|
||||
51
packet-capture-diagnostics/Makefile
Normal file
51
packet-capture-diagnostics/Makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Copyright (C) 2023 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=packet-capture-diagnostics
|
||||
PKG_VERSION:=1.0.0
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/packet-capture-diagnostics.git
|
||||
PKG_SOURCE_VERSION:=a47189b5faa9f678f1a27475c474cc1524d777f4
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/packet-capture-diagnostics
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=PacketCaptureDiagnostics datamodel
|
||||
DEPENDS:=+libbbfdm-api +tcpdump
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/packet-capture-diagnostics/description
|
||||
Package to add Device.PacketCaptureDiagnostics. datamodel support using bbfdm
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/packet-capture-diagnostics/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/packet-capture-diagnostics/install
|
||||
$(BBFDM_INSTALL_SCRIPT) ./files/scripts/packetcapture $(1)
|
||||
$(BBFDM_INSTALL_CORE_PLUGIN) $(PKG_BUILD_DIR)/src/libpackcapture.so $(1)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,packet-capture-diagnostics))
|
||||
192
packet-capture-diagnostics/files/scripts/packetcapture
Normal file
192
packet-capture-diagnostics/files/scripts/packetcapture
Normal file
@@ -0,0 +1,192 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2024 iopsys Software Solutions AB
|
||||
# Author: Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
ROOT="$(dirname "${0}")"
|
||||
. "${ROOT}"/bbf_api
|
||||
|
||||
UPLOAD_TIMEOUT=1800
|
||||
|
||||
packet_capture_error() {
|
||||
json_init
|
||||
json_add_string "Status" "$1"
|
||||
json_add_string "FileLocation" ""
|
||||
json_add_string "StartTime" "0"
|
||||
json_add_string "EndTime" "0"
|
||||
json_add_string "Count" "0"
|
||||
json_dump
|
||||
|
||||
[ "$2" = "both_proto" ] && {
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.DiagnosticState="$1"
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.FileLocation=""
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.StartTime=0
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.EndTime=0
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.Count=0
|
||||
$UCI_COMMIT_BBF_DMMAP
|
||||
}
|
||||
}
|
||||
|
||||
packet_capture_launch() {
|
||||
input="$1"
|
||||
intf=""
|
||||
filename=$(mktemp /tmp/capture.XXXXXXX)
|
||||
|
||||
# Delete if any local capture file exist
|
||||
find / -name "packetcapture.pcap" -exec rm {} \;
|
||||
|
||||
json_load "${input}"
|
||||
|
||||
json_get_var interface interface
|
||||
json_get_var format format
|
||||
json_get_var duration duration
|
||||
json_get_var packet_count packet_count
|
||||
json_get_var file_target file_target
|
||||
json_get_var expression expression
|
||||
json_get_var username username
|
||||
json_get_var password password
|
||||
json_get_var proto proto
|
||||
json_get_var cancel cancel
|
||||
|
||||
[ "$proto" = "both_proto" ] && {
|
||||
old_pid=$(cat /tmp/packetcapture_pid)
|
||||
|
||||
[ -n "${old_pid}" ] && {
|
||||
cmd=$(cat /proc/$old_pid/cmdline)
|
||||
}
|
||||
|
||||
if [[ "${cmd}" = *packetcapture* ]]; then
|
||||
kill -9 ${old_pid}
|
||||
fi
|
||||
|
||||
if [ "${cancel}" -eq "1" ]; then
|
||||
json_init
|
||||
json_add_string "Status" "None"
|
||||
json_add_string "FileLocation" ""
|
||||
json_add_string "StartTime" "0"
|
||||
json_add_string "EndTime" "0"
|
||||
json_add_string "Count" "0"
|
||||
json_dump
|
||||
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.DiagnosticState="None"
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.FileLocation=""
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.StartTime=0
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.EndTime=0
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.Count=0
|
||||
$UCI_COMMIT_BBF_DMMAP
|
||||
|
||||
return
|
||||
else
|
||||
echo $$ > /tmp/packetcapture_pid
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.DiagnosticState="Requested_running"
|
||||
$UCI_COMMIT_BBF_DMMAP
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "${format}" ] && [ "${format}" != "libpcap" ]; then
|
||||
# Error
|
||||
packet_capture_error "Error_Internal" "${proto}"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "${file_target}" ]; then
|
||||
# Error
|
||||
packet_capture_error "Error_Internal" "${proto}"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "${interface}" ]; then
|
||||
intf=$(ifstatus "${interface}" | jq ".l3_device")
|
||||
|
||||
if [ -z "${intf}" ]; then
|
||||
# Error
|
||||
packet_capture_error "Error_Internal" "${proto}"
|
||||
return
|
||||
fi
|
||||
|
||||
intf=$(eval echo "${intf}")
|
||||
fi
|
||||
|
||||
cmd="timeout ${duration} tcpdump -w ${filename}"
|
||||
|
||||
if [ -n "${intf}" ]; then
|
||||
cmd="${cmd} -i ${intf}"
|
||||
fi
|
||||
|
||||
if [ "${packet_count}" -ne 0 ]; then
|
||||
cmd="${cmd} -c ${packet_count}"
|
||||
fi
|
||||
|
||||
if [ -n "${expression}" ]; then
|
||||
cmd="${cmd} \"${expression}\""
|
||||
fi
|
||||
|
||||
time_start=$(date +"%s")
|
||||
output=$(eval ${cmd} 2>&1 | grep "packets captured")
|
||||
res="$?"
|
||||
time_stop=$(date +"%s")
|
||||
|
||||
if [ "${res}" -ne 0 ]; then
|
||||
# Error
|
||||
packet_capture_error "Error_Internal" "${proto}"
|
||||
return
|
||||
fi
|
||||
|
||||
pkt_count=$(echo $output | cut -d' ' -f 1)
|
||||
|
||||
if [[ "${file_target}" == "file://"* ]]; then
|
||||
# Local file
|
||||
file_target=$(realpath "${file_target:6}/packetcapture.pcap")
|
||||
if [ -z "${file_target}" ]; then
|
||||
# Invalid local path Error
|
||||
rm -rf "${filename}"
|
||||
res=1
|
||||
else
|
||||
# Copy file to destination
|
||||
mv "${filename}" "${file_target}"
|
||||
res="$?"
|
||||
fi
|
||||
else
|
||||
# Remote file
|
||||
opt=""
|
||||
if [ -n "${username}" ] && [ -n "${password}" ]; then
|
||||
opt="--user ${username}:${password}"
|
||||
fi
|
||||
|
||||
file_target="${file_target}/packetcapture.pcap"
|
||||
opt="${opt} --upload-file ${filename}"
|
||||
eval curl --fail --silent "${opt}" --max-time ${UPLOAD_TIMEOUT} "${file_target}"
|
||||
res="$?"
|
||||
rm -rf "${filename}"
|
||||
fi
|
||||
|
||||
if [ "$res" -ne 0 ]; then
|
||||
# Error
|
||||
packet_capture_error "Error_Internal" "${proto}"
|
||||
return
|
||||
else
|
||||
json_init
|
||||
json_add_string "Status" "Complete"
|
||||
json_add_string "FileLocation" "${file_target}"
|
||||
json_add_string "StartTime" "${time_start}"
|
||||
json_add_string "EndTime" "${time_stop}"
|
||||
json_add_string "Count" "${pkt_count}"
|
||||
json_dump
|
||||
|
||||
[ "${proto}" = "both_proto" ] && {
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.DiagnosticState="Complete"
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.FileLocation="${file_target}"
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.StartTime="${time_start}"
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.EndTime="${time_stop}"
|
||||
$UCI_SET_BBF_DMMAP dmmap_diagnostics.packetcapture.Count="${pkt_count}"
|
||||
$UCI_COMMIT_BBF_DMMAP
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
packet_capture_launch "$1"
|
||||
else
|
||||
packet_capture_error "Error_Internal"
|
||||
fi
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=periodicstats
|
||||
PKG_VERSION:=1.5.10
|
||||
PKG_VERSION:=1.5.11
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/periodicstats.git
|
||||
PKG_SOURCE_VERSION:=b3940f4ec851e24e2fdcea6015685f4fae45082b
|
||||
PKG_SOURCE_VERSION:=0bfe78ce9daf1cfbe9453e2cb08327dc7885cea2
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=qosmngr
|
||||
PKG_VERSION:=1.0.10
|
||||
PKG_VERSION:=1.0.11
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5985b914d63c3f4607f1436cdd1af4f67e864ec9
|
||||
PKG_SOURCE_VERSION:=56829e15bdce24a3eb4f8dfa43355d4b25632c48
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/qosmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -29,6 +29,7 @@ define Package/qosmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=QoS Manager
|
||||
DEPENDS:=+libbbfdm-api +libuci +libubox +libubus +libblobmsg-json +libjson-c +libqos +!(TARGET_brcmbca||TARGET_airoha):tc-full
|
||||
DEPENDS+=+kmod-vlantranslation +kmod-dscp2pbit +!(TARGET_brcmbca):ebtables-legacy
|
||||
endef
|
||||
|
||||
define Package/qosmngr/description
|
||||
|
||||
22
qosmngr/files/airoha/etc/ruleng/qoslink.json
Normal file
22
qosmngr/files/airoha/etc/ruleng/qoslink.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"bandwidth_update": {
|
||||
"if" : [
|
||||
{
|
||||
"event": "network.device",
|
||||
"match": {
|
||||
"link": "up"
|
||||
}
|
||||
}
|
||||
],
|
||||
"then" : [
|
||||
{
|
||||
"cli": "/usr/sbin/qos-uplink-bandwidth",
|
||||
"envs": {
|
||||
"PORT": "&network.device->ifname"
|
||||
},
|
||||
"timeout": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
2
qosmngr/files/airoha/etc/uci-defaults/ruleng.qoslink
Normal file
2
qosmngr/files/airoha/etc/uci-defaults/ruleng.qoslink
Normal file
@@ -0,0 +1,2 @@
|
||||
uci -q set ruleng.qoslink=rule
|
||||
uci -q set ruleng.qoslink.recipe='/etc/ruleng/qoslink.json'
|
||||
@@ -25,6 +25,7 @@ broute_ipv4_rule_options()
|
||||
local cid="$1"
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
|
||||
set_ip_addr "$cid" ebt_match_src_ip ebt_match_dst_ip
|
||||
|
||||
@@ -43,6 +44,8 @@ broute_ipv4_rule_options()
|
||||
|
||||
if [ "$proto_num" == "6" ] || [ "$proto_num" == "17" ] || [ "$proto_num" = "132" ] ; then
|
||||
set_ports "$cid" ebt_match_ip_src_port ebt_match_ip_dst_port
|
||||
elif [ "$proto_num" = "1" -a -n "$icmp_type" ]; then
|
||||
ebt_match_ip_icmp_type "$icmp_type"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -53,6 +56,7 @@ broute_ipv6_rule_options()
|
||||
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
|
||||
set_ip_addr "$cid" ebt_match_ipv6_src_ip ebt_match_ipv6_dst_ip
|
||||
|
||||
@@ -71,6 +75,8 @@ broute_ipv6_rule_options()
|
||||
|
||||
if [ "$proto_num" = "6" ] || [ "$proto_num" = "17" ] || [ "$proto_num" = "132" ] ; then
|
||||
set_ports "$cid" ebt_match_ipv6_src_port ebt_match_ipv6_dst_port
|
||||
elif [ "$proto_num" = "58" -a -n "$icmp_type" ]; then
|
||||
ebt_match_ipv6_icmp_type "$icmp_type"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
22
qosmngr/files/airoha/usr/sbin/qos-uplink-bandwidth
Executable file
22
qosmngr/files/airoha/usr/sbin/qos-uplink-bandwidth
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
readonly WANPORT="$(jsonfilter -i /etc/board.json -e @.network.wan.device)"
|
||||
readonly LINKSPEED_FILE="/tmp/qos/wan_link_speed"
|
||||
|
||||
[ "${WANPORT}" = "${PORT}" ] || exit 0
|
||||
|
||||
LINKSPEED="$(devstatus "${WANPORT}" | jsonfilter -e '@["speed"]' | tr -d 'A-Z')"
|
||||
PREV_LINKSPEED=$(cat ${LINKSPEED_FILE} 2>/dev/null)
|
||||
|
||||
[ "${WANPORT}" = "pon" -a $((LINKSPEED)) -eq 2500 ] && LINKSPEED=1250 #GPON asymmetrical uplink
|
||||
[ -z "${PREV_LINKSPEED}" ] && PREV_LINKSPEED=0
|
||||
|
||||
if [ $((LINKSPEED)) -ne $((PREV_LINKSPEED)) -a $((LINKSPEED)) -ne 0 ]; then
|
||||
if [ $((LINKSPEED)) -ge 10000 ]; then
|
||||
/userfs/bin/qosrule discpline Rate uplink-bandwidth $((LINKSPEED*1000*999/1000))
|
||||
else
|
||||
/userfs/bin/qosrule discpline Rate uplink-bandwidth $((LINKSPEED*1000))
|
||||
fi
|
||||
mkdir -p "/tmp/qos"
|
||||
echo ${LINKSPEED} > ${LINKSPEED_FILE}
|
||||
fi
|
||||
@@ -223,6 +223,7 @@ broute_ipv4_rule_options()
|
||||
local cid=$1
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
|
||||
set_ip_addr $cid ebt_match_src_ip ebt_match_dst_ip
|
||||
|
||||
@@ -237,6 +238,8 @@ broute_ipv4_rule_options()
|
||||
#port installation for protol tcp/udp/sctp
|
||||
if [ $proto_num = "6" ] || [ $proto_num = "17" ] || [ $proto_num = "132" ] ; then
|
||||
set_ports "$cid" ebt_match_ip_src_port ebt_match_ip_dst_port
|
||||
elif [ "$proto_num" = "1" -a -n "$icmp_type" ]; then
|
||||
ebt_match_ip_icmp_type "$icmp_type"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -247,6 +250,7 @@ broute_ipv6_rule_options()
|
||||
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
|
||||
set_ip_addr $cid ebt_match_ipv6_src_ip ebt_match_ipv6_dst_ip
|
||||
|
||||
@@ -266,6 +270,8 @@ broute_ipv6_rule_options()
|
||||
#port installation for protol tcp/udp/sctp
|
||||
if [ $proto_num = "6" ] || [ $proto_num = "17" ] || [ $proto_num = "132" ]; then
|
||||
set_ports "$cid" ebt_match_ipv6_src_port ebt_match_ipv6_dst_port
|
||||
elif [ "$proto_num" = "58" -a -n "$icmp_type" ]; then
|
||||
ebt_match_ipv6_icmp_type "$icmp_type"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -93,7 +93,11 @@ ebt_match_ipv6_dst_port() {
|
||||
}
|
||||
|
||||
ebt_match_ip_protocol() {
|
||||
BR_RULE="$BR_RULE --ip-proto $1"
|
||||
BR_RULE="$BR_RULE --ip-proto $1"
|
||||
}
|
||||
|
||||
ebt_match_ip_icmp_type() {
|
||||
BR_RULE="$BR_RULE --ip-icmp-type $1"
|
||||
}
|
||||
|
||||
ebt_match_ipv6_protocol() {
|
||||
@@ -107,6 +111,17 @@ ebt_match_ipv6_protocol() {
|
||||
fi
|
||||
}
|
||||
|
||||
ebt_match_ipv6_icmp_type() {
|
||||
#when ethertype is not configured by user then both proto rules of ipv4
|
||||
#and ipv6 to be installed so update BR6_RULE string as well otherwise
|
||||
#update BR_RULE only for installation of ipv6 proto rule only.
|
||||
if [ -n "$BR6_RULE" ]; then
|
||||
BR6_RULE="$BR6_RULE --ip6-icmp-type $1"
|
||||
else
|
||||
BR_RULE="$BR_RULE --ip6-icmp-type $1"
|
||||
fi
|
||||
}
|
||||
|
||||
broute_filter_on_vid() {
|
||||
|
||||
if [ -z "$1" ] || [ "$1" -lt 0 ]; then
|
||||
@@ -183,9 +198,6 @@ protocol_string_to_num()
|
||||
local value="-1"
|
||||
|
||||
case "$1" in
|
||||
*[0-9]*)
|
||||
value="$1"
|
||||
;;
|
||||
TCP|tcp)
|
||||
value=6
|
||||
;;
|
||||
@@ -204,6 +216,9 @@ protocol_string_to_num()
|
||||
SCTP|sctp)
|
||||
value=132
|
||||
;;
|
||||
*[0-9]*)
|
||||
value="$1"
|
||||
;;
|
||||
*)
|
||||
value=-1
|
||||
;;
|
||||
|
||||
@@ -15,6 +15,14 @@ iptables_filter_proto() {
|
||||
IP_RULE="$IP_RULE -p $1"
|
||||
}
|
||||
|
||||
iptables_filter_icmp() {
|
||||
IP_RULE="$IP_RULE --icmp-type $1"
|
||||
}
|
||||
|
||||
iptables_filter_icmpv6() {
|
||||
IP_RULE="$IP_RULE --icmpv6-type $1"
|
||||
}
|
||||
|
||||
iptables_filter_ip_src() {
|
||||
IP_RULE="$IP_RULE -s $1"
|
||||
}
|
||||
@@ -66,10 +74,44 @@ append_rule_to_mangle_table() {
|
||||
fi
|
||||
}
|
||||
|
||||
protocol_string_to_num()
|
||||
{
|
||||
local value="-1"
|
||||
|
||||
case "$1" in
|
||||
TCP|tcp)
|
||||
value=6
|
||||
;;
|
||||
UDP|udp)
|
||||
value=17
|
||||
;;
|
||||
ICMP|icmp)
|
||||
value=1
|
||||
;;
|
||||
ICMPv6|icmpv6)
|
||||
value=58
|
||||
;;
|
||||
IGMP|igmp)
|
||||
value=2
|
||||
;;
|
||||
SCTP|sctp)
|
||||
value=132
|
||||
;;
|
||||
*[0-9]*)
|
||||
value="$1"
|
||||
;;
|
||||
*)
|
||||
value=-1
|
||||
;;
|
||||
esac
|
||||
echo $value
|
||||
}
|
||||
|
||||
handle_iptables_rules() {
|
||||
local cid="$1"
|
||||
local ip_version=0
|
||||
local is_l3_rule=0
|
||||
local proto_num=-1
|
||||
traffic_class=$2
|
||||
|
||||
init_iptables_rule
|
||||
@@ -94,6 +136,7 @@ handle_iptables_rules() {
|
||||
config_get ip_len_max "$cid" "ip_len_max"
|
||||
config_get ifname "$cid" "ifname"
|
||||
config_get all_interfaces "$cid" "all_interfaces"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
|
||||
#check version of ip
|
||||
case $src_ip$dest_ip in
|
||||
@@ -116,7 +159,17 @@ handle_iptables_rules() {
|
||||
|
||||
# filter proto
|
||||
if [ -n "$proto" ]; then
|
||||
iptables_filter_proto "$proto"
|
||||
proto_num=$(protocol_string_to_num "$proto")
|
||||
iptables_filter_proto "$proto_num"
|
||||
if [ -n "$icmp_type" -a \( "$proto_num" = "58" -o "$proto_num" = "1" \) ]; then
|
||||
if [ "$proto_num" = "1" ]; then
|
||||
iptables_filter_icmp "$icmp_type"
|
||||
ip_version=4
|
||||
else
|
||||
iptables_filter_icmpv6 "$icmp_type"
|
||||
ip_version=6
|
||||
fi
|
||||
fi
|
||||
is_l3_rule=1
|
||||
fi
|
||||
|
||||
|
||||
@@ -166,11 +166,7 @@ handle_queue() {
|
||||
|
||||
[ -f /etc/board.json ] || return 0
|
||||
if [ $salg -ne 2 ]; then
|
||||
priority=$order
|
||||
wan_port=$(jsonfilter -i /etc/board.json -e @.network.wan.device)
|
||||
if [ "$wan_port" == "$port" ]; then
|
||||
priority=`expr 7 - $order`
|
||||
fi
|
||||
priority=`expr 7 - $order`
|
||||
fi
|
||||
|
||||
local ceil_rate=$port_bw
|
||||
@@ -225,6 +221,7 @@ broute_ipv4_rule_options()
|
||||
local cid=$1
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
|
||||
set_ip_addr $cid ebt_match_src_ip ebt_match_dst_ip
|
||||
|
||||
@@ -244,6 +241,8 @@ broute_ipv4_rule_options()
|
||||
#port installation for protol tcp/udp/sctp
|
||||
if [ $proto_num = "6" ] || [ $proto_num = "17" ] || [ $proto_num = "132" ] ; then
|
||||
set_ports "$cid" ebt_match_ip_src_port ebt_match_ip_dst_port
|
||||
elif [ "$proto_num" = "1" -a -n "$icmp_type" ]; then
|
||||
ebt_match_ip_icmp_type "$icmp_type"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -254,6 +253,7 @@ broute_ipv6_rule_options()
|
||||
|
||||
config_get protocol "$cid" "proto"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get icmp_type "$cid" "icmp_type"
|
||||
|
||||
set_ip_addr $cid ebt_match_ipv6_src_ip ebt_match_ipv6_dst_ip
|
||||
|
||||
@@ -273,6 +273,8 @@ broute_ipv6_rule_options()
|
||||
#port installation for protol tcp/udp/sctp
|
||||
if [ $proto_num = "6" ] || [ $proto_num = "17" ] || [ $proto_num = "132" ]; then
|
||||
set_ports "$cid" ebt_match_ipv6_src_port ebt_match_ipv6_dst_port
|
||||
elif [ "$proto_num" = "58" -a -n "$icmp_type" ]; then
|
||||
ebt_match_ipv6_icmp_type "$icmp_type"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -538,14 +540,160 @@ reload_qos() {
|
||||
elif [ "$service_name" == "queue" ]; then
|
||||
pre_configure_queue
|
||||
configure_queue
|
||||
elif [ "$service_name" == "classify" ]; then
|
||||
configure_classify
|
||||
elif [ "$service_name" == "classify" ]; then
|
||||
configure_classify
|
||||
if [ -f "/tmp/qos/classify.ebtables" ]; then
|
||||
sh /tmp/qos/classify.ebtables
|
||||
fi
|
||||
elif [ "$service_name" == "policer" ]; then
|
||||
configure_policer
|
||||
fi
|
||||
}
|
||||
|
||||
reload_qos_service() {
|
||||
reload_qos
|
||||
get_cfg_added_deleted()
|
||||
{
|
||||
# return true if there is difference in number of queue configuration
|
||||
# in /etc/config/qos and /tmp/qos/qos, false is returned if both file
|
||||
# has same count of queue configuration.
|
||||
local queue=0
|
||||
local classify=0
|
||||
local shaper=0
|
||||
local policer=0
|
||||
local old_cfg="false"
|
||||
|
||||
config_cb() {
|
||||
# invoked on the just previous config_load, get the count of
|
||||
# queue configuration in /etc/config/qos and /tmp/qos/qos.
|
||||
cfg_type="$1"
|
||||
cfg_name="$2"
|
||||
if [ -z $cfg_name ] || [ -z $cfg_type ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$old_cfg" == "false" ]; then
|
||||
eval $cfg_type=$(($cfg_type + 1))
|
||||
else
|
||||
eval $cfg_type=$(($cfg_type - 1))
|
||||
fi
|
||||
option_cb() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
if [ -z "$option" ] || [ -z "$value" ]; then
|
||||
return
|
||||
fi
|
||||
if [ "$old_cfg" == "false" ]; then
|
||||
eval $cfg_type=$(($cfg_type + 1))
|
||||
else
|
||||
eval $cfg_type=$(($cfg_type - 1))
|
||||
fi
|
||||
}
|
||||
}
|
||||
# config_load will trigger call for config_cb that is getting count
|
||||
# of qos configuration, respective config counts will come.
|
||||
config_load qos
|
||||
# config_load will trigger call for config_cb that is decreasing count
|
||||
# of qos configuration.
|
||||
old_cfg="true"
|
||||
UCI_CONFIG_DIR="/tmp/qos"
|
||||
config_load qos
|
||||
UCI_CONFIG_DIR="/etc/config"
|
||||
reset_cb
|
||||
|
||||
if [ $classify -ne 0 ]; then
|
||||
modified_config="classify"
|
||||
fi
|
||||
if [ $shaper -ne 0 ]; then
|
||||
modified_config="$modified_config shaper"
|
||||
fi
|
||||
if [ $policer -ne 0 ]; then
|
||||
modified_config="$modified_config policer"
|
||||
fi
|
||||
if [ $queue -eq 0 ]; then
|
||||
echo "$modified_config"
|
||||
return
|
||||
else
|
||||
echo "queue"
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
# reload_qos_service is invoked on qos service reload.
|
||||
reload_qos_service() {
|
||||
q_cfg_restart="false"
|
||||
policer="false"
|
||||
classify="false"
|
||||
shaper="false"
|
||||
|
||||
setup_qos
|
||||
|
||||
if ! [[ -f "/etc/config/qos" && -f "/tmp/qos/qos" ]]; then
|
||||
configure_qos
|
||||
cp /etc/config/qos /tmp/qos/qos
|
||||
fi
|
||||
|
||||
config_cb() {
|
||||
# this is invoked when config_load is called.
|
||||
cfg_type="$1"
|
||||
cfg_name="$2"
|
||||
if [ -z $cfg_name ] || [ -z $cfg_type ]; then
|
||||
return
|
||||
fi
|
||||
option_cb() {
|
||||
# checking for if any parameters value is modified in queue cfg
|
||||
# comparsion is done between /etc/config/qos and /tmp/qos/qos
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
local old_value=""
|
||||
if [ -z "$option" ] || [ -z "$value" ]; then
|
||||
return
|
||||
fi
|
||||
old_value=$(uci -q -c "/tmp/qos" get qos.$cfg_name.$option)
|
||||
if ! [ "$old_value" == "$value" ]; then
|
||||
if [ "$cfg_type" == "queue" ]; then
|
||||
q_cfg_restart="true"
|
||||
else
|
||||
eval $cfg_type="true"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
}
|
||||
# if there is new addition/deletion of queue configuration
|
||||
# then return is queue to trigger restart of qos.
|
||||
# Otehrwise shaper policer classify
|
||||
# respective operation config is invoked that does not change queue statistics
|
||||
cfg_added_deleted=$(get_cfg_added_deleted)
|
||||
if [ "$cfg_added_deleted" == "queue" ]; then
|
||||
configure_qos
|
||||
else
|
||||
q_cfg_restart="false"
|
||||
# config_load will trigger call for config_cb that is checking
|
||||
# for modification in config value of queue config.
|
||||
# if change of value of queue config is there then q_cfg_restart
|
||||
# is set as true, else other qos config flag is set as true.
|
||||
config_load qos
|
||||
reset_cb
|
||||
if [ "$q_cfg_restart" == "true" ]; then
|
||||
configure_qos
|
||||
else
|
||||
for config in $cfg_added_deleted
|
||||
do
|
||||
eval $config="true"
|
||||
done
|
||||
if [ "$shaper" == "true" ]; then
|
||||
# for tc, shaper is implemented as part of q setup
|
||||
# hence, if shaper is modified, reload queue
|
||||
reload_qos "queue"
|
||||
fi
|
||||
if [ "$policer" == "true" ]; then
|
||||
reload_qos "policer"
|
||||
# change in policer config may need reconfiguration
|
||||
# of classifier
|
||||
reload_qos "classify"
|
||||
fi
|
||||
if [ "$classify" == "true" ]; then
|
||||
reload_qos "classify"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
cp /etc/config/qos /tmp/qos/qos
|
||||
}
|
||||
|
||||
@@ -1,35 +1,30 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=self-diagnostics
|
||||
PKG_VERSION:=1.0.5
|
||||
PKG_VERSION:=1.0.6
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/self-diagnostics
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=System Report
|
||||
DEPENDS:=+@CONFIG_BUSYBOX_CONFIG_TIMEOUT +@CONFIG_BUSYBOX_CONFIG_FEATURE_FIND_PATH +@CONFIG_BUSYBOX_CONFIG_TEE \
|
||||
+@CONFIG_BUSYBOX_CONFIG_GZIP
|
||||
+@CONFIG_BUSYBOX_CONFIG_GZIP +libbbfdm-api
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/self-diagnostics/description
|
||||
Generate Self test diagnostics report
|
||||
endef
|
||||
|
||||
#define Build/Prepare
|
||||
# mkdir -p $(PKG_BUILD_DIR)
|
||||
# $(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
#endef
|
||||
|
||||
define Build/Compile
|
||||
Generate Self test diagnostics report and adds Device.SelfTestDiagnostics. datamodel object
|
||||
endef
|
||||
|
||||
define Package/self-diagnostics/install
|
||||
$(INSTALL_DIR) $(1)/etc/self-diagnostics/spec/
|
||||
$(CP) ./files/* $(1)/
|
||||
$(BBFDM_INSTALL_CORE_PLUGIN) $(PKG_BUILD_DIR)/libselftest.so $(1)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,self-diagnostics))
|
||||
|
||||
29
self-diagnostics/src/LICENSE
Normal file
29
self-diagnostics/src/LICENSE
Normal file
@@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2023, IOPSYS
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
21
self-diagnostics/src/Makefile
Normal file
21
self-diagnostics/src/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
LIBOUT := libselftest.so
|
||||
|
||||
LIBOBJS := selftest.o
|
||||
|
||||
PROG_CFLAGS = $(CFLAGS) -Wall -Werror -fstrict-aliasing -g
|
||||
LIB_LDFLAGS = $(LDFLAGS)
|
||||
|
||||
FPIC := -fPIC
|
||||
|
||||
.PHONY: all
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $<
|
||||
|
||||
all: $(LIBOUT)
|
||||
|
||||
$(LIBOUT): $(LIBOBJS)
|
||||
$(CC) $(PROG_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f *.o $(LIBOUT)
|
||||
155
self-diagnostics/src/selftest.c
Normal file
155
self-diagnostics/src/selftest.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* selftest.c: SelfTestDiagnostics datamodel handler
|
||||
*
|
||||
* Copyright (C) 2023-2024 IOPSYS Software Solutions AB. All rights reserved.
|
||||
*
|
||||
*
|
||||
* See LICENSE file for license related information.
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "libbbfdm-api/dmcommon.h"
|
||||
|
||||
#define DIAG_BIN "/usr/sbin/self-diagnostics"
|
||||
|
||||
static char *get_selftest_log_instance(struct dmctx *ctx)
|
||||
{
|
||||
char *file_name = NULL;
|
||||
char *path = NULL;
|
||||
|
||||
struct uci_section *s = get_origin_section_from_config("system", "system", "self_test_log");
|
||||
if (s == NULL)
|
||||
goto err;
|
||||
|
||||
dmuci_get_value_by_section_string(s, "log_file", &file_name);
|
||||
if (DM_STRLEN(file_name) == 0)
|
||||
goto err;
|
||||
|
||||
_bbfdm_get_references(ctx, "Device.DeviceInfo.VendorLogFile.", "Name", file_name, &path);
|
||||
|
||||
err:
|
||||
return path ? path : dmstrdup("");
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* OPERATE COMMAND
|
||||
**************************************************************/
|
||||
static operation_args device_self_test_args = {
|
||||
.out = (const char *[]) {
|
||||
"Status",
|
||||
"Results",
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
int get_operate_args_SelfTest(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = (char *)&device_self_test_args;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int operate_Device_SelfTest(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char cmd[512] = {0};
|
||||
char output[512] = {0};
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "sh %s", DIAG_BIN);
|
||||
|
||||
if (run_cmd(cmd, output, sizeof(output)) != 0)
|
||||
goto err;
|
||||
|
||||
// truncate the new line char from end
|
||||
remove_new_line(output);
|
||||
|
||||
if (!file_exists(output))
|
||||
goto err;
|
||||
|
||||
/* Add in vendor log */
|
||||
struct uci_section *s = get_origin_section_from_config("system", "system", "self_test_log");
|
||||
if (s == NULL) {
|
||||
dmuci_add_section("system", "system", &s);
|
||||
dmuci_rename_section_by_section(s, "self_test_log");
|
||||
}
|
||||
|
||||
dmuci_set_value_by_section(s, "log_file", output);
|
||||
dmuci_commit_package("system");
|
||||
|
||||
/* Get self test log instance */
|
||||
char *result = get_selftest_log_instance(ctx);
|
||||
|
||||
add_list_parameter(ctx, dmstrdup("Status"), dmstrdup("Complete"), DMT_TYPE[DMT_STRING], NULL);
|
||||
add_list_parameter(ctx, dmstrdup("Results"), result, DMT_TYPE[DMT_STRING], NULL);
|
||||
|
||||
if (ctx->dm_type != BBFDM_USP) {
|
||||
diagnostics_set_option("selftest", "DiagnosticState", "Complete");
|
||||
dmuci_commit_package_bbfdm(DMMAP_DIAGNOSTIGS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
add_list_parameter(ctx, dmstrdup("Status"), dmstrdup("Error_Internal"), DMT_TYPE[DMT_STRING], NULL);
|
||||
if (ctx->dm_type != BBFDM_USP) {
|
||||
diagnostics_set_option("selftest", "DiagnosticState", "Error");
|
||||
dmuci_commit_package_bbfdm(DMMAP_DIAGNOSTIGS);
|
||||
}
|
||||
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* GET & SET PARAM
|
||||
**************************************************************/
|
||||
static int get_SelfTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = diagnostics_get_option_fallback_def("selftest", "DiagnosticState", "None");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_SelfTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
if (DM_LSTRCMP(value, "Requested") == 0)
|
||||
diagnostics_set_option("selftest", "DiagnosticState", value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_SelfTest_Results(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = get_selftest_log_instance(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************
|
||||
* OBJ & LEAF DEFINITION
|
||||
***********************************************************************************************************************************/
|
||||
DMLEAF tSelfTestParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
|
||||
{"DiagnosticsState", &DMWRITE, DMT_STRING, get_SelfTest_DiagnosticsState, set_SelfTest_DiagnosticsState, BBFDM_CWMP},
|
||||
{"Results", &DMREAD, DMT_STRING, get_SelfTest_Results, NULL, BBFDM_CWMP},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMOBJ tDeviceObjs[] = {
|
||||
{"SelfTestDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tSelfTestParams, NULL, BBFDM_CWMP, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMLEAF tDeviceParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
{"SelfTestDiagnostics()", &DMASYNC, DMT_COMMAND, get_operate_args_SelfTest, operate_Device_SelfTest, BBFDM_USP},
|
||||
{0}
|
||||
};
|
||||
|
||||
DM_MAP_OBJ tDynamicObj[] = {
|
||||
/* parentobj, nextobject, parameter */
|
||||
{"Device.", tDeviceObjs, tDeviceParams},
|
||||
{0}
|
||||
};
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ssdpd
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_VERSION:=1.0.6
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
@@ -20,30 +20,30 @@ PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/ssdpd/config
|
||||
if PACKAGE_ssdpd
|
||||
config SSDPD_UPNP_DEVICE
|
||||
bool "Enable Device.UPnP.Device Datamodel object"
|
||||
default n
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/ssdpd
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+libnfnetlink +libpthread +libubox +libubus +libblobmsg-json +libcurl +mxml
|
||||
TITLE:=MiniSSDPd - SSDP daemon
|
||||
DEPENDS:=+libnfnetlink +libpthread +libubox +libubus +libblobmsg-json +libcurl +mxml +SSDPD_UPNP_DEVICE:miniupnpd-iptables +libbbfdm-api
|
||||
TITLE:=MiniSSDPd - SSDP Daemon
|
||||
URL:=https://miniupnp.tuxfamily.org/minissdpd.html
|
||||
endef
|
||||
|
||||
MAKE_PATH:=minissdpd
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE \
|
||||
-Wall -Wextra -Werror
|
||||
-D_GNU_SOURCE
|
||||
|
||||
TARGET_LDFLAGS += \
|
||||
-lpthread -lubox -lubus -lblobmsg_json -lcurl -lmxml
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/sspd/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/ssdpd/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
@@ -51,6 +51,7 @@ define Package/ssdpd/install
|
||||
$(INSTALL_CONF) ./files/etc/config/ssdpd $(1)/etc/config/ssdpd
|
||||
$(INSTALL_BIN) ./files/etc/init.d/ssdpd $(1)/etc/init.d/ssdpd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/minissdpd/minissdpd $(1)/usr/sbin/ssdpd
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/upnpdm.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ssdpd))
|
||||
|
||||
22
ssdpd/src/Makefile
Normal file
22
ssdpd/src/Makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
LIBOUT := upnpdm.so
|
||||
|
||||
LIBOBJS := datamodel.o
|
||||
|
||||
PROG_CFLAGS = $(CFLAGS) -Wno-unused-parameter -fstrict-aliasing -g
|
||||
LIB_LDFLAGS = $(LDFLAGS)
|
||||
|
||||
FPIC := -fPIC
|
||||
|
||||
.PHONY: all
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $<
|
||||
|
||||
all: $(LIBOUT)
|
||||
make -C minissdpd
|
||||
|
||||
$(LIBOUT): $(LIBOBJS)
|
||||
$(CC) $(PROG_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f *.o $(LIBOUT)
|
||||
851
ssdpd/src/datamodel.c
Normal file
851
ssdpd/src/datamodel.c
Normal file
@@ -0,0 +1,851 @@
|
||||
/*
|
||||
* datamodel.c: uPnP Datamodel handler
|
||||
*
|
||||
* Copyright (C) 2024 IOPSYS Software Solutions AB. All rights reserved.
|
||||
*
|
||||
* See LICENSE file for license related information.
|
||||
*/
|
||||
|
||||
#include "libbbfdm-api/dmcommon.h"
|
||||
|
||||
struct upnpdiscovery {
|
||||
char *st;
|
||||
char *usn;
|
||||
char *uuid;
|
||||
char *urn;
|
||||
char *descurl;
|
||||
struct uci_section *dmmap_sect;
|
||||
};
|
||||
|
||||
struct upnp_device_inst {
|
||||
char *device_type;
|
||||
char *friendly_name;
|
||||
char *manufacturer;
|
||||
char *manufacturer_url;
|
||||
char *model_description;
|
||||
char *model_name;
|
||||
char *model_number;
|
||||
char *model_url;
|
||||
char *serial_number;
|
||||
char *udn;
|
||||
char *uuid;
|
||||
char *preentation_url;
|
||||
char *parentudn;
|
||||
char *upc;
|
||||
struct uci_section *dmmap_sect;
|
||||
};
|
||||
|
||||
struct upnp_service_inst {
|
||||
char *parentudn;
|
||||
char *serviceid;
|
||||
char *servicetype;
|
||||
char *scpdurl;
|
||||
char *controlurl;
|
||||
char *eventsuburl;
|
||||
struct uci_section *dmmap_sect;
|
||||
};
|
||||
|
||||
struct upnp_description_file_info {
|
||||
char *desc_url;
|
||||
struct uci_section *dmmap_sect;
|
||||
};
|
||||
|
||||
/*************************************************************
|
||||
* ENTRY METHOD
|
||||
**************************************************************/
|
||||
static int browseUPnPDiscoveryRootDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
json_object *res = NULL, *root_devices = NULL, *device = NULL;
|
||||
struct upnpdiscovery upnp_dev = {0};
|
||||
char *descurl = NULL, *st = NULL, *usn = NULL, *inst = NULL;
|
||||
struct uci_section *dmmap_sect = NULL;
|
||||
char buf[512] = {0};
|
||||
int root_inst = 0;
|
||||
|
||||
dmubus_call("upnp", "discovery", UBUS_ARGS{{}}, 0, &res);
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
|
||||
json_object_object_get_ex(res, "root_devices", &root_devices);
|
||||
size_t nbre_devices = (root_devices) ? json_object_array_length(root_devices) : 0;
|
||||
|
||||
for (int i = 0; i < nbre_devices; i++) {
|
||||
device = json_object_array_get_idx(root_devices, i);
|
||||
|
||||
descurl = dmjson_get_value(device, 1, "descurl");
|
||||
st = dmjson_get_value(device, 1, "st");
|
||||
usn = dmjson_get_value(device, 1, "usn");
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s", usn);
|
||||
|
||||
char *p = strstr(buf, "::");
|
||||
char *urn_p = NULL;
|
||||
|
||||
if (p) {
|
||||
urn_p = p + 2;
|
||||
*p = 0;
|
||||
char *uuid = strchr(buf, ':');
|
||||
upnp_dev.uuid = uuid ? dmstrdup(uuid + 1) : "";
|
||||
}
|
||||
|
||||
if (urn_p) {
|
||||
char *urn = strchr(urn_p, ':');
|
||||
upnp_dev.urn = urn ? dmstrdup(urn + 1) : "";
|
||||
}
|
||||
|
||||
upnp_dev.descurl = dmstrdup(descurl);
|
||||
upnp_dev.st = dmstrdup(st);
|
||||
upnp_dev.usn = dmstrdup(usn);
|
||||
|
||||
if ((dmmap_sect = get_dup_section_in_dmmap_opt("dmmap_upnp", "upnp_root_device", "uuid", upnp_dev.urn)) == NULL) {
|
||||
dmuci_add_section_bbfdm("dmmap_upnp", "upnp_root_device", &dmmap_sect);
|
||||
dmuci_set_value_by_section_bbfdm(dmmap_sect, "uuid", upnp_dev.urn);
|
||||
}
|
||||
|
||||
upnp_dev.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_instance_without_section(dmctx, parent_node, ++root_inst);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int browseUPnPDiscoveryDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
json_object *res = NULL, *devices = NULL, *device = NULL;
|
||||
struct upnpdiscovery upnp_dev = {0};
|
||||
char *dev_descurl = NULL, *dev_st = NULL, *dev_usn = NULL, *inst = NULL;
|
||||
struct uci_section *dmmap_sect = NULL;
|
||||
char buf[512] = {0};
|
||||
|
||||
dmubus_call("upnp", "discovery", UBUS_ARGS{{}}, 0, &res);
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
|
||||
json_object_object_get_ex(res, "devices", &devices);
|
||||
size_t nbre_devices = (devices) ? json_object_array_length(devices) : 0;
|
||||
|
||||
for (int i = 0; i < nbre_devices; i++) {
|
||||
device = json_object_array_get_idx(devices, i);
|
||||
|
||||
dev_descurl = dmjson_get_value(device, 1, "descurl");
|
||||
dev_st = dmjson_get_value(device, 1, "st");
|
||||
dev_usn = dmjson_get_value(device, 1, "usn");
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s", dev_usn);
|
||||
|
||||
char *p = strstr(buf, "::");
|
||||
char *urn_p = NULL;
|
||||
|
||||
if (p) {
|
||||
urn_p = p + 2;
|
||||
*p = 0;
|
||||
char *uuid = strchr(buf, ':');
|
||||
upnp_dev.uuid = uuid ? dmstrdup(uuid + 1) : "";
|
||||
}
|
||||
|
||||
if (urn_p) {
|
||||
char *urn = strchr(urn_p, ':');
|
||||
upnp_dev.urn = urn ? dmstrdup(urn + 1) : "";
|
||||
}
|
||||
|
||||
upnp_dev.descurl = dmstrdup(dev_descurl);
|
||||
upnp_dev.st = dmstrdup(dev_st);
|
||||
upnp_dev.usn = dmstrdup(dev_usn);
|
||||
|
||||
if ((dmmap_sect = get_dup_section_in_dmmap_opt("dmmap_upnp", "upnp_device", "uuid", upnp_dev.uuid)) == NULL) {
|
||||
dmuci_add_section_bbfdm("dmmap_upnp", "upnp_device", &dmmap_sect);
|
||||
dmuci_set_value_by_section_bbfdm(dmmap_sect, "uuid", upnp_dev.uuid);
|
||||
}
|
||||
|
||||
upnp_dev.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_instance_without_section(dmctx, parent_node, i+1);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int browseUPnPDiscoveryServiceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
json_object *res = NULL, *services = NULL, *service = NULL;
|
||||
struct upnpdiscovery upnp_dev = {0};
|
||||
char *srv_descurl = NULL, *srv_st = NULL, *srv_usn = NULL, *inst = NULL;
|
||||
struct uci_section* dmmap_sect = NULL;
|
||||
char buf[512] = {0};
|
||||
|
||||
dmubus_call("upnp", "discovery", UBUS_ARGS{{}}, 0, &res);
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
|
||||
json_object_object_get_ex(res, "services", &services);
|
||||
size_t nbre_services = (services) ? json_object_array_length(services) : 0;
|
||||
|
||||
for (int i = 0; i < nbre_services; i++){
|
||||
service = json_object_array_get_idx(services, i);
|
||||
|
||||
srv_descurl = dmjson_get_value(service, 1, "descurl");
|
||||
srv_st = dmjson_get_value(service, 1, "st");
|
||||
srv_usn = dmjson_get_value(service, 1, "usn");
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s", srv_usn);
|
||||
|
||||
char *p = strstr(buf, "::");
|
||||
char *urn_p = NULL;
|
||||
|
||||
if (p) {
|
||||
urn_p = p + 2;
|
||||
*p = 0;
|
||||
char *uuid = strchr(buf, ':');
|
||||
upnp_dev.uuid = uuid ? dmstrdup(uuid + 1) : "";
|
||||
}
|
||||
|
||||
if (urn_p) {
|
||||
char *urn = strchr(urn_p, ':');
|
||||
upnp_dev.urn = urn ? dmstrdup(urn + 1) : "";
|
||||
}
|
||||
|
||||
upnp_dev.descurl = dmstrdup(srv_descurl);
|
||||
upnp_dev.st = dmstrdup(srv_st);
|
||||
upnp_dev.usn = dmstrdup(srv_usn);
|
||||
|
||||
if ((dmmap_sect = get_dup_section_in_dmmap_opt("dmmap_upnp", "upnp_service", "usn", srv_usn)) == NULL) {
|
||||
dmuci_add_section_bbfdm("dmmap_upnp", "upnp_service", &dmmap_sect);
|
||||
dmuci_set_value_by_section_bbfdm(dmmap_sect, "usn", srv_usn);
|
||||
}
|
||||
|
||||
upnp_dev.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_instance_without_section(dmctx, parent_node, i+1);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int browseUPnPDescriptionDeviceDescriptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
json_object *res = NULL, *descriptions = NULL, *description = NULL;
|
||||
struct upnp_description_file_info upnp_desc = {0};
|
||||
char *descurl = NULL, *inst = NULL;
|
||||
struct uci_section* dmmap_sect = NULL;
|
||||
|
||||
dmubus_call("upnp", "description", UBUS_ARGS{{}}, 0, &res);
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
|
||||
json_object_object_get_ex(res, "descriptions", &descriptions);
|
||||
size_t nbre_descriptions = (descriptions) ? json_object_array_length(descriptions) : 0;
|
||||
|
||||
for (int i = 0; i < nbre_descriptions; i++) {
|
||||
description = json_object_array_get_idx(descriptions, i);
|
||||
|
||||
descurl = dmjson_get_value(description, 1, "desc_url");
|
||||
upnp_desc.desc_url = dmstrdup(descurl);
|
||||
|
||||
if ((dmmap_sect = get_dup_section_in_dmmap_opt("dmmap_upnp", "upnp_description", "descurl", descurl)) == NULL) {
|
||||
dmuci_add_section_bbfdm("dmmap_upnp", "upnp_description", &dmmap_sect);
|
||||
dmuci_set_value_by_section_bbfdm(dmmap_sect, "descurl", descurl);
|
||||
}
|
||||
upnp_desc.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_instance_without_section(dmctx, parent_node, i+1);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_desc, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int browseUPnPDescriptionDeviceInstanceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
json_object *res = NULL, *devices_instances = NULL, *device_inst = NULL;
|
||||
struct upnp_device_inst upnp_dev_inst = {};
|
||||
char *inst = NULL;
|
||||
struct uci_section* dmmap_sect = NULL;
|
||||
int i;
|
||||
|
||||
dmubus_call("upnp", "description", UBUS_ARGS{{}}, 0, &res);
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
|
||||
json_object_object_get_ex(res, "devices", &devices_instances);
|
||||
size_t nbre_devices_inst = (devices_instances) ? json_object_array_length(devices_instances) : 0;
|
||||
|
||||
for (i = 0; i < nbre_devices_inst; i++){
|
||||
device_inst = json_object_array_get_idx(devices_instances, i);
|
||||
|
||||
dmasprintf(&upnp_dev_inst.parentudn, "%s", dmjson_get_value(device_inst, 1, "parent_dev"));
|
||||
dmasprintf(&upnp_dev_inst.device_type, "%s", dmjson_get_value(device_inst, 1, "deviceType"));
|
||||
dmasprintf(&upnp_dev_inst.friendly_name, "%s", dmjson_get_value(device_inst, 1, "friendlyName"));
|
||||
dmasprintf(&upnp_dev_inst.manufacturer, "%s", dmjson_get_value(device_inst, 1, "manufacturer"));
|
||||
dmasprintf(&upnp_dev_inst.manufacturer_url, "%s", dmjson_get_value(device_inst, 1, "manufacturerURL"));
|
||||
dmasprintf(&upnp_dev_inst.model_description, "%s", dmjson_get_value(device_inst, 1, "modelDescription"));
|
||||
dmasprintf(&upnp_dev_inst.model_name, "%s", dmjson_get_value(device_inst, 1, "modelName"));
|
||||
dmasprintf(&upnp_dev_inst.model_number, "%s", dmjson_get_value(device_inst, 1, "modelNumber"));
|
||||
dmasprintf(&upnp_dev_inst.model_url, "%s", dmjson_get_value(device_inst, 1, "modelURL"));
|
||||
dmasprintf(&upnp_dev_inst.serial_number, "%s", dmjson_get_value(device_inst, 1, "serialNumber"));
|
||||
dmasprintf(&upnp_dev_inst.udn, "%s", dmjson_get_value(device_inst, 1, "UDN"));
|
||||
dmasprintf(&upnp_dev_inst.upc, "%s", dmjson_get_value(device_inst, 1, "UPC"));
|
||||
|
||||
if ((dmmap_sect = get_dup_section_in_dmmap_opt("dmmap_upnp", "upnp_device_inst", "udn", dmjson_get_value(device_inst, 1, "UDN"))) == NULL) {
|
||||
dmuci_add_section_bbfdm("dmmap_upnp", "upnp_device_inst", &dmmap_sect);
|
||||
dmuci_set_value_by_section_bbfdm(dmmap_sect, "udn", dmjson_get_value(device_inst, 1, "UDN"));
|
||||
}
|
||||
|
||||
upnp_dev_inst.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_instance_without_section(dmctx, parent_node, i+1);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev_inst, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int browseUPnPDescriptionServiceInstanceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
json_object *res = NULL, *services_instances = NULL, *service_inst = NULL;
|
||||
struct upnp_service_inst upnp_services_inst = {};
|
||||
char *inst = NULL;
|
||||
struct uci_section* dmmap_sect = NULL;
|
||||
int i;
|
||||
|
||||
dmubus_call("upnp", "description", UBUS_ARGS{{}}, 0, &res);
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
|
||||
json_object_object_get_ex(res, "services", &services_instances);
|
||||
size_t nbre_devices_inst = (services_instances) ? json_object_array_length(services_instances) : 0;
|
||||
|
||||
for (i = 0; i < nbre_devices_inst; i++) {
|
||||
service_inst = json_object_array_get_idx(services_instances, i);
|
||||
dmasprintf(&upnp_services_inst.parentudn, "%s", dmjson_get_value(service_inst, 1, "parent_dev"));
|
||||
dmasprintf(&upnp_services_inst.serviceid, "%s", dmjson_get_value(service_inst, 1, "serviceId"));
|
||||
dmasprintf(&upnp_services_inst.servicetype, "%s", dmjson_get_value(service_inst, 1, "serviceType"));
|
||||
dmasprintf(&upnp_services_inst.scpdurl, "%s", dmjson_get_value(service_inst, 1, "SCPDURL"));
|
||||
dmasprintf(&upnp_services_inst.controlurl, "%s", dmjson_get_value(service_inst, 1, "controlURL"));
|
||||
dmasprintf(&upnp_services_inst.eventsuburl, "%s", dmjson_get_value(service_inst, 1, "eventSubURL"));
|
||||
|
||||
if ((dmmap_sect = get_dup_section_in_dmmap_opt("dmmap_upnp", "upnp_service_inst", "serviceid", dmjson_get_value(service_inst, 1, "serviceId"))) == NULL) {
|
||||
dmuci_add_section_bbfdm("dmmap_upnp", "upnp_service_inst", &dmmap_sect);
|
||||
dmuci_set_value_by_section_bbfdm(dmmap_sect, "serviceid", dmjson_get_value(service_inst, 1, "serviceId"));
|
||||
}
|
||||
|
||||
upnp_services_inst.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_instance_without_section(dmctx, parent_node, i+1);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_services_inst, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*************************************************************
|
||||
* GET & SET PARAM
|
||||
**************************************************************/
|
||||
/*#Device.UPnP.Device.Enable!UCI:upnpd/upnpd,config/enabled*/
|
||||
static int get_UPnPDevice_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmuci_get_option_value_fallback_def("upnpd", "config", "enabled", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_UPnPDevice_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
bool b;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
string_to_bool(value, &b);
|
||||
dmuci_set_value("upnpd", "config", "enabled", b ? "1" : "0");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDeviceCapabilities_UPnPArchitecture(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "1";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDeviceCapabilities_UPnPArchitectureMinorVer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "1";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDeviceCapabilities_UPnPIGD(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_option_value_string("upnpd", "config", "igdv1", value);
|
||||
*value = (DM_STRLEN(*value) && *value[0] == '1') ? "1" : "2";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDiscovery_RootDeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
int cnt = get_number_of_entries(ctx, data, instance, browseUPnPDiscoveryRootDeviceInst);
|
||||
dmasprintf(value, "%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDiscovery_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
int cnt = get_number_of_entries(ctx, data, instance, browseUPnPDiscoveryDeviceInst);
|
||||
dmasprintf(value, "%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDiscovery_ServiceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
int cnt = get_number_of_entries(ctx, data, instance, browseUPnPDiscoveryServiceInst);
|
||||
dmasprintf(value, "%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Discovery.RootDevice.{i}.UUID!UBUS:upnpc/discovery//devices[i-1].st*/
|
||||
static int get_UPnPDiscoveryRootDevice_UUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnpdiscovery *)data)->uuid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Discovery.RootDevice.{i}.USN!UBUS:upnpc/discovery//devices[i-1].usn*/
|
||||
static int get_UPnPDiscoveryRootDevice_USN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnpdiscovery *)data)->usn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Discovery.RootDevice.{i}.Location!UBUS:upnpc/discovery//devices[i-1].descurl*/
|
||||
static int get_UPnPDiscoveryRootDevice_Location(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnpdiscovery *)data)->descurl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Discovery.Device.{i}.UUID!UBUS:upnpc/discovery//devices[i-1].st*/
|
||||
static int get_UPnPDiscoveryDevice_UUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnpdiscovery *)data)->uuid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Discovery.Device.{i}.USN!UBUS:upnpc/discovery//devices[i-1].usn*/
|
||||
static int get_UPnPDiscoveryDevice_USN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnpdiscovery *)data)->usn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Discovery.Device.{i}.Location!UBUS:upnpc/discovery//devices[i-1].descurl*/
|
||||
static int get_UPnPDiscoveryDevice_Location(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnpdiscovery *)data)->descurl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Discovery.Service.{i}.USN!UBUS:upnpc/discovery//services[i-1].usn*/
|
||||
static int get_UPnPDiscoveryService_USN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnpdiscovery *)data)->usn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Discovery.Service.{i}.Location!UBUS:upnpc/discovery//services[i-1].descurl*/
|
||||
static int get_UPnPDiscoveryService_Location(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnpdiscovery *)data)->descurl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDiscoveryService_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char buf[256] = {0};
|
||||
|
||||
bbfdm_get_references(ctx, MATCH_FIRST, "Device.UPnP.Discovery.Device.", "UUID", ((struct upnpdiscovery *)data)->uuid, buf, sizeof(buf));
|
||||
|
||||
if (!DM_STRLEN(buf))
|
||||
bbfdm_get_references(ctx, MATCH_FIRST, "Device.UPnP.Discovery.RootDevice.", "UUID", ((struct upnpdiscovery *)data)->uuid, buf, sizeof(buf));
|
||||
|
||||
*value = dmstrdup(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDescription_DeviceDescriptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
int cnt = get_number_of_entries(ctx, data, instance, browseUPnPDescriptionDeviceDescriptionInst);
|
||||
dmasprintf(value, "%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDescription_DeviceInstanceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
int cnt = get_number_of_entries(ctx, data, instance, browseUPnPDescriptionDeviceInstanceInst);
|
||||
dmasprintf(value, "%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDescription_ServiceInstanceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
int cnt = get_number_of_entries(ctx, data, instance, browseUPnPDescriptionServiceInstanceInst);
|
||||
dmasprintf(value, "%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceDescription.{i}.URLBase!UBUS:upnpc/description//descriptions[i-1].descurl*/
|
||||
static int get_UPnPDescriptionDeviceDescription_URLBase(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_description_file_info *)data)->desc_url;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.UDN!UBUS:upnpc/description//devicesinstances[i-1].UDN*/
|
||||
static int get_UPnPDescriptionDeviceInstance_UDN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->udn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDescriptionDeviceInstance_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
_bbfdm_get_references(ctx, "Device.UPnP.Description.DeviceInstance.", "UDN", ((struct upnp_device_inst *)data)->parentudn, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDescriptionDeviceInstance_DiscoveryDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct upnp_device_inst *upnpdevinst = (struct upnp_device_inst *)data;
|
||||
|
||||
if (upnpdevinst->udn && upnpdevinst->udn[0]) {
|
||||
char buf[256] = {0};
|
||||
size_t length = 0;
|
||||
|
||||
char **udnarray = strsplit(upnpdevinst->udn, ":", &length);
|
||||
|
||||
if (length != 2)
|
||||
return 0;
|
||||
|
||||
bbfdm_get_references(ctx, MATCH_FIRST, "Device.UPnP.Discovery.Device.", "UUID", udnarray[1], buf, sizeof(buf));
|
||||
|
||||
if (!DM_STRLEN(*value))
|
||||
bbfdm_get_references(ctx, MATCH_FIRST, "Device.UPnP.Discovery.RootDevice.", "UUID", udnarray[1], buf, sizeof(buf));
|
||||
|
||||
*value = dmstrdup(buf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.DeviceType!UBUS:upnpc/description//devicesinstances[i-1].deviceType*/
|
||||
static int get_UPnPDescriptionDeviceInstance_DeviceType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->device_type;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.FriendlyName!UBUS:upnpc/description//devicesinstances[i-1].friendlyName*/
|
||||
static int get_UPnPDescriptionDeviceInstance_FriendlyName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->friendly_name;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.Manufacturer!UBUS:upnpc/description//devicesinstances[i-1].manufacturer*/
|
||||
static int get_UPnPDescriptionDeviceInstance_Manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->manufacturer;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.ManufacturerURL!UBUS:upnpc/description//devicesinstances[i-1].manufacturerURL*/
|
||||
static int get_UPnPDescriptionDeviceInstance_ManufacturerURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->manufacturer_url;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.ModelDescription!UBUS:upnpc/description//devicesinstances[i-1].modelDescription*/
|
||||
static int get_UPnPDescriptionDeviceInstance_ModelDescription(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->model_description;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.ModelName!UBUS:upnpc/description//devicesinstances[i-1].modelName*/
|
||||
static int get_UPnPDescriptionDeviceInstance_ModelName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->model_name;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.ModelNumber!UBUS:upnpc/description//devicesinstances[i-1].modelNumber*/
|
||||
static int get_UPnPDescriptionDeviceInstance_ModelNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->model_number;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.ModelURL!UBUS:upnpc/description//devicesinstances[i-1].modelURL*/
|
||||
static int get_UPnPDescriptionDeviceInstance_ModelURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->model_url;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.SerialNumber!UBUS:upnpc/description//devicesinstances[i-1].serialNumber*/
|
||||
static int get_UPnPDescriptionDeviceInstance_SerialNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->serial_number;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.UPC!UBUS:upnpc/description//devicesinstances[i-1].UPC*/
|
||||
static int get_UPnPDescriptionDeviceInstance_UPC(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->upc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.DeviceInstance.{i}.PresentationURL!UBUS:upnpc/description//devicesinstances[i-1].preentation_url*/
|
||||
static int get_UPnPDescriptionDeviceInstance_PresentationURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_device_inst *)data)->preentation_url;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDescriptionServiceInstance_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
_bbfdm_get_references(ctx, "Device.UPnP.Description.DeviceInstance.", "UDN", ((struct upnp_service_inst *)data)->parentudn, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.ServiceInstance.{i}.ServiceId!UBUS:upnpc/description//servicesinstances[i-1].serviceId*/
|
||||
static int get_UPnPDescriptionServiceInstance_ServiceId(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_service_inst *)data)->serviceid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_UPnPDescriptionServiceInstance_ServiceDiscovery(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char usn[512] = {0};
|
||||
|
||||
snprintf(usn, sizeof(usn), "%s::%s", ((struct upnp_service_inst *)data)->parentudn, ((struct upnp_service_inst *)data)->servicetype);
|
||||
|
||||
_bbfdm_get_references(ctx, "Device.UPnP.Discovery.Service.", "USN", usn, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.ServiceInstance.{i}.ServiceType!UBUS:upnpc/description//servicesinstances[i-1].serviceType*/
|
||||
static int get_UPnPDescriptionServiceInstance_ServiceType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_service_inst *)data)->servicetype;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.ServiceInstance.{i}.SCPDURL!UBUS:upnpc/description//servicesinstances[i-1].SCPDURL*/
|
||||
static int get_UPnPDescriptionServiceInstance_SCPDURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_service_inst *)data)->scpdurl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.ServiceInstance.{i}.ControlURL!UBUS:upnpc/description//servicesinstances[i-1].controlURL*/
|
||||
static int get_UPnPDescriptionServiceInstance_ControlURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_service_inst *)data)->controlurl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.UPnP.Description.ServiceInstance.{i}.EventSubURL!UBUS:upnpc/description//servicesinstances[i-1].eventSubURL*/
|
||||
static int get_UPnPDescriptionServiceInstance_EventSubURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = ((struct upnp_service_inst *)data)->eventsuburl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************
|
||||
* OBJ & LEAF DEFINITION
|
||||
***********************************************************************************************************************************/
|
||||
/* *** Device.UPnP.Description.ServiceInstance.{i}. *** */
|
||||
DMLEAF tUPnPDescriptionServiceInstanceParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
{"ParentDevice", &DMREAD, DMT_STRING, get_UPnPDescriptionServiceInstance_ParentDevice, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE|DM_FLAG_REFERENCE},
|
||||
{"ServiceId", &DMREAD, DMT_STRING, get_UPnPDescriptionServiceInstance_ServiceId, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE},
|
||||
{"ServiceDiscovery", &DMREAD, DMT_STRING, get_UPnPDescriptionServiceInstance_ServiceDiscovery, NULL, BBFDM_BOTH},
|
||||
{"ServiceType", &DMREAD, DMT_STRING, get_UPnPDescriptionServiceInstance_ServiceType, NULL, BBFDM_BOTH},
|
||||
{"SCPDURL", &DMREAD, DMT_STRING, get_UPnPDescriptionServiceInstance_SCPDURL, NULL, BBFDM_BOTH},
|
||||
{"ControlURL", &DMREAD, DMT_STRING, get_UPnPDescriptionServiceInstance_ControlURL, NULL, BBFDM_BOTH},
|
||||
{"EventSubURL", &DMREAD, DMT_STRING, get_UPnPDescriptionServiceInstance_EventSubURL, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Description.DeviceInstance.{i}. *** */
|
||||
DMLEAF tUPnPDescriptionDeviceInstanceParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
{"UDN", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_UDN, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE},
|
||||
{"ParentDevice", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_ParentDevice, NULL, BBFDM_BOTH, DM_FLAG_REFERENCE},
|
||||
{"DiscoveryDevice", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_DiscoveryDevice, NULL, BBFDM_BOTH},
|
||||
{"DeviceType", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_DeviceType, NULL, BBFDM_BOTH},
|
||||
{"FriendlyName", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_FriendlyName, NULL, BBFDM_BOTH},
|
||||
//{"DeviceCategory", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_DeviceCategory, NULL, BBFDM_BOTH},
|
||||
{"Manufacturer", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_Manufacturer, NULL, BBFDM_BOTH},
|
||||
//{"ManufacturerOUI", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_ManufacturerOUI, NULL, BBFDM_BOTH},
|
||||
{"ManufacturerURL", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_ManufacturerURL, NULL, BBFDM_BOTH},
|
||||
{"ModelDescription", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_ModelDescription, NULL, BBFDM_BOTH},
|
||||
{"ModelName", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_ModelName, NULL, BBFDM_BOTH},
|
||||
{"ModelNumber", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_ModelNumber, NULL, BBFDM_BOTH},
|
||||
{"ModelURL", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_ModelURL, NULL, BBFDM_BOTH},
|
||||
{"SerialNumber", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_SerialNumber, NULL, BBFDM_BOTH},
|
||||
{"UPC", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_UPC, NULL, BBFDM_BOTH},
|
||||
{"PresentationURL", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceInstance_PresentationURL, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Description.DeviceDescription.{i}. *** */
|
||||
DMLEAF tUPnPDescriptionDeviceDescriptionParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
{"URLBase", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceDescription_URLBase, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE},
|
||||
//{"SpecVersion", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceDescription_SpecVersion, NULL, BBFDM_BOTH},
|
||||
//{"Host", &DMREAD, DMT_STRING, get_UPnPDescriptionDeviceDescription_Host, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMLEAF tUPnPDescriptionParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
{"DeviceDescriptionNumberOfEntries", &DMREAD, DMT_UNINT, get_UPnPDescription_DeviceDescriptionNumberOfEntries, NULL, BBFDM_BOTH},
|
||||
{"DeviceInstanceNumberOfEntries", &DMREAD, DMT_UNINT, get_UPnPDescription_DeviceInstanceNumberOfEntries, NULL, BBFDM_BOTH},
|
||||
{"ServiceInstanceNumberOfEntries", &DMREAD, DMT_UNINT, get_UPnPDescription_ServiceInstanceNumberOfEntries, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Description. *** */
|
||||
DMOBJ tUPnPDescriptionObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
|
||||
{"DeviceDescription", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionDeviceDescriptionInst, NULL, NULL, NULL, tUPnPDescriptionDeviceDescriptionParams, NULL, BBFDM_BOTH, NULL},
|
||||
{"DeviceInstance", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionDeviceInstanceInst, NULL, NULL, NULL, tUPnPDescriptionDeviceInstanceParams, NULL, BBFDM_BOTH, NULL},
|
||||
{"ServiceInstance", &DMREAD, NULL, NULL, NULL, browseUPnPDescriptionServiceInstanceInst, NULL, NULL, NULL, tUPnPDescriptionServiceInstanceParams, NULL, BBFDM_BOTH, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Discovery.Service.{i}. *** */
|
||||
DMLEAF tUPnPDiscoveryServiceParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
//{"Status", &DMREAD, DMT_STRING, get_UPnPDiscoveryService_Status, NULL, BBFDM_BOTH},
|
||||
{"USN", &DMREAD, DMT_STRING, get_UPnPDiscoveryService_USN, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE},
|
||||
//{"LeaseTime", &DMREAD, DMT_UNINT, get_UPnPDiscoveryService_LeaseTime, NULL, BBFDM_BOTH},
|
||||
{"Location", &DMREAD, DMT_STRING, get_UPnPDiscoveryService_Location, NULL, BBFDM_BOTH},
|
||||
//{"Server", &DMREAD, DMT_STRING, get_UPnPDiscoveryService_Server, NULL, BBFDM_BOTH},
|
||||
//{"Host", &DMREAD, DMT_STRING, get_UPnPDiscoveryService_Host, NULL, BBFDM_BOTH},
|
||||
//{"LastUpdate", &DMREAD, DMT_TIME, get_UPnPDiscoveryService_LastUpdate, NULL, BBFDM_BOTH},
|
||||
{"ParentDevice", &DMREAD, DMT_STRING, get_UPnPDiscoveryService_ParentDevice, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Discovery.Device.{i}. *** */
|
||||
DMLEAF tUPnPDiscoveryDeviceParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
//{"Status", &DMREAD, DMT_STRING, get_UPnPDiscoveryDevice_Status, NULL, BBFDM_BOTH},
|
||||
{"UUID", &DMREAD, DMT_STRING, get_UPnPDiscoveryDevice_UUID, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE},
|
||||
{"USN", &DMREAD, DMT_STRING, get_UPnPDiscoveryDevice_USN, NULL, BBFDM_BOTH},
|
||||
//{"LeaseTime", &DMREAD, DMT_UNINT, get_UPnPDiscoveryDevice_LeaseTime, NULL, BBFDM_BOTH},
|
||||
{"Location", &DMREAD, DMT_STRING, get_UPnPDiscoveryDevice_Location, NULL, BBFDM_BOTH},
|
||||
//{"Server", &DMREAD, DMT_STRING, get_UPnPDiscoveryDevice_Server, NULL, BBFDM_BOTH},
|
||||
//{"Host", &DMREAD, DMT_STRING, get_UPnPDiscoveryDevice_Host, NULL, BBFDM_BOTH},
|
||||
//{"LastUpdate", &DMREAD, DMT_TIME, get_UPnPDiscoveryDevice_LastUpdate, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Discovery.RootDevice.{i}. *** */
|
||||
DMLEAF tUPnPDiscoveryRootDeviceParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
//{"Status", &DMREAD, DMT_STRING, get_UPnPDiscoveryRootDevice_Status, NULL, BBFDM_BOTH},
|
||||
{"UUID", &DMREAD, DMT_STRING, get_UPnPDiscoveryRootDevice_UUID, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE},
|
||||
{"USN", &DMREAD, DMT_STRING, get_UPnPDiscoveryRootDevice_USN, NULL, BBFDM_BOTH},
|
||||
//{"LeaseTime", &DMREAD, DMT_UNINT, get_UPnPDiscoveryRootDevice_LeaseTime, NULL, BBFDM_BOTH},
|
||||
{"Location", &DMREAD, DMT_STRING, get_UPnPDiscoveryRootDevice_Location, NULL, BBFDM_BOTH},
|
||||
//{"Server", &DMREAD, DMT_STRING, get_UPnPDiscoveryRootDevice_Server, NULL, BBFDM_BOTH},
|
||||
//{"Host", &DMREAD, DMT_STRING, get_UPnPDiscoveryRootDevice_Host, NULL, BBFDM_BOTH},
|
||||
//{"LastUpdate", &DMREAD, DMT_TIME, get_UPnPDiscoveryRootDevice_LastUpdate, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMLEAF tUPnPDiscoveryParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
{"RootDeviceNumberOfEntries", &DMREAD, DMT_UNINT, get_UPnPDiscovery_RootDeviceNumberOfEntries, NULL, BBFDM_BOTH},
|
||||
{"DeviceNumberOfEntries", &DMREAD, DMT_UNINT, get_UPnPDiscovery_DeviceNumberOfEntries, NULL, BBFDM_BOTH},
|
||||
{"ServiceNumberOfEntries", &DMREAD, DMT_UNINT, get_UPnPDiscovery_ServiceNumberOfEntries, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Discovery. *** */
|
||||
DMOBJ tUPnPDiscoveryObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
|
||||
{"RootDevice", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryRootDeviceInst, NULL, NULL, NULL, tUPnPDiscoveryRootDeviceParams, NULL, BBFDM_BOTH, NULL},
|
||||
{"Device", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryDeviceInst, NULL, NULL, NULL, tUPnPDiscoveryDeviceParams, NULL, BBFDM_BOTH, NULL},
|
||||
{"Service", &DMREAD, NULL, NULL, NULL, browseUPnPDiscoveryServiceInst, NULL, NULL, NULL, tUPnPDiscoveryServiceParams, NULL, BBFDM_BOTH, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Device.Capabilities. *** */
|
||||
DMLEAF tUPnPDeviceCapabilitiesParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
{"UPnPArchitecture", &DMREAD, DMT_UNINT, get_UPnPDeviceCapabilities_UPnPArchitecture, NULL, BBFDM_BOTH},
|
||||
{"UPnPArchitectureMinorVer", &DMREAD, DMT_UNINT, get_UPnPDeviceCapabilities_UPnPArchitectureMinorVer, NULL, BBFDM_BOTH},
|
||||
{"UPnPIGD", &DMREAD, DMT_UNINT, get_UPnPDeviceCapabilities_UPnPIGD, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMLEAF tUPnPDeviceParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
|
||||
{"Enable", &DMWRITE, DMT_BOOL, get_UPnPDevice_Enable, set_UPnPDevice_Enable, BBFDM_BOTH},
|
||||
//{"UPnPMediaServer", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPMediaServer, set_UPnPDevice_UPnPMediaServer, BBFDM_BOTH},
|
||||
//{"UPnPMediaRenderer", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPMediaRenderer, set_UPnPDevice_UPnPMediaRenderer, BBFDM_BOTH},
|
||||
//{"UPnPWLANAccessPoint", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPWLANAccessPoint, set_UPnPDevice_UPnPWLANAccessPoint, BBFDM_BOTH},
|
||||
//{"UPnPQoSDevice ", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPQoSDevice , set_UPnPDevice_UPnPQoSDevice , BBFDM_BOTH},
|
||||
//{"UPnPQoSPolicyHolder", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPQoSPolicyHolder, set_UPnPDevice_UPnPQoSPolicyHolder, BBFDM_BOTH},
|
||||
//{"UPnPIGD", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPIGD, set_UPnPDevice_UPnPIGD, BBFDM_BOTH},
|
||||
//{"UPnPDMBasicMgmt", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPDMBasicMgmt, set_UPnPDevice_UPnPDMBasicMgmt, BBFDM_BOTH},
|
||||
//{"UPnPDMConfigurationMgmt", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPDMConfigurationMgmt, set_UPnPDevice_UPnPDMConfigurationMgmt, BBFDM_BOTH},
|
||||
//{"UPnPDMSoftwareMgmt", &DMWRITE, DMT_BOOL, get_UPnPDevice_UPnPDMSoftwareMgmt, set_UPnPDevice_UPnPDMSoftwareMgmt, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP.Device. *** */
|
||||
DMOBJ tUPnPDeviceObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
|
||||
{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceCapabilitiesParams, NULL, BBFDM_BOTH, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.UPnP. *** */
|
||||
DMOBJ tUPnPObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
|
||||
{"Device", &DMREAD, NULL, NULL, "file:/etc/config/upnpd", NULL, NULL, NULL, tUPnPDeviceObj, tUPnPDeviceParams, NULL, BBFDM_BOTH, NULL},
|
||||
{"Discovery", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDiscoveryObj, tUPnPDiscoveryParams, NULL, BBFDM_BOTH, NULL},
|
||||
{"Description", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDescriptionObj, tUPnPDescriptionParams, NULL, BBFDM_BOTH, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMOBJ tDeviceObjs[] = {
|
||||
{"UPnP", &DMREAD, NULL, NULL, "file:/etc/init.d/ssdpd", NULL, NULL, NULL, tUPnPObj, NULL, NULL, BBFDM_BOTH, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
DM_MAP_OBJ tDynamicObj[] = {
|
||||
/* parentobj, nextobject, parameter */
|
||||
{"Device.", tDeviceObjs, NULL},
|
||||
{0}
|
||||
};
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sshmngr
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/sshmngr.git
|
||||
PKG_SOURCE_VERSION:=748b90845e69d1c665d39ea4c498cb2727c38550
|
||||
PKG_SOURCE_VERSION:=790689b6ccc89ca90623b6b93b95ee4642cb789e
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=3.1.59
|
||||
PKG_VERSION:=3.1.60
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
@@ -145,9 +145,12 @@ define Package/sulu/install/Default
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/users/roles
|
||||
$(INSTALL_DATA) ./files/etc/users/roles/*.json $(1)/etc/users/roles/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-userinterface-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/10-add-mqtt-config $(1)/etc/uci-defaults/
|
||||
ifeq ($(CONFIG_SULU_PWA_APP),y)
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
config global 'global'
|
||||
option SessionMode 'Allow'
|
||||
list user 'admin'
|
||||
list user 'user'
|
||||
option enabled '1'
|
||||
|
||||
@@ -6,7 +6,6 @@ START=60
|
||||
STOP=01
|
||||
|
||||
. /lib/functions.sh
|
||||
. /etc/sulu/sulu.sh
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t sulu.init -p debug
|
||||
@@ -15,12 +14,11 @@ log() {
|
||||
validate_sulu_global_section()
|
||||
{
|
||||
uci_validate_section sulu global global \
|
||||
'enabled:bool:1' \
|
||||
'enable_system_credentials:bool:1'
|
||||
'enabled:bool:1'
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled enable_system_credentials
|
||||
local enabled
|
||||
|
||||
config_load sulu
|
||||
procd_open_instance sulu
|
||||
@@ -33,8 +31,8 @@ start_service() {
|
||||
fi
|
||||
|
||||
update_nginx_template
|
||||
configure_sulu "${enable_system_credentials}" 1
|
||||
generate_sulu_conn_config
|
||||
|
||||
/etc/sulu/sulu.sh -r
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
@@ -45,5 +43,5 @@ reload_service() {
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "sulu" "nginx"
|
||||
procd_add_reload_trigger "sulu" "userinterface"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
# format using "shfmt"
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
RESTART_REQ=0
|
||||
_RESTART_SERVICES="0"
|
||||
|
||||
mkdir -p /tmp/sulu/
|
||||
@@ -39,8 +41,20 @@ function _get_endpoint_id() {
|
||||
fi
|
||||
}
|
||||
|
||||
function _get_sulu_users() {
|
||||
echo "$(uci -q get sulu.global.user)"
|
||||
function _get_sulu_user_roles() {
|
||||
roles=$(uci -q get userinterface._sulu_s.role)
|
||||
|
||||
for role in ${roles}; do
|
||||
if [ -f "/etc/users/roles/$role.json" ]; then
|
||||
sulu_user_roles="${sulu_user_roles} ${role}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${sulu_user_roles}" ]; then
|
||||
sulu_user_roles=$(echo -e "${sulu_user_roles// /\\n}" | sort | uniq)
|
||||
fi
|
||||
|
||||
echo ${sulu_user_roles}
|
||||
}
|
||||
|
||||
function _get_sulu_root() {
|
||||
@@ -91,7 +105,7 @@ function update_nginx_template() {
|
||||
port="$(_get_usp_upstream_port)"
|
||||
if ! grep -q "upstream websocket { server 127.0.0.1:${port}; }" ${UCI_TEMPLATE}; then
|
||||
sed -i "s/upstream websocket { server 127.0.0.1:[0-9]\+; }/upstream websocket { server 127.0.0.1:${var}; }/" ${UCI_TEMPLATE}
|
||||
log "Restarting nginx"
|
||||
slog "Restarting nginx"
|
||||
ubus call uci commit '{"config":"nginx"}'
|
||||
fi
|
||||
}
|
||||
@@ -99,7 +113,7 @@ function update_nginx_template() {
|
||||
function generate_sulu_conn_config() {
|
||||
local users SCONFIG session
|
||||
|
||||
users="$(_get_sulu_users)"
|
||||
users="$(_get_sulu_user_roles)"
|
||||
session="$(_get_sulu_session_mode)"
|
||||
SCONFIG="$(_get_sulu_connection_config)"
|
||||
|
||||
@@ -139,32 +153,34 @@ function generate_sulu_conn_config() {
|
||||
json_dump >${SCONFIG}
|
||||
}
|
||||
|
||||
function _remove_obuspa_config() {
|
||||
local restart session
|
||||
cleanup_sulu_usp_config() {
|
||||
local users sec stype tmp
|
||||
|
||||
restart=0
|
||||
if [ "$(uci_get obuspa localmqtt)" == "mqtt" ]; then
|
||||
uci_remove obuspa localmqtt
|
||||
restart=1
|
||||
sec="${1}"
|
||||
stype="${2}"
|
||||
users="${3}"
|
||||
|
||||
if [[ "${sec}" == "${stype}_sulu_"* ]]; then
|
||||
tmp="${sec//${stype}_sulu_/}"
|
||||
|
||||
val="$(echo ${users}|grep -w -o $tmp)"
|
||||
if [ -z "$val" ]; then
|
||||
_remove_sulu_section "${sec}"
|
||||
RESTART_REQ=1
|
||||
fi
|
||||
fi
|
||||
if [ "$(uci_get obuspa agent_mtp)" == "mtp" ]; then
|
||||
uci_remove obuspa agent_mtp
|
||||
restart=1
|
||||
fi
|
||||
if [ "$(uci_get obuspa localcontroller)" == "controller" ]; then
|
||||
uci_remove obuspa localcontroller
|
||||
restart=1
|
||||
fi
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _update_obuspa_config_rbac() {
|
||||
local agent users restart session
|
||||
local agent users session
|
||||
|
||||
agent="$(_get_agent_id)"
|
||||
users="$(_get_sulu_users)"
|
||||
users="$(_get_sulu_user_roles)"
|
||||
session="$(_get_sulu_session_mode)"
|
||||
restart=0
|
||||
|
||||
config_foreach cleanup_sulu_usp_config controller controller "${users}"
|
||||
config_foreach cleanup_sulu_usp_config mtp mtp "${users}"
|
||||
config_foreach cleanup_sulu_usp_config mqtt mqtt "${users}"
|
||||
|
||||
for user in ${users}; do
|
||||
local section
|
||||
@@ -176,7 +192,7 @@ function _update_obuspa_config_rbac() {
|
||||
uci_set obuspa ${section} BrokerAddress "127.0.0.1"
|
||||
uci_set obuspa ${section} BrokerPort "1883"
|
||||
uci_set obuspa ${section} TransportProtocol "TCP/IP"
|
||||
restart=1
|
||||
RESTART_REQ=1
|
||||
fi
|
||||
|
||||
# Add mtp
|
||||
@@ -186,7 +202,7 @@ function _update_obuspa_config_rbac() {
|
||||
uci_set obuspa ${section} Protocol "MQTT"
|
||||
uci_set obuspa ${section} ResponseTopicConfigured "/usp/${agent}/${user}/endpoint"
|
||||
uci_set obuspa ${section} mqtt "mqtt_sulu_$user"
|
||||
restart=1
|
||||
RESTART_REQ=1
|
||||
fi
|
||||
|
||||
# Add controller
|
||||
@@ -198,16 +214,15 @@ function _update_obuspa_config_rbac() {
|
||||
uci_set obuspa ${section} Topic "/usp/${agent}/${user}/controller"
|
||||
uci_set obuspa ${section} mqtt "mqtt_sulu_$user"
|
||||
uci_set obuspa ${section} assigned_role_name "$user"
|
||||
restart=1
|
||||
RESTART_REQ=1
|
||||
fi
|
||||
|
||||
obMode="$(uci_get obuspa ${section} SessionMode)"
|
||||
if [ "${session}" != "${obMode}" ]; then
|
||||
uci_set obuspa ${section} SessionMode "${session}"
|
||||
restart=1
|
||||
RESTART_REQ=1
|
||||
fi
|
||||
done
|
||||
return "${restart}"
|
||||
}
|
||||
|
||||
function _remove_sulu_section() {
|
||||
@@ -221,10 +236,10 @@ function _remove_sulu_section() {
|
||||
}
|
||||
|
||||
function _create_acl() {
|
||||
local agentid users restart
|
||||
local agentid users
|
||||
local ACL_FILE
|
||||
|
||||
restart="0"
|
||||
RESTART_REQ="0"
|
||||
|
||||
ACL_FILE="$(_get_sulu_acl_file)"
|
||||
if [ -z "${ACL_FILE}" ]; then
|
||||
@@ -236,7 +251,7 @@ function _create_acl() {
|
||||
fi
|
||||
touch "${ACL_FILE}"
|
||||
|
||||
users="$(_get_sulu_users)"
|
||||
users="$(_get_sulu_user_roles)"
|
||||
agentid="$(_get_agent_id)"
|
||||
for user in ${users}; do
|
||||
if ! grep -q "user $user" ${ACL_FILE}; then
|
||||
@@ -245,47 +260,45 @@ function _create_acl() {
|
||||
echo "topic write /usp/${agentid}/${user}/endpoint/#" >>${ACL_FILE}
|
||||
echo "topic read /usp/${agentid}/${user}/controller/#" >>${ACL_FILE}
|
||||
echo "" >>${ACL_FILE}
|
||||
restart="1"
|
||||
RESTART_REQ="1"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${restart}" -gt "0" ]; then
|
||||
if [ "${RESTART_REQ}" -gt "0" ]; then
|
||||
slog "Restarting mosquitto..."
|
||||
ubus call uci commit '{"config":"mosquitto"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function update_obuspa_config() {
|
||||
local restart
|
||||
|
||||
restart=0
|
||||
|
||||
RESTART_REQ=0
|
||||
uci_load obuspa
|
||||
_remove_obuspa_config
|
||||
restart="$((restart + $?))"
|
||||
_update_obuspa_config_rbac
|
||||
restart="$((restart + $?))"
|
||||
uci_commit obuspa
|
||||
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -gt "0" ]; then
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${RESTART_REQ}" -gt "0" ]; then
|
||||
slog "Restarting obuspa..."
|
||||
ubus call uci commit '{"config":"obuspa"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function configure_sulu() {
|
||||
local sys_cred restart
|
||||
|
||||
sys_cred="${1}"
|
||||
restart="${2:-0}"
|
||||
|
||||
if [ -z "${sys_cred}" ]; then
|
||||
slog "Invalid inputs"
|
||||
return 0
|
||||
fi
|
||||
|
||||
_RESTART_SERVICES="${restart}"
|
||||
|
||||
update_obuspa_config
|
||||
_create_acl
|
||||
generate_sulu_conn_config
|
||||
}
|
||||
|
||||
while getopts ":r" opt; do
|
||||
case ${opt} in
|
||||
r)
|
||||
_RESTART_SERVICES="1"
|
||||
;;
|
||||
*)
|
||||
slog "Invalid option: ${OPTARG}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
configure_sulu
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
add_sulu_nginx_uci()
|
||||
{
|
||||
uci_load nginx
|
||||
|
||||
if ! uci_get nginx _sulu_s >/dev/null 2>&1; then
|
||||
uci_add nginx server _sulu_s
|
||||
uci_set nginx _sulu_s root '/sulu'
|
||||
uci_add_list nginx _sulu_s listen "8443 ssl default_server"
|
||||
uci_add_list nginx _sulu_s listen "[::]:8443 ssl default_server"
|
||||
uci_set nginx _sulu_s server_name '_sulu_s'
|
||||
uci_add_list nginx _sulu_s include '/etc/sulu/nginx.locations'
|
||||
uci_set nginx _sulu_s uci_manage_ssl 'self-signed'
|
||||
uci_set nginx _sulu_s ssl_certificate '/etc/nginx/conf.d/_lan.crt'
|
||||
uci_set nginx _sulu_s ssl_certificate_key '/etc/nginx/conf.d/_lan.key'
|
||||
uci_set nginx _sulu_s ssl_session_cache 'none'
|
||||
uci_set nginx _sulu_s access_log 'off; # logd openwrt'
|
||||
uci_set nginx _sulu_s error_log '/dev/null'
|
||||
fi
|
||||
|
||||
# To host on http, disable _suluredirect and enable _sulu_http
|
||||
if ! uci_get nginx _suluredirect >/dev/null 2>&1; then
|
||||
uci_add nginx server _suluredirect
|
||||
uci_add_list nginx _suluredirect listen "8080"
|
||||
uci_add_list nginx _suluredirect listen "[::]:8080"
|
||||
uci_set nginx _suluredirect server_name '_suluredirect'
|
||||
uci_set nginx _suluredirect return '302 https://$host:8443$request_uri'
|
||||
fi
|
||||
|
||||
if uci_get nginx _sulu_http >/dev/null 2>&1; then
|
||||
uci_remove nginx _sulu_http
|
||||
fi
|
||||
# if ! uci_get nginx _sulu_http >/dev/null 2>&1; then
|
||||
# uci_add nginx server _sulu_http
|
||||
# uci_set nginx _sulu_http root '/sulu'
|
||||
# uci_add_list nginx _sulu_http listen "8080"
|
||||
# uci_add_list nginx _sulu_http listen "[::]:8080"
|
||||
# uci_set nginx _sulu_http server_name '_sulu_http'
|
||||
# uci_add_list nginx _sulu_http include '/etc/sulu/nginx.locations'
|
||||
# uci_set nginx _sulu_http ssl_session_cache 'none'
|
||||
# uci_set nginx _sulu_http access_log 'off; # logd openwrt'
|
||||
# fi
|
||||
}
|
||||
|
||||
|
||||
add_sulu_nginx_uci
|
||||
32
sulu/sulu-builder/files/etc/uci-defaults/40-add-sulu-userinterface-config
Executable file
32
sulu/sulu-builder/files/etc/uci-defaults/40-add-sulu-userinterface-config
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
add_sulu_userinterface_uci()
|
||||
{
|
||||
uci_load userinterface
|
||||
|
||||
if ! uci_get userinterface _sulu_s >/dev/null 2>&1; then
|
||||
uci_add userinterface http_access _sulu_s
|
||||
uci_set userinterface _sulu_s path_prefix '/sulu'
|
||||
uci_set userinterface _sulu_s port '8443'
|
||||
uci_add_list userinterface _sulu_s _nginx_include '/etc/sulu/nginx.locations'
|
||||
uci_set userinterface _sulu_s _nginx_uci_manage_ssl 'self-signed'
|
||||
uci_set userinterface _sulu_s _nginx_ssl_certificate '/etc/nginx/conf.d/_lan.crt'
|
||||
uci_set userinterface _sulu_s _nginx_ssl_certificate_key '/etc/nginx/conf.d/_lan.key'
|
||||
uci_set userinterface _sulu_s _nginx_ssl_session_cache 'none'
|
||||
uci_set userinterface _sulu_s protocol 'HTTPS'
|
||||
uci_add_list userinterface _sulu_s role 'admin'
|
||||
uci_add_list userinterface _sulu_s role 'user'
|
||||
fi
|
||||
|
||||
if ! uci_get userinterface _suluredirect >/dev/null 2>&1; then
|
||||
uci_add userinterface http_access _suluredirect
|
||||
uci_set userinterface _suluredirect redirect '_sulu_s'
|
||||
uci_set userinterface _suluredirect protocol 'HTTP'
|
||||
uci_set userinterface _suluredirect port "8080"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
add_sulu_userinterface_uci
|
||||
@@ -1,9 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/sulu/sulu.sh
|
||||
|
||||
config_load sulu
|
||||
config_get enable_system_credentials global enable_system_credentials 1
|
||||
|
||||
configure_sulu "${enable_system_credentials}" 0
|
||||
generate_sulu_conn_config
|
||||
/etc/sulu/sulu.sh
|
||||
|
||||
538
sulu/sulu-builder/files/etc/users/roles/admin.json
Normal file
538
sulu/sulu-builder/files/etc/users/roles/admin.json
Normal file
@@ -0,0 +1,538 @@
|
||||
{
|
||||
"tr181": {
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.Reboot()",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.SelfTestDiagnostics()",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.FactoryReset()",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DeviceInfo.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Time.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.UPnP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Bridging.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Ethernet.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DHCPv4.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DHCPv4.Server.Pool.{i}.StaticAddress.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DHCPv6.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Hosts.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.{BBF_VENDOR_PREFIX}URLFilter.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.{BBF_VENDOR_PREFIX}OpenVPN.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.NAT.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.PPP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Routing.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.IEEE1905.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.InterfaceStack.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DynamicDNS.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.LANConfigSecurity.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Security.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.RouterAdvertisement.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Services.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.UserInterface.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.PeriodicStatistics.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.SoftwareModules.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Users.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.Subscription.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DNS.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.IP.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.SSH.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
101
sulu/sulu-builder/files/etc/users/roles/user.json
Normal file
101
sulu/sulu-builder/files/etc/users/roles/user.json
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"tr181": {
|
||||
"permission": [
|
||||
{
|
||||
"object": "Device.",
|
||||
"perm": [
|
||||
"PERMIT_NONE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.DeviceInfo.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.Hosts.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.IEEE1905.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.DynamicDNS.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object":"Device.PeriodicStatistics.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.LocalAgent.Subscription.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_ADD",
|
||||
"PERMIT_SET",
|
||||
"PERMIT_DEL",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.",
|
||||
"perm": [
|
||||
"PERMIT_GET",
|
||||
"PERMIT_GET_INST",
|
||||
"PERMIT_OBJ_INFO",
|
||||
"PERMIT_CMD_INFO",
|
||||
"PERMIT_SUBS_VAL_CHANGE",
|
||||
"PERMIT_SUBS_OBJ_ADD",
|
||||
"PERMIT_SUBS_OBJ_DEL"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.AccessPoint.{i}.WPS.InitiateWPSPBC()",
|
||||
"perm": [
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "Device.WiFi.DataElements.Network.SetSSID()",
|
||||
"perm": [
|
||||
"PERMIT_OPER",
|
||||
"PERMIT_SUBS_EVT_OPER_COMP"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.5.5
|
||||
PKG_VERSION:=2.5.7
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/lcm/swmodd.git
|
||||
PKG_SOURCE_VERSION:=723d3597ef0f1b20fd3212b3e1ced3242f2491f1
|
||||
PKG_SOURCE_VERSION:=4d228d6be9759d285b49a20e191c6ca23ab40a51
|
||||
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}"
|
||||
}
|
||||
|
||||
|
||||
65
swmodd/files/etc/swmodd/run.sh
Normal file → Executable file
65
swmodd/files/etc/swmodd/run.sh
Normal file → Executable file
@@ -123,12 +123,58 @@ 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
|
||||
log "## PERM [$PERM], Name [${NAME}] ##"
|
||||
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 +258,21 @@ pull_image_from_registry() {
|
||||
clean=0
|
||||
net_update=0
|
||||
update_json=0
|
||||
while getopts b:n:i:r:l:t:cuU options
|
||||
PERM=""
|
||||
|
||||
log "## Runner [$@] ##"
|
||||
|
||||
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 +284,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 +294,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 +304,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;
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=timemngr
|
||||
PKG_VERSION:=1.0.18
|
||||
PKG_VERSION:=1.0.19
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/timemngr.git
|
||||
PKG_SOURCE_VERSION:=48408cc78532c261976ac2d3a3fbb50b1f4c0892
|
||||
PKG_SOURCE_VERSION:=c9fb0a58c5a928dd397edc5d3f5c1ccf0485dccc
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=tr104
|
||||
PKG_VERSION:=1.0.27
|
||||
PKG_VERSION:=1.0.28
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifeq ($(LOCAL_DEV),0)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/voice/tr104.git
|
||||
PKG_SOURCE_VERSION:=0d86598b75b201a66f869d483c04ce117d1501d9
|
||||
PKG_SOURCE_VERSION:=8792d5bf496a4c25c31f4e84ec825b02bf097cc2
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
53
tr143/Makefile
Normal file
53
tr143/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=tr143
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/tr143d.git
|
||||
PKG_SOURCE_VERSION:=6762d1efbb995be685af32af5f4b67cc4d737bcd
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/tr143
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-143 Data Model Support
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libbbfdm-api
|
||||
endef
|
||||
|
||||
define Package/tr143/description
|
||||
Package to add Device.IP.Diagnostics. data model support.
|
||||
endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/tr143/install
|
||||
$(BBFDM_INSTALL_MS_DM) -u Diagnostics $(PKG_BUILD_DIR)/src/libtr143d.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_SCRIPT) $(PKG_BUILD_DIR)/scripts/download $(1)
|
||||
$(BBFDM_INSTALL_SCRIPT) $(PKG_BUILD_DIR)/scripts/traceroute $(1)
|
||||
$(BBFDM_INSTALL_SCRIPT) $(PKG_BUILD_DIR)/scripts/upload $(1)
|
||||
$(BBFDM_INSTALL_SCRIPT) -d $(PKG_BUILD_DIR)/scripts/bbf_diag/ipping $(1)
|
||||
$(BBFDM_INSTALL_SCRIPT) -d $(PKG_BUILD_DIR)/scripts/bbf_diag/serverselection $(1)
|
||||
$(BBFDM_INSTALL_SCRIPT) -d $(PKG_BUILD_DIR)/scripts/bbf_diag/udpecho $(1)
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) ~/git/tr143/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,tr143))
|
||||
48
tr471/Makefile
Normal file
48
tr471/Makefile
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=tr471
|
||||
PKG_VERSION:=1.0.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/tr471d.git
|
||||
PKG_SOURCE_VERSION:=036c87b237f266cf7f9fae170c37c863a5f4af2e
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
|
||||
define Package/tr471
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TR-471 Data Model Support
|
||||
DEPENDS:=+obudpst +libuci +libubox +libubus +libblobmsg-json +libbbfdm-api
|
||||
endef
|
||||
|
||||
define Package/tr471/description
|
||||
Package to add Device.IP.Diagnostics.IPLayerCapacityMetrics. data model support.
|
||||
endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/tr471/install
|
||||
$(BBFDM_INSTALL_MS_DM) -u IPLayerCapacity $(PKG_BUILD_DIR)/src/libtr471d.so $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_SCRIPT) $(PKG_BUILD_DIR)/scripts/iplayercap $(1)
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) ~/git/tr471/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,tr471))
|
||||
@@ -14,7 +14,7 @@ LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/udpecho.git
|
||||
PKG_SOURCE_VERSION:=c0991eeeaa210ae2910f970e8b23d34139ad6044
|
||||
PKG_SOURCE_VERSION:=abffd08f3c2d333137ce6757619e08f986d89906
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -70,7 +70,7 @@ define Package/$(PKG_NAME)-server/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/udpechoserverd $(1)/usr/sbin/
|
||||
$(INSTALL_DATA) ./files/etc/config/udpechoserver $(1)/etc/config/udpechoserver
|
||||
$(INSTALL_BIN) ./files/etc/init.d/udpechoserverd $(1)/etc/init.d/udpechoserverd
|
||||
$(BBFDM_INSTALL_CORE_PLUGIN) $(PKG_BUILD_DIR)/src/libudpechoserver.so $(1)
|
||||
$(BBFDM_INSTALL_MS_DM) -u UDPEchoConfig $(PKG_BUILD_DIR)/src/libudpechoserver.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)-client/install
|
||||
|
||||
@@ -6,13 +6,13 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=urlfilter
|
||||
PKG_VERSION:=1.1.13
|
||||
PKG_VERSION:=1.1.14
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/urlfilter.git
|
||||
PKG_SOURCE_VERSION:=75077256211644443ca30cc994ef16b013c4131c
|
||||
PKG_SOURCE_VERSION:=ebf8afb44ff808d3b99c45a7c636fb12a774f357
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=usbmngr
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_VERSION:=1.0.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/system/usbmngr.git
|
||||
PKG_SOURCE_VERSION:=edd4dc2d59c4f1ef56a4d3bd39f664178673128e
|
||||
PKG_SOURCE_VERSION:=bace625f9bba99c2093982878dfe08cab2b920d4
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -17,7 +17,7 @@ endchoice
|
||||
config USERINTERFACE_HTTPACCESS_MIGRATE_NGINX_CONFIG
|
||||
bool "migrate nginx config"
|
||||
depends on USERINTERFACE_HTTPACCESS_BACKEND_NGINX
|
||||
default y
|
||||
default n
|
||||
help
|
||||
Migrate nginx to userinterface on firmware upgrade
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=userinterface
|
||||
PKG_VERSION:=1.1.0
|
||||
PKG_VERSION:=1.1.3
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/userinterface.git
|
||||
PKG_SOURCE_VERSION:=8fd2afed32dea24ac5e0ce31f17b645ba852493f
|
||||
PKG_SOURCE_VERSION:=07dd97620309df416ff449c64fdd73dc4c5950c1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -41,6 +41,7 @@ _set_server_params() {
|
||||
config_get allow_host "${1}" allow_host
|
||||
config_get protocol "${1}" protocol
|
||||
config_get activationdate "${1}" activationdate
|
||||
config_get redirect "${1}" redirect
|
||||
|
||||
if [ "$enable" -eq "0" ]; then
|
||||
uci -q delete nginx."${1}"
|
||||
@@ -108,6 +109,18 @@ _set_server_params() {
|
||||
uci_set nginx "${1}" "${opt//_nginx_}" "${val}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${redirect}" ]; then
|
||||
config_get port "${redirect}" port
|
||||
config_get protocol "${redirect}" protocol
|
||||
|
||||
if [ -n "${port}" ] && [ -n "${protocol}" ]; then
|
||||
proto="$(echo ${protocol} | awk '{print tolower ($0)}')"
|
||||
uci -q set nginx."${1}".return="302 ${proto}://\$host:${port}\$request_uri"
|
||||
else
|
||||
uci -q set nginx."${1}".return=""
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Public APIs
|
||||
|
||||
@@ -71,19 +71,12 @@ configure_ui_firewall_rule() {
|
||||
local enabled access interface
|
||||
local port=""
|
||||
|
||||
config_get_bool enabled "${sec}" uci_enable '1'
|
||||
config_get access "${sec}" uci_access ""
|
||||
config_get interface "${sec}" uci_interface ""
|
||||
config_get_bool enabled "${sec}" enable '1'
|
||||
config_get access "${sec}" access ""
|
||||
config_get interface "${sec}" interface ""
|
||||
config_get port "${sec}" port ""
|
||||
|
||||
if [ "${enabled}" -eq "1" ] && [ "${access}" == "remote" ] && [ -n "${interface}" ]; then
|
||||
port_list=$(uci -q show nginx."${1}".listen|cut -d'=' -f 2|sed "s/'/ /g"|sed "s/\[\:\:\]\://g")
|
||||
for item in ${port_list}; do
|
||||
if [ -z "${item##[0-9]*}" ]; then
|
||||
port="${item}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
return 0
|
||||
fi
|
||||
@@ -119,7 +112,6 @@ config_load userinterface
|
||||
config_get_bool serv_enable global enable 1
|
||||
|
||||
if [ "${serv_enable}" -eq "1" ]; then
|
||||
config_load nginx
|
||||
# Configure the User Interface rule
|
||||
config_foreach configure_ui_firewall_rule server
|
||||
config_foreach configure_ui_firewall_rule http_access
|
||||
fi
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=usermngr
|
||||
PKG_VERSION:=1.2.14
|
||||
PKG_VERSION:=1.2.16
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/usermngr.git
|
||||
PKG_SOURCE_VERSION:=497148226e0ada16656a6971c5e66a023c740e87
|
||||
PKG_SOURCE_VERSION:=8eeff3205a0e2705a9cede28ed215af64aa97e26
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -46,9 +46,10 @@ define Package/usermngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/init.d/users $(1)/etc/init.d/users
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/uci-defaults/90-indicate-bootstrap $(1)/etc/uci-defaults/90-indicate-bootstrap
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/uci-defaults/91-sync-shells $(1)/etc/uci-defaults/91-sync-shells
|
||||
$(INSTALL_DIR) $(1)/etc/users/roles
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/90-indicate-bootstrap $(1)/etc/uci-defaults/90-indicate-bootstrap
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/91-sync-shells $(1)/etc/uci-defaults/91-sync-shells
|
||||
$(INSTALL_BIN) ./files/etc/init.d/users $(1)/etc/init.d/users
|
||||
$(INSTALL_BIN) ./files/etc/config/users $(1)/etc/config/users
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libusermngr.so $(1) $(PKG_NAME)
|
||||
endef
|
||||
|
||||
148
usermngr/files/etc/init.d/users
Executable file
148
usermngr/files/etc/init.d/users
Executable file
@@ -0,0 +1,148 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=11
|
||||
STOP=90
|
||||
USE_PROCD=1
|
||||
|
||||
create_group() {
|
||||
local group="$1"
|
||||
local enabled deleted old_name
|
||||
config_get enabled "$group" enabled ""
|
||||
config_get deleted "$group" deleted ""
|
||||
config_get old_name "$group" old_name ""
|
||||
|
||||
groupname=${group#*_}
|
||||
|
||||
if [ "$deleted" = "1" ]; then
|
||||
groupdel -f "$groupname"
|
||||
uci -q delete users."$group"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -n "$old_name" ]; then
|
||||
del_group=${old_name#*_}
|
||||
grep -rq "^$del_group:" /etc/group
|
||||
if [ "$?" = "0" ]; then
|
||||
groupdel -f "$del_group"
|
||||
fi
|
||||
uci -q delete users."$group".old_name
|
||||
fi
|
||||
|
||||
if [ "$enabled" = "1" ]; then
|
||||
grep -rq "^$groupname:" /etc/group
|
||||
if [ "$?" = "1" ]; then
|
||||
groupadd -f "$groupname"
|
||||
fi
|
||||
else
|
||||
grep -rq "^$groupname:" /etc/group
|
||||
if [ "$?" = "0" ]; then
|
||||
groupdel -f "$groupname"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
create_user() {
|
||||
local user="$1"
|
||||
local enabled password member_groups shell old_name deleted encrypted_password
|
||||
config_get password "$user" password ""
|
||||
config_get enabled "$user" enabled ""
|
||||
config_get old_name "$user" old_name ""
|
||||
config_get member_groups "$user" member_groups ""
|
||||
config_get shell "$user" shell ""
|
||||
config_get deleted "$user" deleted ""
|
||||
config_get encrypted_password "$user" encrypted_password ""
|
||||
|
||||
if [ "$deleted" = "1" ]; then
|
||||
userdel -f "$user"
|
||||
uci -q delete users."$user"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -n "$old_name" ]; then
|
||||
cat /etc/passwd | cut -d: -f1 | grep -qE "^$old_name$"
|
||||
if [ "$?" = "0" ]; then
|
||||
usermod -b -l "$user" "$old_name"
|
||||
fi
|
||||
uci -q delete users."$user".old_name
|
||||
fi
|
||||
|
||||
grep -rq "^$user:" /etc/passwd
|
||||
if [ "$?" = "1" ]; then
|
||||
adduser -D -H -s /bin/false "$user"
|
||||
fi
|
||||
|
||||
# set password
|
||||
if [ -n "$password" ]; then
|
||||
echo "$user:$password" | chpasswd
|
||||
uci -q delete users."$user".password
|
||||
fi
|
||||
|
||||
# set encrypted_password
|
||||
if [ -n "$encrypted_password" ]; then
|
||||
str=$(ubus call bbf.secure decode "{'data':'$encrypted_password'}" |jsonfilter -e @.value)
|
||||
if [ -n "$str" ]; then
|
||||
echo "$user:$str" | chpasswd
|
||||
fi
|
||||
fi
|
||||
|
||||
# set shell
|
||||
usermod -s /bin/false "$user"
|
||||
if [ -n "$shell" ] && [ "$shell" != "false" ]; then
|
||||
shellname=$(cat /etc/shells | grep -r "/$shell$")
|
||||
if [ -n "$shellname" ]; then
|
||||
shell_sec=""
|
||||
shell_en=""
|
||||
uci_param=$(uci -q show users | grep -E "^users\.@shell\[[0-9]+\]\.name=\'$shell\'$")
|
||||
if [ -n "$uci_param" ]; then
|
||||
shell_sec=$(echo "$uci_param" | cut -d= -f1 | cut -d. -f2)
|
||||
fi
|
||||
|
||||
if [ -n "$shell_sec" ]; then
|
||||
shell_en=$(uci -q get users."$shell_sec".enabled)
|
||||
fi
|
||||
|
||||
if [ "$shell_en" = "1" ]; then
|
||||
usermod -s "$shellname" "$user"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# add groups
|
||||
usermod -G "" "$user"
|
||||
if [ -n "$member_groups" ]; then
|
||||
for i in ${member_groups//,/ }
|
||||
do
|
||||
group=${i#*_}
|
||||
grep -rq "^$group:" /etc/group
|
||||
if [ "$?" = "0" ]; then
|
||||
usermod -aG "$group" "$user"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$enabled" = "1" ]; then
|
||||
usermod -U "$user"
|
||||
else
|
||||
usermod -L "$user"
|
||||
fi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load users
|
||||
|
||||
# creation of non-static groups and users
|
||||
config_foreach create_group group
|
||||
config_foreach create_user user
|
||||
uci commit users
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "users"
|
||||
}
|
||||
|
||||
5
usermngr/files/etc/uci-defaults/90-indicate-bootstrap
Normal file
5
usermngr/files/etc/uci-defaults/90-indicate-bootstrap
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
touch /var/run/user_bootstrap
|
||||
touch /var/run/group_bootstrap
|
||||
touch /var/run/role_bootstrap
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user