Compare commits

..

1 Commits

Author SHA1 Message Date
Vivek Kumar Dutta
eafe5587fc bbfdm: Added SelfTestDiagnostics() 2023-10-31 14:08:49 +05:30
159 changed files with 2617 additions and 4738 deletions

View File

@@ -1,3 +1,7 @@
config BBF_VENDOR_EXTENSION
bool "Enable Vendor Extension"
default y
config BBF_VENDOR_LIST config BBF_VENDOR_LIST
string "Vendor List" string "Vendor List"
default "iopsys" default "iopsys"

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm PKG_NAME:=bbfdm
PKG_VERSION:=1.7.4 PKG_VERSION:=1.4.4
USE_LOCAL:=0 USE_LOCAL:=0
ifneq ($(USE_LOCAL),1) ifneq ($(USE_LOCAL),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
PKG_SOURCE_VERSION:=57a3aedb8f6dea2a951d3edf1da0c868e252b27c PKG_SOURCE_VERSION:=3c0f416653781f04e2b73e7da6ccaddf6ab691de
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif endif
@@ -21,24 +21,55 @@ PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk include $(INCLUDE_DIR)/cmake.mk
include bbfdm.mk
define Package/libbbfdm-api define Package/libbbfdm-api
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
SUBMENU:=TRx69 SUBMENU:=TRx69
TITLE:=BBF datamodel library, provides API to extend datamodel using DotSO plugins TITLE:=BBF datamodel library, provides API to extend datamodel using DotSO plugins
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
ABI_VERSION:=1.0 ABI_VERSION:=1.0
endef endef
define Package/libbbfdm define Package/libbbfdm/default
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
SUBMENU:=TRx69 SUBMENU:=TRx69
TITLE:=Library for broadband forum data model support TITLE:=Library for broadband forum data model support
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api \ DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl +libbbfdm-api \
+BBF_TR471:obudpst +libopenssl +BBF_TR471:obudpst
endef
define Package/libbbfdm
$(Package/libbbfdm/default)
TITLE += (default)
VARIANT:=default
DEPENDS += +PACKAGE_libbbfdm-openssl:libopenssl
DEFAULT_VARIANT:=1
endef
define Package/libbbfdm-mbedtls
$(Package/libbbfdm/default)
TITLE += (mbedtls)
DEPENDS += +PACKAGE_libbbfdm-mbedtls:libmbedtls
VARIANT:=mbedtls
CONFLICTS := libbbfdm libbbfdm-openssl libbbfdm-wolfssl
endef
define Package/libbbfdm-openssl
$(Package/libbbfdm/default)
TITLE += (openssl)
DEPENDS += +PACKAGE_libbbfdm-openssl:libopenssl
VARIANT:=openssl
CONFLICTS := libbbfdm libbbfdm-mbedtls libbbfdm-wolfssl
endef
define Package/libbbfdm-wolfssl
$(Package/libbbfdm/default)
TITLE += (wolfssl)
DEPENDS += +PACKAGE_libbbfdm-wolfssl:libwolfssl
VARIANT:=wolfssl
CONFLICTS := libbbfdm libbbfdm-mbedtls libbbfdm-openssl
endef endef
define Package/bbfdmd define Package/bbfdmd
@@ -46,7 +77,20 @@ define Package/bbfdmd
CATEGORY:=Utilities CATEGORY:=Utilities
SUBMENU:=TRx69 SUBMENU:=TRx69
TITLE:=Datamodel ubus backend TITLE:=Datamodel ubus backend
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libbbfdm-api +libbbfdm DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libbbfdm-api +PACKAGE_libbbfdm-mbedtls:libbbfdm-mbedtls \
+PACKAGE_libbbfdm-openssl:libbbfdm-openssl +PACKAGE_libbbfdm-wolfssl:libbbfdm-wolfssl \
+PACKAGE_libbbfdm:libbbfdm
endef
define Package/userinterface
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Package to add Device.UserInterface. datamodel support
endef
define Package/userinterface/description
Package to add Device.UserInterface. datamodel support
endef endef
define Package/libbbfdm/config define Package/libbbfdm/config
@@ -81,11 +125,34 @@ CMAKE_OPTIONS += \
-DBBF_TR471=ON -DBBF_TR471=ON
endif endif
ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
CMAKE_OPTIONS += \
-DBBF_VENDOR_EXTENSION=ON
CMAKE_OPTIONS += \ CMAKE_OPTIONS += \
-DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \ -DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \ -DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
-DDAEMON_JSON_INPUT:String="/etc/bbfdm/input.json" \
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES) -DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES)
endif ##CONFIG_BBF_VENDOR_EXTENSION
ifeq ($(BUILD_VARIANT),default)
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
endif
ifeq ($(BUILD_VARIANT),openssl)
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
endif
ifeq ($(BUILD_VARIANT),wolfssl)
CMAKE_OPTIONS += -DWITH_WOLFSSL=ON
endif
ifeq ($(BUILD_VARIANT),mbedtls)
CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
endif
ifeq ($(CONFIG_PACKAGE_bbfdmd),y) ifeq ($(CONFIG_PACKAGE_bbfdmd),y)
CMAKE_OPTIONS += \ CMAKE_OPTIONS += \
-DBBFDMD_MAX_MSG_LEN:Integer=10485760 -DBBFDMD_MAX_MSG_LEN:Integer=10485760
@@ -96,7 +163,7 @@ define Package/libbbfdm-api/install
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/libbbfdm-api.so $(1)/lib/ $(CP) $(PKG_BUILD_DIR)/libbbfdm-api/libbbfdm-api.so $(1)/lib/
endef endef
define Package/libbbfdm/install define Package/libbbfdm/default/install
$(INSTALL_DIR) $(1)/lib $(INSTALL_DIR) $(1)/lib
$(INSTALL_DIR) $(1)/etc/bbfdm $(INSTALL_DIR) $(1)/etc/bbfdm
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap $(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
@@ -109,18 +176,15 @@ define Package/libbbfdm/install
$(INSTALL_BIN) ./files/etc/uci-defaults/99-link-core-plugins $(1)/etc/uci-defaults/99-link-core-plugins $(INSTALL_BIN) ./files/etc/uci-defaults/99-link-core-plugins $(1)/etc/uci-defaults/99-link-core-plugins
$(INSTALL_BIN) ./files/etc/firewall.portmap $(1)/etc/firewall.portmap $(INSTALL_BIN) ./files/etc/firewall.portmap $(1)/etc/firewall.portmap
$(INSTALL_BIN) ./files/etc/firewall.service $(1)/etc/firewall.service $(INSTALL_BIN) ./files/etc/firewall.service $(1)/etc/firewall.service
ifeq ($(findstring iopsys,$(CONFIG_BBF_VENDOR_LIST)),iopsys)
$(call BbfdmInstallPlugin,$(1),$(PKG_BUILD_DIR)/libbbfdm/dmtree/vendor/iopsys/libbbfdm_iopsys_ext.so)
endif
ifeq ($(CONFIG_BBF_TR143),y) ifeq ($(CONFIG_BBF_TR143),y)
$(INSTALL_DIR) $(1)/usr/share/bbfdm $(INSTALL_DIR) $(1)/usr/share/bbfdm
$(INSTALL_DIR) $(1)/usr/libexec/rpcd $(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(CP) $(PKG_BUILD_DIR)/libbbfdm/scripts/* $(1)/usr/share/bbfdm $(INSTALL_BIN) $(PKG_BUILD_DIR)/libbbfdm/scripts/* $(1)/usr/share/bbfdm
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag $(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
endif endif
endef endef
define Package/libbbfdm/prerm define Package/libbbfdm/default/prerm
#!/bin/sh #!/bin/sh
rm -rf /etc/bbfdm/dmmap/* rm -rf /etc/bbfdm/dmmap/*
exit 0 exit 0
@@ -133,21 +197,56 @@ define Package/bbfdmd/install
$(INSTALL_DIR) $(1)/etc/bbfdm $(INSTALL_DIR) $(1)/etc/bbfdm
$(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
$(INSTALL_DATA) ./files/etc/bbfdm/input.json $(1)/etc/bbfdm/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/json/input.json $(1)/etc/bbfdm/
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd $(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm $(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
$(INSTALL_BIN) ./files/etc/bbfdm/bbfdm_services.sh $(1)/etc/bbfdm/ $(INSTALL_BIN) ./files/etc/bbfdm/bbfdm_services.sh $(1)/etc/bbfdm/
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl $(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
endef endef
define Package/userinterface/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_DATA) ./files/etc/config/userinterface $(1)/etc/config/userinterface
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/userinterface $(1)/lib/upgrade/keep.d/userinterface
$(INSTALL_BIN) ./files/etc/init.d/userinterface $(1)/etc/init.d/userinterface
$(INSTALL_BIN) ./files/etc/uci-defaults/93-userinterface-firewall $(1)/etc/uci-defaults/93-userinterface-firewall
$(INSTALL_BIN) ./files/etc/uci-defaults/94-userinterface-json $(1)/etc/uci-defaults/94-userinterface-json
$(INSTALL_BIN) ./files/etc/firewall.userinterface $(1)/etc/firewall.userinterface
endef
Package/libbbfdm/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-openssl/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-wolfssl/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-mbedtls/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm/install = $(Package/libbbfdm/default/install)
Package/libbbfdm-openssl/install = $(Package/libbbfdm/default/install)
Package/libbbfdm-wolfssl/install = $(Package/libbbfdm/default/install)
Package/libbbfdm-mbedtls/install = $(Package/libbbfdm/default/install)
define Build/InstallDev define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include $(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/include/libbbfdm
$(INSTALL_DIR) $(1)/usr/include/libbbfdm-api $(INSTALL_DIR) $(1)/usr/include/libbbfdm-api
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/*.h $(1)/usr/include/libbbfdm-api/ $(INSTALL_DIR) $(1)/usr/include/libbbf_api
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/include/*.h $(1)/usr/include/ $(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/include/*.h $(1)/usr/include/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm/dmtree/tr181/device.h $(1)/usr/include/libbbfdm/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm/dmtree/vendor/vendor.h $(1)/usr/include/libbbfdm/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/*.h $(1)/usr/include/libbbfdm-api/
# Work around for backward compatibility
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/*.h $(1)/usr/include/libbbf_api/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/include/libbbfdm_api.h $(1)/usr/include/libbbf_api.h
endef endef
$(eval $(call BuildPackage,libbbfdm-api)) $(eval $(call BuildPackage,libbbfdm-api))
$(eval $(call BuildPackage,libbbfdm)) $(eval $(call BuildPackage,libbbfdm))
$(eval $(call BuildPackage,libbbfdm-openssl))
$(eval $(call BuildPackage,libbbfdm-wolfssl))
$(eval $(call BuildPackage,libbbfdm-mbedtls))
$(eval $(call BuildPackage,bbfdmd)) $(eval $(call BuildPackage,bbfdmd))
$(eval $(call BuildPackage,userinterface))

View File

@@ -15,33 +15,3 @@ bbfdm_add_service()
ubus call service add "{'name':'bbfdm.services','instances':{'$name':{'command':['$BBFDMD','-m','$path']}}}" ubus call service add "{'name':'bbfdm.services','instances':{'$name':{'command':['$BBFDMD','-m','$path']}}}"
} }
bbfdm_stop_service()
{
local name
name="${1}"
if [ -z "${name}" ]; then
return 0;
fi
if ubus call service list '{"name":"bbfdm.services"}' |grep -q "bbfdm.$name"; then
ubus call service delete "{'name':'bbfdm.services','instance':'bbfdm.$name'}"
fi
}
usages()
{
echo "Usages $0: <OPTIONS>..."
echo
echo " -h show help"
echo " -k micro-service name to stop"
echo
}
while getopts "s:k:h" opts; do
case "$opts" in
h) usages; exit 0;;
k) bbfdm_stop_service "${OPTARG}";;
esac
done

View File

@@ -1,28 +0,0 @@
{
"daemon": {
"config": {
},
"input": {
"type": "DotSo",
"name": "/lib/libbbfdm.so",
"plugin_dir": "/etc/bbfdm/plugins"
},
"output": {
"type": "UBUS",
"name": "bbfdm"
}
},
"cli": {
"config": {
"proto": "both",
"instance_mode": 0
},
"input": {
"type": "UBUS",
"name": "bbfdm"
},
"output": {
"type": "CLI"
}
}
}

View File

@@ -4,5 +4,4 @@ config bbfdmd 'bbfdmd'
option loglevel '1' option loglevel '1'
option refresh_time '10' option refresh_time '10'
option transaction_timeout '30' option transaction_timeout '30'
option subprocess_level '2'

View File

@@ -7,7 +7,7 @@ USE_PROCD=1
PROG=/usr/sbin/bbfdmd PROG=/usr/sbin/bbfdmd
BBFDM_JSON_INPUT="/etc/bbfdm/input.json" BBFDM_JSON_INPUT="/etc/bbfdm/input.json"
BBFDM_TEMP_JSON="/tmp/bbfdm/input.json" BBFDM_TEMP_JSON="/tmp/bbfdm.json"
log() { log() {
echo "${@}"|logger -t bbfdmd.init -p info echo "${@}"|logger -t bbfdmd.init -p info
@@ -28,7 +28,7 @@ validate_bbfdm_bbfdmd_section()
configure_bbfdmd() configure_bbfdmd()
{ {
local enabled debug sock update local enabled debug sock update
local jlog jrefresh jtimeout jlevel local jlog jrefresh jtimeout
update=0 update=0
config_load bbfdm config_load bbfdm
@@ -38,9 +38,26 @@ configure_bbfdmd()
} }
[ "${enabled}" -eq 0 ] && return 0 [ "${enabled}" -eq 0 ] && return 0
[ ! -f "${BBFDM_JSON_INPUT}" ] && return 0
if [ -f "${BBFDM_JSON_INPUT}" ]; then jlog="$(jq '.daemon.config.loglevel' ${BBFDM_JSON_INPUT})"
echo "$(jq --arg log ${loglevel} --arg tran ${transaction_timeout} --arg refresh ${refresh_time} --arg level ${subprocess_level} '.daemon.config += {"loglevel": $log, "refresh_time": $refresh, "transaction_timeout": $tran, "subprocess_level": $level}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON} if [ "\"${loglevel}\"" != "${jlog}" ]; then
update=1
fi
jrefresh="$(jq '.daemon.config.refresh_time' ${BBFDM_JSON_INPUT})"
if [ "\"${refresh_time}\"" != "${jrefresh}" ]; then
update=1
fi
jtimeout="$(jq '.daemon.config.transaction_timeout' ${BBFDM_JSON_INPUT})"
if [ "\"${transaction_timeout}\"" != "${jtimeout}" ]; then
update=1
fi
if [ "${update}" -eq "1" ]; then
echo "$(jq --arg log ${loglevel} --arg tran ${transaction_timeout} --arg refresh ${refresh_time} '.daemon.config += {"loglevel": $log, "refresh_time": $refresh, "transaction_timeout": $tran}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON}
mv ${BBFDM_TEMP_JSON} ${BBFDM_JSON_INPUT}
fi fi
procd_set_param command ${PROG} procd_set_param command ${PROG}
@@ -56,7 +73,6 @@ configure_bbfdmd()
start_service() start_service()
{ {
mkdir -p /tmp/bbfdm
procd_open_instance "bbfdm" procd_open_instance "bbfdm"
configure_bbfdmd configure_bbfdmd
procd_set_param respawn procd_set_param respawn

View File

@@ -7,13 +7,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=bulkdata PKG_NAME:=bulkdata
PKG_VERSION:=2.1.5 PKG_VERSION:=2.1.2
LOCAL_DEV:=0 LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bulkdata.git PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bulkdata.git
PKG_SOURCE_VERSION:=f03fb8682aa7efe760294e54c422f2eab856e08c PKG_SOURCE_VERSION:=d83c42070e7f10178dc1c2d0ce078e3d6d42d889
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif endif

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=capiagent PKG_NAME:=capiagent
PKG_VERSION:=2.1.1 PKG_VERSION:=2.1.0
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=136cab3a9f1eec0132db9fa3f7bb1c8748ce1449 PKG_SOURCE_VERSION:=3e671db8f567b19c109fc13b25bc571c4c73a962
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/capiagent.git PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/capiagent.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
@@ -31,7 +31,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/capiagent define Package/capiagent
TITLE+= capiagent (daemon implementing Wi-Fi Alliance's CAPI commands) TITLE+= capiagent (daemon implementing Wi-Fi Alliance's CAPI commands)
DEPENDS= +libubox +libuci +libubus +libnl-genl +libeasy +libwifi \ DEPENDS= +libubox +libuci +libubus +libnl-genl +libeasy +libwifi \
+libjson-c +libblobmsg-json +ubus +libieee1905 +libwifiutils +libjson-c +libblobmsg-json +ubus +libieee1905
endef endef
define Package/capiagent/description define Package/capiagent/description

View File

@@ -1,64 +0,0 @@
#
# Copyright (C) 2020-2024 IOPSYS Software Solutions AB
#
include $(TOPDIR)/rules.mk
PKG_NAME:=csmngr
PKG_VERSION:=0.0.5
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=dcdaba75b85bf8758c34d3ae4a1be0ba09359331
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/csmngr.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_CONFIG_DEPENDS := \
CONFIG_PACKAGE_libwifiutils \
CONFIG_PACKAGE_libwifi
PKG_BUILD_DEPENDS := libwifi
include $(INCLUDE_DIR)/package.mk
MAKE_PATH:=src
define Package/csmngr
SECTION:=utils
CATEGORY:=Utilities
TITLE:=WiFi channel selection manager
DEPENDS:=+libwifiutils +libwifi +libuci +libubox +ubus +libnl-genl
endef
define Package/csmngr/description
WiFi Auto Channel Selection manager.
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \
-D_GNU_SOURCE
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -r --exclude=.* ~/git/csmngr/ $(PKG_BUILD_DIR)/
endef
endif
define Package/csmngr/install
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/csmngr $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,csmngr))

View File

@@ -1,21 +0,0 @@
#!/bin/sh /etc/rc.common
START=95
STOP=10
USE_PROCD=1
PROG=/usr/sbin/csmngr
start_service() {
procd_open_instance
procd_set_param command ${PROG}
# procd_set_param stderr 1 #for debugging only
# procd_set_param respawn
procd_close_instance
}
reload_service() {
stop
start
}

View File

@@ -1,16 +0,0 @@
if PACKAGE_ddnsmngr
choice
prompt "Select backend for dynamic DNS management"
default DDNSMNGR_BACKEND_DDNSSCRIPT
depends on PACKAGE_ddnsmngr
help
Select which package to use for dynamic DNS support
config DDNSMNGR_BACKEND_DDNSSCRIPT
bool "Use ddns_script"
config DDNSMNGR_BACKEND_INADYN
bool "Use inadyn"
endchoice
endif

View File

@@ -1,79 +0,0 @@
#
# Copyright (C) 2024 IOPSYS
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ddnsmngr
PKG_VERSION:=1.0.0
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/ddnsmngr.git
PKG_SOURCE_VERSION:=d0d37df44644ef2c1a0b11d3a4f92dc694ae1010
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_CONFIG_DEPENDS:=CONFIG_DDNSMNGR_BACKEND_DDNSSCRIPT CONFIG_DDNSMNGR_BACKEND_INADYN
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Dynamic DNS manager
DEPENDS:=+libbbfdm-api +DDNSMNGR_BACKEND_DDNSSCRIPT:ddns-scripts +DDNSMNGR_BACKEND_INADYN:inadyn
MENU:=1
endef
define Package/$(PKG_NAME)/config
source "$(SOURCE)/Config.in"
endef
MAKE_PATH:=src
define Package/$(PKG_NAME)/description
Manage dynamic DNS updation and provides Device.DynamicDNS. datamodel object based on TR181-2.16
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ~/git/ddnsmngr/* $(PKG_BUILD_DIR)/
endef
endif
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc/ddnsmngr
$(INSTALL_DIR) $(1)/etc/ddnsmngr/ddns
$(INSTALL_DIR) $(1)/etc/ddnsmngr/servers
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/ddnsmngr
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/libddnsmngr.so $(1)/etc/ddnsmngr/
$(INSTALL_DATA) ./files/etc/ddnsmngr/input.json $(1)/etc/ddnsmngr/
$(INSTALL_DATA) ./files/etc/config/ddnsmngr $(1)/etc/config/ddnsmngr
$(INSTALL_BIN) ./files/etc/uci-defaults/01-ddns-config-migrate $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/init.d/ddnsmngr $(1)/etc/init.d/ddnsmngr
ifeq ($(CONFIG_DDNSMNGR_BACKEND_DDNSSCRIPT),y)
$(INSTALL_BIN) ./files/usr/lib/ddns_script/ddnsmngr_service.sh $(1)/usr/lib/ddnsmngr/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns-script/usr/lib/ddnsmngr/ddnsmngr_updater.sh $(1)/usr/lib/ddnsmngr/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/ddns-script/server/* $(1)/etc/ddnsmngr/servers
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns-script/usr/libexec/rpcd/ddnsmngr $(1)/usr/libexec/rpcd/ddnsmngr
endif
ifeq ($(CONFIG_DDNSMNGR_BACKEND_INADYN),y)
$(INSTALL_BIN) ./files/usr/lib/inadyn/ddnsmngr_service.sh $(1)/usr/lib/ddnsmngr/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/inadyn/server/* $(1)/etc/ddnsmngr/servers
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/inadyn/usr/libexec/rpcd/ddnsmngr $(1)/usr/libexec/rpcd/ddnsmngr
endif
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@@ -1,23 +0,0 @@
config ddnsmngr 'global'
option configfile '/var/run/ddnsmngr/ddnsmngr.json'
option ddns_dateformat '%F %R'
option ddns_rundir '/var/run/ddnsmngr'
option ddns_logdir '/var/log/ddnsmngr'
option ddns_loglines '250'
option upd_privateip '0'
option use_curl '1'
config server 'ddns_server_1'
option enabled '1'
option service 'dynu.com'
option name 'dynu.com'
config server 'ddns_server_2'
option enabled '1'
option service 'dyndns.org'
option name 'dyndns.org'
config server 'ddns_server_3'
option enabled '1'
option service 'zoneedit.com'
option name 'zoneedit.com'

View File

@@ -1,15 +0,0 @@
{
"daemon": {
"input": {
"type": "DotSo",
"name": "/etc/ddnsmngr/libddnsmngr.so"
},
"output": {
"type": "UBUS",
"name": "bbfdm.ddnsmngr",
"parent_dm": "Device.",
"object": "DynamicDNS",
"root_obj": "bbfdm"
}
}
}

View File

@@ -1,29 +0,0 @@
#!/bin/sh /etc/rc.common
START=80
STOP=10
USE_PROCD=1
DM_INPUT="/etc/ddnsmngr/input.json"
. /etc/bbfdm/bbfdm_services.sh
. /usr/lib/ddnsmngr/ddnsmngr_service.sh
start_service() {
start_ddnsmngr_service
bbfdm_add_service "bbfdm.ddnsmngr" "${DM_INPUT}"
}
stop_service() {
stop_ddnsmngr_service
}
reload_service() {
stop
sleep 1
start
}
service_triggers() {
procd_add_reload_trigger ddnsmngr
add_ddnsmngr_triggers
}

View File

@@ -1,170 +0,0 @@
#!/bin/sh
. /lib/functions.sh
cl_id=1
srv_id=1
function get_ddns_config_option() {
local val
val="$(uci -q get ddns.${1}.${2})"
if [ -z "${val}" ] && [ -n "${3}" ]; then
val="${3}"
fi
echo "${val}"
}
function config_supported_service() {
if ! uci -q get ddnsmngr.global >/dev/null 2>&1; then
uci -q set ddnsmngr.global="ddnsmngr"
fi
servers=""
for i in $(find /etc/ddnsmngr/servers/ -name '*.json' | cut -d'/' -f 5 | sed "s/.json//")
do
if [ -z "${servers}" ]; then
servers="${i}"
else
servers="${servers},${i}"
fi
done
uci -q set ddnsmngr.global.supported_services="${servers}"
}
function migrate_service_section() {
client_sec=""
enabled="$(get_ddns_config_option ${1} enabled "0")"
service_name="$(get_ddns_config_option ${1} service_name)"
interface="$(get_ddns_config_option ${1} interface)"
ip_network="$(get_ddns_config_option ${1} ip_network)"
username="$(get_ddns_config_option ${1} username)"
password="$(get_ddns_config_option ${1} password)"
lookup_host="$(get_ddns_config_option ${1} lookup_host)"
use_ipv6="$(get_ddns_config_option ${1} use_ipv6 "0")"
force_ipversion="$(get_ddns_config_option ${1} force_ipversion "0")"
use_https="$(get_ddns_config_option ${1} use_https "0")"
force_dnstcp="$(get_ddns_config_option ${1} force_dnstcp "0")"
if [ -z "${service_name}" ]; then
uci -q delete ddns."${1}"
return 0
fi
# check server file is present in device
if [ ! -f "/etc/ddnsmngr/servers/${service_name}.json" ]; then
uci -q delete ddns."${1}"
return 0
fi
# Check if client section is already added for this service
clients=$(uci -q show ddnsmngr | grep "=client")
client_count=$(echo "${clients}" | wc -l)
tmp=0
while [ $tmp -lt $client_count ]
do
mngr_serv="$(uci -q get ddnsmngr.@client[$tmp].service_name)"
mngr_intf="$(uci -q get ddnsmngr.@client[$tmp].interface)"
mngr_netw="$(uci -q get ddnsmngr.@client[$tmp].ip_network)"
mngr_user="$(uci -q get ddnsmngr.@client[$tmp].username)"
mngr_ipv6="$(uci -q get ddnsmngr.@client[$tmp].use_ipv6)"
mngr_forceip="$(uci -q get ddnsmngr.@client[$tmp].force_ipversion)"
mngr_https="$(uci -q get ddnsmngr.@client[$tmp].use_https)"
mngr_dnstcp="$(uci -q get ddnsmngr.@client[$tmp].force_dnstcp)"
[ -z "${mngr_ipv6}" ] && mngr_ipv6="0"
[ -z "${mngr_forceip}" ] && mngr_forceip="0"
[ -z "${mngr_https}" ] && mngr_https="0"
[ -z "${mngr_dnstcp}" ] && mngr_dnstcp="0"
if [ "${mngr_serv}" == "${service_name}" ] && [ "${mngr_intf}" == "${interface}" ] && \
[ "${mngr_netw}" == "${ip_network}" ] && [ "${mngr_user}" == "${username}" ] && \
[ "${mngr_ipv6}" == "${use_ipv6}" ] && [ "${mngr_forceip}" == "${force_ipversion}" ] && \
[ "${mngr_https}" == "${use_https}" ] && [ "${mngr_dnstcp}" == "${force_dnstcp}" ]; then
break
fi
tmp=$(( tmp + 1 ))
done
if [ $tmp -ne $client_count ]; then
i=0
for client in $clients; do
if [ $i -eq $tmp ]; then
client_sec="$(echo $client | cut -d'=' -f 1 | cut -d'.' -f 2)"
break
fi
i=$(( i + 1 ))
done
if [ $enabled -eq 1 ]; then
uci -q set ddnsmngr."${client_sec}".enabled="1"
fi
else
client_sec=ddns_mig_client_"${cl_id}"
uci -q set ddnsmngr."${client_sec}"="client"
uci -q set ddnsmngr."${client_sec}".enabled="${enabled}"
uci -q set ddnsmngr."${client_sec}".service_name="${service_name}"
uci -q set ddnsmngr."${client_sec}".interface="${interface}"
uci -q set ddnsmngr."${client_sec}".ip_network="${ip_network}"
uci -q set ddnsmngr."${client_sec}".username="${username}"
uci -q set ddnsmngr."${client_sec}".password="${password}"
uci -q set ddnsmngr."${client_sec}".use_ipv6="${use_ipv6}"
uci -q set ddnsmngr."${client_sec}".force_ipversion="${force_ipversion}"
uci -q set ddnsmngr."${client_sec}".use_https="${use_https}"
uci -q set ddnsmngr."${client_sec}".force_dnstcp="${force_dnstcp}"
cl_id=$(( cl_id + 1 ))
# add server section if not added
servers=$(uci -q show ddnsmngr | grep "service=\'${service_name}\'")
if [ -z "${servers}" ]; then
server_sec=ddns_mig_server_"${srv_id}"
uci -q set ddnsmngr."${server_sec}"="server"
uci -q set ddnsmngr."${server_sec}".enabled="1"
uci -q set ddnsmngr."${server_sec}".service="${service_name}"
uci -q set ddnsmngr."${server_sec}".name="${service_name}"
srv_id=$(( srv_id + 1 ))
fi
fi
# if lookup_host is set then add host section
if [ -n "${lookup_host}" ] && [ -n "${client_sec}" ]; then
# check number of hosts present for this client
host_count=$(uci -q show ddnsmngr | grep "dm_parent=\'${client_sec}\'" | wc -l)
host_ix=$(( host_count + 1 ))
host_sec="${client_sec}"_host_"${host_ix}"
uci -q set ddnsmngr."${host_sec}"="host"
uci -q set ddnsmngr."${host_sec}".enabled="${enabled}"
uci -q set ddnsmngr."${host_sec}".lookup_host="${lookup_host}"
uci -q set ddnsmngr."${host_sec}".dm_parent="${client_sec}"
fi
uci -q delete ddns."${1}"
}
function migrate_ddns_config() {
if [ ! -f "/etc/config/ddnsmngr" ]; then
# Create ddnsmngr config file
touch /etc/config/ddnsmngr
fi
config_supported_service
config_load ddns
config_foreach migrate_service_section service
uci -q commit ddns
uci -q commit ddnsmngr
}
migrate_ddns_config

View File

@@ -1,169 +0,0 @@
#! /bin/sh
RUNDIR="/var/run/ddnsmngr"
LOGDIR="/var/log/ddnsmngr"
PROG="/usr/lib/ddnsmngr/ddnsmngr_updater.sh"
CONFIGFILE="/var/run/ddnsmngr/ddnsmngr.json"
CLIENT_INTFS=""
. /usr/share/libubox/jshn.sh
log() {
echo "$*"|logger -t ddnsmngr.init -p debug
}
validate_host_section() {
uci_validate_section ddnsmngr host "${1}" \
'enabled:bool:0' \
'lookup_host:string' \
'dm_parent:string'
}
validate_client_section() {
uci_validate_section ddnsmngr client "${1}" \
'enabled:bool:0' \
'service_name:string' \
'interface:string' \
'ip_network:string' \
'username:string' \
'password:string' \
'use_https:bool:0' \
'force_dnstcp:bool:0' \
'use_ipv6:bool:0' \
'force_ipversion:bool:0'
}
add_object() {
local enabled lookup_host dm_parent use_ipv6 force_ipversion proc_info_file
local service_name interface ip_network username password use_https force_dnstcp
validate_host_section "${1}" || {
log "Validation of host section failed"
return 0
}
if [ "${enabled}" -ne 1 ] || [ -z "${dm_parent}" ]; then
return 0
fi
validate_client_section "${dm_parent}" || {
log "Validation of client section failed"
return 0
}
if [ "${enabled}" -ne 1 ]; then
return 0
fi
service_name=$(uci -q get ddnsmngr.${dm_parent}.service_name)
if [ -z "${service_name}" ]; then
return 0
fi
service_section=$(uci -q show ddnsmngr | grep "service=\'${service_name}\'" | cut -d'.' -f 2 | head -1)
if [ -z "${service_section}" ]; then
return 0
fi
service_enabled=$(uci -q get ddnsmngr.${service_section}.enabled)
if [ "${service_enabled}" -ne 1 ]; then
return 0
fi
json_add_object
json_add_string "interface" "${interface}"
json_add_string "service_name" "${service_name}"
json_add_string "username" "${username}"
json_add_string "password" "${password}"
json_add_string "lookup_host" "${lookup_host}"
json_add_string "ip_network" "${ip_network}"
json_add_string "proc_info_file" "${1}"
json_add_string "use_ipv6" "${use_ipv6}"
json_add_string "force_ipversion" "${force_ipversion}"
json_add_string "use_https" "${use_https}"
json_add_string "force_dnstcp" "${force_dnstcp}"
json_close_object
if [ -z "${interface}" ]; then
if [ "${use_ipv6}" -eq 0 ]; then
interface="wan"
else
interface="wan6"
fi
fi
for intf in $CLIENT_INTFS; do
if [ "${intf}" == "${interface}" ]; then
return 0
fi
done
CLIENT_INTFS="${CLIENT_INTFS} ${interface}"
}
start_ddnsmngr_service() {
run_dir=$(uci -q get ddnsmngr.global.ddns_rundir)
log_dir=$(uci -q get ddnsmngr.global.ddns_logdir)
if [ -n "${run_dir}" ]; then
RUNDIR="${run_dir}"
fi
if [ -n "${log_dir}" ]; then
LOGDIR="${log_dir}"
fi
mkdir -p "${RUNDIR}"
mkdir -p "${LOGDIR}"
conf_file=$(uci -q get ddnsmngr.global.configfile)
if [ -n "${conf_file}" ]; then
CONFIGFILE="${conf_file}"
fi
touch "${CONFIGFILE}"
if [ ! -f "${CONFIGFILE}" ]; then
log "Can not create ${CONFIGFILE}, exit"
exit 0
fi
json_init
json_add_array "services"
config_load ddnsmngr
config_foreach add_object host
json_close_array
json_dump > "${CONFIGFILE}"
procd_open_instance ddnsmngr
procd_set_param command "$PROG"
procd_append_param command -c "${CONFIGFILE}"
procd_append_param command -- start
procd_close_instance
}
stop_ddnsmngr_service() {
conf_file=$(uci -q get ddnsmngr.global.configfile)
if [ -n "${conf_file}" ]; then
CONFIGFILE="${conf_file}"
fi
if [ ! -f "${CONFIGFILE}" ]; then
log "${CONFIGFILE} not found, can't stop services if running any"
fi
"$PROG" -c "${CONFIGFILE}" -- stop
return 0
}
add_ddnsmngr_triggers() {
procd_open_trigger
for intf in $CLIENT_INTFS; do
# No need to handle other ifevents like ifupdate etc
procd_add_interface_trigger "interface.*.up" $intf /etc/init.d/ddnsmngr restart
procd_add_interface_trigger "interface.*.down" $intf /etc/init.d/ddnsmngr restart
done
procd_close_trigger
}

View File

@@ -1,311 +0,0 @@
#!/bin/sh
PROG="/usr/sbin/inadyn"
CONFIGPATH="/tmp/inadyn_config"
PIDPATH="/etc/inadyn_pid"
CLIENT_INTFS=""
CONFIG_FILES=""
SERVER_PATH="/etc/ddnsmngr/servers"
FORMAT="custom [SECTION] {\n\tusername\t= [USER]\n\tpassword\t= [PWD]\n\tddns-server\t= [SERV]\n\tddns-path\t= [URI]\n\tssl\t\t= [SSL]\n\thostname\t= [NAME]\n\tcheckip-command\t= [CMD]\n\tddns-response\t= [RESPONSES]\n}"
. /usr/share/libubox/jshn.sh
log() {
echo "$*"|logger -t ddnsmngr.init -p debug
}
get_service_data() {
local provider="$1"
shift
local dir="$1"
shift
local ipv6="$1"
shift
local name data url answer script
[ $# -ne 2 ] && {
return 1
}
[ -f "${dir}/${provider}.json" ] || {
eval "$1=\"\""
eval "$2=\"\""
return 1
}
json_load_file "${dir}/${provider}.json"
json_get_var name "name"
if [ "$ipv6" -eq "1" ]; then
json_select "ipv6"
else
json_select "ipv4"
fi
json_get_var data "url"
json_get_var answer "answer"
json_select ".."
json_cleanup
response=""
if [ -n "${answer}" ]; then
answer=$(echo "${answer}" | sed 's/|/ /g')
for ans in $answer; do
if [ -z "${response}" ]; then
response="${ans}"
else
response="${response}, ${ans}"
fi
done
response="{ ${response} }"
fi
eval "$1=\"$data\""
eval "$2=\"$response\""
return 0
}
generate_inadyn_config() {
json_load "${1}"
json_get_var service_name service_name
json_get_var use_ipv6 use_ipv6
json_get_var interface interface
json_get_var username username
json_get_var password password
json_get_var host lookup_host
json_get_var conf_file config_file
json_get_var conf_dir config_dir
json_get_var server_address server_address
json_cleanup
if [ -z "${service_name}" ] || [ -z "${host}" ]; then
return 1
fi
if [ -z "${conf_file}" ]; then
return 1
fi
if [ -z "${conf_dir}" ]; then
return 1
fi
# First look into custom path to load the url otherwise default path
get_service_data "${service_name}" "${SERVER_PATH}" "${use_ipv6}" server_url server_answer
if [ -z "${server_url}" ]; then
return 1
fi
# Need to pick proto, server address and request uri separately from the url
# format http://[server_address]/[update_Request_uri]
proto=$(echo $server_url | cut -d':' -f 1)
serv=$(echo $server_url | cut -d'/' -f 3 | cut -d'@' -f 2)
uri=${server_url#*$serv}
if [ -z $proto ] || [ -z $serv ] || [ -z $uri ]; then
return 1
fi
path=$(echo "$uri" | sed 's/&/\\&/g')
update_uri=$(echo $path | sed -e "s#\[DOMAIN\]#%h#g" -e "s#\[PASSWORD\]#%p#g" \
-e "s#\[USERNAME\]#%u#g" -e "s#\[IP\]#%i#g")
if [ -z "${interface}" ]; then
if [ "${use_ipv6}" -eq 0 ]; then
interface="wan"
else
interface="wan6"
fi
fi
# now get the physical interface name
intf=$(ifstatus "${interface}" | jsonfilter -e '@.device')
if [ -z "${intf}" ]; then
return 1
fi
# command to get ip of the interface
if [ "${use_ipv6}" -eq 0 ]; then
get_ip="\"ifstatus ${interface} | jsonfilter -e '@[\\\\\"ipv4-address\\\\\"][0].address'\""
else
get_ip="\"ifstatus ${interface} | jsonfilter -e '@[\\\\\"ipv6-address\\\\\"][0].address'\""
fi
if [ "${proto}" = "http" ]; then
ssl="false"
else
ssl="true"
fi
inadyn_ver=$(inadyn -v)
user_agent="inadyn/${inadyn_ver}"
config_file="${conf_dir}/${conf_file}"
touch "${config_file}"
echo "iface = ${intf}" > "${config_file}"
echo "period = 600" >> "${config_file}"
echo "user-agent = ${user_agent}" >> "${config_file}"
if [ "${use_ipv6}" -eq 1 ]; then
echo "allow-ipv6 = true" >> "${config_file}"
fi
if [ -z "${password}" ]; then
FORMAT=$(echo "${FORMAT}" | sed 's/\\tpassword\\t= \[PWD\]\\n//g')
fi
if [ -z "${server_answer}" ]; then
FORMAT=$(echo "${FORMAT}" | sed 's/\\tddns-response\\t= \[RESPONSES\]\\n//g')
fi
config=$(echo $FORMAT | sed -e "s#\[SECTION\]#$conf_file#g" -e "s#\[PWD\]#$password#g" \
-e "s#\[USER\]#$username#g" -e "s#\[SERV\]#$serv#g" \
-e "s#\[URI\]#\"$update_uri\"#g" -e "s#\[SSL\]#$ssl#g" \
-e "s#\[NAME\]#$host#g" -e "s#\[CMD\]#$get_ip#g" \
-e "s#\[RESPONSES\]#$server_answer#g")
echo -e "\n\n${config}" >> "${config_file}"
return 0
}
validate_host_section() {
uci_validate_section ddnsmngr host "${1}" \
'enabled:bool:0' \
'lookup_host:string' \
'dm_parent:string'
}
validate_client_section() {
uci_validate_section ddnsmngr client "${1}" \
'enabled:bool:0' \
'service_name:string' \
'interface:string' \
'ip_network:string' \
'username:string' \
'password:string' \
'use_https:bool:0' \
'force_dnstcp:bool:0' \
'use_ipv6:bool:0' \
'force_ipversion:bool:0'
}
add_object() {
local enabled lookup_host dm_parent use_ipv6 force_ipversion
local service_name interface ip_network username password use_https force_dnstcp
validate_host_section "${1}" || {
log "Validation of host section failed"
return
}
if [ "${enabled}" -ne 1 ] || [ -z "${dm_parent}" ]; then
return
fi
validate_client_section "${dm_parent}" || {
log "Validation of client section failed"
return
}
if [ "${enabled}" -ne 1 ]; then
return
fi
service_name=$(uci -q get ddnsmngr.${dm_parent}.service_name)
if [ -z "${service_name}" ]; then
return
fi
service_section=$(uci show ddnsmngr | grep "service=\'${service_name}\'" | cut -d'.' -f 2 | head -1)
if [ -z "${service_section}" ]; then
return
fi
service_enabled=$(uci -q get ddnsmngr.${service_section}.enabled)
if [ "${service_enabled}" -ne 1 ]; then
return
fi
json_init
json_add_string "interface" "${interface}"
json_add_string "service_name" "${service_name}"
json_add_string "username" "${username}"
json_add_string "password" "${password}"
json_add_string "lookup_host" "${lookup_host}"
json_add_string "ip_network" "${ip_network}"
json_add_string "use_ipv6" "${use_ipv6}"
json_add_string "force_ipversion" "${force_ipversion}"
json_add_string "use_https" "${use_https}"
json_add_string "force_dnstcp" "${force_dnstcp}"
json_add_string "config_file" "${1}"
json_add_string "config_dir" "${CONFIGPATH}"
json_str=$(json_dump)
json_cleanup
generate_inadyn_config "${json_str}"
if [ "$?" -ne 0 ]; then
return
fi
CONFIG_FILES="${CONFIG_FILES} ${1}"
if [ -z "${interface}" ]; then
if [ "${use_ipv6}" -eq 0 ]; then
interface="wan"
else
interface="wan6"
fi
fi
for intf in $CLIENT_INTFS; do
if [ "${intf}" == "${interface}" ]; then
return
fi
done
CLIENT_INTFS="${CLIENT_INTFS} ${interface}"
}
start_ddnsmngr_service() {
rm -rf $CONFIGPATH
mkdir $CONFIGPATH
mkdir -p $PIDPATH
config_load ddnsmngr
config_foreach add_object host
i=1
for conf in $CONFIG_FILES; do
instance="ddnsmngr_${i}"
i=$(( i + 1 ))
procd_open_instance $instance
procd_set_param command "$PROG"
procd_append_param command -f "${CONFIGPATH}/${conf}"
procd_append_param command -l debug
procd_append_param command -P "${PIDPATH}/${conf}"
procd_append_param command -n -C
procd_close_instance
done
}
stop_ddnsmngr_service() {
rm -rf $CONFIGPATH
return 0
}
add_ddnsmngr_triggers() {
procd_open_trigger
for intf in $CLIENT_INTFS; do
# No need to handle other ifevents like ifupdate etc
procd_add_interface_trigger "interface.*.up" $intf /etc/init.d/ddnsmngr restart
done
procd_close_trigger
}

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=decollector PKG_NAME:=decollector
PKG_VERSION:=4.2.1.3 PKG_VERSION:=4.2.0.1
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=0fe317cbe2b2e37c25a6d6d4e6f5c1d6964f9e50 PKG_SOURCE_VERSION:=3e54fa519defa462d08d4107c115905abb929c1a
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
@@ -29,7 +29,7 @@ define Package/decollector
CATEGORY:=Utilities CATEGORY:=Utilities
TITLE:=WiFi DataElements Collector Proxy TITLE:=WiFi DataElements Collector Proxy
DEPENDS:=+libuci +libubox +ubus +libpthread +libnl-genl \ DEPENDS:=+libuci +libubox +ubus +libpthread +libnl-genl \
+libeasy +libwifiutils +libieee1905 +ieee1905-map-plugin +libeasy +libwifiutils +libieee1905 +map-plugin
endef endef
define Package/decollector/description define Package/decollector/description

View File

@@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dectmngr PKG_NAME:=dectmngr
PKG_RELEASE:=3 PKG_RELEASE:=3
PKG_VERSION:=3.6.5 PKG_VERSION:=3.5.19
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=192e74db2082e3f89f6defe9d752d752b0b09079 PKG_SOURCE_VERSION:=1fd0b11ad34f8f59b40c3a12e0cc07aa212eb87b
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif endif

View File

@@ -1,5 +1,5 @@
# #
# Copyright (C) 2018-2024 iopsys Software Solutions AB # Copyright (C) 2018 iopsys Software Solutions AB
# #
# This is free software, licensed under the GNU General Public License v2. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@@ -8,15 +8,14 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=dslmngr PKG_NAME:=dslmngr
PKG_VERSION:=1.2.1 PKG_VERSION:=1.2.0
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=cb8b8fd2549751bcd38808391b76a1a9a908c4de PKG_SOURCE_VERSION:=43dec92b1c86be7859521da337e7bd1168848b26
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/dslmngr.git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dslmngr.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif endif
@@ -60,7 +59,7 @@ MAKE_FLAGS += \
ifeq ($(LOCAL_DEV),1) ifeq ($(LOCAL_DEV),1)
define Build/Prepare define Build/Prepare
rsync -r --exclude=.* ./dslmngr/ $(PKG_BUILD_DIR)/ rsync -r --exclude=.* ~/git/dslmngr/ $(PKG_BUILD_DIR)/
endef endef
endif endif

View File

@@ -1,21 +1,18 @@
# #
# Copyright (C) 2020-2024 Iopsys # Copyright (C) 2020 Iopsys
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ethmngr PKG_NAME:=ethmngr
PKG_VERSION:=2.1.2 PKG_VERSION:=2.1.0
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=e5cccdd45a93d969d51c4085cb52b543df544811 PKG_SOURCE_VERSION:=5a0ff3bc7c49dcb05129f423ef8e0c4929f6aa03
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/ethmngr.git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ethmngr.git
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0-only PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE
@@ -26,7 +23,7 @@ define Package/ethmngr
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
TITLE:=Ethernet status and configration utility TITLE:=Ethernet status and configration utility
DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx||TARGET_ipq53xx||TARGET_mediatek):libethernet +libuci +libubox +ubus +libpthread +libnl-genl +libeasy DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx||TARGET_ipq53xx||TARGET_mediatek):libethernet +libuci +libubox +ubus +libpthread +libnl-genl
endef endef
define Package/ethmngr/description define Package/ethmngr/description
@@ -35,12 +32,6 @@ define Package/ethmngr/description
It uses APIs from the libethernet.so library. It uses APIs from the libethernet.so library.
endef endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ./ethmngr/* $(PKG_BUILD_DIR)/
endef
endif
TARGET_CFLAGS += \ TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \ -I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \ -I$(STAGING_DIR)/usr/include/libnl3 \

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=hostmngr PKG_NAME:=hostmngr
PKG_VERSION:=1.2.2 PKG_VERSION:=1.0.7
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=b4990b384461f2d1ff75a122a7fa5d9276f211bb PKG_SOURCE_VERSION:=975549e01df338a90e1d1a356d22a2c7f5bf2387
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/hostmngr.git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/hostmngr.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
@@ -31,8 +31,7 @@ define Package/hostmngr
DEPENDS= +libubox +libuci +libubus +ubus +libeasy +libnl-genl \ DEPENDS= +libubox +libuci +libubus +ubus +libeasy +libnl-genl \
+libjson-c +libblobmsg-json +libnfnetlink +libmnl \ +libjson-c +libblobmsg-json +libnfnetlink +libmnl \
+libnetfilter-conntrack \ +libnetfilter-conntrack \
+HOSTMNGR_PLATFORM_HAS_WIFI:libwifi +libbbfdm-api \ +HOSTMNGR_PLATFORM_HAS_WIFI:libwifi +libbbfdm-api
+libwifiutils
endef endef
@@ -64,8 +63,7 @@ define Package/hostmngr/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/hostmngr $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/hostmngr $(1)/usr/sbin/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/bbf_plugin/libhostmngr.so $(1)/etc/hostmngr/ $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/bbf_plugin/libhostmngr.so $(1)/etc/hostmngr/
$(INSTALL_DATA) ./files/etc/hostmngr/input.json $(1)/etc/hostmngr/ $(INSTALL_DATA) ./files/etc/hostmngr/input.json $(1)/etc/hostmngr/
$(INSTALL_DIR) $(1)/usr/share/hostmngr $(INSTALL_DATA) ./files/lib/hosts/hosts_acl.sh $(1)/lib/hosts/
$(INSTALL_DATA) ./files/scripts/hosts_acl.sh $(1)/usr/share/hostmngr/
endef endef
ifeq ($(LOCAL_DEV),1) ifeq ($(LOCAL_DEV),1)

View File

@@ -1,3 +1,19 @@
#!/bin/sh #!/bin/sh
sh /usr/share/hostmngr/hosts_acl.sh . /lib/functions.sh
. /lib/hosts/hosts_acl.sh
iptables -w -F hosts_forward
ip6tables -w -F hosts_forward
iptables -w -t filter -N hosts_forward
ret=$?
[ $ret -eq 0 ] && iptables -w -t filter -I FORWARD -j hosts_forward
ip6tables -w -t filter -N hosts_forward
ret=$?
[ $ret -eq 0 ] && ip6tables -w -t filter -I FORWARD -j hosts_forward
# Load /etc/config/hosts UCI file
config_load hosts
config_foreach process_ac_schedule ac_schedule

View File

@@ -1,9 +1,10 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
START=65 START=97
STOP=20 STOP=20
. /etc/bbfdm/bbfdm_services.sh . /etc/bbfdm/bbfdm_services.sh
. /lib/hosts/hosts_acl.sh
USE_PROCD=1 USE_PROCD=1
@@ -19,7 +20,7 @@ start_service() {
procd_close_instance procd_close_instance
bbfdm_add_service "bbfdm.hosts" "${HOSTS_JSON_INPUT}" bbfdm_add_service "bbfdm.hosts" "${HOSTS_JSON_INPUT}"
sh /usr/share/hostmngr/hosts_acl.sh hosts_acl
} }
service_triggers() service_triggers()

View File

@@ -0,0 +1,230 @@
#!/bin/sh
. /lib/functions.sh
day=""
next_days=""
prev_days=""
IP_RULE=""
IP_RULE1=""
get_next_day() {
local weekday="$1"
case "$weekday" in
"Mon"|"Monday") echo "Tuesday"
;;
"Tue"|"Tuesday") echo "Wednesday"
;;
"Wed"|"Wednesday") echo "Thursday"
;;
"Thu"|"Thursday") echo "Friday"
;;
"Fri"|"Friday") echo "Saturday"
;;
"Sat"|"Saturday") echo "Sunday"
;;
"Sun"|"Sunday") echo "Monday"
;;
esac
}
get_previous_day() {
local weekday="$1"
case "$weekday" in
"Mon"|"Monday") echo "Sunday"
;;
"Tue"|"Tuesday") echo "Monday"
;;
"Wed"|"Wednesday") echo "Tuesday"
;;
"Thu"|"Thursday") echo "Wednesday"
;;
"Fri"|"Friday") echo "Thursday"
;;
"Sat"|"Saturday") echo "Friday"
;;
"Sun"|"Sunday") echo "Saturday"
;;
esac
}
ip_rule_west_zone() {
local utc_start_t_h="$1"
local utc_stop_t_h="$2"
local local_start_t_h="$3"
local local_stop_t_h="$4"
local utc_start_time="$5"
local utc_stop_time="$6"
if [ "$utc_start_t_h" -lt "$local_start_t_h" ]; then
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop $utc_stop_time"
if [ -n "$next_days" ]; then
IP_RULE="$IP_RULE --weekdays $next_days"
fi
else
if [ "$utc_stop_t_h" -lt "$local_stop_t_h" ]; then
IP_RULE1="$IP_RULE"
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop 23:59"
IP_RULE1="$IP_RULE1 -m time --timestart 00:00 --timestop $utc_stop_time"
if [ -n "$next_days" ]; then
IP_RULE1="$IP_RULE1 --weekdays $next_days"
fi
else
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop $utc_stop_time"
fi
if [ -n "$day" ]; then
IP_RULE="$IP_RULE --weekdays $day"
fi
fi
}
ip_rule_east_zone() {
local utc_start_t_h="$1"
local utc_stop_t_h="$2"
local local_start_t_h="$3"
local local_stop_t_h="$4"
local utc_start_time="$5"
local utc_stop_time="$6"
if [ "$utc_start_t_h" -lt "$local_start_t_h" ]; then
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop $utc_stop_time"
if [ -n "$day" ]; then
IP_RULE="$IP_RULE --weekdays $day"
fi
else
if [ "$utc_stop_t_h" -lt "$local_stop_t_h" ]; then
IP_RULE1="$IP_RULE"
IP_RULE="$IP_RULE -m time --timestart 00:00 --timestop $utc_stop_time"
IP_RULE1="$IP_RULE1 -m time --timestart $utc_start_time --timestop 23:59"
if [ -n "$prev_days" ]; then
IP_RULE1="$IP_RULE1 --weekdays $prev_days"
fi
else
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop $utc_stop_time"
fi
if [ -n "$day" ]; then
IP_RULE="$IP_RULE --weekdays $day"
fi
fi
}
process_ac_schedule() {
local acs_id="$1"
local is_enabled
local access_control
local start_time=""
local mac=""
handle_day_list() {
local value=$1
val=$(echo $value | cut -c 1-3)
next_day_val=$(get_next_day $val)
prev_day_val=$(get_previous_day $val)
if [ -z $day ]; then
day="$val"
next_days="$next_day_val"
prev_days="$prev_day_val"
else
day="$day,$val"
next_days="$next_days,$next_day_val"
prev_days="$prev_days,$prev_day_val"
fi
}
config_list_foreach "$acs_id" "day" handle_day_list
config_get is_enabled "$acs_id" "enable" 1
config_get access_control "$acs_id" "dm_parent"
if [ "$is_enabled" == "0" ] || [ -z "$access_control" ]; then
return
fi
IP_RULE=""
IP_RULE1=""
mac=$(uci -q get hosts.$access_control.macaddr)
access_policy=$(uci -q get hosts.$access_control.access_policy)
config_get start_time "$acs_id" "start_time"
config_get duration "$acs_id" "duration"
if [ -z "$mac" ] && [ -z "$start_time" ] && [ -z "$duration" ] && [ -z "$day" ] && [ -z "$access_policy" ]; then
return
fi
if [ -n "$mac" ]; then
IP_RULE="$IP_RULE -m mac --mac-source $mac"
fi
zone=$(date +%z | cut -c 1)
local_start_time=$start_time
if [ -n "$duration" ]; then
hh=$(echo $local_start_time | awk -F: '{ print $1 }')
mm=$(echo $local_start_time | awk -F: '{ print $2 }')
hh_s=`expr $hh \* 3600`
mm_s=`expr $mm \* 60`
ss=$(( hh_s + mm_s ))
local_start_hh=$hh
stop_ss=$(( ss + duration ))
hh=$(( stop_ss / 3600 ))
rem_ss=$(( stop_ss % 3600 ))
mm=$(( rem_ss / 60 ))
ss=$(( rem_ss % 60 ))
local_stop_time="$hh:$mm:$ss"
local_stop_hh=$hh
fi
utc_start_time=$(date -u -d @$(date "+%s" -d "$local_start_time") +%H:%M)
utc_stop_time=$(date -u -d @$(date "+%s" -d "$local_stop_time") +%H:%M)
utc_start_hh=$(echo $utc_start_time | awk -F: '{ print $1 }')
utc_stop_hh=$(echo $utc_stop_time | awk -F: '{ print $1 }')
if [ "$zone" == "-" ]; then
ip_rule_west_zone $utc_start_hh $utc_stop_hh $local_start_hh $local_stop_hh $utc_start_time $utc_stop_time
else
ip_rule_east_zone $utc_start_hh $utc_stop_hh $local_start_hh $local_stop_hh $utc_start_time $utc_stop_time
fi
if [ "$access_policy" == "Deny" ]; then
IP_RULE="$IP_RULE -j DROP"
if [ -n "$IP_RULE1" ]; then
IP_RULE1="$IP_RULE1 -j DROP"
fi
else
IP_RULE="$IP_RULE -j ACCEPT"
if [ -n "$IP_RULE1" ]; then
IP_RULE1="$IP_RULE1 -j ACCEPT"
fi
fi
iptables -w -A hosts_forward ${IP_RULE}
ip6tables -w -A hosts_forward ${IP_RULE}
if [ -n "$IP_RULE1" ]; then
iptables -w -A hosts_forward ${IP_RULE1}
ip6tables -w -A hosts_forward ${IP_RULE1}
fi
day=""
next_days=""
prev_days=""
}
hosts_acl() {
iptables -w -F hosts_forward
ip6tables -w -F hosts_forward
hosts_forward=$(iptables -t filter --list | grep hosts_forward)
if [ -z "$hosts_forward" ]; then
iptables -w -t filter -N hosts_forward
ret=$?
[ $ret -eq 0 ] && iptables -w -t filter -I FORWARD -j hosts_forward
ip6tables -w -t filter -N hosts_forward
ret=$?
[ $ret -eq 0 ] && ip6tables -w -t filter -I FORWARD -j hosts_forward
fi
# Load /etc/config/hosts UCI file
config_load hosts
config_foreach process_ac_schedule ac_schedule
}

View File

@@ -1,295 +0,0 @@
#!/bin/sh
. /lib/functions.sh
day=""
next_days=""
prev_days=""
schedule_added=""
ACCESS_RULE=""
IP_RULE=""
IP_RULE1=""
get_next_day() {
local weekday="$1"
case "$weekday" in
"Mon"|"Monday") echo "Tuesday"
;;
"Tue"|"Tuesday") echo "Wednesday"
;;
"Wed"|"Wednesday") echo "Thursday"
;;
"Thu"|"Thursday") echo "Friday"
;;
"Fri"|"Friday") echo "Saturday"
;;
"Sat"|"Saturday") echo "Sunday"
;;
"Sun"|"Sunday") echo "Monday"
;;
esac
}
get_previous_day() {
local weekday="$1"
case "$weekday" in
"Mon"|"Monday") echo "Sunday"
;;
"Tue"|"Tuesday") echo "Monday"
;;
"Wed"|"Wednesday") echo "Tuesday"
;;
"Thu"|"Thursday") echo "Wednesday"
;;
"Fri"|"Friday") echo "Thursday"
;;
"Sat"|"Saturday") echo "Friday"
;;
"Sun"|"Sunday") echo "Saturday"
;;
esac
}
ip_rule_west_zone() {
local utc_start_t_h="$1"
local utc_stop_t_h="$2"
local local_start_t_h="$3"
local local_stop_t_h="$4"
local utc_start_time="$5"
local utc_stop_time="$6"
if [ "$utc_start_t_h" -lt "$local_start_t_h" ]; then
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop $utc_stop_time"
if [ -n "$next_days" ]; then
IP_RULE="$IP_RULE --weekdays $next_days"
fi
else
if [ "$utc_stop_t_h" -lt "$local_stop_t_h" ]; then
IP_RULE1="$IP_RULE"
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop 23:59"
IP_RULE1="$IP_RULE1 -m time --timestart 00:00 --timestop $utc_stop_time"
if [ -n "$next_days" ]; then
IP_RULE1="$IP_RULE1 --weekdays $next_days"
fi
else
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop $utc_stop_time"
fi
if [ -n "$day" ]; then
IP_RULE="$IP_RULE --weekdays $day"
fi
fi
}
ip_rule_east_zone() {
local utc_start_t_h="$1"
local utc_stop_t_h="$2"
local local_start_t_h="$3"
local local_stop_t_h="$4"
local utc_start_time="$5"
local utc_stop_time="$6"
if [ "$utc_start_t_h" -lt "$local_start_t_h" ]; then
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop $utc_stop_time"
if [ -n "$day" ]; then
IP_RULE="$IP_RULE --weekdays $day"
fi
else
if [ "$utc_stop_t_h" -lt "$local_stop_t_h" ]; then
IP_RULE1="$IP_RULE"
IP_RULE="$IP_RULE -m time --timestart 00:00 --timestop $utc_stop_time"
IP_RULE1="$IP_RULE1 -m time --timestart $utc_start_time --timestop 23:59"
if [ -n "$prev_days" ]; then
IP_RULE1="$IP_RULE1 --weekdays $prev_days"
fi
else
IP_RULE="$IP_RULE -m time --timestart $utc_start_time --timestop $utc_stop_time"
fi
if [ -n "$day" ]; then
IP_RULE="$IP_RULE --weekdays $day"
fi
fi
}
add_access_rule() {
local rule="$1"
echo "iptables -w -A hosts_forward ${rule}" >> $ACL_FILE
echo "ip6tables -w -A hosts_forward ${rule}" >> $ACL_FILE
}
handle_day_list() {
local value=$1
val=$(echo $value | cut -c 1-3)
next_day_val=$(get_next_day $val)
prev_day_val=$(get_previous_day $val)
if [ -z $day ]; then
day="$val"
next_days="$next_day_val"
prev_days="$prev_day_val"
else
day="$day,$val"
next_days="$next_days,$next_day_val"
prev_days="$prev_days,$prev_day_val"
fi
}
handle_schedule() {
local schd_section="$1"
local ac_section="$2"
local acs_id
local start_time
local duration
IP_RULE="$ACCESS_RULE"
IP_RULE1=""
day=""
next_days=""
prev_days=""
config_get acs_id "$schd_section" "dm_parent"
if [ "$acs_id" != "$ac_section" ]; then
return # schedule not for this access control section
fi
local is_enabled
config_get is_enabled "$schd_section" "enable" 0
if [ "$is_enabled" == "0" ]; then
return
fi
local all_days="Monday Tuesday Wednesday Thursday Friday Saturday Sunday"
local day_config
config_get day_config "$schd_section" "day" "$all_days"
IFS=" "
for d in $day_config; do
handle_day_list $d
done
config_get start_time "$schd_section" "start_time" "00:00"
config_get duration "$schd_section" "duration"
zone=$(date +%z | cut -c 1)
local_start_time=$start_time
hh=$(echo $local_start_time | awk -F: '{ print $1 }')
mm=$(echo $local_start_time | awk -F: '{ print $2 }')
hh_s=`expr $hh \* 3600`
mm_s=`expr $mm \* 60`
ss=$(( hh_s + mm_s ))
local_start_hh=$hh
if [ -n "$duration" ]; then
stop_ss=$(( ss + duration ))
hh=$(( stop_ss / 3600 ))
rem_ss=$(( stop_ss % 3600 ))
mm=$(( rem_ss / 60 ))
ss=$(( rem_ss % 60 ))
local_stop_time="$hh:$mm:$ss"
local_stop_hh=$hh
else
# if duartion is not specified, then apply rule to end of the day
local_stop_time="23:59:59"
local_stop_hh="23"
fi
utc_start_time=$(date -u -d @$(date "+%s" -d "$local_start_time") +%H:%M)
utc_stop_time=$(date -u -d @$(date "+%s" -d "$local_stop_time") +%H:%M)
utc_start_hh=$(echo $utc_start_time | awk -F: '{ print $1 }')
utc_stop_hh=$(echo $utc_stop_time | awk -F: '{ print $1 }')
if [ "$zone" == "-" ]; then
ip_rule_west_zone $utc_start_hh $utc_stop_hh $local_start_hh $local_stop_hh $utc_start_time $utc_stop_time
else
ip_rule_east_zone $utc_start_hh $utc_stop_hh $local_start_hh $local_stop_hh $utc_start_time $utc_stop_time
fi
IP_RULE="$IP_RULE -j ACCEPT"
if [ -n "$IP_RULE1" ]; then
IP_RULE1="$IP_RULE1 -j ACCEPT"
fi
add_access_rule "$IP_RULE"
if [ -n "$IP_RULE1" ]; then
add_access_rule "$IP_RULE1"
fi
# for access rules to be effective for a schedule, need to add DROP rule
# to block the access outside the defined schedule
if [ "$schedule_added" == "0" ]; then
schedule_added="1"
fi
}
handle_access_control() {
local ac_section="$1"
local is_enabled
# default value of Hosts.AccessControl.{i}.Enable is false,
# so, if not defined in uci as 1, assume 0
config_get is_enabled "$ac_section" "enable" 0
if [ "$is_enabled" == "0" ]; then
return
fi
local mac_addr
config_get mac_addr "$ac_section" "macaddr"
if [ -z "$mac_addr" ]; then
return
else
ACCESS_RULE="-m mac --mac-source $mac_addr"
fi
local access_policy
config_get access_policy "$ac_section" "access_policy"
if [ -z "$access_policy" ]; then
return # since system default is allow so no need to do anything
fi
# As per Data Model, if access policy is deny, then schedule is to be ignored
# and no access is to be provided for the device
if [ "$access_policy" == "Deny" ]; then
ACCESS_RULE="$ACCESS_RULE -j DROP"
add_access_rule "$ACCESS_RULE"
return # no need to parse schedule
fi
schedule_added="0"
# check if schedule is defined for this access_control instance
# and if yes, create rule accordingly
config_foreach handle_schedule ac_schedule "$ac_section"
# for access rule to work, need to have default drop rule as last rule
if [ "$schedule_added" == "1" ]; then
IP_RULE="$ACCESS_RULE -j DROP"
add_access_rule "$IP_RULE"
fi
}
ACL_FILE="/tmp/hosts_access_control/access_control.rules"
rm -f $ACL_FILE
mkdir -p /tmp/hosts_access_control/
touch $ACL_FILE
echo "iptables -w -F hosts_forward" >> $ACL_FILE
echo "ip6tables -w -F hosts_forward" >> $ACL_FILE
hosts_forward=$(iptables -t filter --list | grep hosts_forward)
if [ -z "$hosts_forward" ]; then
echo "iptables -w -t filter -N hosts_forward" >> $ACL_FILE
ret=$?
[ $ret -eq 0 ] && echo "iptables -w -t filter -I FORWARD -j hosts_forward" >> $ACL_FILE
echo "ip6tables -w -t filter -N hosts_forward" >> $ACL_FILE
ret=$?
[ $ret -eq 0 ] && echo "ip6tables -w -t filter -I FORWARD -j hosts_forward" >> $ACL_FILE
fi
# Load /etc/config/hosts UCI file
config_load hosts
config_foreach handle_access_control access_control
# apply the rules
sh $ACL_FILE

View File

@@ -8,16 +8,15 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp PKG_NAME:=icwmp
PKG_VERSION:=9.6.8 PKG_VERSION:=9.5.13
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
PKG_SOURCE_VERSION:=7ff419cefc314156a0ac518972096ef0dfb87162 PKG_SOURCE_VERSION:=ade480d2b090e3fba952605596c9e9276e4cbd02
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_LICENSE:=BSD-3-Clause PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE
@@ -26,21 +25,69 @@ include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk include $(INCLUDE_DIR)/cmake.mk
include ../bbfdm/bbfdm.mk include ../bbfdm/bbfdm.mk
define Package/icwmp define Package/icwmp/default
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
SUBMENU:=TRx69 SUBMENU:=TRx69
TITLE:=TR069 CWMP client TITLE:=TR069 CWMP client
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml +libuuid +libbbfdm-api +libopenssl DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml +libuuid +libbbfdm-api
endef endef
ifeq ($(LOCAL_DEV),1) define Package/icwmp
$(Package/icwmp/default)
VARIANT:=default
DEFAULT_VARIANT:=1
DEPENDS += +PACKAGE_icwmp-openssl:libopenssl
endef
define Package/icwmp-openssl
$(Package/icwmp/default)
TITLE += (openssl)
VARIANT:=openssl
DEPENDS += +PACKAGE_icwmp-openssl:libopenssl
CONFLICTS := icwmp icwmp-mbedtls icwmp-wolfssl
endef
define Package/icwmp-wolfssl
$(Package/icwmp/default)
TITLE += (wolfssl)
VARIANT:=wolfssl
DEPENDS += +PACKAGE_icwmp-wolfssl:libwolfssl
CONFLICTS := icwmp icwmp-mbedtls icwmp-openssl
endef
define Package/icwmp-mbedtls
$(Package/icwmp/default)
TITLE += (mbedtls)
DEPENDS += +PACKAGE_icwmp-mbedtls:libmbedtls
VARIANT:=mbedtls
CONFLICTS := icwmp icwmp-wolfssl icwmp-openssl
endef
ifeq ($(BUILD_VARIANT),default)
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
endif
ifeq ($(BUILD_VARIANT),openssl)
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
endif
ifeq ($(BUILD_VARIANT),wolfssl)
CMAKE_OPTIONS += -DWITH_WOLFSSL=ON
endif
ifeq ($(BUILD_VARIANT),mbedtls)
CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
endif
USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
ifneq ($(USE_LOCAL),)
define Build/Prepare define Build/Prepare
$(CP) -rf ~/git/icwmp/* $(PKG_BUILD_DIR)/ $(CP) ./src/* $(PKG_BUILD_DIR)/
endef endef
endif endif
define Package/icwmp/install define Package/icwmp/default/install
$(INSTALL_DIR) $(1)/etc/icwmpd $(INSTALL_DIR) $(1)/etc/icwmpd
$(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/config $(INSTALL_DIR) $(1)/etc/config
@@ -54,12 +101,19 @@ define Package/icwmp/install
$(INSTALL_BIN) ./files/etc/init.d/icwmpd $(1)/etc/init.d/icwmpd $(INSTALL_BIN) ./files/etc/init.d/icwmpd $(1)/etc/init.d/icwmpd
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/ $(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/ $(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/95-set-random-inform-time $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp $(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
$(call BbfdmInstallPlugin,$(1),./files/etc/bbfdm/json/CWMPManagementServer.json) $(call BbfdmInstallPlugin,$(1),./files/etc/bbfdm/json/CWMPManagementServer.json)
$(call BbfdmInstallPlugin,$(1),$(PKG_BUILD_DIR)/libcwmpdm.so) $(call BbfdmInstallPlugin,$(1),$(PKG_BUILD_DIR)/libcwmpdm.so)
endef endef
Package/icwmp/install = $(Package/icwmp/default/install)
Package/icwmp-openssl/install = $(Package/icwmp/default/install)
Package/icwmp-wolfssl/install = $(Package/icwmp/default/install)
Package/icwmp-mbedtls/install = $(Package/icwmp/default/install)
$(eval $(call BuildPackage,icwmp)) $(eval $(call BuildPackage,icwmp))
$(eval $(call BuildPackage,icwmp-openssl))
$(eval $(call BuildPackage,icwmp-wolfssl))
$(eval $(call BuildPackage,icwmp-mbedtls))

View File

@@ -5,14 +5,12 @@ config acs 'acs'
option periodic_inform_interval '1800' option periodic_inform_interval '1800'
option periodic_inform_time '0001-01-01T00:00:00Z' option periodic_inform_time '0001-01-01T00:00:00Z'
option dhcp_discovery 'enable' option dhcp_discovery 'enable'
option ssl_capath "/etc/ssl/certs"
# compression possible configs: GZIP, Deflate, Disabled # compression possible configs: GZIP, Deflate, Disabled
option compression 'Disabled' option compression 'Disabled'
#­ possible configs interval :[1:65535] #­ possible configs interval :[1:65535]
option retry_min_wait_interval '5' option retry_min_wait_interval '5'
#­ possible configs interval :[1000:65535] #­ possible configs interval :[1000:65535]
option retry_interval_multiplier '2000' option retry_interval_multiplier '2000'
option skip_dhcp_boot_options '0'
config cpe 'cpe' config cpe 'cpe'
option enable '1' option enable '1'
@@ -22,7 +20,7 @@ config cpe 'cpe'
option log_to_file 'disable' option log_to_file 'disable'
# log_severity: INFO (Default) # log_severity: INFO (Default)
# log_severity possible configs: EMERG, ALERT, CRITIC ,ERROR, WARNING, NOTICE, INFO, DEBUG # log_severity possible configs: EMERG, ALERT, CRITIC ,ERROR, WARNING, NOTICE, INFO, DEBUG
option log_severity 'ERROR' option log_severity 'INFO'
option log_file_name '/var/log/icwmpd.log' option log_file_name '/var/log/icwmpd.log'
option log_max_size '102400' option log_max_size '102400'
option userid '' #$OUI-$SER option userid '' #$OUI-$SER
@@ -39,8 +37,6 @@ config cpe 'cpe'
option periodic_notify_interval '10' option periodic_notify_interval '10'
option incoming_rule 'Port_Only' option incoming_rule 'Port_Only'
option active_notif_throttle '0' option active_notif_throttle '0'
option disable_gatewayinfo '0'
option fw_upgrade_keep_settings '1'
config lwn 'lwn' config lwn 'lwn'
option enable '0' option enable '0'

View File

@@ -15,24 +15,32 @@ log() {
echo "${@}"|logger -t cwmp.init -p info echo "${@}"|logger -t cwmp.init -p info
} }
regenerate_ssl_link() { regenerate_ssl_link()
local cert_dir="${1%/}" {
[ ! -d "${cert_dir}" ] || [ "${cert_dir}" = "/etc/ssl/certs" ] && return 0 local cert_dir all_file rehash
generate_links() { cert_dir="${1}"
local file_type="$1" [ ! -d "${cert_dir}" ] && return 0;
local files="${cert_dir}"/*."${file_type}"
for cfile in ${files}; do ### Generate all ssl link for pem certicates ###
if [ -f "${cfile}" ]; then all_file=$(ls "${cert_dir}"/*.pem 2>/dev/null)
rehash="$(openssl x509 -hash -noout -in "${cfile}")" if [ -n "${all_file}" ]; then
[ -f "${cert_dir}/${rehash}.0" ] || \ for cfile in $all_file; do
ln -s "${cfile}" "${cert_dir}/${rehash}.0" rehash="$(openssl x509 -hash -noout -in "${cfile}")"
fi [ -f "${cert_dir}"/"${rehash}".0 ] || \
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
done done
} fi
generate_links "pem" ### Generate all ssl link for crt certicates ###
generate_links "crt" all_file=$(ls "${cert_dir}"/*.crt 2>/dev/null)
if [ -n "${all_file}" ]; then
for cfile in $all_file; do
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
[ -f "${cert_dir}"/"${rehash}".0 ] || \
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
done
fi
} }
enable_dhcp_option43() { enable_dhcp_option43() {
@@ -399,7 +407,6 @@ validate_acs_section()
'periodic_inform_time:string' \ 'periodic_inform_time:string' \
'url:string' \ 'url:string' \
'dhcp_discovery:string' \ 'dhcp_discovery:string' \
'skip_dhcp_boot_options:bool:0' \
'dhcp_url:string' \ 'dhcp_url:string' \
'compression:or("GZIP","Deflate","Disabled")' \ 'compression:or("GZIP","Deflate","Disabled")' \
'retry_min_wait_interval:range(1, 65535)' \ 'retry_min_wait_interval:range(1, 65535)' \
@@ -428,14 +435,12 @@ validate_cpe_section()
'notification:bool' \ 'notification:bool' \
'exec_download:bool' \ 'exec_download:bool' \
'periodic_notify_enable:bool' \ 'periodic_notify_enable:bool' \
'enable:bool:1' \ 'enable:bool' \
'periodic_notify_interval:uinteger' \ 'periodic_notify_interval:uinteger'
'fw_upgrade_keep_settings:bool'
} }
validate_defaults() { validate_defaults() {
local ssl_capath enable url dhcp_url local ssl_capath
config_load cwmp config_load cwmp
validate_acs_section || { validate_acs_section || {
@@ -443,17 +448,13 @@ validate_defaults() {
return 1; return 1;
} }
if [ -z "${url}" ] && [ -z "${dhcp_url}" ]; then
log "No ACS URL is configured"
return 1
fi
ssl_capath="${ssl_capath%/}" ssl_capath="${ssl_capath%/}"
# Put the cert pem file in keep list # Put the cert pem file in keep list
if [ -d "${ssl_capath}" ] && [ "${ssl_capath}" != "/etc/ssl/certs" ]; then if [ -d "${ssl_capath}" ]; then
if ! grep "*.pem\|*.crt" /lib/upgrade/keep.d/icwmp; then if ! grep "*.pem\|*.crt" /lib/upgrade/keep.d/icwmp; then
echo "${ssl_capath}"'/*.pem' >> /lib/upgrade/keep.d/icwmp echo "${ssl_capath}"'/*.pem' >> /lib/upgrade/keep.d/icwmp
echo "${ssl_capath}"'/*.crt' >> /lib/upgrade/keep.d/icwmp echo "${ssl_capath}"'/*.crt' >> /lib/upgrade/keep.d/icwmp
echo "${ssl_capath}"'/*.0' >> /lib/upgrade/keep.d/icwmp
fi fi
fi fi
@@ -462,41 +463,29 @@ validate_defaults() {
return 1; return 1;
} }
if [ "$enable" = "0" ]; then
log "CWMP service disabled"
return 1
fi
return 0; return 0;
} }
boot() { boot() {
local dhcp_discovery wan_interface skip_dhcp_boot_options disable_gatewayinfo local dhcp_discovery="0"
local wan_interface=""
config_load cwmp config_load cwmp
config_get wan_interface cpe default_wan_interface "wan" config_get wan_interface cpe default_wan_interface "wan"
config_get disable_gatewayinfo cpe disable_gatewayinfo "0"
config_get dhcp_discovery acs dhcp_discovery "0" config_get dhcp_discovery acs dhcp_discovery "0"
config_get dhcp_discovery acs dhcp_discovery "0"
config_get skip_dhcp_boot_options acs skip_dhcp_boot_options "0"
if [ "${dhcp_discovery}" = "enable" ] || [ "${dhcp_discovery}" = "1" ]; then if [ "${dhcp_discovery}" = "enable" ] || [ "${dhcp_discovery}" = "1" ]; then
if [ "${skip_dhcp_boot_options}" -ne 1 ]; then # Set dhcp option 43 if not already configured
# Set dhcp option 43 if not already configured enable_dhcp_option43 "${wan_interface}"
enable_dhcp_option43 "${wan_interface}" # Set dhcp option 60
# Set dhcp option 60 set_vendor_id "${wan_interface}"
set_vendor_id "${wan_interface}"
fi
fi fi
config_get lan_interface cpe default_lan_interface "" config_get lan_interface cpe default_lan_interface ""
if [ -n "${lan_interface}" ]; then if [ -n "${lan_interface}" ]; then
if [ "${disable_gatewayinfo}" -ne 1 ]; then # Set dhcp_option 125 if not already configured
# Set dhcp_option 125 if not already configured enable_dhcp_option125 "${wan_interface}"
enable_dhcp_option125 "${wan_interface}" enable_dnsmasq_option125 "${lan_interface}"
enable_dnsmasq_option125 "${lan_interface}"
fi
fi fi
config_get ssl_capath acs ssl_capath config_get ssl_capath acs ssl_capath
@@ -514,22 +503,33 @@ boot() {
} }
start_service() { start_service() {
local enable_cwmp url dhcp_url
procd_open_instance icwmp config_load cwmp
config_get_bool enable_cwmp cpe enable 1
config_get url acs url ""
config_get dhcp_url acs dhcp_url ""
if [ "$enable_cwmp" = "0" ]; then
return 0
fi
validate_defaults || { validate_defaults || {
log "Validation of defaults failed" log "Validation of defaults failed"
procd_close_instance
return 1; return 1;
} }
procd_set_param command "$PROG" procd_open_instance icwmp
procd_append_param command -b if [ -n "${url}" ] || [ -n "${dhcp_url}" ]; then
procd_set_param command "$PROG"
procd_append_param command -b
fi
procd_set_param respawn \ procd_set_param respawn \
"${respawn_threshold:-5}" \ "${respawn_threshold:-5}" \
"${respawn_timeout:-10}" "${respawn_retry:-3}" "${respawn_timeout:-10}" "${respawn_retry:-3}"
procd_set_param watch network.interface
procd_close_instance procd_close_instance
} }
@@ -541,35 +541,22 @@ stop_service()
reload_service() { reload_service() {
local ret local ret
log "Reload service $ret" config_load cwmp
ret="0" config_get_bool enable_cwmp cpe enable 1
validate_defaults || { ret="0"
if [ "$enable_cwmp" = "0" ]; then
stop stop
start start
return 0; return 0
} fi
ret=$(ubus call service list '{"name":"icwmpd"}' | jsonfilter -qe '@.icwmpd.instances.icwmp.running') ret=$(ubus call service list '{"name":"icwmpd"}' | jsonfilter -qe '@.icwmpd.instances.icwmp.running')
if [ "$ret" != "true" ]; then if [ "$ret" != "true" ]; then
log "Reloading cwmp service ..."
stop stop
start start
return 0 return 0
fi fi
tr069_status="$(ubus -t 1 call tr069 status)"
ret="$?"
if [ "$ret" = "7" ]; then
# ubus timed out may be due to uloop is busy in some task so return
log "Skipping ubus reload due to ubus timeout"
return 0
fi
status="$(echo "${tr069_status}" | jsonfilter -qe '@.cwmp.status')"
if [ "$status" = "up" ]; then
ubus -t 1 call tr069 command '{"command":"reload"}'
fi
} }
service_triggers() { service_triggers() {

View File

@@ -1,20 +0,0 @@
#!/bin/sh
. /lib/functions.sh
set_inform_time()
{
local sec inform_time value
config_load cwmp
config_get inform_time acs periodic_inform_time '0001-01-01T00:00:00Z'
if [ "${inform_time}" == "0001-01-01T00:00:00Z" ]; then
sec=$(date +%s)
value="$(date -d @$(($sec-$RANDOM)) +%Y-%m-%dT%H:%M:%SZ)"
uci_set cwmp acs periodic_inform_time "$value"
fi
}
set_inform_time

View File

@@ -1,139 +0,0 @@
#!/bin/sh
. /lib/functions.sh
CLASS=""
OUI=""
SERIAL=""
get_vivsoi() {
# opt125 environment variable has data in below format
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | enterprise-number1 |
# | |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | data-len1 | |
# +-+-+-+-+-+-+-+-+ option-data1 |
# / /
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -----
# | enterprise-number2 | ^
# | | |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
# | data-len2 | | optional
# +-+-+-+-+-+-+-+-+ option-data2 | |
# / / |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
# ~ ... ~ V
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -----
# Enterprise Id Len Sub Op SLen Data Sub Op SLen Data Sub Op SLen Data
# +-------------+-----+------+------+----+------+-----+----+-----+------+-----+----+
# | id | n | 1 | n1 | D1 | 2 | n2 | D2 | ... | 6 | n6 | D6 |
# +-------------+-----+------+------+----+------+-----+----+-----+------+-----+----+
local opt125="$1"
local len="$2"
local ent_id
#hex-string 2 character=1 Byte
# length in hex string will be twice of actual Byte length
[ "$len" -gt "8" ] || return
data="${opt125}"
rem_len="${len}"
while [ $rem_len -gt 0 ]; do
ent_id=${data:0:8}
ent_id=$(printf "%d\n" "0x$ent_id")
if [ $ent_id -ne 3561 ]; then
len_val=${data:8:2}
data_len=$(printf "%d\n" "0x$len_val")
# add 4 byte for ent_id and 1 byte for len
data_len=$(( data_len * 2 + 10 ))
# move ahead data to next enterprise id
data=${data:"${data_len}":"${rem_len}"}
rem_len=$(( rem_len - $data_len ))
continue
fi
# read the length of enterprise data
len_val=${data:8:2}
data_len=$(printf "%d\n" "0x$len_val")
# add 4 byte for ent_id and 1 byte for len
data_len=$(( data_len * 2 + 10 ))
opt_len=$(printf "%d\n" "0x$len_val")
[ $opt_len -eq 0 ] && return
# populate the option data of enterprise id
sub_data_len=$(( opt_len * 2))
# starting 10 means ahead of length field
sub_data=${data:10:"${sub_data_len}"}
# parsing of suboption of option 125
while [ $sub_data_len -gt 0 ]; do
# get the suboption id
sub_opt_id=${sub_data:0:2}
sub_opt_id=$(printf "%d\n" "0x$sub_opt_id")
# get the length of suboption
sub_opt_len=${sub_data:2:2}
sub_opt_len=$(printf "%d\n" "0x$sub_opt_len")
sub_opt_len=$(( sub_opt_len * 2 ))
# get the value of sub option starting 4 means starting after length
sub_opt_val=${sub_data:4:${sub_opt_len}}
# assign the value found in sub option
case "${sub_opt_id}" in
"4") OUI=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
;;
"5") SERIAL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
;;
"6") CLASS=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
;;
esac
# add 2 bytes for sub_opt id and sub_opt len field
sub_opt_end=$(( sub_opt_len + 4 ))
# update the remaining sub option hex string length
sub_data_len=$((sub_data_len - sub_opt_end))
# fetch next sub option hex string
sub_data=${sub_data:${sub_opt_end}:${sub_data_len}}
done
# move ahead data to next enterprise id
data=${data:"${data_len}":"${rem_len}"}
rem_len=$(( rem_len - data_len ))
done
}
config_load cwmp
config_get_bool enable_cwmp cpe enable 1
config_get wan_intf cpe default_wan_interface "wan"
if [ "$enable_cwmp" = "0" ]; then
return 0
fi
if [ "${wan_intf}" == "${INTERFACE}" ]; then
if [ -n "$opt125" ]; then
len=$(printf "$opt125"|wc -c)
get_vivsoi "$opt125" "$len"
fi
mkdir -p /var/state
touch /var/state/icwmp
sec=$(uci -q -c /var/state get icwmp.gatewayinfo)
if [ -z "${sec}" ]; then
sec=$(uci -q -c /var/state add icwmp gatewayinfo)
uci -q -c /var/state rename icwmp."${sec}"="gatewayinfo"
fi
uci -q -c /var/state set icwmp.gatewayinfo.class="$CLASS"
uci -q -c /var/state set icwmp.gatewayinfo.oui="$OUI"
uci -q -c /var/state set icwmp.gatewayinfo.serial="$SERIAL"
uci -q -c /var/state commit icwmp
fi

View File

@@ -1,141 +0,0 @@
#!/bin/sh
. /lib/functions.sh
DHCP_ACS_URL=""
DHCP_PROV_CODE=""
MIN_WAIT_INVL=""
INVL_MULTIPLIER=""
log() {
echo "$@" |logger -t cwmp.update -p info
}
get_opt43() {
# Check if option value is in encapsulated form
local opt43="$1"
local len="$2"
[ "$len" -gt "2" ] || return
first_byte=${opt43:0:2}
first_byte=$(printf "%d\n" "0x$first_byte")
if [ $len -ge 4 ] && [ $first_byte -ge 1 ] && [ $first_byte -le 4 ]; then
# it is in encapsulated form
# opt43 encapsulated vendor-specific option has data in below format
# Code Len Data item Code Len Data item Code
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
# | T1 | n | d1 | d2 | ... | T2 | n | D1 | D2 | ... | ... |
# +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
#hex-string 2 character=1 Byte
# length in hex string will be twice of actual Byte length
data="${opt43}"
rem_len="${len}"
# parsing of suboption of option 43
while [ $rem_len -gt 0 ]; do
# get the suboption id
sub_opt_id=${data:0:2}
sub_opt_id=$(printf "%d\n" "0x$sub_opt_id")
# get the length of suboption
sub_opt_len=${data:2:2}
sub_opt_len=$(printf "%d\n" "0x$sub_opt_len")
sub_opt_len=$(( sub_opt_len * 2 ))
# get the value of sub option starting 4 means starting after length
sub_opt_val=${data:4:${sub_opt_len}}
# assign the value found in sub option
case "${sub_opt_id}" in
"1") DHCP_ACS_URL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
;;
"2") DHCP_PROV_CODE=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
;;
"3") MIN_WAIT_INVL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
;;
"4") INVL_MULTIPLIER=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
;;
esac
# add 2 bytes for sub_opt id and sub_opt len field
sub_opt_end=$(( sub_opt_len + 4 ))
# fetch next sub option hex string
data=${data:${sub_opt_end}:${len}}
# update the remaining sub option hex string length
rem_len=$((rem_len - sub_opt_end))
done
else
DHCP_ACS_URL=$(echo -n $opt43 | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
fi
}
config_load cwmp
config_get wan_intf cpe default_wan_interface "wan"
config_get dhcp_discovery acs dhcp_discovery "0"
config_get dhcp_url acs dhcp_url ""
config_get min_wait_intvl acs dhcp_retry_min_wait_interval "0"
config_get intvl_multi acs dhcp_retry_interval_multiplier "0"
config_change=0
discovery_enable=0
if [ "$dhcp_discovery" = "1" ] || [ "$dhcp_discovery" = "true" ] || [ "$dhcp_discovery" = "enable" ]; then
discovery_enable=1
fi
if [ "$discovery_enable" = "0" ]; then
return 0
fi
if [ "${wan_intf}" == "${INTERFACE}" ]; then
if [ -n "$opt43" ]; then
len=$(printf "$opt43"|wc -c)
get_opt43 "$opt43" "$len"
fi
if [ -z "$DHCP_ACS_URL" ]; then
return 0
fi
sec=$(uci -q get cwmp.acs)
if [ -z "${sec}" ]; then
return 0
fi
if [ "${dhcp_url}" != "${DHCP_ACS_URL}" ]; then
uci -q set cwmp.acs.dhcp_url="$DHCP_ACS_URL"
config_change=1
fi
if [ -n "$MIN_WAIT_INVL" ] && [ "${MIN_WAIT_INVL}" != "${min_wait_intvl}" ]; then
uci -q set cwmp.acs.dhcp_retry_min_wait_interval="$MIN_WAIT_INVL"
config_change=1
fi
if [ -n "$INVL_MULTIPLIER" ] && [ "${INVL_MULTIPLIER}" != "${intvl_multi}" ]; then
uci -q set cwmp.acs.dhcp_retry_interval_multiplier="$INVL_MULTIPLIER"
config_change=1
fi
sec=$(uci -q get cwmp.cpe)
if [ -n "${sec}" ] && [ -n "$DHCP_PROV_CODE" ]; then
uci -q set cwmp.cpe.dhcp_provisioning_code="$DHCP_PROV_CODE"
config_change=1
fi
if [ $config_change -eq 0 ]; then
return 0
fi
# ACS url has been set, inform icwmpd to reload new configuration
sleep 10 # wait for some time to avoid interface fluctuation
ubus call uci commit '{"config":"cwmp"}'
fi

View File

@@ -20,6 +20,7 @@ config IEEE1905_WIFI_EASYMESH
config IEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY config IEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY
bool "Fragment large CMDU frame at TLV boundary instead of octet boundary" bool "Fragment large CMDU frame at TLV boundary instead of octet boundary"
default y
endmenu endmenu

View File

@@ -1,16 +1,16 @@
# #
# Copyright (C) 2020-2024 IOPSYS Software Solutions AB # Copyright (C) 2020-2023 IOPSYS Software Solutions AB
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ieee1905 PKG_NAME:=ieee1905
PKG_VERSION:=8.3.7.1 PKG_VERSION:=8.2.22
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=490979bd8ec0395795801f3bfb9dc47af1eb4ade PKG_SOURCE_VERSION:=78ab0f41b76773a446bd64d6d981e2b91302c02b
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/ieee1905.git PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/ieee1905.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
@@ -60,12 +60,12 @@ define Package/libieee1905/description
endef endef
plugins := \ plugins := \
$(if $(CONFIG_PACKAGE_ieee1905-map-plugin),map) \ $(if $(CONFIG_PACKAGE_map-plugin),map) \
$(if $(CONFIG_PACKAGE_ieee1905-snoop-plugin),snoop) \ $(if $(CONFIG_PACKAGE_snoop-plugin),snoop) \
$(if $(CONFIG_PACKAGE_ieee1905-topology-plugin),topology) $(if $(CONFIG_PACKAGE_topology-plugin),topology)
ppkg:=$(patsubst plugins/%.mk,ieee1905-%-plugin,$(wildcard plugins/*.mk)) ppkg:=$(patsubst plugins/%.mk,%-plugin,$(wildcard plugins/*.mk))
TARGET_CFLAGS += \ TARGET_CFLAGS += \
@@ -123,6 +123,7 @@ define Build/InstallDev/libieee1905
$(CP) $(PKG_BUILD_DIR)/src/cmdu_ackq.h $(1)/usr/include/ $(CP) $(PKG_BUILD_DIR)/src/cmdu_ackq.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/1905_tlvs.h $(1)/usr/include/ $(CP) $(PKG_BUILD_DIR)/src/1905_tlvs.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/i1905_wsc.h $(1)/usr/include/ $(CP) $(PKG_BUILD_DIR)/src/i1905_wsc.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/bufutil.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/timer_impl.h $(1)/usr/include/ $(CP) $(PKG_BUILD_DIR)/src/timer_impl.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/i1905_extension.h $(1)/usr/include/ $(CP) $(PKG_BUILD_DIR)/src/i1905_extension.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/libmidgen.so $(1)/usr/lib/ $(CP) $(PKG_BUILD_DIR)/src/libmidgen.so $(1)/usr/lib/

View File

@@ -4,7 +4,6 @@ config ieee1905 'ieee1905'
list extmodule 'map' list extmodule 'map'
list extmodule 'topology' list extmodule 'topology'
option registrar '2 5 6' option registrar '2 5 6'
list exclude_tagging '/eth.*'
# option macaddress '0a:1b:2c:3d:4e:50' # option macaddress '0a:1b:2c:3d:4e:50'
config al-iface config al-iface

View File

@@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
START=60 START=96
STOP=21 STOP=21
USE_PROCD=1 USE_PROCD=1

View File

@@ -1,12 +1,12 @@
define Package/ieee1905-map-plugin define Package/map-plugin
$(call Package/ieee1905/Default) $(call Package/ieee1905/Default)
TITLE:=Multi-AP plugin supporting WiFi-Alliance Easymesh standard TITLE:=Multi-AP plugin supporting WiFi-Alliance Easymesh standard
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \ DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
+libjson-c +libblobmsg-json +ieee1905 +libieee1905 +libjson-c +libblobmsg-json +ieee1905 +libieee1905
endef endef
define Package/ieee1905-map-plugin/config define Package/map-plugin/config
if (PACKAGE_ieee1905-map-plugin) if (PACKAGE_map-plugin)
menu "Configuration" menu "Configuration"
@@ -32,7 +32,7 @@ ifeq ($(CONFIG_MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG),y)
TARGET_CFLAGS += -DDYNAMIC_CNTLR_SYNC_CONFIG TARGET_CFLAGS += -DDYNAMIC_CNTLR_SYNC_CONFIG
endif endif
define Build/InstallDev/ieee1905-map-plugin define Build/InstallDev/map-plugin
$(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include $(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib/ieee1905 $(INSTALL_DIR) $(1)/usr/lib/ieee1905
@@ -43,7 +43,7 @@ define Build/InstallDev/ieee1905-map-plugin
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so $(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
endef endef
define Package/ieee1905-map-plugin/install define Package/map-plugin/install
$(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/ieee1905 $(INSTALL_DIR) $(1)/usr/lib/ieee1905
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so $(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so

View File

@@ -1,11 +1,11 @@
define Package/ieee1905-snoop-plugin define Package/snoop-plugin
$(call Package/ieee1905/Default) $(call Package/ieee1905/Default)
TITLE:=Show all received 1905 CMDUs over UBUS TITLE:=Show all received 1905 CMDUs over UBUS
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \ DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
+libjson-c +libblobmsg-json +ieee1905 +libieee1905 +libjson-c +libblobmsg-json +ieee1905 +libieee1905
endef endef
define Package/ieee1905-snoop-plugin/install define Package/snoop-plugin/install
$(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/ieee1905 $(INSTALL_DIR) $(1)/usr/lib/ieee1905
$(CP) $(PKG_BUILD_DIR)/src/extensions/snoop/snoop.so $(1)/usr/lib/ieee1905/snoop.so $(CP) $(PKG_BUILD_DIR)/src/extensions/snoop/snoop.so $(1)/usr/lib/ieee1905/snoop.so

View File

@@ -1,11 +1,11 @@
define Package/ieee1905-topology-plugin define Package/topology-plugin
$(call Package/ieee1905/Default) $(call Package/ieee1905/Default)
TITLE:=Build full network topology of the 1905 nodes only TITLE:=Build full network topology of the 1905 nodes only
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \ DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
+libjson-c +libblobmsg-json +ieee1905 +libieee1905 +libjson-c +libblobmsg-json +ieee1905 +libieee1905
endef endef
define Package/ieee1905-topology-plugin/install define Package/topology-plugin/install
$(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/ieee1905 $(INSTALL_DIR) $(1)/usr/lib/ieee1905
$(CP) $(PKG_BUILD_DIR)/src/extensions/topology/topology.so $(1)/usr/lib/ieee1905/topology.so $(CP) $(PKG_BUILD_DIR)/src/extensions/topology/topology.so $(1)/usr/lib/ieee1905/topology.so

56
inbd/Makefile Normal file
View File

@@ -0,0 +1,56 @@
#
# Copyright (C) 2016 iopsys
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=inbd
PKG_VERSION:=1.2.3
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=d4e910a31039e0c0b7a539311eafcd716c36be77
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/inbd
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
# support parallel build
PKG_BUILD_PARALLEL:=1
#re create configure scripts if not present.
PKG_FIXUP:=autoreconf
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
# this way we don't need to pick out the resulting files from the build dir.
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/inbd
CATEGORY:=Utilities
TITLE:=iopsys Netlink Bridge Daemon
URL:=
DEPENDS:=+libuci +libubus +libblobmsg-json +libnl-genl
endef
define Package/inbd/description
Application handling netlink messages from kernel and sending them out on ubus.
endef
define Package/inbd/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inbd $(1)/usr/bin/
cp $(PKG_BUILD_DIR)/files/etc/init.d/inbd $(1)/etc/init.d/
endef
$(eval $(call BuildPackage,inbd))

View File

@@ -11,19 +11,10 @@ CONFIG_DEVEL=y
CONFIG_USE_STRIP=y CONFIG_USE_STRIP=y
# CONFIG_SIGNED_PACKAGES is not set # CONFIG_SIGNED_PACKAGES is not set
CONFIG_JSON_CYCLONEDX_SBOM=y
CONFIG_INCLUDE_CONFIG=y
# Image # # Image #
CONFIG_TARGET_CUSTOMER="IOPSYS" CONFIG_TARGET_CUSTOMER="IOPSYS"
CONFIG_TARGET_ROOTFS_TARGZ=y CONFIG_TARGET_ROOTFS_TARGZ=y
# Although UBIFS and EXT4 images work on all non-secure-boot devices,
# squashfs is the only officially supported rootfs filesystem.
# A writable rootfs is useful for developping an debugging preinit code.
# CONFIG_TARGET_ROOTFS_UBIFS is not set
# CONFIG_TARGET_ROOTFS_EXT4FS is not set
# /etc/banner and /etc/device_info # # /etc/banner and /etc/device_info #
CONFIG_IMAGEOPT=y CONFIG_IMAGEOPT=y
CONFIG_VERSIONOPT=y CONFIG_VERSIONOPT=y
@@ -64,6 +55,7 @@ CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/"
################ ################
# EasySoC HAL # # EasySoC HAL #
CONFIG_PACKAGE_inbd=y
CONFIG_PACKAGE_qosmngr=y CONFIG_PACKAGE_qosmngr=y
CONFIG_PACKAGE_libwifiutils=y CONFIG_PACKAGE_libwifiutils=y
CONFIG_PACKAGE_wifimngr=y CONFIG_PACKAGE_wifimngr=y
@@ -71,7 +63,7 @@ CONFIG_PACKAGE_wifimngr=y
# Multi-AP # # Multi-AP #
CONFIG_PACKAGE_ieee1905=y CONFIG_PACKAGE_ieee1905=y
CONFIG_IEEE1905_CMDU_SA_IS_ALMAC=y CONFIG_IEEE1905_CMDU_SA_IS_ALMAC=y
CONFIG_PACKAGE_ieee1905-topology-plugin=y CONFIG_PACKAGE_topology-plugin=y
CONFIG_PACKAGE_decollector=y CONFIG_PACKAGE_decollector=y
CONFIG_PACKAGE_map-agent=y CONFIG_PACKAGE_map-agent=y
CONFIG_PACKAGE_map-controller=y CONFIG_PACKAGE_map-controller=y
@@ -102,7 +94,6 @@ CONFIG_PACKAGE_udpecho-server=y
CONFIG_PACKAGE_userinterface=y CONFIG_PACKAGE_userinterface=y
CONFIG_PACKAGE_xmppc=y CONFIG_PACKAGE_xmppc=y
CONFIG_PACKAGE_timemngr=y CONFIG_PACKAGE_timemngr=y
CONFIG_PACKAGE_self-diagnostics=y
# WebGUI # # WebGUI #
CONFIG_PACKAGE_sulu=y CONFIG_PACKAGE_sulu=y
@@ -142,6 +133,7 @@ CONFIG_PACKAGE_wwan=y
CONFIG_PACKAGE_xl2tpd=y CONFIG_PACKAGE_xl2tpd=y
# Services # # Services #
CONFIG_PACKAGE_atftp=y
CONFIG_PACKAGE_atftpd=y CONFIG_PACKAGE_atftpd=y
CONFIG_PACKAGE_ddns-scripts=y CONFIG_PACKAGE_ddns-scripts=y
CONFIG_PACKAGE_dnsmasq=y CONFIG_PACKAGE_dnsmasq=y
@@ -177,8 +169,6 @@ CONFIG_PACKAGE_iptables-mod-ipmark=y
CONFIG_PACKAGE_iptables-mod-ipopt=y CONFIG_PACKAGE_iptables-mod-ipopt=y
CONFIG_PACKAGE_iptables-mod-nflog=y CONFIG_PACKAGE_iptables-mod-nflog=y
CONFIG_PACKAGE_iptables-mod-nfqueue=y CONFIG_PACKAGE_iptables-mod-nfqueue=y
CONFIG_PACKAGE_iputils-arping=y
CONFIG_PACKAGE_iputils-ping=y
CONFIG_PACKAGE_ndisc6=y CONFIG_PACKAGE_ndisc6=y
CONFIG_PACKAGE_rdisc6=y CONFIG_PACKAGE_rdisc6=y
CONFIG_PACKAGE_resolveip=y CONFIG_PACKAGE_resolveip=y
@@ -195,7 +185,6 @@ CONFIG_PACKAGE_at=y
CONFIG_PACKAGE_ca-certificates=y CONFIG_PACKAGE_ca-certificates=y
CONFIG_PACKAGE_crun=y CONFIG_PACKAGE_crun=y
CONFIG_PACKAGE_getopt=y CONFIG_PACKAGE_getopt=y
CONFIG_PACKAGE_gpiod-tools=y
# CONFIG_PACKAGE_iwatchdog is not set # CONFIG_PACKAGE_iwatchdog is not set
CONFIG_PACKAGE_jq=y CONFIG_PACKAGE_jq=y
CONFIG_PACKAGE_libcap-bin=y CONFIG_PACKAGE_libcap-bin=y
@@ -248,10 +237,12 @@ CONFIG_PACKAGE_nginx-mod-luci=y
CONFIG_BUSYBOX_CUSTOM=y CONFIG_BUSYBOX_CUSTOM=y
CONFIG_BUSYBOX_CONFIG_ADDUSER=y CONFIG_BUSYBOX_CONFIG_ADDUSER=y
CONFIG_BUSYBOX_CONFIG_ARPING=y
CONFIG_BUSYBOX_CONFIG_ASH_IDLE_TIMEOUT=y CONFIG_BUSYBOX_CONFIG_ASH_IDLE_TIMEOUT=y
CONFIG_BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT=y CONFIG_BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT=y
CONFIG_BUSYBOX_CONFIG_CTTYHACK=y CONFIG_BUSYBOX_CONFIG_CTTYHACK=y
CONFIG_BUSYBOX_CONFIG_DELUSER=y CONFIG_BUSYBOX_CONFIG_DELUSER=y
# CONFIG_BUSYBOX_CONFIG_DEVMEM is not set
CONFIG_BUSYBOX_CONFIG_FEATURE_UDHCP_8021Q=y CONFIG_BUSYBOX_CONFIG_FEATURE_UDHCP_8021Q=y
CONFIG_BUSYBOX_CONFIG_FIRST_SYSTEM_ID=100 CONFIG_BUSYBOX_CONFIG_FIRST_SYSTEM_ID=100
# CONFIG_BUSYBOX_CONFIG_HTTPD is not set # CONFIG_BUSYBOX_CONFIG_HTTPD is not set
@@ -328,8 +319,3 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y
CONFIG_BUSYBOX_CONFIG_TIMEOUT=y CONFIG_BUSYBOX_CONFIG_TIMEOUT=y
CONFIG_BUSYBOX_CONFIG_NOHUP=y CONFIG_BUSYBOX_CONFIG_NOHUP=y
CONFIG_BUSYBOX_CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512"
# CONFIG_BUSYBOX_CONFIG_ARPING is not set
# CONFIG_BUSYBOX_CONFIG_PING is not set
# CONFIG_BUSYBOX_CONFIG_PING6 is not set
# CONFIG_BUSYBOX_CONFIG_FEATURE_FANCY_PING is not set

View File

@@ -33,8 +33,7 @@ _iop()
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
iopcmds="bootstrap cfe_upgrade cfe_upgrade_latest extract_core \ iopcmds="bootstrap cfe_upgrade cfe_upgrade_latest extract_core \
feeds_update feeds_update-legacy genconfig genconfig-legacy \ feeds_update genconfig generate_tarballs install_key \
generate_tarballs install_key \
scp_changes setup_host ssh_install_key status \ scp_changes setup_host ssh_install_key status \
update_package update_feed_branches ssh_upgrade smoketest" update_package update_feed_branches ssh_upgrade smoketest"

View File

@@ -1,88 +0,0 @@
#!/bin/bash
function feeds_update-legacy {
heads=1
developer=0
override=1
force=1
function update_failure {
if [ $force == 1 ]; then
echo "WARNING: Failed to update feed(s). Forced update, proceeding anyway." >&2
else
echo "ERROR: Failed to update feed(s). Omit -F to proceed anyway." >&2
exit 1
fi
}
while getopts "inFh" opt; do
case $opt in
i)
heads=0
;;
n)
override=0
;;
F)
force=0
;;
h|\?)
echo "Usage: ./iop feeds_update-legacy [-i] [-n] [-F] [-h]"
echo
echo "OPTIONS:"
echo " -i - Only update index. Do not change HEAD in feeds."
echo " -n - Do not replace core packages with iopsys versions."
echo " -F - Do not force update if there are inaccessible feeds."
echo " -h - Display this help message and exit."
exit 1
;;
esac
done
git remote -v | grep -qE '(git@|ssh://)' && developer=1
cp .config .genconfig_config_bak
if [ $heads == 1 ]; then
if [ $developer == 1 ]; then
./scripts/feeds update -g || update_failure
else
./scripts/feeds update || update_failure
fi
fi
./scripts/feeds update -ai || exit 1
# replace core packages with iopsys versions
if [ $override == 1 ]; then
./scripts/feeds install -f -p openwrt_core -a || exit 1
./scripts/feeds install -f -p qualcomm -a || exit 1
fi
(
echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update'
echo 'FEED_DEVICES_DIRS:='
find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h\n'
) > target/linux/feed-devices/feed-devices-list.mk || exit 1
# targets need to be installed explicitly
for target in $(ls ./feeds/targets); do
./scripts/feeds install -f -p targets $target || exit 1
done
# install all packages
./scripts/feeds install -a || exit 1
# remove broken symlinks ( for packages that are no longer in the feed )
find -L package/feeds -maxdepth 2 -type l -delete || exit 1
cp .genconfig_config_bak .config
make defconfig || exit 1
# record when we last run this script
touch tmp/.iop_bootstrap || exit 1
# always return true
exit 0
}
register_command "feeds_update-legacy" "Update feeds to point to commit hashes from feeds.conf - legacy mode"

View File

@@ -1,9 +1,73 @@
#!/bin/bash #!/bin/bash
function feeds_update { function feeds_update {
heads=1
developer=0
override=1
while getopts "inh" opt; do
case $opt in
i)
heads=0
;;
n)
override=0
;;
h|\?)
echo "Usage: ./iop feeds_update [-i] [-n] [-h]"
echo
echo "OPTIONS:"
echo " -i - Only update index. Do not change HEAD in feeds."
echo " -n - Do not replace core packages with iopsys versions."
echo " -h - Display this help message and exit."
exit 1
;;
esac
done
git remote -v | grep -qE '(git@|ssh://)' && developer=1
cp .config .genconfig_config_bak
if [ $heads == 1 ]; then
if [ $developer == 1 ]; then
./scripts/feeds update -g
else
./scripts/feeds update
fi
fi
./scripts/feeds update -ai || exit 1
# replace core packages with iopsys versions
if [ $override == 1 ]; then
./scripts/feeds install -f -p openwrt_core -a || exit 1
./scripts/feeds install -f -p qualcomm -a || exit 1
fi
(
echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update'
echo 'FEED_DEVICES_DIRS:='
find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h'
) > target/linux/feed-devices/feed-devices-list.mk || exit 1
# targets need to be installed explicitly
for target in $(ls ./feeds/targets); do
./scripts/feeds install -f -p targets $target || exit 1
done
# install all packages
./scripts/feeds install -a || exit 1
# remove broken symlinks ( for packages that are no longer in the feed )
find -L package/feeds -maxdepth 2 -type l -delete || exit 1
cp .genconfig_config_bak .config
make defconfig || exit 1
# record when we last run this script
touch tmp/.iop_bootstrap || exit 1
# always return true # always return true
exit 0 exit 0
} }
register_command "feeds_update" "Compatibility function only" register_command "feeds_update" "Update feeds to point to commit hashes from feeds.conf"

View File

@@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
function genconfig-legacy { function genconfig {
export CLEAN=0 export CLEAN=0
export DIRTY="--dirty"
export IMPORT=1 export IMPORT=1
export SRCTREEOVERR=0 export SRCTREEOVERR=0
export FILEDIR="files/" export FILEDIR="files/"
@@ -196,10 +195,9 @@ function genconfig-legacy {
usage() { usage() {
echo echo
echo 1>&2 "Usage: $0 genconfig-legacy [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]" echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]"
echo echo
echo -e " -c|--clean\t\tRemove all files under ./files and import from config " echo -e " -c|--clean\t\tRemove all files under ./files and import from config "
echo -e " -D|--no-dirty\t\tIgnore dirty tree"
echo -e " -v|--verbose\t\tVerbose" echo -e " -v|--verbose\t\tVerbose"
echo -e " -n|--no-update\tDo NOT! Update customer config before applying" echo -e " -n|--no-update\tDo NOT! Update customer config before applying"
echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from" echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from"
@@ -210,7 +208,7 @@ function genconfig-legacy {
echo -e " -a|--list-all\t\tList all Customers and their board types" echo -e " -a|--list-all\t\tList all Customers and their board types"
echo -e " -b|--boards\t\tList all board types" echo -e " -b|--boards\t\tList all board types"
echo echo
echo "Example ./iop genconfig-legacy eg400 OPERATORX" echo "Example ./iop genconfig eg400 OPERATORX"
echo "(if no customerconfig is chosen, iopsys config will be used)" echo "(if no customerconfig is chosen, iopsys config will be used)"
echo echo
exit 0 exit 0
@@ -365,27 +363,11 @@ function genconfig-legacy {
echo "" >> .config echo "" >> .config
fi fi
# hack to support custom-devices until we have deprecated this genconfig-script... # hack to support custom-devices until we have deprecated this genconfig-script...
local custom_found=false if [ -f "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" ]; then
local used_config_file cat "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" >> .config
echo "" >> .config
for config_file in feeds/*/devices/$target/config/$BOARDTYPE/config; do fi
if [ "$custom_found" = "true" ]; then
echo
echo "Error was found!"
echo "Please use only one path."
echo "Two instances of $target/config/$BOARDTYPE exists:"
echo "Path 1: $used_config_file"
echo "Path 2: $config_file"
return 1
fi
if [ -f "$config_file" ]; then
cat "$config_file" >> .config
echo "" >> .config
custom_found=true
used_config_file=$config_file
fi
done
# Special handling for targets which use TARGET_DEVICES # Special handling for targets which use TARGET_DEVICES
case "$target" in case "$target" in
airoha | mediatek | brcmbca | ipq95xx | ipq53xx) airoha | mediatek | brcmbca | ipq95xx | ipq53xx)
@@ -399,8 +381,6 @@ function genconfig-legacy {
echo "CONFIG_TARGET_${target}=y" >> .config echo "CONFIG_TARGET_${target}=y" >> .config
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
echo "CONFIG_TARGET_MULTI_PROFILE=y" >> .config
echo "CONFIG_TARGET_PER_DEVICE_ROOTFS=y" >> .config
;; ;;
*) *)
echo "CONFIG_TARGET_${target}=y" >> .config echo "CONFIG_TARGET_${target}=y" >> .config
@@ -436,7 +416,7 @@ function genconfig-legacy {
# Set target version # Set target version
local git_version local git_version
if ! git_version="$(git describe --always $DIRTY --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
echo "ERROR: Failed getting version via git describe, exiting." >&2 echo "ERROR: Failed getting version via git describe, exiting." >&2
return 1 return 1
fi fi
@@ -496,14 +476,13 @@ function genconfig-legacy {
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo Current profile: echo Current profile:
cat $CURRENT_CONFIG_FILE cat $CURRENT_CONFIG_FILE
echo "Try ./iop genconfig-legacy -h' to get instructions if you want to change current config" echo "Try ./iop genconfig -h' to get instructions if you want to change current config"
exit 0 exit 0
else else
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
-c|--clean) export CLEAN=1;; -c|--clean) export CLEAN=1;;
-D|--no-dirty) export DIRTY="";;
-n|--no-update) export IMPORT=0;; -n|--no-update) export IMPORT=0;;
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";; -v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
-t|--target) export TARGET="$2"; shift;; -t|--target) export TARGET="$2"; shift;;
@@ -532,4 +511,4 @@ function genconfig-legacy {
fi fi
} }
register_command "genconfig-legacy" "Generate configuration for board and customer - legacy mode" register_command "genconfig" "Generate configuration for board and customer"

View File

@@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
function genconfig_min-legacy { function genconfig_min {
export CLEAN=0 export CLEAN=0
export DIRTY="--dirty"
export SRCTREEOVERR=0 export SRCTREEOVERR=0
export FILEDIR="files/" export FILEDIR="files/"
CURRENT_CONFIG_FILE=".current_config_file" CURRENT_CONFIG_FILE=".current_config_file"
@@ -195,10 +194,9 @@ function genconfig_min-legacy {
usage() { usage() {
echo echo
echo 1>&2 "Usage: $0 genconfig_min-legacy [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]" echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]"
echo echo
echo -e " -c|--clean\t\tRemove all files under ./files and import from config " echo -e " -c|--clean\t\tRemove all files under ./files and import from config "
echo -e " -D|--no-dirty\t\tIgnore dirty tree"
echo -e " -v|--verbose\t\tVerbose" echo -e " -v|--verbose\t\tVerbose"
echo -e " -n|--no-update\tDo NOT! Update customer config before applying" echo -e " -n|--no-update\tDo NOT! Update customer config before applying"
echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from" echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from"
@@ -209,7 +207,7 @@ function genconfig_min-legacy {
echo -e " -a|--list-all\t\tList all Customers and their board types" echo -e " -a|--list-all\t\tList all Customers and their board types"
echo -e " -b|--boards\t\tList all board types" echo -e " -b|--boards\t\tList all board types"
echo echo
echo "Example ./iop genconfig_min-legacy eg400 OPERATORX" echo "Example ./iop genconfig eg400 OPERATORX"
echo "(if no customerconfig is chosen, iopsys config will be used)" echo "(if no customerconfig is chosen, iopsys config will be used)"
echo echo
exit 0 exit 0
@@ -339,26 +337,10 @@ function genconfig_min-legacy {
echo "" >> .config echo "" >> .config
fi fi
# hack to support custom-devices until we have deprecated this genconfig-script... # hack to support custom-devices until we have deprecated this genconfig-script...
local custom_found=false if [ -f "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" ]; then
local used_config_file cat "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" >> .config
echo "" >> .config
for config_file in feeds/*/devices/$target/config/$BOARDTYPE/config; do fi
if [ "$custom_found" = "true" ]; then
echo
echo "Error was found!"
echo "Please use only one path."
echo "Two instances of $target/config/$BOARDTYPE exists:"
echo "Path 1: $used_config_file"
echo "Path 2: $config_file"
return 1
fi
if [ -f "$config_file" ]; then
cat "$config_file" >> .config
echo "" >> .config
custom_found=true
used_config_file=$config_file
fi
done
# Special handling for targets which use TARGET_DEVICES # Special handling for targets which use TARGET_DEVICES
case "$target" in case "$target" in
@@ -373,8 +355,6 @@ function genconfig_min-legacy {
echo "CONFIG_TARGET_${target}=y" >> .config echo "CONFIG_TARGET_${target}=y" >> .config
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
echo "CONFIG_TARGET_MULTI_PROFILE=y" >> .config
echo "CONFIG_TARGET_PER_DEVICE_ROOTFS=y" >> .config
;; ;;
*) *)
echo "CONFIG_TARGET_${target}=y" >> .config echo "CONFIG_TARGET_${target}=y" >> .config
@@ -410,7 +390,7 @@ function genconfig_min-legacy {
# Set target version # Set target version
local git_version local git_version
if ! git_version="$(git describe --always $DIRTY --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
echo "ERROR: Failed getting version via git describe, exiting." >&2 echo "ERROR: Failed getting version via git describe, exiting." >&2
return 1 return 1
fi fi
@@ -464,14 +444,13 @@ function genconfig_min-legacy {
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo Current profile: echo Current profile:
cat $CURRENT_CONFIG_FILE cat $CURRENT_CONFIG_FILE
echo "Try ./iop genconfig_min-legacy -h' to get instructions if you want to change current config" echo "Try ./iop genconfig -h' to get instructions if you want to change current config"
exit 0 exit 0
else else
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
-c|--clean) export CLEAN=1;; -c|--clean) export CLEAN=1;;
-D|--no-dirty) export DIRTY="";;
-n|--no-update) export IMPORT=0;; -n|--no-update) export IMPORT=0;;
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";; -v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
-t|--target) export TARGET="$2"; shift;; -t|--target) export TARGET="$2"; shift;;
@@ -500,4 +479,4 @@ function genconfig_min-legacy {
fi fi
} }
register_command "genconfig_min-legacy" "Generate configuration for customer with manual board configuration - legacy mode" register_command "genconfig_min" "Generate configuration for customer with manual board configuration"

View File

@@ -1,29 +0,0 @@
#!/bin/bash
# Function to convert parameters to lowercase
function to_lowercase {
local params=()
for param in "$@"; do
params+=("$(tr '[:upper:]' '[:lower:]' <<< "$param")")
done
echo "${params[@]}"
}
function genconfig {
target_script="./scripts/gen_config.py"
# First convert all to lowercase
args=$(to_lowercase "$@")
# Check if an option is provided
if [[ ${args[0]} == -* ]]; then
# Convert options for target script
if [[ ${args[0]} == "-b" || ${args[0]} == "--boards" ]]; then
args=("--list")
fi
fi
${target_script} ${args[@]}
}
register_command "genconfig" "Generate configuration for board and customer"

View File

@@ -1,10 +1,646 @@
# Exported interface #!/bin/bash
update_package() {
echo "update_package is no longer supported." >&2 print_git_update()
echo "Its replacement will come soon." >&2 {
echo >&2 echo "pkg -> ${PKG_NAME}"
echo "For now update references in profiles/include/*.yml and feeds.conf.io manually." >&2 echo " PKG_BUILD_DIR = ${PKG_BUILD_DIR}"
return 1 echo " PKG_DIR = ${PKG_DIR}"
echo " PKG_SOURCE = ${PKG_SOURCE}"
echo " PKG_NAME = ${PKG_NAME}"
echo " PKG_SOURCE_URL = ${PKG_SOURCE_URL}"
echo " PKG_SOURCE_PROTO= ${PKG_SOURCE_PROTO}"
echo " PKG_SOURCE_VERSION= ${PKG_SOURCE_VERSION}"
echo " PKG_SOURCE = ${PKG_SOURCE}"
echo " PKG_SOURCE_VERSION_FILE=${PKG_SOURCE_VERSION_FILE}"
} }
register_command "update_package" "No longer used command" is_git_same()
{
git_last=$(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)
#echo "$PKG_NAME $git_last = ${PKG_SOURCE_VERSION}"
if [ "$git_last" == "${PKG_SOURCE_VERSION}" ]
then
return 0
fi
return 1
}
update_this_pkg()
{
mk_hash=$(get_makefile_hash)
if [ "$mk_hash" != "${PKG_SOURCE_VERSION}" ]
then
echo "${PKG_NAME}:"
echo " build dir = ${PKG_BUILD_DIR}"
echo " feed makefile = ${mk_hash}"
echo " stale hash = ${PKG_SOURCE_VERSION}"
echo " build git = $(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)"
echo " Git hash in package makefile and the git hash recorded from last compile of"
echo " package is different. You probably want to recompile the package"
echo " to get an up to date version in ${PKG_BUILD_DIR}/.git_update"
echo ""
echo -n " Should we continue with the update anyway? [y/N]:"
read answer
echo ""
case $answer in
y|Y)
;;
n|N|*)
return 1;;
esac
fi
echo "${PKG_NAME}:"
echo " build dir = ${PKG_BUILD_DIR}"
echo " pkg dir = ${PKG_DIR}"
echo " feed makefile = ${PKG_SOURCE_VERSION}"
echo " build git = $(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)"
echo " package is at a different git commit in build compared to feed"
echo -n " Should we update the feed and top project to reflect the new version ? [y/N]:"
read answer
echo ""
case $answer in
y|Y)
return 0;;
*)
echo ""
return 1;;
esac
}
get_makefile_hash()
{
if [ -n "$PKG_SOURCE_VERSION_FILE" ]
then
name="$PKG_SOURCE_VERSION_FILE"
else
name=Makefile
fi
grep "PKG_SOURCE_VERSION:=" ${PKG_DIR}/${name} | sed -e "s/\(^PKG_SOURCE_VERSION:=\)\(.*\)/\2/"
}
insert_hash_in_feed_makefile()
{
if [ -n "$PKG_SOURCE_VERSION_FILE" ]
then
name="$PKG_SOURCE_VERSION_FILE"
else
name=Makefile
fi
git_last=$(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)
sed -i -e "s/\(^PKG_SOURCE_VERSION:=\).*/\1${git_last}/" ${PKG_DIR}/${name}
(cd ${PKG_DIR}; git add ${name})
}
insert_version_in_feed_makefile()
{
if [ -n "$PKG_SOURCE_VERSION_FILE" ]
then
name="$PKG_SOURCE_VERSION_FILE"
else
name=Makefile
fi
last_version=$(awk -F '=' '/PKG_VERSION:=/ {print $2}' ${PKG_DIR}/${name})
echo -n "please enter version: "
read -ei "$last_version" answer
if [ -z ${answer} ]; then
return
fi
sed -i -e "s/\(^PKG_VERSION:=\).*/\1${answer}/" ${PKG_DIR}/${name}
(cd ${PKG_DIR}; git add ${name})
}
# BUG: fix if only local branche name!
branch_uptodate()
{
# $1 git repo
# $2 if it exist dont abort do the pull
(cd $1
git remote update 2>&1 >/dev/null
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
BASE=$(git merge-base @ @{u})
if [ -z "$REMOTE" ]; then
BRANCH=$(basename $(git symbolic-ref -q HEAD))
echo "You need to setup a tracking branch for $BRANCH"
exit 99
fi
if [ $LOCAL = $REMOTE ]; then
return
elif [ $LOCAL = $BASE ]; then
if [ -n "$2" ]
then
echo "Doing automatic pull on [ $1 ]"
if git pull
then
return
else
echo "Something wrong with pull. aborting, repo at"
echo " [ $1 ]"
exit 99
fi
else
echo "Local repo behind remote:"
echo "do git pull at repo"
echo " [ $1 ]"
exit 99
fi
elif [ $REMOTE = $BASE ]; then
echo "Local repo ahead of remote. A push is needed"
echo "Repo is at: $1"
echo ""
echo -n "Should we try a push ? [Y/n]:"
read answer
echo ""
case $answer in
n|N|q|Q)
exit 99;;
*)
echo -e "${Yellow}"
if ! git push origin HEAD
then
echo -e "${Color_Off}"
exit 99
fi
echo -e "${Color_Off}Push done."
;;
esac
else
echo "Diverged. not sure what you did but there is no tracking branch. "
echo "repo at [ $1 ]. fix it so that there is a tracking branch remote."
echo "Often this is related to somebody having commited to the same branch"
echo "on the server so a simple push wont work, try a 'git rebase'."
exit 99
fi
)
}
on_a_branch()
{
local repo=$1
local type=$2
(
cd $repo
name=$(git symbolic-ref -q HEAD)
if [ -z "$name" ]
then
echo "git $type repo [ $repo ] is detached."
branches=($(git branch -r --contains $(git rev-parse HEAD)))
if [ 0 == ${#branches[@]} ]
then
echo "It needs to be on a branch but git could not find any associated branch"
echo ""
echo "you need to make sure that the commit is not on a detached branch"
echo "and that the branch exist in the remote repo also. it can not be a local name"
echo "as it is about to get pushed so it can be part of system release"
exit 99
fi
echo "It needs to be on a branch. Please select one or quit if it is not in list."
echo ""
i=0
for branch in ${branches[*]}
do
echo "$i: $branch"
i=$((i + 1))
done
echo ""
echo -n "Select what branch to checkout. Q/q or N/n to quit? "
read answer
case $answer in
q|Q|n|N)
echo "Aborting!"
exit 99;;
esac
echo -e "${Yellow}"
pwd
echo "git checkout ${branches[$answer]}"
if ! git checkout -t ${branches[$answer]}
then
local_branch=$(basename ${branches[$answer]})
if ! git checkout ${local_branch}
then
echo -e "${Color_Off}"
echo "update_git aborting! something was wrong changing to branch ${branches[$answer]}"
echo "go to [ $repo ] and fix it."
exit 99
fi
fi
echo -e "${Color_Off}"
fi
)
}
git_repos_uptodate()
{
on_a_branch ${PKG_BUILD_DIR} package
on_a_branch ${PKG_DIR} feed
on_a_branch ${PWD} top
branch_uptodate ${PKG_BUILD_DIR}
branch_uptodate ${PKG_DIR} do_pull
branch_uptodate ${PWD} do_pull
}
get_feed_name()
{
echo $1 |sed -e "s|.*feeds/\([^/]*\).*|\1|"
# rest=$(dirname $1)
# base=$(basename $1)
# prev=$base
# while [ -n "$rest" ]
# do
# if [ "$base" == "feeds" ]
# then
# echo "$prev"
# fi
# done
}
create_message()
{
FORMAT="commit %H%n\
Author: %aN <%aE>%n\
Date: %ai%n\
%n\
%w(80,4,4)%s%n
%b%n\
%w()Base directory -> ${repo_PATH}/"
local FROM=${PKG_SOURCE_VERSION}
local TO=$(cd ${PKG_BUILD_DIR}; git rev-parse HEAD)
local commits=$(cd ${PKG_BUILD_DIR};git rev-list ${FROM}..${TO})
local feed=$(get_feed_name ${PKG_DIR})
echo "Update feed [ $feed ] package [ $PKG_NAME ]"
echo ""
echo "-------------------------------------------------------------------------------"
(cd ${PKG_BUILD_DIR}; git log --graph --oneline ${FROM}..${TO})
echo "-------------------------------------------------------------------------------"
for commit in $commits
do
(cd ${PKG_BUILD_DIR}; git show --stat --pretty=format:"$FORMAT" $commit)
echo "-------------------------------------------------------------------------------"
done
}
edit_file()
{
echo -en "${Red}"
echo "Here is the commit message we are going to use!"
echo "-------------------------------------------------------------------------------"
echo -en "${Color_Off}"
cat $1
echo -en "${Red}"
echo "-------------------------------------------------------------------------------"
echo -en "${Color_Off}"
echo -n "Do you want to edit the message [y/N]? "
read answer
case $answer in
y|Y)
$EDITOR $1;;
esac
}
commit_feed()
{
template=$(readlink -f $1)
edit_file $template
echo -e "${Yellow}"
(
cd ${PKG_DIR}
if git commit -F $template
then
if git push origin HEAD
then
echo -e "${Color_Off} Feed Updated!"
return
else
echo -e "${Color_Off}"
echo "something wrong push feed git ${PKG_DIR}"
exit 99
fi
else
echo -e "${Color_Off}"
echo "something wrong committing to feed git ${PKG_DIR}"
exit 99
fi
)
}
commit_feeds_config()
{
template=$(readlink -f $1)
edit_file $template
echo -e "${Yellow}"
if git commit -F $template
then
if git push origin HEAD
then
echo -e "${Color_Off}Feeds.conf updated!"
return
else
echo -e "${Color_Off}"
echo "something wrong push change to feeds.conf"
echo "try \"git remote update ; git stash ;git rebase; git push;git stash pop\""
exit 99
fi
else
echo -e "${Color_Off}"
echo "something wrong committing to feed git"
exit 99
fi
}
insert_hash_in_feeds_config()
{
local feed=$(get_feed_name ${PKG_DIR})
local TO=$(cd ${PKG_DIR}; git rev-parse HEAD)
sed -i feeds.conf -e "/ ${feed} / s/\(.*\)[;^].*/\1^${TO}/"
git add feeds.conf
}
check_packages()
{
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
echo "Now checking if any changes have been done to the packages."
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
# only scan in the build directory that is currently in use.
CPU=$(grep "CONFIG_CPU_TYPE=" .config| cut -f2 -d\")
LIBC=$(grep "CONFIG_LIBC=" .config| cut -f2 -d\")
# First scan all files in build dir for packages that have .git directories.
all_pkgs=$(find build_dir/*${CPU}*${LIBC}* -name ".git")
for pkg in `echo "$all_pkgs"`
do
pkg=$(dirname $pkg)
# check if the git in build is at same commit id as the feed makefile points out
if [ -e ${pkg}/.git_update ]
then
source ${pkg}/.git_update
fi
# print_git_update
if [ -n "${PKG_NAME}" ]
then
if ! is_git_same
then
if update_this_pkg
then
# print_git_update
git_repos_uptodate
insert_hash_in_feed_makefile
[ ${UPDATE} -eq 1 ] && insert_version_in_feed_makefile
create_message >tmp/msg
commit_feed tmp/msg
insert_hash_in_feeds_config
commit_feeds_config tmp/msg
fi
fi
fi
done
}
# now handle the target git. we have only one
feeds_hash()
{
grep -v "^#" feeds.conf | grep " $1 " | grep "\^" | sed -e "s/.*[;^]\(.*\)/\1/"
}
insert_feed_hash_in_feeds_config()
{
local feed=$1
local TO=$(cd feeds/${feed}; git rev-parse HEAD)
sed -i feeds.conf -e "/ ${feed} / s/\(.*\)[;^].*/\1^${TO}/"
git add feeds.conf
}
create_feed_message()
{
local feed=$1
local FROM=$2
local TO=$3
local FORMAT="commit %H%n\
Author: %aN <%aE>%n\
Date: %ai%n\
%n\
%w(80,4,4)%s%n
%b%n\
%w()Base directory -> feeds/$feed/"
local commits=$(cd feeds/$feed;git rev-list ${FROM}..${TO})
echo "Update feed [ $feed ]"
echo ""
echo "-------------------------------------------------------------------------------"
(cd feeds/$feed; git log --graph --oneline ${FROM}..${TO})
echo "-------------------------------------------------------------------------------"
for commit in $commits
do
(cd feeds/$feed; git show --stat --pretty=format:"$FORMAT" $commit)
echo "-------------------------------------------------------------------------------"
done
}
check_feeds()
{
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
echo "Now checking if any changes have been done to the feeds."
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
feeds="$1"
[ -n "$feeds" ] || feeds=$(grep -v "^#" feeds.conf| awk '{print $2}')
for feed in `echo $feeds`
do
feed_hash=$(feeds_hash $feed)
[ -n "$feed_hash" ] || continue
if [ -d feeds/$feed ]; then
in_git=$(cd feeds/$feed; git rev-parse HEAD)
if [ "$feed_hash" != "$in_git" ]
then
name=$(cd feeds/$feed;git symbolic-ref -q HEAD)
if [ -z "$name" ]
then
echo "Feed feeds/${feed} is at a git commit which is different from feeds.conf"
#echo "git id from feeds.conf [$feed_hash] git id from feeds/${feed} [$in_git]"
on_a_branch feeds/${feed} feed
#redo the test here and see if the feeds.conf and git is still different.
in_git=$(cd feeds/$feed; git rev-parse HEAD)
if [ "$feed_hash" = "$in_git" ]
then
continue
fi
fi
LOCAL=$(cd feeds/$feed;git rev-parse @)
REMOTE=$(cd feeds/$feed;git rev-parse @{u})
BASE=$(cd feeds/$feed;git merge-base @ @{u})
# if we are behind the remote automatically do a pull
if [ $LOCAL = $BASE ]; then
(cd feeds/$feed ; git pull 1>/dev/null)
#redo the test here and see if the feeds.conf and git is still different.
in_git=$(cd feeds/$feed; git rev-parse HEAD)
if [ "$feed_hash" = "$in_git" ]
then
continue
fi
fi
echo "Feed feeds/${feed} is at different commit than what is in feeds.conf"
#echo "git id from feeds.conf [$feed_hash] git id from feeds/${feed} [$in_git]"
echo -n "Should we update feeds.conf to reflect the new version ? [y/N]:"
read answer
case $answer in
n|N|'')
continue;;
esac
branch_uptodate feeds/${feed}
create_feed_message ${feed} $feed_hash $in_git >tmp/msg
insert_feed_hash_in_feeds_config ${feed}
commit_feeds_config tmp/msg
fi
fi
done
}
is_local_and_remote_same()
{
git remote update 2>/dev/null 1>/dev/null
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
if [ $LOCAL = $REMOTE ]
then
return
fi
local_name=$(git rev-parse --abbrev-ref @ )
remote_name=$(git rev-parse --abbrev-ref @{u} )
echo "Top repo local branch \"$local_name\" is not at same point as remote \"$remote_name\""
echo "This update script will update the feeds.conf file and for that to work it needs to"
echo "be up to date with the remote."
echo ""
echo "please run:"
echo " git pull"
echo " ./iop feeds_update"
echo ""
echo "do not forget the bootstrap. but do not run make it can delete your package in build"
exit 0
}
usage(){
echo -e "$0 [flags]"
echo -e "flags:"
echo -e " -f\tFeed to update"
echo -e " -h\tShow this help"
echo -e " -u\tUpdate package version\n"
}
# Exported interface
function update_package {
UPDATE=0
Color_Off='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
Cyan='\033[0;36m' # Cyan
White='\033[0;37m' # White
while getopts "f:hu" opt; do
case $opt in
f)
feed=$OPTARG
;;
h)
usage
exit 1
;;
u)
UPDATE=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
if [ -z "$EDITOR" ]
then
if [ -f /usr/bin/vi ]; then
EDITOR=vi
else
echo "env variable EDITOR needs to be set"
exit 1
fi
fi
# allow subshells to abort the whole program by exiting with "exit 99"
set -E
trap '[ "$?" -ne 99 ] || exit 99' ERR
is_local_and_remote_same
[ -n "$feed" ] || check_packages
check_feeds $feed
}
register_command "update_package" "Publish changes to packages and feeds"

View File

@@ -1,50 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=iopsys-analytics
PKG_RELEASE:=$(COMMITCOUNT)
PKG_LICENSE:=PROPRIETARY
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=88dd7997ed78b1ab02c2904ed90518c46a8fa26b
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
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
CATEGORY:=Utilities
TITLE:=Analytics tweaks for IOPSYS CI/CD purposes
# setting core dump limit
DEPENDS+= \
+prlimit \
# monitoring
DEPENDS+= \
+collectd \
+collectd-mod-cpu \
+collectd-mod-exec \
+collectd-mod-load \
+collectd-mod-memory \
+collectd-mod-network \
+collectd-mod-processes \
+collectd-mod-write-http \
+@PACKAGE_COLLECTD_ENCRYPTED_NETWORK \
# remote syslog
DEPENDS+= \
+syslog-ng \
+@SYSLOGNG_LOGROTATE \
endef
define Package/$(PKG_NAME)/description
Analytics tweaks for IOPSYS internal CI/CD purposes
e.g. syslog, system health, coredumps...
endef
Build/Compile=
define Package/$(PKG_NAME)/install
$(CP) -r $(PKG_BUILD_DIR)/files/* $(1)/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@@ -1,57 +0,0 @@
#
# Copyright (C) 2020-2023 Iopsys
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libdpp
PKG_VERSION:=2.0.0
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=f22959b107a8bf443d04d6261d00074b5514dfe8
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/libdpp.git
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=LGPL-2.1-only
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/libdpp/description
Library providing APIs for DPP EasyConnect frame generation and handling
endef
define Package/libdpp
TITLE:= DPP EasyConnect library (libdpp)
DEPENDS:= +libeasy +libopenssl +libgcrypt +libubox +libwifiutils
endef
MAKE_PATH:=lib
define Build/InstallDev/libdpp
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/lib/dpp_api.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/lib/dpputils.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/lib/libdpp.so* $(1)/usr/lib/
endef
define Build/InstallDev
$(call Build/InstallDev/libdpp,$(1),$(2))
endef
define Package/libdpp/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/lib/libdpp.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libdpp))

View File

@@ -24,9 +24,8 @@ include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_TARGET_brcmbca),y) ifeq ($(CONFIG_TARGET_brcmbca),y)
TARGET_PLATFORM=BROADCOM TARGET_PLATFORM=BROADCOM
CONFIG_ID=$(SUBTARGET:bcm%=BCM%) CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
CHIP_ID=$(CONFIG_ID:BCM9%=%) TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_$(CONFIG_ID) \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \ -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include -I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include
else ifeq ($(CONFIG_TARGET_x86),y) else ifeq ($(CONFIG_TARGET_x86),y)

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=libeasy PKG_NAME:=libeasy
PKG_VERSION:=7.4.3 PKG_VERSION:=7.2.100
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=ba80dcc51056772c906cac8022a2537b74959e6a PKG_SOURCE_VERSION:=32db1b79bd88eba85a3e7518dbbbd1e29f4b06d9
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libeasy.git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libeasy.git
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu> PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
@@ -28,12 +28,6 @@ TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include/openssl \ -I$(STAGING_DIR)/usr/include/openssl \
-I$(STAGING_DIR)/usr/include/libnl3 -I$(STAGING_DIR)/usr/include/libnl3
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -r --exclude=.* ~/git/libeasy/ $(PKG_BUILD_DIR)/
endef
endif
MAKE_FLAGS += \ MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS) -Wall" CFLAGS="$(TARGET_CFLAGS) -Wall"
@@ -56,13 +50,9 @@ define Build/InstallDev/libeasy
$(CP) $(PKG_BUILD_DIR)/easy.h $(1)/usr/include/easy/ $(CP) $(PKG_BUILD_DIR)/easy.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/event.h $(1)/usr/include/easy/ $(CP) $(PKG_BUILD_DIR)/event.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/utils.h $(1)/usr/include/easy/ $(CP) $(PKG_BUILD_DIR)/utils.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/bufutil.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/cryptutil.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/ecc_cryptutil.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/if_utils.h $(1)/usr/include/easy/ $(CP) $(PKG_BUILD_DIR)/if_utils.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/debug.h $(1)/usr/include/easy/ $(CP) $(PKG_BUILD_DIR)/debug.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/hlist.h $(1)/usr/include/easy/ $(CP) $(PKG_BUILD_DIR)/hlist.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/timestamp.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/libeasy*.so* $(1)/usr/lib/ $(CP) $(PKG_BUILD_DIR)/libeasy*.so* $(1)/usr/lib/
endef endef

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=libethernet PKG_NAME:=libethernet
PKG_VERSION:=7.2.107 PKG_VERSION:=7.2.105
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=9c0e9ecd62b79d4e89b4f013f04124870d237395 PKG_SOURCE_VERSION:=4a363a699c4a8024054ca095f1b7818f8bd56ded
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libethernet.git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libethernet.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
@@ -24,9 +24,8 @@ include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_TARGET_brcmbca),y) ifeq ($(CONFIG_TARGET_brcmbca),y)
TARGET_PLATFORM=BROADCOM TARGET_PLATFORM=BROADCOM
CONFIG_ID=$(SUBTARGET:bcm%=BCM%) CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
CHIP_ID=$(CONFIG_ID:BCM9%=%) TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_$(CONFIG_ID) \
-I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx \ -I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \ -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include -I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=libqos PKG_NAME:=libqos
PKG_VERSION:=7.2.106 PKG_VERSION:=7.2.105
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=02dba6571fddd9b4c5b4b671270604b4c0faf9ae PKG_SOURCE_VERSION:=61b15e0fe345186d36d0ca3212a08f384af3609b
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libqos.git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libqos.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
@@ -24,9 +24,8 @@ include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_TARGET_brcmbca),y) ifeq ($(CONFIG_TARGET_brcmbca),y)
TARGET_PLATFORM=BROADCOM TARGET_PLATFORM=BROADCOM
CONFIG_ID=$(SUBTARGET:bcm%=BCM%) CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
CHIP_ID=$(CONFIG_ID:BCM9%=%) TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_$(CONFIG_ID) \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \ -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include -I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include
else ifeq ($(CONFIG_TARGET_x86),y) else ifeq ($(CONFIG_TARGET_x86),y)

View File

@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libvoice-airoha PKG_NAME:=libvoice-airoha
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_VERSION:=1.0.12 PKG_VERSION:=1.0.8
PKG_LICENSE:=PROPRIETARY PKG_LICENSE:=PROPRIETARY
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE
@@ -17,7 +17,7 @@ LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
PKG_SOURCE_VERSION:=68f0b4f3edecea9b8f05e72b6bbf3952d3946b7c PKG_SOURCE_VERSION:=a6a70c7259ba440f7587f4f79d29e8caecafa544
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif endif

View File

@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libvoice-broadcom PKG_NAME:=libvoice-broadcom
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_VERSION:=1.0.9 PKG_VERSION:=1.0.6
PKG_LICENSE:=PROPRIETARY PKG_LICENSE:=PROPRIETARY
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE
@@ -17,7 +17,7 @@ LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
PKG_SOURCE_VERSION:=3a8d0954ca351a1f8f669dc2f3d294409b90f091 PKG_SOURCE_VERSION:=14e626db4e8943c100602e6e73e0b1652ff3faca
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif endif
@@ -28,7 +28,7 @@ PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR) LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
export BCM_CHIP_ID:=$(SUBTARGET) export CONFIG_BCM_CHIP_ID
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libvoice-d2 PKG_NAME:=libvoice-d2
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_VERSION:=1.1.4 PKG_VERSION:=1.0.15
PKG_LICENSE:=PROPRIETARY PKG_LICENSE:=PROPRIETARY
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE
@@ -17,7 +17,7 @@ LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
PKG_SOURCE_VERSION:=17388c54e14d8505254c0640067cf697760310ee PKG_SOURCE_VERSION:=499abc3c7932bf5187bce6cabeffdc0c0f6eada8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
endif endif

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=libwifi PKG_NAME:=libwifi
PKG_VERSION:=7.4.42 PKG_VERSION:=7.4.6
LOCAL_DEV=0 LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=c3efa4ecd3bbf8247bc1b4c3e0ff512e42649531 PKG_SOURCE_VERSION:=57348d9a901c33650ebfe8b5d8f35a0b57d12a89
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libwifi.git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libwifi.git
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu> PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
@@ -26,9 +26,8 @@ include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_TARGET_brcmbca),y) ifeq ($(CONFIG_TARGET_brcmbca),y)
TARGET_PLATFORM=BROADCOM TARGET_PLATFORM=BROADCOM
TARGET_WIFI_TYPE=BROADCOM TARGET_WIFI_TYPE=BROADCOM
CONFIG_ID=$(SUBTARGET:bcm%=BCM%) CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
CHIP_ID=$(CONFIG_ID:BCM9%=%) TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_$(CONFIG_ID) \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \ -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include -I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include
else ifeq ($(CONFIG_TARGET_x86),y) else ifeq ($(CONFIG_TARGET_x86),y)
@@ -143,7 +142,7 @@ define Package/libwifi/config
config LIBWIFI_USE_CTRL_IFACE config LIBWIFI_USE_CTRL_IFACE
bool "Create UNIX sockets to interface with hostapd/wpa_supplicant" bool "Create UNIX sockets to interface with hostapd/wpa_supplicant"
default y default n
endif endif
endef endef

View File

@@ -52,8 +52,5 @@ config AGENT_OPER_CHANNEL_CHANGE_RELAY_MCAST
bool "Use config opt to determine if Oper Channel Report CMDU is send as relayed multicast or directly to controller" bool "Use config opt to determine if Oper Channel Report CMDU is send as relayed multicast or directly to controller"
default y default y
config AGENT_USE_LIBDPP
bool "Depend on libdpp for DPP EasyConnect"
endmenu endmenu
endif endif

View File

@@ -5,9 +5,9 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=map-agent PKG_NAME:=map-agent
PKG_VERSION:=4.5.1.15.1 PKG_VERSION:=4.3.7.2
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=e0538bb1eb0b85ac085e6abb61ebbf8e1712f1e7 PKG_SOURCE_VERSION:=406b484e33f5f9862f2adcc95c8e8231a7bde87c
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu> PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
PKG_LICENSE:=BSD-3-Clause PKG_LICENSE:=BSD-3-Clause
@@ -28,19 +28,16 @@ define Package/map-agent
CATEGORY:=Utilities CATEGORY:=Utilities
TITLE:=WiFi multi-AP Agent (EasyMesh R2) TITLE:=WiFi multi-AP Agent (EasyMesh R2)
DEPENDS:=+libwifi +libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 \ DEPENDS:=+libwifi +libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 \
+ieee1905-map-plugin +ip-bridge +AGENT_USE_LIBDPP:libdpp +map-plugin +ip-bridge
endef endef
ifeq ($(CONFIG_AGENT_USE_LIBDPP),y)
TARGET_CFLAGS += -DUSE_LIBDPP
endif
define Package/dynbhd define Package/dynbhd
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
TITLE:=Dynamic Backhaul Daemon TITLE:=Dynamic Backhaul Daemon
DEPENDS:=+libwifi +libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 \ DEPENDS:=+libwifi +libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 \
+ieee1905-map-plugin +map-agent +map-plugin +map-agent
endef endef

View File

@@ -1,13 +1,13 @@
config agent 'agent' config agent 'agent'
option enabled '0' option enabled '0'
option debug '0' option debug '0'
option profile '3' option profile '4'
option al_bridge 'br-lan' option al_bridge 'br-lan'
option netdev 'wlan' option netdev 'wlan'
option island_prevention '0' option island_prevention '0'
option eth_onboards_wifi_bhs '1' option eth_onboards_wifi_bhs '1'
option scan_on_boot_only '0' option scan_on_boot_only '0'
option chan_ch_relay_mcast '0' option chan_ch_relay_mcast '1'
option guest_isolation '1' option guest_isolation '1'
list map_port 'all' list map_port 'all'
# option controller_macaddr '0a:1b:2c:3d:4e:50' # option controller_macaddr '0a:1b:2c:3d:4e:50'

View File

@@ -69,7 +69,7 @@ fi
remove_from_bridge() { remove_from_bridge() {
config_get ifname "$section" ifname config_get ifname "$section" ifname
[ -n "$ifname" ] && brctl delif ${al_bridge} ${ifname} [ -n "$ifname" ] && ubus call network.interface.${al_brnet} remove_device '{"name":"$ifname"}'
} }
update_bstas() { update_bstas() {

View File

@@ -19,8 +19,8 @@ is_broadcom() {
} }
is_qualcomm() { is_qualcomm() {
[ -d /sys/module/ath12k ] && return 0 [ -f /proc/device-tree/compatible ] || return
return 1 strings /proc/device-tree/compatible | grep -qE '^(qcom,|ipq,)'; return
} }
generate_multiap_config() { generate_multiap_config() {
@@ -80,7 +80,6 @@ generate_multiap_config() {
ifprefix="wlan0%-" ifprefix="wlan0%-"
ifname="wlan${devidx}" ifname="wlan${devidx}"
ifname_bh="wlan${devidx}-1" ifname_bh="wlan${devidx}-1"
ap_follow_sta_dfs="1"
else else
ifprefix="wlan%-" ifprefix="wlan%-"
ifname="wlan$devidx" ifname="wlan$devidx"
@@ -90,7 +89,6 @@ generate_multiap_config() {
if [ $generate_mapagent_config -eq 1 ]; then if [ $generate_mapagent_config -eq 1 ]; then
uci set mapagent.agent.ifprefix="$ifprefix" uci set mapagent.agent.ifprefix="$ifprefix"
uci set mapagent.agent.brcm_setup="$brcm_setup" uci set mapagent.agent.brcm_setup="$brcm_setup"
uci set mapagent.agent.ap_follow_sta_dfs="$ap_follow_sta_dfs"
uci add mapagent radio uci add mapagent radio
uci set mapagent.@radio[-1].device="$device" uci set mapagent.@radio[-1].device="$device"
uci set mapagent.@radio[-1].band="$mode_band" uci set mapagent.@radio[-1].band="$mode_band"

View File

@@ -26,9 +26,5 @@ config CONTROLLER_EASYMESH_VENDOR_EXT_OUI
enabled through CONTROLLER_EASYMESH_VENDOR_EXT. Please provide the Vendor's OUI enabled through CONTROLLER_EASYMESH_VENDOR_EXT. Please provide the Vendor's OUI
through which such features would be exposed. through which such features would be exposed.
config CONTROLLER_USE_LIBDPP
bool "Depend on libdpp for DPP EasyConnect"
endmenu endmenu
endif endif

View File

@@ -5,9 +5,9 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=map-controller PKG_NAME:=map-controller
PKG_VERSION:=4.6.0.5.2 PKG_VERSION:=4.3.3.1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=27b2dabe45811909122a90e185bab3860a340084 PKG_SOURCE_VERSION:=1faf0fce0d524f626638e08bd45348d11631f390
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu> PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
LOCAL_DEV=0 LOCAL_DEV=0
@@ -27,15 +27,9 @@ define Package/map-controller
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
TITLE:=WiFi Multi-AP Controller (EasyMesh R2) TITLE:=WiFi Multi-AP Controller (EasyMesh R2)
DEPENDS:=+libuci +libubox +ubus +libeasy +libwifiutils +libieee1905 +ieee1905 +ieee1905-map-plugin \ DEPENDS:=+libuci +libubox +ubus +libeasy +libwifiutils +libieee1905 +ieee1905 +map-plugin
+CONTROLLER_USE_LIBDPP:libdpp
endef endef
ifeq ($(CONFIG_CONTROLLER_USE_LIBDPP),y)
TARGET_CFLAGS += -DUSE_LIBDPP
endif
define Package/map-controller/description define Package/map-controller/description
This package provides WiFi MultiAP Controller as per the EasyMesh-R2 specs. This package provides WiFi MultiAP Controller as per the EasyMesh-R2 specs.
endef endef

View File

@@ -1,6 +1,6 @@
config controller 'controller' config controller 'controller'
option enabled '1' # may be modified by other package start-up scripts (i.e. map-agent) option enabled '1' # may be modified by other package start-up scripts (i.e. map-agent)
option profile '3' option profile '4'
option registrar '2 5 6' option registrar '2 5 6'
option debug '0' option debug '0'
option bcn_metrics_max_num '10' option bcn_metrics_max_num '10'
@@ -59,7 +59,7 @@ config ap
config ap config ap
option band '2' option band '2'
option ssid 'MAP-$BASEMAC_ADDR-BH' option ssid 'MAP-$BASEMAC_ADDR-BH-2.4GHz'
option encryption 'sae' option encryption 'sae'
option key '$WIFI_BH_KEY' option key '$WIFI_BH_KEY'
option type 'backhaul' option type 'backhaul'
@@ -67,7 +67,7 @@ config ap
config ap config ap
option band '5' option band '5'
option ssid 'MAP-$BASEMAC_ADDR-BH' option ssid 'MAP-$BASEMAC_ADDR-BH-5GHz'
option encryption 'sae' option encryption 'sae'
option key '$WIFI_BH_KEY' option key '$WIFI_BH_KEY'
option type 'backhaul' option type 'backhaul'
@@ -75,7 +75,7 @@ config ap
config ap config ap
option band '6' option band '6'
option ssid 'MAP-$BASEMAC_ADDR-BH' option ssid 'MAP-$BASEMAC_ADDR-BH-6GHz'
option encryption 'sae' option encryption 'sae'
option key '$WIFI_BH_KEY' option key '$WIFI_BH_KEY'
option type 'backhaul' option type 'backhaul'

View File

@@ -5,7 +5,7 @@
WIFI_BH_KEY=$(openssl rand -rand /dev/urandom -hex 64 2>/dev/null | openssl dgst -hex -sha256 | cut -d " " -f 2) WIFI_BH_KEY=$(openssl rand -rand /dev/urandom -hex 64 2>/dev/null | openssl dgst -hex -sha256 | cut -d " " -f 2)
WIFI_BH_KEY=${WIFI_BH_KEY::-1} WIFI_BH_KEY=${WIFI_BH_KEY::-1}
BASEMAC_ADDR="$(fw_printenv -n ethaddr | tr -d ':' | tr 'a-z' 'A-Z')" BASEMAC_ADDR="$(fw_printenv -n ethaddr | tr -d ':')"
[ ${#BASEMAC_ADDR} -eq 12 ] || BASEMAC_ADDR="$(db -q get device.deviceinfo.BaseMACAddress | tr -d ':')" [ ${#BASEMAC_ADDR} -eq 12 ] || BASEMAC_ADDR="$(db -q get device.deviceinfo.BaseMACAddress | tr -d ':')"
WIFI_FH_KEY="$(db get hw.board.wpa_key)" WIFI_FH_KEY="$(db get hw.board.wpa_key)"

View File

@@ -89,24 +89,15 @@ interfaces_ok(){
# check if upstream untagged # check if upstream untagged
IFS=" " IFS=" "
for itf in $up_interf; do for itf in $up_interf; do
# check if there exist a interface section for this upstream interface, if yes the # check if there exist a device section for this upstream interface, if yes the
# do nothing, if no then generate config as mcast config is outdated # do nothing, if no then split the it at . and use the native interface as
local dev_section=$(uci show network | grep -E "\.device=\'$itf\'" | cut -d'.' -f2) # upstream interface
dev_section=$(ubus call uci get '{"config":"network", "type":"device", "match":{"name":"'"$itf"'"}}' | jsonfilter -e @.values | jq keys[])
# mcast config is outdated, simply generate as per new logic # mcast config is outdated, simply generate as per new logic
if [ -z "$dev_section" ]; then if [ -z "$dev_section" ]; then
# check if the itf is a native interface && return 1 # check if the itf is a native interface && return 1
return 1 [ -f "/proc/net/vlan/$itf" ] || return 1
else
section_type=$(uci get network.$dev_section)
if [ "$section_type" == "interface" ]; then
# interface section exits, hence, sync has already happened
# nothing to do further, just return
return 0
else
# mcast config is outdated
return 1
fi
fi fi
done done
return 0 return 0

View File

@@ -15,7 +15,7 @@ snooping_bridges=
__device_is_bridge() { __device_is_bridge() {
local device="$2" local device="$2"
local devsec__="$(uci show network | grep -F ".name='$device'" | cut -d'.' -f2)" local devsec__="$(uci show network | grep name=.*$device | cut -d'.' -f2)"
local sectype="$(uci -q get network.$devsec__)" local sectype="$(uci -q get network.$devsec__)"
local devtype="$(uci -q get network.$devsec__.type)" local devtype="$(uci -q get network.$devsec__.type)"
[ "$sectype" != "device" -o "$devtype" != "bridge" ] && return 1 [ "$sectype" != "device" -o "$devtype" != "bridge" ] && return 1
@@ -302,12 +302,7 @@ config_mcproxy_instance() {
# for snooping to work we should enable it on the bridge, doing it from # for snooping to work we should enable it on the bridge, doing it from
# here instead of from inside network config # here instead of from inside network config
if [ "$downstreams" != "$snooping_bridges" ]; then if [ "$downstreams" != "$snooping_bridges" ]; then
if [ "$mcast_mode" == "0" ]; then config_sysfs_mcast_snooping "$downstreams" 1
config_sysfs_mcast_snooping "$downstreams" 0
else
config_sysfs_mcast_snooping "$downstreams" 1
fi
[ -n $fast_leave ] && [ -n $fast_leave ] &&
config_sysfs_mcast_fastleave "$downstreams" "$fast_leave" config_sysfs_mcast_fastleave "$downstreams" "$fast_leave"
config_sysfs_mcast_flood "$downstreams" "$mcast_mode" config_sysfs_mcast_flood "$downstreams" "$mcast_mode"
@@ -316,16 +311,6 @@ config_mcproxy_instance() {
PROG_PARAMS="${PROG_PARAMS} -f ${CONFFILE}${PROG_PARAMS_SEPARATOR}" PROG_PARAMS="${PROG_PARAMS} -f ${CONFFILE}${PROG_PARAMS_SEPARATOR}"
} }
disable_snooping_iface() {
local iface="$(uci -q get network.$1.name)"
config_sysfs_mcast_snooping "$iface" 0
}
disable_snooping() {
config_load network
config_foreach disable_snooping_iface device
}
config_snooping() { config_snooping() {
local protocol="$1" local protocol="$1"
@@ -398,7 +383,6 @@ config_snooping() {
} }
config_mcproxy() { config_mcproxy() {
disable_snooping
if [ "$igmp_p_enable" == "1" ]; then if [ "$igmp_p_enable" == "1" ]; then
config_mcproxy_instance igmp "$igmp_p_version" config_mcproxy_instance igmp "$igmp_p_version"
elif [ "$igmp_s_enable" == "1" ]; then elif [ "$igmp_s_enable" == "1" ]; then

View File

@@ -11,7 +11,6 @@
* Erik Karlsson - initial implementation * Erik Karlsson - initial implementation
*/ */
#define _GNU_SOURCE
#include <string.h> #include <string.h>
#include <shadow.h> #include <shadow.h>
#include <crypt.h> #include <crypt.h>

View File

@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=netmode PKG_NAME:=netmode
PKG_VERSION:=1.0.1 PKG_VERSION:=0.3.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0-only PKG_LICENSE:=GPL-2.0-only

View File

@@ -1,3 +1,10 @@
config netmode global config netmode global
option enabled 0 option enabled 0
# option mode 'router' # option mode 'router'
#config testnet testnet
# option enabled 1
# option destination '8.8.8.8'
#config shiftrange shiftrange
# option enabled 1

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# do not start testnet if the feature is explicitly disabled # do not start testnet if the feature is explicitly disabled
[ "$(uci -q get testnet.global.enabled)" = "0" ] && exit 0 [ "$(uci -q get netmode.testnet.enabled)" = "0" ] && exit 0
[ "$ACTION" == "ifup" -o "$ACTION" == "ifdown" ] || exit 0 [ "$ACTION" == "ifup" -o "$ACTION" == "ifdown" ] || exit 0
@@ -14,4 +14,8 @@ interface_check() {
} }
interface_check interface_check
/etc/init.d/testnet reload if [ -n "$(pgrep -f testnet)" ]; then
testnet once
else
testnet &
fi

View File

@@ -0,0 +1,252 @@
#!/bin/sh
# this scripts shifts the lan network prefixes
# if a wan interface has the same network prefix.
# do not shift range if the feature is explicitly disabled
[ "$(uci -q get netmode.shiftrange.enabled)" == "0" ] && exit 0
. /lib/functions.sh
. /lib/functions/network.sh
LOCKFILE="/tmp/70-shiftrange.lock"
RESTRICTED_NETS=""
ALL_NETS=""
#####
##### initial functions
#####
initial_check()
{
# run only on ifup
[ "$ACTION" == "ifup" ] || exit 0
# run only for uplink (not is_lan) interfaces
local islan="$(uci -q get network.$INTERFACE.is_lan)"
[ "$islan" != "1" ] || exit 0
# run only if the uplink interface has a configured protocol
local proto="$(uci -q get network.$INTERFACE.proto)"
[ "$proto" != "none" ] || exit 0
}
finish()
{
lock -u $LOCKFILE
rm -f $LOCKFILE
}
# just one instance of this script at a time
just_one_instance()
{
local counter=0
local limit=10
#wait for the lock to become free
while [ -e $LOCKFILE ] ; do
sleep 1
counter=$((counter + 1))
[ "$counter" -gt "$limit" ] && exit 1
done
lock $LOCKFILE
trap finish EXIT INT TERM
}
#####
##### helper functions
#####
#given a an ip and a mask in the form of "192.168.1.1/24"
#return the network address like "192.168.1.0/24"
get_network_address()
{
local ip="$1"
[ -z "$ip" ] && return
local prefix=${ip##*/}
local ip1=${ip%%.*} ; ip=${ip#*.*}
local ip2=${ip%%.*} ; ip=${ip#*.*}
local ip3=${ip%%.*} ; ip=${ip#*.*}
local ip4=${ip%%/*}
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
local mask=$((0xFFFFFFFF >> (32 - $prefix) << (32 - $prefix)))
local network=$(($ip & $mask))
local n1=$((($network & 0xFF000000) >> 24))
local n2=$((($network & 0x00FF0000) >> 16))
local n3=$((($network & 0x0000FF00) >> 8))
local n4=$(( $network & 0x000000FF))
echo "$n1.$n2.$n3.$n4/$prefix"
}
#given a network address (192.168.1.0/24)
#find the next network address (192.168.2.0/24)
next_network_address()
{
local ip=$1
local prefix=${ip##*/}
local ip1=${ip%%.*} ; ip=${ip#*.*}
local ip2=${ip%%.*} ; ip=${ip#*.*}
local ip3=${ip%%.*} ; ip=${ip#*.*}
local ip4=${ip%%/*}
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
local one="$((1 << (32-$prefix)))"
local new=$(($ip + $one))
local n1=$((($new & 0xFF000000) >> 24))
local n2=$((($new & 0x00FF0000) >> 16))
local n3=$((($new & 0x0000FF00) >> 8))
local n4=$(( $new & 0x000000FF))
echo "$n1.$n2.$n3.$n4/$prefix"
}
# given a network address and a prefix (192.168.2.0/24)
# return the first host ip available (192.168.2.1)
first_host_in_network ()
{
local ip=$1
local prefix=${ip##*/}
local ip1=${ip%%.*} ; ip=${ip#*.*}
local ip2=${ip%%.*} ; ip=${ip#*.*}
local ip3=${ip%%.*} ; ip=${ip#*.*}
local ip4=${ip%%/*}
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
local new=$(($ip + 1))
local n1=$((($new & 0xFF000000) >> 24))
local n2=$((($new & 0x00FF0000) >> 16))
local n3=$((($new & 0x0000FF00) >> 8))
local n4=$(( $new & 0x000000FF))
echo "$n1.$n2.$n3.$n4"
}
# given a network address,
# find the next available network address.
shift_range()
{
local net="$1"
while true ; do
if [ "$RESTRICTED_NETS" == "${RESTRICTED_NETS//$net/}" ] && [ "$ALL_NETS" == "${ALL_NETS//$net/}" ]; then
# found a net that is not in restricted nets nor in all nets
break
fi
net=$(next_network_address $net)
done
echo "$net"
}
#####
##### parse all interfaces section
#####
# RESTRICTED_NETS = all the IPs on wan interfaces
# ALL_NETS = all the IPs on any interface
parse_interface()
{
local interface=$1
local nets="" # "192.168.1.1/24"
local networks="" # "192.168.1.0/24"
config_get is_lan $interface is_lan
network_get_subnets nets $interface
for n in $nets ; do
networks="$networks $(get_network_address $n)"
done
[ "$is_lan" != "1" ] && RESTRICTED_NETS="$RESTRICTED_NETS $networks"
ALL_NETS="$ALL_NETS $networks"
}
# parse all the interfaces
# get all the IPs on wan interfaces and store them in restrict_nets
# get all the IPs on all interfaces and store them in ALL_NETS
parse_interfaces()
{
config_foreach parse_interface "interface"
}
#####
##### parse all lan interfaces section
#####
parse_lan()
{
local interface=$1
local nets=""
local ips=""
local newips=""
local ips_changed=0
[ "$interface" == "loopback" ] && return
config_get is_lan $interface is_lan
[ "$is_lan" == "1" ] || return
network_get_subnets ips $interface
for ip in $ips ; do
net="$(get_network_address $ip)"
if [ "$RESTRICTED_NETS" == "${RESTRICTED_NETS//$net/}" ] ; then
# net is not in restricted nets
# append ip to newips
[ -z "$newips" ] && newips="${ip%/*}" || newips="$newips ${ip%/*}"
continue
fi
#net is in RESTRICTED_NETS
local newnet=$(shift_range $net)
local newip="$(first_host_in_network $newnet)"
# append newip to newips
[ -z "$newips" ] && newips="$newip" || newips="$newips $newip"
ips_changed=1
logger "$0: Changing the ip on interface $interface from $ip to $newip/${newnet##*/}"
echo "$0: Changing the ip on interface $interface from $ip to $newip/${newnet##*/}" >/dev/console
done
#assign the new ips
if [ "$ips_changed" == "1" ] ; then
uci -q set network.$interface.ipaddr="$newips"
fi
}
# parse all the interface with is_lan=1
parse_lans()
{
config_foreach parse_lan "interface"
}
#####
##### main
#####
main()
{
initial_check
just_one_instance
config_load network
parse_interfaces
parse_lans
if [ -n "$(uci changes network)" ] ; then
ubus call uci commit '{"config":"network"}'
fi
}
main $@

View File

@@ -1,110 +0,0 @@
#!/bin/sh
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
source "/etc/device_info"
l2_mcast_config() {
# configure L2 mcast config for snooping
logger -s -p user.info -t "netmode" "Generating L2 mcast configuration"
# remove proxy sections
uci -q delete mcast.igmp_proxy_1
uci -q delete mcast.mc_proxy_MLD
# add igmp_snooping section
uci -q set mcast.igmp_snooping_1=snooping
uci -q set mcast.igmp_snooping_1.enable='1'
uci -q set mcast.igmp_snooping_1.proto='igmp'
uci -q set mcast.igmp_snooping_1.version='2'
uci -q set mcast.igmp_snooping_1.robustness='2'
uci -q set mcast.igmp_snooping_1.query_interval='125'
uci -q set mcast.igmp_snooping_1.query_response_interval='100'
uci -q set mcast.igmp_snooping_1.last_member_query_interval='10'
uci -q set mcast.igmp_snooping_1.fast_leave='1'
uci -q set mcast.igmp_snooping_1.snooping_mode='2'
uci -q set mcast.igmp_snooping_1.interface='br-lan'
uci -q add_list mcast.igmp_snooping_1.filter='239.0.0.0/8'
# add mld_snooping section
uci -q set mcast.mld_snooping_1=snooping
uci -q set mcast.mld_snooping_1.enable='1'
uci -q set mcast.mld_snooping_1.proto='mld'
uci -q set mcast.mld_snooping_1.version='2'
uci -q set mcast.mld_snooping_1.robustness='2'
uci -q set mcast.mld_snooping_1.query_interval='125'
uci -q set mcast.mld_snooping_1.query_response_interval='100'
uci -q set mcast.mld_snooping_1.last_member_query_interval='10'
uci -q set mcast.mld_snooping_1.fast_leave='1'
uci -q set mcast.mld_snooping_1.snooping_mode='2'
uci -q set mcast.mld_snooping_1.interface='br-lan'
uci -q commit mcast
}
l2_network_config() {
logger -s -p user.info -t "netmode" "Generating L2 network configuration"
# Configure L2 Network Mode
uci -q delete network.lan
uci -q delete network.wan
uci -q delete network.wan6
uci -q set network.lan=interface
uci -q set network.lan.proto='dhcp'
uci -q set network.lan.device='br-lan'
uci -q set network.lan.force_link='1'
uci -q set network.lan6=interface
uci -q set network.lan6.proto='dhcpv6'
uci -q set network.lan6.device='@lan'
uci -q set network.lan6.reqprefix='no'
uci -q delete network.br_lan.ports
uci -q set network.br_lan.bridge_empty='1'
add_port_to_br_lan() {
port="$1"
[ -n "$port" -a -d /sys/class/net/$port ] || continue
uci add_list network.br_lan.ports="$port"
}
if [ -f /etc/board.json ]; then
json_load_file /etc/board.json
json_select network
json_select lan
if json_is_a ports array; then
json_for_each_item add_port_to_br_lan ports
else
json_get_var device device
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
fi
json_select ..
json_select wan 2>/dev/null
json_get_var device device
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
json_cleanup
fi
uci -q commit network
# Disable DHCP Server
uci -q set dhcp.lan.ignore=1
uci -q commit dhcp
/etc/init.d/odhcpd disable
# Disable SSDPD
uci -q set ssdpd.ssdp.enabled="0"
uci -q commit ssdpd
# Update CWMP Agent WAN Interface
uci -q set cwmp.cpe.default_wan_interface="lan"
uci -q commit cwmp
}
network_mode="$(fw_printenv -n netmode 2>/dev/null)"
case "$network_mode" in
layer2|extender)
l2_network_config
l2_mcast_config
;;
esac

View File

@@ -14,17 +14,14 @@ test_connection() {
local defroute="$(ip r | grep default | awk '{print$3}' | head -1)" local defroute="$(ip r | grep default | awk '{print$3}' | head -1)"
local def6route="$(ip -f inet6 r | grep default | awk '{print$3}')" local def6route="$(ip -f inet6 r | grep default | awk '{print$3}')"
local ping6dev="$(ip -f inet6 r | grep default | awk '{print$5}')" local ping6dev="$(ip -f inet6 r | grep default | awk '{print$5}')"
local resolvfile="$(uci -q get dhcp.@dnsmasq[0].resolvfile)"
if [ -n "$addr" ]; then if [ -n "$addr" ]; then
ping -q -w 5 -c 1 $addr >/dev/null 2>&1 && return 0 ping -q -w 5 -c 1 $addr >/dev/null 2>&1 && return 0
elif [ -n "$defroute" ]; then elif [ -n "$defroute" ]; then
ping -q -w 5 -c 1 $defroute >/dev/null 2>&1 && return 0 ping -q -w 5 -c 1 $defroute >/dev/null 2>&1 && return 0
if [ -e "$resolvfile" ]; then for nmsrv in $(grep nameserver /var/resolv.conf.auto | awk '{print$2}'); do
for nmsrv in $(grep nameserver "$resolvfile" | awk '{print$2}'); do ping -q -w 5 -c 1 $nmsrv >/dev/null 2>&1 && return 0
ping -q -w 5 -c 1 $nmsrv >/dev/null 2>&1 && return 0 done
done
fi
elif [ -n "$def6route" -a -n "$ping6dev" ]; then elif [ -n "$def6route" -a -n "$ping6dev" ]; then
ndisc6 -w 5 -1 $def6route $ping6dev >/dev/null 2>&1 && return 0 ndisc6 -w 5 -1 $def6route $ping6dev >/dev/null 2>&1 && return 0
fi fi
@@ -35,9 +32,9 @@ internet_test() {
local link dest local link dest
# use the destination address given in config for connectivity check # use the destination address given in config for connectivity check
dest="$(uci -q get testnet.global.destination)" dest="$(uci -q get netmode.testnet.destination)"
# for backwards compatibility # for backwards compatibility
[ -n "$dest" ] || dest="$(uci -q get system.@system[0].netping_addr)" [ -n "$dest" ] || dest="$(uci -q get diagnostics.@connectivity[0].destination)"
test_connection $dest test_connection $dest

View File

@@ -22,12 +22,4 @@ config OBUSPA_CONTROLLER_MTP_VERIFY
config OBUSPA_ENABLE_TEST_CONTROLLER config OBUSPA_ENABLE_TEST_CONTROLLER
bool "Adds a test controller by default" bool "Adds a test controller by default"
default n default n
config OBUSPA_MAX_CONTROLLERS_NUM
int "The maximum number of controllers to be supported"
range 1 10
default 5
help
This value must be in range of 1 to 10. (default 5)
endif endif

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=obuspa PKG_NAME:=obuspa
PKG_VERSION:=7.0.5.16 PKG_VERSION:=7.0.4.11
LOCAL_DEV:=0 LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1) ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
PKG_SOURCE_VERSION:=8249b1e9ae996ed45ec5edcd1adc128bd810a45b PKG_SOURCE_VERSION:=1211494650d170cc23e7d041dd5bff260530080e
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu> PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
@@ -32,7 +32,7 @@ define Package/obuspa
SUBMENU:=TRx69 SUBMENU:=TRx69
TITLE:=USP agent TITLE:=USP agent
MENU:=1 MENU:=1
DEPENDS:=+libopenssl +libuci +libblobmsg-json +libcurl +libsqlite3 +libubox +libubus +libmosquitto-ssl +libwebsockets-openssl +ca-certificates DEPENDS:=+libopenssl +libuci +libblobmsg-json +libcurl +libsqlite3 +libubox +libubus +libmosquitto-ssl +libwebsockets-openssl
endef endef
define Package/obuspa/description define Package/obuspa/description
@@ -81,14 +81,10 @@ else
CMAKE_OPTIONS += -DENABLE_WEBSOCKETS=OFF CMAKE_OPTIONS += -DENABLE_WEBSOCKETS=OFF
endif endif
ifdef $(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
TARGET_CFLAGS += -DOBUSPA_MAX_CONTROLLERS_NUM=$(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
endif
ifeq ($(LOCAL_DEV),1) ifeq ($(LOCAL_DEV),1)
define Build/Prepare define Build/Prepare
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/ $(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
$(Build/Patch) $(Build/Patch)
endef endef
endif endif

View File

@@ -2,12 +2,12 @@ config obuspa 'global'
option enabled '1' option enabled '1'
option debug '1' option debug '1'
option dhcp_discovery '1' option dhcp_discovery '1'
option log_level '1' option log_level '2'
option prototrace '0' option prototrace '0'
option db_file '/etc/obuspa/usp.db' option db_file '/etc/obuspa/usp.db'
option role_file '/etc/obuspa/roles.json' option role_file '/etc/obuspa/roles.json'
option dm_caching_exclude '/etc/obuspa/dmcaching_exclude.json' option dm_caching_exclude '/etc/obuspa/dmcaching_exclude.json'
option trust_cert '/etc/ssl/cert.pem' #option trust_cert '/etc/obuspa/rootCA.pem'
#option client_cert '/etc/obuspa/client.pem' #option client_cert '/etc/obuspa/client.pem'
#option log_dest '/tmp/obuspa.log' #option log_dest '/tmp/obuspa.log'

View File

@@ -92,10 +92,10 @@ get_base_path()
count=0 count=0
if [ -f "${DB_DUMP}" ]; then if [ -f "${DB_DUMP}" ]; then
path=$(grep -E "${refpath}\d+.Alias \"${value}\"" ${DB_DUMP}) path=$(grep "${refpath}\d.Alias \"${value}\"" ${DB_DUMP})
path=${path%.*} path=${path%.*}
if [ -z "${path}" ]; then if [ -z "${path}" ]; then
path=$(grep -oE "${refpath}\d+" ${DB_DUMP} |sort -r|head -n 1) path=$(grep -o "${refpath}\d" ${DB_DUMP} |sort -r|head -n 1)
if [ -n "${path}" ]; then if [ -n "${path}" ]; then
count=${path##*.} count=${path##*.}
count=$(( count + 1 )) count=$(( count + 1 ))
@@ -122,9 +122,9 @@ get_refrence_path()
path="" path=""
if [ -f "${DB_DUMP}" ]; then if [ -f "${DB_DUMP}" ]; then
path=$(grep -E "${dmref}\d+.Alias " ${DB_DUMP}|grep -w "${value}") path=$(grep "${dmref}\d.Alias " ${DB_DUMP}|grep -w "${value}")
elif [ -f "${RESET_FILE}" ]; then elif [ -f "${RESET_FILE}" ]; then
path=$(grep -E "${dmref}\d+.Alias " ${RESET_FILE}|grep -w "${value}") path=$(grep "${dmref}\d.Alias " ${RESET_FILE}|grep -w "${value}")
fi fi
path=${path%.*} path=${path%.*}
echo "${path}" echo "${path}"
@@ -728,13 +728,13 @@ get_instances_from_db_dump()
{ {
local obj inst local obj inst
obj="${1}\d+" obj="${1}\d"
if [ ! -f "${DB_DUMP}" ]; then if [ ! -f "${DB_DUMP}" ]; then
echo "" echo ""
return 0; return 0;
fi fi
inst="$(grep -oE "${obj}" "${DB_DUMP}"|uniq)" inst="$(grep -oe "${obj}" "${DB_DUMP}"|uniq)"
echo "$inst" echo "$inst"
} }
@@ -942,7 +942,7 @@ check_n_delete_db()
r="${3}" r="${3}"
sec="${sec/${t}_/cpe-}" sec="${sec/${t}_/cpe-}"
path=$(grep -E "${r}\d+.Alias \"${sec}\"" ${DB_DUMP}) path=$(grep "${r}\d.Alias \"${sec}\"" ${DB_DUMP})
path=${path%.*} path=${path%.*}
delete_sql_db_entry_with_pattern "${path}" delete_sql_db_entry_with_pattern "${path}"

View File

@@ -61,516 +61,7 @@
{ {
"object": "Device.", "object": "Device.",
"perm": [ "perm": [
"PERMIT_GET", "PERMIT_ALL"
"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.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"
] ]
} }
] ]
@@ -581,7 +72,8 @@
{ {
"object": "Device.", "object": "Device.",
"perm": [ "perm": [
"PERMIT_NONE" "PERMIT_NONE",
"PERMIT_SUBS_EVT_OPER_COMP"
] ]
}, },
{ {
@@ -594,6 +86,66 @@
"PERMIT_SUBS_EVT_OPER_COMP" "PERMIT_SUBS_EVT_OPER_COMP"
] ]
}, },
{
"object":"Device.Time.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.UPnP.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.Bridging.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.Ethernet.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.DHCPv4.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.DHCPv6.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{ {
"object":"Device.Hosts.", "object":"Device.Hosts.",
"perm": [ "perm": [
@@ -604,6 +156,37 @@
"PERMIT_SUBS_EVT_OPER_COMP" "PERMIT_SUBS_EVT_OPER_COMP"
] ]
}, },
{
"object":"Device.NAT.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.PPP.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.Routing.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{ {
"object":"Device.IEEE1905.", "object":"Device.IEEE1905.",
"perm": [ "perm": [
@@ -614,6 +197,16 @@
"PERMIT_SUBS_EVT_OPER_COMP" "PERMIT_SUBS_EVT_OPER_COMP"
] ]
}, },
{
"object":"Device.InterfaceStack.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{ {
"object":"Device.DynamicDNS.", "object":"Device.DynamicDNS.",
"perm": [ "perm": [
@@ -624,6 +217,56 @@
"PERMIT_SUBS_EVT_OPER_COMP" "PERMIT_SUBS_EVT_OPER_COMP"
] ]
}, },
{
"object":"Device.LANConfigSecurity.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.Security.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.RouterAdvertisement.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.Services.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.UserInterface.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{ {
"object":"Device.PeriodicStatistics.", "object":"Device.PeriodicStatistics.",
"perm": [ "perm": [
@@ -634,6 +277,27 @@
"PERMIT_SUBS_EVT_OPER_COMP" "PERMIT_SUBS_EVT_OPER_COMP"
] ]
}, },
{
"object":"Device.SoftwareModules.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{
"object":"Device.Users.",
"perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_SUBS_EVT_OPER_COMP"
]
},
{ {
"object": "Device.LocalAgent.Subscription.", "object": "Device.LocalAgent.Subscription.",
"perm": [ "perm": [
@@ -660,16 +324,30 @@
] ]
}, },
{ {
"object": "Device.WiFi.AccessPoint.{i}.WPS.InitiateWPSPBC()", "object": "Device.DNS.",
"perm": [ "perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER", "PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP" "PERMIT_SUBS_EVT_OPER_COMP"
] ]
}, },
{ {
"object": "Device.WiFi.DataElements.Network.SetSSID()", "object": "Device.IP.",
"perm": [ "perm": [
"PERMIT_GET",
"PERMIT_GET_INST",
"PERMIT_OBJ_INFO",
"PERMIT_CMD_INFO",
"PERMIT_OPER", "PERMIT_OPER",
"PERMIT_SUBS_VAL_CHANGE",
"PERMIT_SUBS_OBJ_ADD",
"PERMIT_SUBS_OBJ_DEL",
"PERMIT_SUBS_EVT_OPER_COMP" "PERMIT_SUBS_EVT_OPER_COMP"
] ]
} }

View File

@@ -8,11 +8,6 @@ RETRY_MIN_INTERVAL="5"
RETRY_INTERVAL_MUL="2000" RETRY_INTERVAL_MUL="2000"
ENDPOINT_ID="" ENDPOINT_ID=""
log()
{
echo "$*"|logger -t obuspa.dhcp -p debug
}
get_oui_from_db() { get_oui_from_db() {
db -q get device.deviceinfo.ManufacturerOUI db -q get device.deviceinfo.ManufacturerOUI
} }
@@ -314,7 +309,6 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then
fi fi
if [ ${uci_change} -eq 1 ]; then if [ ${uci_change} -eq 1 ]; then
log "# Reloading obuspa as dhcp config changed"
ubus call uci commit '{"config":"obuspa"}' ubus call uci commit '{"config":"obuspa"}'
fi fi
fi fi

View File

@@ -1,69 +1,29 @@
--- a/src/core/cli_server.c --- a/src/core/cli_server.c
+++ b/src/core/cli_server.c +++ b/src/core/cli_server.c
@@ -780,6 +780,7 @@ int ExecuteCli_Set(char *arg1, char *arg @@ -787,6 +787,7 @@ int ExecuteCli_Set(char *arg1, char *arg
goto exit; goto exit;
} }
+ SetControllerRoleForInternal(); + SetControllerRoleForInternal();
// Exit if unable to start a transaction // Iterate over all objects to set
err = DM_TRANS_Start(&trans); for (i=0; i < objects.num_entries; i++)
if (err != USP_ERR_OK) {
@@ -865,6 +866,7 @@ int ExecuteCli_Add(char *arg1, char *arg
goto exit;
}
+ SetControllerRoleForInternal();
// Exit if unable to start a transaction
err = DM_TRANS_Start(&trans);
if (err != USP_ERR_OK)
@@ -976,6 +978,7 @@ int ExecuteCli_Del(char *arg1, char *arg
goto exit;
}
+ SetControllerRoleForInternal();
// Exit if unable to start a transaction
err = DM_TRANS_Start(&trans);
if (err != USP_ERR_OK)
--- a/src/core/data_model.h --- a/src/core/data_model.h
+++ b/src/core/data_model.h +++ b/src/core/data_model.h
@@ -325,6 +325,8 @@ void DATA_MODEL_DumpSchema(void); @@ -325,6 +325,7 @@ void DATA_MODEL_DumpSchema(void);
void DATA_MODEL_DumpInstances(void); void DATA_MODEL_DumpInstances(void);
char DATA_MODEL_GetJSONParameterType(char *path); char DATA_MODEL_GetJSONParameterType(char *path);
int DATA_MODEL_SetParameterInDatabase(char *path, char *value); int DATA_MODEL_SetParameterInDatabase(char *path, char *value);
+void SetControllerRoleForInternal(); +void SetControllerRoleForInternal();
+void SetControllerDummyID();
int DM_PRIV_InitSetRequest(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst, char *new_value); int DM_PRIV_InitSetRequest(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst, char *new_value);
void DM_PRIV_RequestInit(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst); void DM_PRIV_RequestInit(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst);
--- a/src/core/dm_exec.c
+++ b/src/core/dm_exec.c
@@ -1207,6 +1207,7 @@ void ProcessMessageQueueSocketActivity(s
return;
}
+ SetControllerDummyID(); // To make sure session handler does not break with internal services
switch(msg.type)
{
case kDmExecMsg_ProcessUspRecord:
--- a/src/core/msg_handler.c --- a/src/core/msg_handler.c
+++ b/src/core/msg_handler.c +++ b/src/core/msg_handler.c
@@ -902,6 +902,34 @@ char *MtpSendItemToString(mtp_send_item_ @@ -902,6 +902,20 @@ char *MtpSendItemToString(mtp_send_item_
/*********************************************************************//** /*********************************************************************//**
** **
+** SetControllerDummyID
+**
+** Sets the role for internal user
+**
+**
+**************************************************************************/
+void SetControllerDummyID()
+{
+ cur_msg_controller_info.endpoint_id = "";
+}
+
+/*********************************************************************//**
+**
+** SetControllerRoleForInternal +** SetControllerRoleForInternal
+** +**
+** Sets the role for internal user +** Sets the role for internal user
@@ -74,7 +34,6 @@
+{ +{
+ cur_msg_combined_role.inherited = kCTrustRole_Untrusted; + cur_msg_combined_role.inherited = kCTrustRole_Untrusted;
+ cur_msg_combined_role.assigned = kCTrustRole_FullAccess; + cur_msg_combined_role.assigned = kCTrustRole_FullAccess;
+ SetControllerDummyID();
+} +}
+ +
+/*********************************************************************//** +/*********************************************************************//**

View File

@@ -1,6 +1,6 @@
--- a/src/core/bdc_exec.c --- a/src/core/bdc_exec.c
+++ b/src/core/bdc_exec.c +++ b/src/core/bdc_exec.c
@@ -547,11 +547,19 @@ @@ -547,11 +547,19 @@ int StartSendingReport(bdc_connection_t
// Set the list of headers // Set the list of headers
bc->headers = NULL; bc->headers = NULL;
@@ -25,7 +25,7 @@
{ {
--- a/src/core/bdc_exec.h --- a/src/core/bdc_exec.h
+++ b/src/core/bdc_exec.h +++ b/src/core/bdc_exec.h
@@ -53,6 +53,9 @@ @@ -53,6 +53,9 @@ void BDC_EXEC_ScheduleExit(void);
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server #define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped #define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
#define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post. #define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post.
@@ -52,7 +52,7 @@
// Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp // Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
@@ -153,6 +156,7 @@ @@ -153,6 +156,7 @@ static char *profile_push_event_args[] =
typedef struct typedef struct
{ {
int num_retained_failed_reports; int num_retained_failed_reports;
@@ -60,7 +60,7 @@
char report_timestamp[33]; char report_timestamp[33];
char url[1025]; char url[1025];
char username[257]; char username[257];
@@ -161,6 +165,11 @@ @@ -161,6 +165,11 @@ typedef struct
char method[9]; char method[9];
bool use_date_header; bool use_date_header;
char report_format[20]; char report_format[20];
@@ -72,7 +72,7 @@
} profile_ctrl_params_t; } profile_ctrl_params_t;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -208,6 +217,7 @@ @@ -208,6 +217,7 @@ int Validate_BulkDataEncodingType(dm_req
int Validate_BulkDataReportingInterval(dm_req_t *req, char *value); int Validate_BulkDataReportingInterval(dm_req_t *req, char *value);
int Validate_BulkDataReference(dm_req_t *req, char *value); int Validate_BulkDataReference(dm_req_t *req, char *value);
int Validate_BulkDataReportFormat(dm_req_t *req, char *value); int Validate_BulkDataReportFormat(dm_req_t *req, char *value);
@@ -80,7 +80,7 @@
int Validate_BulkDataReportTimestamp(dm_req_t *req, char *value); int Validate_BulkDataReportTimestamp(dm_req_t *req, char *value);
int Validate_BulkDataCompression(dm_req_t *req, char *value); int Validate_BulkDataCompression(dm_req_t *req, char *value);
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value); int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
@@ -236,6 +246,8 @@ @@ -236,6 +246,8 @@ bulkdata_profile_t *bulkdata_find_profil
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map); int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len); int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format); char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
@@ -89,16 +89,15 @@
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len); unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len); int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
int bulkdata_start_profile(bulkdata_profile_t *bp); int bulkdata_start_profile(bulkdata_profile_t *bp);
@@ -250,6 +262,8 @@ @@ -250,6 +262,7 @@ char *bulkdata_platform_calc_uri_query_s
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs); int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv); void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv);
void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map); void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map);
+void append_string_to_target(char *str, char **output); +void append_string_to_target(char *str, char **output);
+char *csv_encode(const char *str);
/*********************************************************************//** /*********************************************************************//**
** **
@@ -282,7 +296,7 @@ @@ -282,7 +295,7 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING); err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT); err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT);
err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols)); err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols));
@@ -107,7 +106,7 @@
err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL); err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT); err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT); err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT);
@@ -297,7 +311,7 @@ @@ -297,7 +310,7 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING);
@@ -116,7 +115,7 @@
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME);
@@ -312,6 +326,13 @@ @@ -312,6 +325,13 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
@@ -130,7 +129,7 @@
// Device.BulkData.Profile.{i}.HTTP // Device.BulkData.Profile.{i}.HTTP
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING); err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
@@ -591,9 +612,10 @@ @@ -591,9 +611,10 @@ int Validate_BulkDataProtocol(dm_req_t *
int Validate_BulkDataEncodingType(dm_req_t *req, char *value) int Validate_BulkDataEncodingType(dm_req_t *req, char *value)
{ {
// Exit if trying to set a value outside of the range we accept // Exit if trying to set a value outside of the range we accept
@@ -143,7 +142,7 @@
return USP_ERR_INVALID_VALUE; return USP_ERR_INVALID_VALUE;
} }
@@ -676,6 +698,32 @@ @@ -676,6 +697,32 @@ int Validate_BulkDataReportFormat(dm_req
/*********************************************************************//** /*********************************************************************//**
** **
@@ -176,7 +175,7 @@
** Validate_BulkDataReportTimestamp ** Validate_BulkDataReportTimestamp
** **
** Validates Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp ** Validates Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
@@ -1970,6 +2018,14 @@ @@ -1970,6 +2017,14 @@ int bulkdata_platform_get_profile_contro
return err; return err;
} }
@@ -191,7 +190,7 @@
// Exit if unable to get ReportTimestamp // Exit if unable to get ReportTimestamp
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id); USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0); err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
@@ -1986,6 +2042,46 @@ @@ -1986,6 +2041,46 @@ int bulkdata_platform_get_profile_contro
return err; return err;
} }
@@ -238,7 +237,7 @@
return USP_ERR_OK; return USP_ERR_OK;
} }
@@ -2222,7 +2318,7 @@ @@ -2222,7 +2317,7 @@ void bulkdata_process_profile_http(bulkd
{ {
int err; int err;
report_t *cur_report; report_t *cur_report;
@@ -247,7 +246,7 @@
profile_ctrl_params_t ctrl; profile_ctrl_params_t ctrl;
unsigned char *compressed_report; unsigned char *compressed_report;
int compressed_len; int compressed_len;
@@ -2261,10 +2357,23 @@ @@ -2261,10 +2356,23 @@ void bulkdata_process_profile_http(bulkd
} }
// Exit if unable to generate the report // Exit if unable to generate the report
@@ -275,7 +274,7 @@
return; return;
} }
@@ -2273,14 +2382,14 @@ @@ -2273,14 +2381,14 @@ void bulkdata_process_profile_http(bulkd
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression); USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
if (enable_protocol_trace) if (enable_protocol_trace)
{ {
@@ -294,7 +293,7 @@
} }
// NOTE: From this point on, only the compressed_report exists // NOTE: From this point on, only the compressed_report exists
@@ -2310,9 +2419,15 @@ @@ -2310,9 +2418,15 @@ void bulkdata_process_profile_usp_event(
kv_vector_t event_args; kv_vector_t event_args;
kv_pair_t kv; kv_pair_t kv;
report_t *cur_report; report_t *cur_report;
@@ -311,7 +310,7 @@
// Exit if the MTP has not been connected to successfully after bootup // Exit if the MTP has not been connected to successfully after bootup
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP). // This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
@@ -2321,20 +2436,62 @@ @@ -2321,20 +2435,62 @@ void bulkdata_process_profile_usp_event(
goto exit; goto exit;
} }
@@ -385,7 +384,7 @@
} }
// When sending via USP events, only one report is ever sent in each USP event // When sending via USP events, only one report is ever sent in each USP event
@@ -2354,10 +2511,16 @@ @@ -2354,10 +2510,16 @@ void bulkdata_process_profile_usp_event(
bp->num_retained_reports = 1; bp->num_retained_reports = 1;
// Exit if unable to generate the report // Exit if unable to generate the report
@@ -405,7 +404,7 @@
return; return;
} }
@@ -2365,15 +2528,15 @@ @@ -2365,15 +2527,15 @@ void bulkdata_process_profile_usp_event(
// Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add() // Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add()
kv.key = "Data"; kv.key = "Data";
@@ -424,37 +423,10 @@
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them // From the point of view of this code, the report(s) have been successfully sent, so don't retain them
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism // NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
@@ -2835,6 +2998,319 @@ @@ -2835,6 +2997,219 @@ char *bulkdata_generate_json_report(bulk
/*********************************************************************//** /*********************************************************************//**
** **
+** safe_asprintf
+**
+** Wrapper around asprintf that calls terminate in case of error
+**
+** \param strp -- pointer to the output string
+** \param fmt -- printing format
+**
+** \return None
+**
+**************************************************************************/
+static void safe_asprintf(char **strp, const char *fmt, ...)
+{
+ int ret;
+ va_list argp;
+
+ va_start(argp, fmt);
+ ret = vasprintf(strp, fmt, argp);
+ va_end(argp);
+
+ if (ret == -1) {
+ USP_ERR_Terminate("%s (%d): asprintf(%s) failed",
+ __FUNCTION__, __LINE__, fmt);
+ }
+}
+
+/*********************************************************************//**
+**
+** append_string_to_target +** append_string_to_target
+** +**
+** concatenates the src string with target string in newly allocated memory +** concatenates the src string with target string in newly allocated memory
@@ -482,70 +454,10 @@
+ } + }
+ +
+ assert(tmp != NULL); + assert(tmp != NULL);
+ safe_asprintf(output, "%s%s", tmp, str); + asprintf(output, "%s%s", tmp, str);
+ free(tmp); + free(tmp);
+} +}
+ +
+/*************************************************************************
+**
+** csv_encode
+**
+** encodes the src string to CSV specification RFC4180 compliance string
+** and assign back the new pointer.
+**
+** \param str - pointer to the src string
+** \return address of the pointer that points to the target string or NULL
+**
+**************************************************************************/
+char *csv_encode(const char *str)
+{
+ if (str == NULL)
+ return NULL;
+
+ int len = strlen(str);
+ if (len == 0)
+ return strdup(str);
+
+ char *temp = NULL;
+ // Get the number of '\"' present in the string
+ int quote_count = 0;
+
+ temp = strchr(str, '\"');
+ while (temp) {
+ quote_count++;
+ temp = strchr(temp+1, '\"');
+ }
+
+ int encode_size = len + quote_count + 3; // added 3 for initial quote, end quote & null at end
+ temp = (char *)malloc(sizeof(char) * encode_size);
+
+ if (!temp)
+ return NULL;
+
+ memset(temp, 0, sizeof(char) * encode_size);
+
+ int i = 0, j = 0;
+
+ temp[j++] = '\"';
+ for (i = 0; i < len; i++) {
+ if (str[i] == '\"') {
+ if (j > (encode_size - 3))
+ break;
+
+ temp[j++] = '\"';
+ }
+
+ if (j > (encode_size - 3))
+ break;
+
+ temp[j++] = str[i];
+ }
+
+ temp[j] = '\"';
+
+ return temp;
+}
+
+/*********************************************************************//** +/*********************************************************************//**
+** +**
+** bulkdata_generate_csv_report +** bulkdata_generate_csv_report
@@ -590,9 +502,9 @@
+ +
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) { + if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
+ if (strcmp(row_timestamp, "None") == 0) + if (strcmp(row_timestamp, "None") == 0)
+ safe_asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator); + asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
+ else + else
+ safe_asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator); + asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
+ +
+ assert(str != NULL); + assert(str != NULL);
+ append_string_to_target(str, &output); + append_string_to_target(str, &output);
@@ -609,18 +521,14 @@
+ // Add Collection time to each csv report element (only if specified and not 'None') + // Add Collection time to each csv report element (only if specified and not 'None')
+ if (strcmp(row_timestamp, "Unix-Epoch")==0) + if (strcmp(row_timestamp, "Unix-Epoch")==0)
+ { + {
+ safe_asprintf(&timestamp, "%lld", (long long int)report->collection_time); + asprintf(&timestamp, "%lld", (long long int)report->collection_time);
+ } + }
+ else if (strcmp(row_timestamp, "ISO-8601")==0) + else if (strcmp(row_timestamp, "ISO-8601")==0)
+ { + {
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf)); + char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
+ if (result != NULL) + if (result != NULL)
+ { + {
+ char *val = csv_encode(buf); + asprintf(&timestamp, "%s", buf);
+ if (val) {
+ safe_asprintf(&timestamp, "%s", buf);
+ free(val);
+ }
+ } + }
+ } + }
+ +
@@ -671,14 +579,11 @@
+ } + }
+ +
+ if (type) { + if (type) {
+ char *p_path = csv_encode(param_path);
+ char *p_value = csv_encode(param_value);
+
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) { + if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
+ if (timestamp == NULL) + if (timestamp == NULL)
+ safe_asprintf(&str, "%s%c%s%c%s%c", p_path, separator, p_value, separator, type, rowseparator); + asprintf(&str, "%s%c%s%c%s%c", param_path, separator, param_value, separator, type, rowseparator);
+ else + else
+ safe_asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, p_path, separator, p_value, separator, type, rowseparator); + asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, param_path, separator, param_value, separator, type, rowseparator);
+ +
+ assert(str != NULL); + assert(str != NULL);
+ append_string_to_target(str, &output); + append_string_to_target(str, &output);
@@ -686,9 +591,9 @@
+ str = NULL; + str = NULL;
+ } else { + } else {
+ if (str1 == NULL || strlen(str1) == 0) + if (str1 == NULL || strlen(str1) == 0)
+ safe_asprintf(&str, "%s", p_path); + asprintf(&str, "%s", param_path);
+ else + else
+ safe_asprintf(&str, "%c%s", separator, p_path); + asprintf(&str, "%c%s", separator, param_path);
+ +
+ assert(str != NULL); + assert(str != NULL);
+ append_string_to_target(str, &str1); + append_string_to_target(str, &str1);
@@ -696,21 +601,15 @@
+ str = NULL; + str = NULL;
+ +
+ if (str2 == NULL || strlen(str2) == 0) + if (str2 == NULL || strlen(str2) == 0)
+ safe_asprintf(&str, "%s", p_value); + asprintf(&str, "%s", param_value);
+ else + else
+ safe_asprintf(&str, "%c%s", separator, p_value); + asprintf(&str, "%c%s", separator, param_value);
+ +
+ assert(str != NULL); + assert(str != NULL);
+ append_string_to_target(str, &str2); + append_string_to_target(str, &str2);
+ free(str); + free(str);
+ str = NULL; + str = NULL;
+ } + }
+
+ if (p_path)
+ free(p_path);
+
+ if (p_value)
+ free(p_value);
+ } + }
+ } + }
+ +
@@ -721,7 +620,7 @@
+ } + }
+ +
+ if (strcasecmp(csv_format, "ParameterPerColumn") == 0) { + if (strcasecmp(csv_format, "ParameterPerColumn") == 0) {
+ safe_asprintf(&str, "%c", rowseparator); + asprintf(&str, "%c", rowseparator);
+ assert(str != NULL); + assert(str != NULL);
+ append_string_to_target(str, &str1); + append_string_to_target(str, &str1);
+ append_string_to_target(str, &str2); + append_string_to_target(str, &str2);
@@ -744,7 +643,7 @@
** bulkdata_compress_report ** bulkdata_compress_report
** **
** Compresses the report to send ** Compresses the report to send
@@ -2986,9 +3462,18 @@ @@ -2986,9 +3361,18 @@ int bulkdata_schedule_sending_http_repor
flags |= BDC_FLAG_DATE_HEADER; flags |= BDC_FLAG_DATE_HEADER;
} }

View File

@@ -1,15 +0,0 @@
diff --git a/src/core/usp_err.c b/src/core/usp_err.c
index 1626e58..6db1d42 100755
--- a/src/core/usp_err.c
+++ b/src/core/usp_err.c
@@ -189,7 +189,9 @@ char *USP_ERR_ToString(int err, char *buf, int len)
{
#if HAVE_STRERROR_R && !STRERROR_R_CHAR_P
// XSI version of strerror_r
- strerror_r(err, buf, len);
+ if (strerror_r(err, buf, len) != 0) {
+ snprintf(buf, len, "Unknown error %d", err);
+ }
return buf;
#else
// GNU version of strerror_r

View File

@@ -1,42 +0,0 @@
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
index 04a1a9c..8cb2ad7 100644
--- a/src/core/mqtt.c
+++ b/src/core/mqtt.c
@@ -234,6 +234,8 @@ void HandleMqttDisconnect(mqtt_client_t *client);
#define DEFINE_MQTT_TrustCertVerifyCallbackIndex(index) \
int MQTT_TrustCertVerifyCallback_##index (int preverify_ok, X509_STORE_CTX *x509_ctx) \
{\
+ if (index >= MAX_MQTT_CLIENTS) \
+ return 0; \
return DEVICE_SECURITY_TrustCertVerifyCallbackWithCertChain(preverify_ok, x509_ctx, &mqtt_clients[index].cert_chain);\
}
@@ -244,6 +246,11 @@ DEFINE_MQTT_TrustCertVerifyCallbackIndex(1);
DEFINE_MQTT_TrustCertVerifyCallbackIndex(2);
DEFINE_MQTT_TrustCertVerifyCallbackIndex(3);
DEFINE_MQTT_TrustCertVerifyCallbackIndex(4);
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(5);
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(6);
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(7);
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(8);
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(9);
// Add more, with incrementing indexes here, if you change MAX_MQTT_CLIENTS
//------------------------------------------------------------------------------------
@@ -254,10 +261,15 @@ ssl_verify_callback_t* mqtt_verify_callbacks[] = {
MQTT_TrustCertVerifyCallbackIndex(2),
MQTT_TrustCertVerifyCallbackIndex(3),
MQTT_TrustCertVerifyCallbackIndex(4),
+ MQTT_TrustCertVerifyCallbackIndex(5),
+ MQTT_TrustCertVerifyCallbackIndex(6),
+ MQTT_TrustCertVerifyCallbackIndex(7),
+ MQTT_TrustCertVerifyCallbackIndex(8),
+ MQTT_TrustCertVerifyCallbackIndex(9),
// Add more, with incrementing indexes here, if you change MAX_MQTT_CLIENTS
};
-USP_COMPILEASSERT( ((sizeof(mqtt_verify_callbacks)/sizeof(ssl_verify_callback_t*)) == MAX_MQTT_CLIENTS),
+USP_COMPILEASSERT( ((sizeof(mqtt_verify_callbacks)/sizeof(ssl_verify_callback_t*)) >= MAX_MQTT_CLIENTS),
"There must be MAX_MQTT_CLIENTS callbacks defined");
/*********************************************************************//**

View File

@@ -15,6 +15,14 @@ include /lib/ethernet
. /lib/qos/shaper.sh . /lib/qos/shaper.sh
. /lib/qos/airoha.sh . /lib/qos/airoha.sh
get_rate_per_queue() {
echo "0"
}
get_burst_size_per_queue() {
echo "0"
}
# marking value be decimal for linux target as it uses set-mark whereas other # marking value be decimal for linux target as it uses set-mark whereas other
# targets uses set-xmark, hence this function can't make it common # targets uses set-xmark, hence this function can't make it common
ip_rule_get_converted_tos() { ip_rule_get_converted_tos() {

View File

@@ -34,6 +34,14 @@ get_port_number() {
done done
} }
get_rate_per_queue() {
echo "0"
}
get_burst_size_per_queue() {
echo "0"
}
# Function to handle a queue order and # Function to handle a queue order and
# update total number of queues # update total number of queues
handle_q_order() { handle_q_order() {

View File

@@ -31,8 +31,8 @@ generate_queue(){
uci set qos.@queue[-1].ifname="$ifname" uci set qos.@queue[-1].ifname="$ifname"
uci set qos.@queue[-1].precedence="$order" uci set qos.@queue[-1].precedence="$order"
uci set qos.@queue[-1].scheduling="SP" uci set qos.@queue[-1].scheduling="SP"
uci set qos.@queue[-1].rate="0" uci set qos.@queue[-1].rate=$(get_rate_per_queue)
uci set qos.@queue[-1].burst_size="0" uci set qos.@queue[-1].burst_size=$(get_burst_size_per_queue)
uci set qos.@queue[-1].weight="1" uci set qos.@queue[-1].weight="1"
done done

View File

@@ -15,9 +15,12 @@ Q_COUNT=0
SP_Q_PRIO=7 SP_Q_PRIO=7
SOQ_wgt=0 SOQ_wgt=0
get_max_burst_size_per_queue() { get_rate_per_queue() {
# maximum burst size for tc class echo "1000000"
echo "4289999999" }
get_burst_size_per_queue() {
echo "1500"
} }
handle_q_weight() { handle_q_weight() {
@@ -96,8 +99,6 @@ handle_queue() {
local port_bs="$5" local port_bs="$5"
local par_class="$6" local par_class="$6"
local priority=7 local priority=7
local bs=0
config_get is_enable "$qid" "enable" config_get is_enable "$qid" "enable"
# no need to configure disabled queues # no need to configure disabled queues
@@ -133,11 +134,10 @@ handle_queue() {
config_get sc_alg "$qid" "scheduling" config_get sc_alg "$qid" "scheduling"
config_get wgt "$qid" "weight" 1 config_get wgt "$qid" "weight" 1
config_get rate "$qid" "rate" config_get rate "$qid" "rate"
config_get bs "$qid" "burst_size" 1500 config_get bs "$qid" "burst_size"
config_get qsize "$qid" "queue_size" 1024 config_get qsize "$qid" "queue_size" 1024
[ "$rate" == "0" ] && rate="$port_bw" [ "$rate" == "0" ] && rate="$port_bw"
[ "$bs" == "0" ] && bs=1500
bs=$(( bs * 8 )) bs=$(( bs * 8 ))
rate_bs=$(( rate * 25 )) rate_bs=$(( rate * 25 ))
@@ -146,10 +146,6 @@ handle_queue() {
fi fi
# burst size in tc class is given in bytes # burst size in tc class is given in bytes
bs=$(( bs * 1000 )) bs=$(( bs * 1000 ))
local max_bs=$(get_max_burst_size_per_queue )
if [ $bs -gt $max_bs ]; then
bs=$max_bs
fi
local salg=1 local salg=1
@@ -164,14 +160,7 @@ handle_queue() {
;; ;;
esac esac
[ -f /etc/board.json ] || return 0 priority=`expr $priority - $order`
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
fi
local ceil_rate=$port_bw local ceil_rate=$port_bw
if [ "$rate" -lt "$port_bw" ]; then if [ "$rate" -lt "$port_bw" ]; then
@@ -365,20 +354,15 @@ config_ingress_rate_limit() {
ingress_rate=$((ingress_rate / 1000)) ingress_rate=$((ingress_rate / 1000))
local bs=0 if [ $in_burst_size -eq 0 ]; then
local avg_bs=$(( ingress_rate * 25 )) in_burst_size=$ingress_rate
config_get b_size "$sid" "burst_size" else
if [ "$in_burst_size" > "0" ]; then in_burst_size=$((in_burst_size / 1000))
bs=`expr $in_burst_size / 1000`
fi
bs=$(( bs * 8 ))
if [ $avg_bs -gt $bs ]; then
bs="$avg_bs"
fi fi
tc qdisc add dev $ifname ingress tc qdisc add dev $ifname ingress
tc filter add dev $ifname parent ffff: protocol ip prio $pindex u32 match ip src 0.0.0.0/0 police rate ${ingress_rate}kbit burst $bs drop flowid :$pindex tc filter add dev $ifname parent ffff: protocol ip prio $pindex u32 match ip src 0.0.0.0/0 police rate ${ingress_rate}kbit burst $in_burst_size drop flowid :$pindex
} }
@@ -398,20 +382,18 @@ pre_configure_queue() {
} }
get_link_rate() { get_link_rate() {
local ifname="$1" intf="$1"
local phycap="$(ethtool $ifname | grep -A 10 "Supported link modes" | grep 00 | tail -n 1 | awk '{print$NF}')" speed=1000
local speed=1000
# Get the max capability of this port if [ -d "/sys/class/net/$intf/" ]; then
case "$phycap" in speed=$(cat /sys/class/net/$intf/speed 2>/dev/null)
10000*) speed=10000 ;; [ -z "$speed" ] & speed=1000
5000*) speed=5000 ;; fi
2500*) speed=2500 ;;
1000*) speed=1000 ;; if [ $speed -le 0 ]; then
100*) speed=100 ;; # assuming default 1000
10*) speed=10 ;; speed=1000
*) speed=1000 ;; fi
esac
echo "$speed" echo "$speed"
} }

Some files were not shown because too many files have changed in this diff Show More