Compare commits

..

1 Commits

Author SHA1 Message Date
Mohd Husaam Mehdi
9efca3c299 fluent-bit: add support for lua filter
this allows us to add custom records, for example, for converting
kernel monotonic timestamps to UTC format timestamps
2025-05-22 05:34:27 +00:00
135 changed files with 727 additions and 3228 deletions

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm
PKG_VERSION:=1.16.8
PKG_VERSION:=1.15.28
USE_LOCAL:=0
ifneq ($(USE_LOCAL),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
PKG_SOURCE_VERSION:=1615b42e405faceceac825f9c0387a58b90785ae
PKG_SOURCE_VERSION:=a20a15888b15864136ec40b15f221db2edbaf574
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -8,16 +8,13 @@
"ieee1905",
"mapcontroller",
"mosquitto",
"nginx",
"netmode"
"nginx"
],
"cwmp": [
"firewall",
"network",
"dhcp",
"mapcontroller",
"wireless",
"time",
"netmode"
"time"
]
}

View File

@@ -10,10 +10,19 @@ log() {
echo "${@}"|logger -t bbf.config -p info
}
create_needed_directories()
{
mkdir -p /tmp/bbfdm/.cwmp
mkdir -p /tmp/bbfdm/.usp
mkdir -p /tmp/bbfdm/.bbfdm
}
start_service()
{
local log_level
create_needed_directories
config_load bbfdm
config_get log_level "reload_handler" log_level 2

View File

@@ -5,7 +5,6 @@ STOP=05
USE_PROCD=1
PROG=/usr/sbin/dm-service
DM_AGENT_PROG=/usr/sbin/dm-agent
BBFDM_MICROSERVICE_DIR="/etc/bbfdm/services"
@@ -25,8 +24,7 @@ validate_bbfdm_micro_service_section()
_add_microservice()
{
local name path loglevel
local enable enable_core unified_daemon dm_framework
local daemon_prog
local enable enable_core unified_daemon
# Check enable from micro-service
path="${1}"
@@ -49,25 +47,14 @@ _add_microservice()
return 0
fi
json_get_var dm_framework dm-framework 0
if [ "${dm_framework}" -eq "1" ] || [ "${dm_framework}" = "true" ]; then
daemon_prog="${DM_AGENT_PROG}"
else
daemon_prog="${PROG}"
fi
json_select config
json_get_var loglevel loglevel 4
procd_open_instance "${name}"
procd_set_param command ${daemon_prog}
# Only add parameters for dm-service, not for dm-agent
if [ "${daemon_prog}" = "${PROG}" ]; then
procd_append_param command -m "${name}"
procd_append_param command -l "${loglevel}"
fi
procd_set_param command ${PROG}
procd_append_param command -m "${name}"
procd_append_param command -l "${loglevel}"
if [ "${enable_core}" -eq "1" ]; then
procd_set_param limits core="unlimited"

View File

@@ -15,13 +15,9 @@
]
},
"dhcp_refresh": {
"if_operator": "OR",
"if" : [
{
"event": "host"
},
{
"event": "wifi.dataelements.Associated"
}
],
"then" : [

17
bridgemngr/Config.in Normal file
View File

@@ -0,0 +1,17 @@
if PACKAGE_bridgemngr
config BRIDGEMNGR_BRIDGE_VLAN
bool "Use bridge-vlan backend"
help
Set this option to use bridge-vlan as backend for VLAN objects.
config BRIDGEMNGR_BRIDGE_VENDOR_EXT
bool "Use bridge BBF vendor extensions"
default y
help
Set this option to use bridge BBF vendor extensions.
config BRIDGEMNGR_BRIDGE_VENDOR_PREFIX
string "Package specific datamodel Vendor Prefix for TR181 extensions"
default ""
endif

76
bridgemngr/Makefile Normal file
View File

@@ -0,0 +1,76 @@
#
# Copyright (C) 2020-2024 iopsys
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bridgemngr
PKG_VERSION:=1.0.14
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/bridgemngr
PKG_SOURCE_VERSION:=99bc3a3a0a2571917eda7085c21952f779fdb471
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include ../bbfdm/bbfdm.mk
define Package/bridgemngr
CATEGORY:=Utilities
TITLE:=Bridge Manager
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
endef
define Package/bridgemngr/description
Package to add Device.Bridging. data model support.
endef
define Package/$(PKG_NAME)/config
source "$(SOURCE)/Config.in"
endef
MAKE_PATH:=src
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_PREFIX),"")
VENDOR_PREFIX = $(CONFIG_BBF_VENDOR_PREFIX)
else
VENDOR_PREFIX = $(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_PREFIX)
endif
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(VENDOR_PREFIX)\\\"
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VLAN),y)
TARGET_CFLAGS += -DBRIDGE_VLAN_BACKEND
endif
define Package/bridgemngr/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libbridgemngr.so $(1) $(PKG_NAME)
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_EXT), y)
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libbridgeext.so $(1) $(PKG_NAME) 10
$(BBFDM_INSTALL_MS_PLUGIN) -v ${VENDOR_PREFIX} ./files/VLAN_Filtering_Extension.json $(1) $(PKG_NAME) 11
endif
$(INSTALL_BIN) ./files/etc/init.d/bridging $(1)/etc/init.d/
$(INSTALL_DATA) ./files/etc/config/bridging $(1)/etc/config/
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) ~/git/bridgemngr/* $(PKG_BUILD_DIR)/
endef
endif
$(eval $(call BuildPackage,bridgemngr))

View File

@@ -2,7 +2,6 @@
"daemon": {
"enable": "1",
"service_name": "bridgemngr",
"dm-framework": true,
"unified_daemon": false,
"services": [
{

View File

@@ -0,0 +1,31 @@
{
"json_plugin_version": 2,
"Device.Bridging.Bridge.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"{BBF_VENDOR_PREFIX}VLANFiltering": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"description": "Enable or disable VLAN Filtering on this bridge.",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "vlan_filtering"
}
]
}
}
}

View File

@@ -77,7 +77,6 @@ handle_ebtables_rule() {
}
start_service() {
ubus -t 30 wait_for network.device uci
config_load bridging
config_foreach handle_ebtables_chain chain
config_foreach handle_ebtables_rule rule

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ddnsmngr
PKG_VERSION:=1.0.12
PKG_VERSION:=1.0.11
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ddnsmngr.git
PKG_SOURCE_VERSION:=44af9a7b3fec3929f8554af9633a5b8068189b48
PKG_SOURCE_VERSION:=9f2f4dabc71c4f405b1c5df576d20d793d299e94
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

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

View File

@@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dectmngr
PKG_RELEASE:=3
PKG_VERSION:=3.7.10
PKG_VERSION:=3.7.7
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=1f851980a6ba616df54f79930225f8bcd563b711
PKG_SOURCE_VERSION:=289a91b3e7f221f16c976efd147bd4b203420b41
PKG_MIRROR_HASH:=skip
endif

View File

@@ -57,53 +57,13 @@ get_dcx81_device() {
device_name_line="$(grep '^DEVNAME=' "$uevent_file")" || return 1
readonly device="/dev/${device_name_line##DEVNAME=}"
[ -c "$device" ] || return 1
printf "%s" "$(basename $device)"
printf "%s" "$device"
return 0
fi
done
return 1
}
check_dcx81_firmware() {
local dcx81_uart=$1
local fw_link="/lib/firmware/dcx81_firmware"
local fw_file
[ -L "$fw_link" ] || return
fw_file=$(readlink -f $fw_link)
[ -f "$fw_file" ] || return
# the symbolic link is not needed
rm -f $fw_link
eval $(/sbin/cmbs_tcx -comname "$dcx81_uart" -fw_version |grep DCX81_FW_Version)
[ -n "$DCX81_FW_Version" ] || return
if echo $(basename $fw_file) | grep -qi "$DCX81_FW_Version" ; then
logger -t "$PROG" "DCX81 running expected $DCX81_FW_Version"
return;
fi
logger -t "$PROG" "DCX81 firmware upgrading to $fw_file"
/sbin/cmbs_tcx -comname "$dcx81_uart" -fwu "$fw_file" 2>&1 >/dev/null &
echo -n "Updrading DCX81 firmware.." >/dev/console
local wait_time=0
while pidof cmbs_tcx >/dev/null && [ "$wait_time" -lt "200" ] ; do
sleep 5
wait_time=$(($wait_time + 5))
echo -n "." >/dev/console
done
if pidof cmbs_tcx >/dev/null ; then
killall -9 cmbs_tcx
logger -t "$PROG" "DCX81 firmware upgrade timeout"
else
logger -t "$PROG" "DCX81 firmware upgrade done"
fi
}
start_service() {
local opt_ext=
local rfpi=
@@ -115,16 +75,14 @@ start_service() {
return 0
fi
opt_ext="-extensionShift $(get_extension_shift)"
local dcx81_uart_device
if ! dcx81_uart_device="$(get_dcx81_device)"; then
logger -t "$PROG" -p daemon.warning "Could not determine DCX81 UART device. Falling back to default ttyH0."
dcx81_uart_device="ttyH0"
dcx81_uart_device=/dev/ttyH0
fi
check_dcx81_firmware $dcx81_uart_device
opt_ext="-extensionShift $(get_extension_shift)"
rfpi=$(db -q get hw.board.dect_rfpi)
[ -n "$rfpi" -a ${#rfpi} -eq 14 ] && opt_ext="$opt_ext -rfpi $rfpi"
@@ -148,19 +106,21 @@ start_service() {
procd_open_instance
# dectmngr takes expects device without /dev
readonly dcx81_uart_device_wo_dev="${dcx81_uart_device##/dev/}"
case "$log_dect_cmbs" in
none)
echo "Starting dectmngr with cmbs logging disabled"
procd_set_param command "$PROG" -comname "$dcx81_uart_device" $opt_ext
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" $opt_ext
rm -f $LOG_PATH/*
;;
file)
echo "Starting dectmngr with cmbs logging enabled to file"
procd_set_param command "$PROG" -comname "$dcx81_uart_device" -log $LOG_PATH/dect-cmbs.log $opt_ext
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" -log $LOG_PATH/dect-cmbs.log $opt_ext
;;
*)
echo "Starting dectmngr with cmbs logging enabled to syslog"
procd_set_param command "$PROG" -comname "$dcx81_uart_device" -syslog $opt_ext
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" -syslog $opt_ext
rm -f $LOG_PATH/*
;;
esac

View File

@@ -1,207 +0,0 @@
#
# Copyright (c) 2023 Genexis B.V. All rights reserved.
# This Software and its content are protected by the Dutch Copyright Act
# ('Auteurswet'). All and any copying and distribution of the software
# and its content without authorization by Genexis B.V. is
# prohibited. The prohibition includes every form of reproduction and
# distribution.
#
#
include $(TOPDIR)/rules.mk
PKG_NAME:=dm-framework
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/lcm/dm-framework.git
PKG_SOURCE_VERSION:=e9978675399c5fdc7233645a9192443e41c41904
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
# Build directories for each component
DATAMODELS_BUILD_DIR:=$(PKG_BUILD_DIR)/datamodels-build
DMAPI_BUILD_DIR:=$(PKG_BUILD_DIR)/dm-api-build
DMAGENT_BUILD_DIR:=$(PKG_BUILD_DIR)/dm-agent-build
include $(INCLUDE_DIR)/package.mk
-include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
#
# Datamodels Package Definition
#
define Package/datamodels
SECTION:=utils
CATEGORY:=Genexis
TITLE:=dm-framework Datamodel
URL:=http://www.genexis.eu
PKG_LICENSE:=GENEXIS
PKG_LICENSE_URL:=
endef
define Package/datamodels/description
This package contains dm-framework datamodel.
endef
#
# DM-API Package Definition
#
define Package/dm-api
CATEGORY:=Genexis
TITLE:=dm-api
PKG_BUILD_DEPENDS:=datamodels
DEPENDS:=+libsqlite3 \
+libjson-c +libstdcpp +quickjs \
+libubus +libubox +libuci
URL:=http://www.genexis.eu
PKG_LICENSE:=GENEXIS
PKG_LICENSE_URL:=
endef
define Package/dm-api/description
This package contains api for the dm-framework
endef
#
# DM-Agent Package Definition
#
define Package/dm-agent
DEPENDS:=+dm-api +datamodels +libubox +libubus +ubus
CATEGORY:=Genexis
TITLE:=dm-framework agent
URL:=http://www.genexis.eu
PKG_LICENSE:=GENEXIS
PKG_LICENSE_URL:=
endef
define Package/dm-agent/description
This package contains dm-framework agent.
endef
#
# Build Preparation
#
define Build/Prepare
$(call Build/Prepare/Default)
# Prepare datamodels
mkdir -p $(DATAMODELS_BUILD_DIR)
$(CP) -rf $(PKG_BUILD_DIR)/datamodels/* $(DATAMODELS_BUILD_DIR)/
# Copy scripts from top-level scripts directory
mkdir -p $(DATAMODELS_BUILD_DIR)/scripts
$(CP) -rf $(PKG_BUILD_DIR)/scripts/* $(DATAMODELS_BUILD_DIR)/scripts/
cd $(DATAMODELS_BUILD_DIR); \
npm install better-sqlite3 quickjs && \
node ./scripts/json2code.js && \
node ./scripts/qjs-handlers-validate.js
# Prepare dm-api
mkdir -p $(DMAPI_BUILD_DIR)
$(CP) -rf $(PKG_BUILD_DIR)/dm-api/* $(DMAPI_BUILD_DIR)/
# Prepare dm-agent
mkdir -p $(DMAGENT_BUILD_DIR)
$(CP) -rf $(PKG_BUILD_DIR)/dm-agent/* $(DMAGENT_BUILD_DIR)/
endef
TARGET_CFLAGS += $(FPIC)
#
# Build Compilation
#
define Build/Compile
# Build datamodels first (dependency for others)
$(MAKE) -C $(DATAMODELS_BUILD_DIR)\
PROJECT_ROOT="$(DATAMODELS_BUILD_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
EXTRA_CFLAGS="$(TARGET_CFLAGS) -I$(DATAMODELS_BUILD_DIR)" \
all
# Build dm-api (depends on datamodels)
$(MAKE) -C $(DMAPI_BUILD_DIR)\
PROJECT_ROOT="$(DMAPI_BUILD_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
EXTRA_CFLAGS="$(TARGET_CFLAGS) -I$(DMAPI_BUILD_DIR)" \
all
# Build dm-agent (depends on both)
$(MAKE) -C $(DMAGENT_BUILD_DIR)\
PROJECT_ROOT="$(DMAGENT_BUILD_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
EXTRA_CFLAGS="$(TARGET_CFLAGS) -I$(DMAGENT_BUILD_DIR)" \
all
endef
#
# Development Installation (headers and libraries)
#
define Build/InstallDev
# Datamodels development files
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(DATAMODELS_BUILD_DIR)/dm.h $(1)/usr/include/
$(CP) $(DATAMODELS_BUILD_DIR)/libdm.so $(1)/usr/lib/
# DM-API development files - headers are now in dm-api/include/
$(CP) $(DMAPI_BUILD_DIR)/include/dm_types.h $(1)/usr/include/
$(CP) $(DMAPI_BUILD_DIR)/include/dm_node.h $(1)/usr/include/
$(CP) $(DMAPI_BUILD_DIR)/core/dm_api.h $(1)/usr/include/
$(CP) $(DMAPI_BUILD_DIR)/core/dm_linker.h $(1)/usr/include/
$(CP) $(DMAPI_BUILD_DIR)/core/dbmgr.h $(1)/usr/include/
$(CP) $(DMAPI_BUILD_DIR)/include/dm_log.h $(1)/usr/include/
$(CP) $(DMAPI_BUILD_DIR)/utils/dm_list.h $(1)/usr/include/
$(CP) $(DMAPI_BUILD_DIR)/libdmapi.so $(1)/usr/lib/
endef
#
# Package Installation - Datamodels
#
define Package/datamodels/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/bbfdm
$(INSTALL_DIR) $(1)/usr/lib/dmf_handlers
$(INSTALL_BIN) $(DATAMODELS_BUILD_DIR)/default.db $(1)/etc/bbfdm/default_dm.db
$(INSTALL_BIN) $(DATAMODELS_BUILD_DIR)/libdm.so $(1)/usr/lib/
# Copy handler files from datamodels directory (new structure)
# Copy .js files from root datamodels directory
( cd $(DATAMODELS_BUILD_DIR); \
find . -maxdepth 1 -type f -name '*.js' -not -path './.*' -exec $(INSTALL_BIN) {} $(1)/usr/lib/dmf_handlers/{} \; )
# Copy .js files from subdirectories, preserving folder structure (skip hidden files/folders)
( cd $(DATAMODELS_BUILD_DIR); \
find . -type d -mindepth 1 -not -path './.*' -not -path './scripts*' -exec $(INSTALL_DIR) $(1)/usr/lib/dmf_handlers/{} \; ; \
find . -type f -name '*.js' -mindepth 2 -not -path './.*' -not -path './scripts*' -exec $(INSTALL_BIN) {} $(1)/usr/lib/dmf_handlers/{} \; )
endef
#
# Package Installation - DM-API
#
define Package/dm-api/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/sbin/
$(INSTALL_BIN) $(DMAPI_BUILD_DIR)/libdmapi.so $(1)/usr/lib/
endef
#
# Package Installation - DM-Agent
#
define Package/dm-agent/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_BIN) ./files/etc/init.d/bridging $(1)/etc/init.d/
$(INSTALL_DATA) ./files/etc/config/bridging $(1)/etc/config/
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) dm-agent
$(INSTALL_BIN) $(DMAGENT_BUILD_DIR)/dm-agent $(1)/usr/sbin
endef
# Register all three packages
$(eval $(call BuildPackage,datamodels))
$(eval $(call BuildPackage,dm-api))
$(eval $(call BuildPackage,dm-agent))

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dnsmngr
PKG_VERSION:=1.0.18
PKG_VERSION:=1.0.17
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/dnsmngr.git
PKG_SOURCE_VERSION:=80fa147e6f1f0d9c1a62a62a693ff3adaef45363
PKG_SOURCE_VERSION:=2ceb76e98cf23a8d52ab3f464d38d62385311a87
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dslmngr
PKG_VERSION:=1.2.10
PKG_VERSION:=1.2.9
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/dslmngr.git
PKG_SOURCE_VERSION:=8fb4093b4d26b3cb06603e110d424005e33cf5d6
PKG_SOURCE_VERSION:=5340cb31f759301f5aca3fd848fc3a63b0b4663f
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MAINTAINER:=Rahul Thakur <rahul.thakur@iopsys.eu>
PKG_MIRROR_HASH:=skip
@@ -30,8 +30,6 @@ include ../bbfdm/bbfdm.mk
ifeq ($(CONFIG_TARGET_brcmbca),y)
TARGET_PLATFORM=BROADCOM
else ifneq ($(CONFIG_TARGET_airoha),)
TARGET_PLATFORM=AIROHA
else
$(info Unexpected CONFIG_TARGET)
endif
@@ -43,7 +41,7 @@ define Package/dslmngr
CATEGORY:=Utilities
TITLE:=XDSL status and configration utility
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl +libeasy
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service +TARGET_airoha:br2684ctl
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
endef
define Package/dslmngr/description
@@ -77,10 +75,7 @@ define Package/dslmngr/install
$(CP) ./files/common/* $(1)/
ifeq ($(CONFIG_TARGET_brcmbca),y)
$(CP) ./files/broadcom/* $(1)/
else ifneq ($(CONFIG_TARGET_airoha),)
$(CP) ./files/airoha/* $(1)/
endif
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dslmngr $(1)/sbin/
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)

View File

@@ -1,26 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
STOP=99
USE_PROCD=1
start_service() {
readonly need_xdsl="$(jsonfilter -i /etc/board.json -e @.dsl)"
[ -f /etc/board.json ] || return 0
if [ "$need_xdsl" != "" ]; then
procd_open_instance xdsl_wan
procd_set_param command /sbin/xdsl_wan
procd_set_param respawn
procd_close_instance
fi
}
boot() {
: # boot-up is handled from 'hsm' application
}
service_triggers()
{
procd_add_reload_trigger "dsl"
}

View File

@@ -1,28 +0,0 @@
#!/bin/sh
. /lib/functions.sh
xtm_remove_devices() {
:
}
xtm_create_devices() {
:
}
xdsl_configure() {
# Support bridged WAN interface
ebtables --concurrent -t broute -D BROUTING -p 0xbeed -j DROP 2> /dev/null
ebtables --concurrent -t broute -I BROUTING -p 0xbeed -j DROP
}
xdsl_stop() {
return 0
}
xdsl_init() {
readonly need_xdsl="$(jsonfilter -i /etc/board.json -e @.dsl)"
[ "$need_xdsl" = "" ] && exit 0
echo "Starting DSL"
}

View File

@@ -1,240 +0,0 @@
#!/bin/sh
source "/lib/functions.sh"
source "/lib/functions/network.sh"
source "/lib/functions/system.sh"
PREVLINK=""
PREVWANMODE=""
WANMODE=""
CONFIGURED=0
CINDEX=0
WANPORT="$(jsonfilter -i /etc/board.json -e @.network.wan.device)"
delete_atm_device() {
/userfs/bin/blapi_cmd xdsl atm_delete_interface $CINDEX
CINDEX=$((CINDEX+1))
}
delete_atm_devices() {
CINDEX=0
config_load dsl
config_foreach delete_atm_device atm-device
}
configure_atm_device() {
local vpi vci encapsulation qos_class pcr mbs scr
local encap qos ethmac
config_get vpi $1 vpi "8"
config_get vci $1 vci "35"
config_get encapsulation $1 encapsulation "llc"
config_get qos_class $1 qos_class "ubr"
config_get pcr $1 pcr "0"
config_get mbs $1 mbs "0"
config_get scr $1 scr "0"
case $encapsulation in # llc, vcmux
vcmux)
encap="1483 Bridged IP VC-Mux"
;;
*)
encap="1483 Bridged IP LLC"
;;
esac
ethmac="$(echo -n "$(macaddr_add 02:AA:BB:01:23:40 $((CINDEX+2)))" | sed 's#:##g')"
/userfs/bin/blapi_cmd xdsl create_device $CINDEX ATM "" "$ethmac"
/userfs/bin/blapi_cmd xdsl atm_create_interface $CINDEX ATM "$qos_class" "$encap" "$vpi" "$vci" "$pcr" "$scr" "$mbs" 0
CINDEX=$((CINDEX+1))
}
create_atm_devices() {
delete_atm_devices
CINDEX=0
config_foreach configure_atm_device atm-device
}
configure_line() {
local mode profile bitswap sra us0 sesdrop sos ginp mod prof
local adsl1_flag=0 issue2_flag=0 Glite_flag=0 adsl2_flag=0 adsl2p_flag=0 vdsl2_flag=0
local pro_8a_flag=0 pro_8b_flag=0 pro_8c_flag=0 pro_8d_flag=0 pro_12a_flag=0 pro_12b_flag=0 pro_17a_flag=0 pro_30a_flag=0 pro_35b_flag=0
config_get mode $1 mode "vdsl2"
config_get profile $1 profile "35b"
config_get bitswap $1 bitswap "1"
config_get sra $1 sra "1"
config_get us0 $1 us0 "1"
config_get sos $1 sos "0"
config_get sos $1 roc "0"
config_get sos $1 ginp "0"
for mod in $mode; do
[ "$mod" = "gdmt" ] && adsl1_flag=1
[ "$mod" = "glite" ] && Glite_flag=1
[ "$mod" = "t1413" ] && issue2_flag=1
[ "$mod" = "adsl2" ] && adsl2_flag=1
[ "$mod" = "adsl2p" ] && adsl2p_flag=1
[ "$mod" = "vdsl2" ] && vdsl2_flag=1
done
for prof in $profile; do
[ "$prof" = "8a" ] && pro_8a_flag=1
[ "$prof" = "8b" ] && pro_8b_flag=1
[ "$prof" = "8c" ] && pro_8c_flag=1
[ "$prof" = "8d" ] && pro_8d_flag=1
[ "$prof" = "12a" ] && pro_12a_flag=1
[ "$prof" = "12b" ] && pro_12b_flag=1
[ "$prof" = "17a" ] && pro_17a_flag=1
[ "$prof" = "30a" ] && pro_30a_flag=1
[ "$prof" = "35b" ] && pro_35b_flag=1
done
/userfs/bin/blapi_cmd xdsl set_adsl_profile "$pro_8a_flag" "$pro_8b_flag" "$pro_8c_flag" "$pro_8d_flag" "$pro_12a_flag" "$pro_12b_flag" "$pro_17a_flag" "$pro_30a_flag" "$pro_35b_flag"
/userfs/bin/blapi_cmd xdsl set_adsl_mode "$adsl1_flag" "$issue2_flag" "$Glite_flag" "$adsl2_flag" "$adsl2p_flag" "$vdsl2_flag"
/userfs/bin/blapi_cmd xdsl set_adsl_ginp "$((!ginp))"
/userfs/bin/blapi_cmd xdsl set_adsl_sos_roc "$((!sos))" "$((!roc))"
/userfs/bin/blapi_cmd xdsl set_adsl_us0 "$((!us0))"
/userfs/bin/blapi_cmd xdsl set_adsl_sra "$((!sra))"
/userfs/bin/blapi_cmd xdsl set_adsl_bitswap "$((!bitswap))"
CONFIGURED=1
}
configure_lines() {
config_load dsl
config_foreach configure_line dsl-line
}
call_wan_hotplug() {
# initializations
local updown="$1"
local ethwan="$2"
# ethernet hotlugs expect LINK and PORT environment variables set
env -i LINK="$updown" PORT="$ethwan" /sbin/hotplug-call ethernet
}
if [ "$WANPORT" = "ae_wan" -a -f /proc/device-tree/ae_wan/wan-dsl ]; then
/etc/init.d/br2684ctl stop
else
/etc/init.d/br2684ctl start
fi
# Wait for nas0 interface to come up.
while [ "$(devstatus "$WANPORT" | jsonfilter -e @.up)" != "true" ]; do
sleep 1
done
while [ true ]; do
LINK="$(awk '/ADSL link status:/{print $4}' /proc/tc3162/adsl_stats)"
[ \( "$LINK" = "down" -o "$LINK" = "up" \) ] && break
sleep 1
done
sleep 2
/userfs/bin/blapi_cmd xdsl set_adsl_sysvid "26 00 47 4E 58 53 00 00" # GNXS vendor id
/userfs/bin/blapi_cmd xdsl set_adsl_version "$(ubus call fwbank dump | jsonfilter -e "@.bank[@.active=true].swver" | cut -f1 -d'_' | cut -f1 -d'-' | hexdump -e '11/1 "%02x " "\n"' | head -n1)"
/userfs/bin/blapi_cmd xdsl set_power_up_down 1
/userfs/bin/blapi_cmd xdsl set_power_up_down 0
sleep 1
while [ true ]; do
LINK="$(awk '/ADSL link status:/{print $4}' /proc/tc3162/adsl_stats)"
if [ "$LINK" != "$PREVLINK" -a \( "$LINK" = "down" -o "$LINK" = "up" \) ]; then
if [ "$LINK" = "down" ]; then
[ "$CONFIGURED" -eq 0 ] && configure_lines # Needs to be done once the slave SoC is in down state and we've not been able to auto-sync.
if [ -n "$WANMODE" ]; then
if [ "$WANMODE" = "PTM" ]; then
/userfs/bin/blapi_cmd xdsl ptm_do_reset_sequence 0 1
else
delete_atm_devices
fi
fi
call_wan_hotplug "down" "$WANPORT"
else
CONFIGURED=1
WANMODE="$(awk '/TPSTC type:/{print $4}' /proc/tc3162/adsl_stats)"
if [ "$WANMODE" != "$PREVWANMODE" ]; then
OLDWANPORT="$WANPORT"
network_defer_device "$OLDWANPORT"
if [ -f /proc/device-tree/ae_wan/wan-dsl ]; then
WANPORT="ae_wan"
else
WANPORT="nas10"
fi
if [ "$WANMODE" = "PTM" ]; then
/etc/init.d/br2684ctl stop
delete_atm_devices
/userfs/bin/blapi_cmd system set_wan_mode 1
/userfs/bin/blapi_cmd xdsl reload_ko 2
/userfs/bin/blapi_cmd xdsl ptm_do_reset_sequence 1 2
# Set extended TPID for PTM packet flow
sys memwl 1FB50000 81001839
# VLAN TPID - VLAN
sys memwl 1FB50F18 8100
ifconfig ${WANPORT} mtu 1500
else
/userfs/bin/blapi_cmd system set_wan_mode 0
/userfs/bin/blapi_cmd xdsl reload_ko 1
/etc/init.d/br2684ctl start
# Set extended TPID for ATM packet flow
sys memwl 1FB50000 884C1839
# VLAN TPID - MPOA
sys memwl 1FB50F18 884C
ifconfig ${WANPORT} mtu 1982
ifconfig ${WANPORT} down up
OLDWANPORT="$WANPORT"
ATMINDEX="$(cat /sys/class/atm/TSARM*/atmindex | tail -n1 2> /dev/null)"
WANPORT="nas$((ATMINDEX))"
fi
if [ "$OLDWANPORT" != "$WANPORT" ]; then
call_wan_hotplug "down" "$OLDWANPORT"
FILES="$(grep "$OLDWANPORT" /etc/config/* | cut -f1 -d: | uniq | cut -f4 -d/ | xargs)"
for FILE in $FILES; do
sed -i -e "s#${OLDWANPORT}#${WANPORT}#g" "/etc/config/${FILE}"
"/etc/init.d/${FILE}" restart
done
else
/etc/init.d/network restart
fi
ifconfig ${OLDWANPORT} down up
fi
if [ "$WANMODE" = "PTM" ]; then
: # ToDo
else
create_atm_devices
fi
call_wan_hotplug "up" "$WANPORT"
PREVWANMODE="$WANMODE"
fi
# Toggle link state
network_defer_device "$WANPORT"
network_ready_device "$WANPORT"
# We are only interested in the transtion from init -> up/down and up/down -> down/up and vice versa.
# Since we poll the status via in-band signaling packets might get lost and the /procfs file is empty.
# This state we don't want to handle as it will toggle the link and do a re-setup which is totally unnecessary and unwanted.
PREVLINK="$LINK"
fi
sleep 5
done

View File

@@ -25,7 +25,6 @@ config dsl-line line
list profile 12b
list profile 17a
list profile 30a
list profile 35b
option bitswap 1
option sra 1
option us0 1 # VDSL2 only

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ethmngr
PKG_VERSION:=3.0.8
PKG_VERSION:=3.0.7
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/ethmngr.git
PKG_SOURCE_VERSION:=c73e5b15718ca40b2740bbe6151dfbb2bcca16df
PKG_SOURCE_VERSION:=171cf63d972c6fa81b97281531e457a0967c16c7
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=firewallmngr
PKG_VERSION:=1.0.10
PKG_VERSION:=1.0.9
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/firewallmngr.git
PKG_SOURCE_VERSION:=05ad0d6f7f21520eecd05429c14d1963de2a8463
PKG_SOURCE_VERSION:=77ad8425b73a3ac63f6160dc217635394ac87907
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -2,8 +2,6 @@
. /lib/functions.sh
ZONE_NAME_FILE="/tmp/service_fw_zone"
log() {
echo "${@}"|logger -t firewall.service -p info
}
@@ -19,37 +17,6 @@ exec_cmd() {
return 0
}
collect_zone_name() {
local name network
config_get name "${1}" name ""
if [ -z "${name}" ]; then
return
fi
config_get network "${1}" network ""
for i in ${network}; do
var="${i}_zone"
echo "${var}=${name}" >> "${ZONE_NAME_FILE}"
done
}
load_zone_names() {
rm -f "${ZONE_NAME_FILE}"
config_foreach collect_zone_name zone
}
get_firewall_zone() {
if [ ! -f "${ZONE_NAME_FILE}" ]; then
echo ""
return
fi
var="${1}_zone="
name="$(cat ${ZONE_NAME_FILE} | grep ${var} | head -n 1 | cut -d'=' -f 2)"
echo "${name}"
}
add_iptable_rule() {
chain_name=$1
protocol=$2
@@ -168,14 +135,9 @@ add_service() {
fi
action=$(echo "${target}" | tr a-z A-Z)
zone_name="$(get_firewall_zone ${interface})"
if [ -z "${zone_name}" ]; then
log "Rule can not be added without zone name for interface ${interface}"
return
fi
chain_name="zone_${zone_name}_input"
chain_name="zone_${interface}_input"
res=0
count=$(echo "${proto}" | sed -n "/-1/p" | wc -l)
if [ "${count}" -eq 0 ]; then
@@ -198,9 +160,4 @@ add_service() {
}
config_load firewall
load_zone_names
config_foreach add_service "service"
rm -f "${ZONE_NAME_FILE}"

View File

@@ -5,16 +5,15 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fluent-bit
PKG_VERSION:=4.0.4
PKG_VERSION:=4.0.2
PKG_RELEASE:=$(AUTORELEASE)
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit.git
PKG_SOURCE_VERSION=v$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit/archive/refs/tags/
PKG_HASH:=aa0577ba7251081c8d5398b2a905b5b0585bb657ca13b39a5e12931437516f08
endif
PKG_LICENSE:=Apache-2.0
@@ -56,7 +55,7 @@ CMAKE_OPTIONS+= \
-DFLB_BACKTRACE=No \
-DFLB_KAFKA=No \
-DFLB_WASM=No \
-DFLB_LUAJIT=No
-DFLB_LUAJIT=Yes
# In plugins
CMAKE_OPTIONS += \
@@ -66,15 +65,15 @@ CMAKE_OPTIONS += \
-DFLB_IN_DISK=Yes \
-DFLB_IN_EXEC=Yes \
-DFLB_IN_HEAD=Yes \
-DFLB_IN_KMSG=Yes \
-DFLB_IN_TAIL=Yes \
-DFLB_IN_FORWARD=No \
-DFLB_IN_KMSG=No \
-DFLB_IN_PROC=No \
-DFLB_IN_RANDOM=No \
-DFLB_IN_SERIAL=No \
-DFLB_IN_MQTT=No \
-DFLB_IN_STDIN=No \
-DFLB_IN_SYSTEMD=No \
-DFLB_IN_TAIL=No \
-DFLB_IN_TCP=No \
-DFLB_IN_THERMAL=No \
-DFLB_IN_UDP=No \
@@ -104,10 +103,10 @@ CMAKE_OPTIONS += \
# Filter options
CMAKE_OPTIONS += \
-DFLB_FILTER_LUA=Yes \
-DFLB_FILTER_AWS=No \
-DFLB_FILTER_ECS=No \
-DFLB_FILTER_KUBERNETES=No \
-DFLB_FILTER_LUA=No \
-DFLB_FILTER_NEST=No \
-DFLB_FILTER_RECORD_MODIFIER=No \
-DFLB_FILTER_THROTTLE=No \
@@ -171,7 +170,6 @@ CMAKE_OPTIONS += \
define Package/fluent-bit/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/fluent-bit
$(INSTALL_DIR) $(1)/etc/fluent-bit/conf.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/fluent-bit $(1)/usr/sbin/
$(INSTALL_DATA) ./files/fluent-bit.conf $(1)/etc/fluent-bit/fluent-bit.conf
$(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/parsers.conf $(1)/etc/fluent-bit/parsers.conf

View File

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

View File

@@ -0,0 +1,24 @@
diff --git a/lib/luajit-cmake/LuaJIT.cmake b/lib/luajit-cmake/LuaJIT.cmake
index 4ad1ef565..c0dee5830 100644
--- a/lib/luajit-cmake/LuaJIT.cmake
+++ b/lib/luajit-cmake/LuaJIT.cmake
@@ -426,10 +426,17 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
-if (GIT_EXISTENCE EQUAL 0)
+execute_process(
+ COMMAND git rev-parse --is-inside-work-tree
+ RESULT_VARIABLE GIT_IN_REPOSITORY
+ OUTPUT_VARIABLE GIT_IS_IN_REPOSITORY
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+if ((GIT_EXISTENCE EQUAL 0) AND (GIT_IN_REPOSITORY EQUAL 0))
message(STATUS "Using Git: ${GIT_VERSION}")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
- COMMAND git show -s --format=${GIT_FORMAT} > ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
+ COMMAND git -c log.showSignature=false show -s --format=${GIT_FORMAT} > ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
WORKING_DIRECTORY ${LUAJIT_DIR}
)
else()

View File

@@ -1,47 +0,0 @@
diff --git a/plugins/out_syslog/syslog.c b/plugins/out_syslog/syslog.c
index 4ecc7c4ac..cfe568245 100644
--- a/plugins/out_syslog/syslog.c
+++ b/plugins/out_syslog/syslog.c
@@ -776,12 +776,42 @@ static flb_sds_t syslog_format(struct flb_syslog *ctx, msgpack_object *o,
}
if (ctx->parsed_mode != FLB_SYSLOG_UDP) {
+ unsigned int msg_len = 0;
+
+ /* Create new SDS for length prefix */
+ flb_sds_t prefix = flb_sds_create_size(ctx->maxsize + 32);
+ if (!prefix) {
+ ret_sds = NULL;
+ goto clean;
+ }
+
+ /* Add newline also to make behaviour similar to syslog-ng */
tmp = flb_sds_cat(*s, "\n", 1);
if (!tmp) {
+ flb_sds_destroy(prefix);
ret_sds = NULL;
goto clean;
}
*s = tmp;
+
+ msg_len = flb_sds_len(*s);
+ tmp = flb_sds_printf(&prefix, "%u ", msg_len);
+ if (!tmp) {
+ flb_sds_destroy(prefix);
+ ret_sds = NULL;
+ goto clean;
+ }
+ prefix = tmp;
+
+ tmp = flb_sds_cat(prefix, *s, msg_len);
+ if (!tmp) {
+ flb_sds_destroy(prefix);
+ ret_sds = NULL;
+ goto clean;
+ }
+
+ flb_sds_destroy(*s);
+ *s = tmp;
}
}
else {

View File

@@ -1,32 +0,0 @@
diff --git a/plugins/in_kmsg/in_kmsg.c b/plugins/in_kmsg/in_kmsg.c
index cd5c4cd17..9524cf194 100644
--- a/plugins/in_kmsg/in_kmsg.c
+++ b/plugins/in_kmsg/in_kmsg.c
@@ -165,6 +165,15 @@ static inline int process_line(const char *line,
flb_time_set(&ts, ctx->boot_time.tv_sec + tv.tv_sec, tv.tv_usec * 1000);
+ /* Format syslog timestamp: "Jul 03 10:31:53" */
+ time_t real_time = ctx->boot_time.tv_sec + tv.tv_sec;
+ struct tm tm_info;
+ char syslog_ts[32];
+
+ localtime_r(&real_time, &tm_info);
+ strftime(syslog_ts, sizeof(syslog_ts), "%b %d %H:%M:%S", &tm_info);
+ int syslog_ts_len = strlen(syslog_ts);
+
/* Now process the human readable message */
p = strchr(p, ';');
if (!p) {
@@ -198,7 +207,10 @@ static inline int process_line(const char *line,
FLB_LOG_EVENT_UINT64_VALUE(tv.tv_usec),
FLB_LOG_EVENT_CSTRING_VALUE("msg"),
- FLB_LOG_EVENT_STRING_VALUE((char *) p, line_len - 1));
+ FLB_LOG_EVENT_STRING_VALUE((char *) p, line_len - 1),
+
+ FLB_LOG_EVENT_CSTRING_VALUE("syslog_ts"),
+ FLB_LOG_EVENT_STRING_VALUE(syslog_ts, syslog_ts_len));
}
if (ret == FLB_EVENT_ENCODER_SUCCESS) {

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostmngr
PKG_VERSION:=1.3.1
PKG_VERSION:=1.2.20
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=3663ca4d001508509774115d6797b932f9ed4f69
PKG_SOURCE_VERSION:=3948618fa8fa23a0ddc51632b0036dbd08e27696
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/hostmngr.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip

View File

@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=9.9.10
PKG_VERSION:=9.9.6
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
PKG_SOURCE_VERSION:=1a842e0a3836f616973e6a92f0b0b6ca82ec39bb
PKG_SOURCE_VERSION:=5dba542b280495730176da468bc45ed5dcc8c94e
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -88,7 +88,6 @@ define Package/icwmp/install
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/95-set-random-inform-time $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/85-migrate-gw-info $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/999-cwmp-conn-config $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/icwmpd/vendor_log.sh $(1)/etc/icwmpd/vendor_log.sh
$(INSTALL_BIN) ./files/etc/icwmpd/firewall.cwmp $(1)/etc/icwmpd/firewall.cwmp
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp

View File

@@ -1,44 +1,14 @@
#!/bin/sh
. /lib/functions.sh
ZONE_NAME_FILE="/tmp/cwmp_fw_zone"
#created by the icwmp package
log() {
echo "${@}"|logger -t firewall.cwmp -p info
}
collect_zone_name() {
local name network
config_get name "${1}" name ""
if [ -z "${name}" ]; then
return
fi
config_get network "${1}" network ""
for i in ${network}; do
var="${i}_zone"
echo "${var}=${name}" >> "${ZONE_NAME_FILE}"
done
}
load_zone_names() {
rm -f "${ZONE_NAME_FILE}"
config_load firewall
config_foreach collect_zone_name zone
}
get_firewall_zone() {
if [ ! -f "${ZONE_NAME_FILE}" ]; then
echo ""
return
fi
var="${1}_zone="
name="$(cat ${ZONE_NAME_FILE} | grep ${var} | head -n 1 | cut -d'=' -f 2)"
echo "${name}"
zone="$(uci show firewall|grep network|grep -w "${1}"|cut -d. -f 2)"
zone="${zone:-wan}" # defaults to wan zone
echo "$zone"
}
cleanup_upstream_rules() {
@@ -199,6 +169,4 @@ configure_connection_req_rules() {
fi
}
load_zone_names
configure_connection_req_rules "$@"
rm -f "${ZONE_NAME_FILE}"

View File

@@ -16,6 +16,79 @@ log() {
echo "${@}"|logger -t cwmp.init -p info
}
regenerate_ssl_link() {
local cert_dir
cert_dir="${1%/}"
if [ -f "${cert_dir}" ]; then
return 0
fi
# do not generate the c_rehash if its system default cert path
# ca-certificate package already generates c_rehash on compilation
[ ! -d "${cert_dir}" ] || [ "${cert_dir}" = "/etc/ssl/certs" ] && return 0
generate_links() {
local file_type="$1"
local files="${cert_dir}"/*."${file_type}"
for cfile in ${files}; do
if [ -f "${cfile}" ]; then
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
if [ ! -f "${cert_dir}/${rehash}.0" ]; then
log "Generating c_rehash for ${cfile}=>${rehash}.0"
ln -s "${cfile}" "${cert_dir}/${rehash}.0"
fi
fi
done
}
generate_links "pem"
}
enable_dhcp_option43() {
local wan="${1}"
### Ask for DHCP Option 43 only if CWMP is enabled ###
local reqopts="$(uci -q get network."${wan}".reqopts)"
local proto="$(uci -q get network."${wan}".proto)"
local newreqopts=""
local option43_present=0
for ropt in $reqopts; do
case $ropt in
43) option43_present=1 ;;
*) ;;
esac
done
if [ ${option43_present} -eq 1 ]; then
return;
fi
newreqopts="$reqopts 43"
if [ "${proto}" = "dhcp" ]; then
uci -q set network."${wan}".reqopts="$newreqopts"
uci commit network
ubus call network reload
fi
}
set_vendor_id() {
local wan="${1}"
local proto="$(uci -q get network."${wan}".proto)"
if [ "${proto}" = "dhcp" ]; then
vendorid="$(uci -q get network."${wan}".vendorid)"
if [ -z "${vendorid}" ]; then
uci -q set network."${wan}".vendorid="dslforum.org"
ubus call uci commit '{"config":"network"}'
elif [[ $vendorid != *"dslforum.org"* ]]; then
uci -q set network."${wan}".vendorid="${vendorid},dslforum.org"
ubus call uci commit '{"config":"network"}'
fi
fi
}
wait_for_resolvfile() {
local time=$1
local tm=1
@@ -138,6 +211,28 @@ validate_defaults() {
}
boot() {
local dhcp_discovery wan_interface skip_dhcp_boot_options
config_load cwmp
config_get wan_interface cpe default_wan_interface "wan"
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 [ "${skip_dhcp_boot_options}" -ne 1 ]; then
# Set dhcp option 43 if not already configured
enable_dhcp_option43 "${wan_interface}"
# Set dhcp option 60
set_vendor_id "${wan_interface}"
fi
fi
config_get ssl_capath acs ssl_capath
if [ -n "${ssl_capath}" ]; then
regenerate_ssl_link "${ssl_capath}"
fi
# Copy backup data so that if it restart latter on, it gets the info
copy_cwmp_etc_files_to_varstate
mkdir -p /var/run/icwmpd/

View File

@@ -1,107 +0,0 @@
#!/bin/sh
. /lib/functions.sh
log() {
echo "${@}"|logger -t cwmp.defaults -p info
}
set_vendor_id() {
local wan="${1}"
local proto="$(uci -q get network."${wan}".proto)"
if [ "${proto}" = "dhcp" ]; then
vendorid="$(uci -q get network."${wan}".vendorid)"
if [ -z "${vendorid}" ]; then
uci -q set network."${wan}".vendorid="dslforum.org"
elif [[ $vendorid != *"dslforum.org"* ]]; then
uci -q set network."${wan}".vendorid="${vendorid},dslforum.org"
fi
fi
}
enable_dhcp_option43() {
local wan="${1}"
local reqopts="$(uci -q get network."${wan}".reqopts)"
local proto="$(uci -q get network."${wan}".proto)"
local newreqopts=""
local option43_present=0
for ropt in $reqopts; do
case $ropt in
43) option43_present=1 ;;
*) ;;
esac
done
if [ ${option43_present} -eq 1 ]; then
return;
fi
newreqopts="$reqopts 43"
if [ "${proto}" = "dhcp" ]; then
uci -q set network."${wan}".reqopts="$newreqopts"
fi
}
regenerate_ssl_link() {
local cert_dir
cert_dir="${1%/}"
if [ -f "${cert_dir}" ]; then
return 0
fi
# do not generate the c_rehash if its system default cert path
# ca-certificate package already generates c_rehash on compilation
[ ! -d "${cert_dir}" ] || [ "${cert_dir}" = "/etc/ssl/certs" ] && return 0
generate_links() {
local file_type="$1"
local files="${cert_dir}"/*."${file_type}"
for cfile in ${files}; do
if [ -f "${cfile}" ]; then
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
if [ ! -f "${cert_dir}/${rehash}.0" ]; then
log "Generating c_rehash for ${cfile}=>${rehash}.0"
ln -s "${cfile}" "${cert_dir}/${rehash}.0"
fi
fi
done
}
generate_links "pem"
}
configure_dhcp_discovery() {
local dhcp_discovery wan_interface skip_dhcp_boot_options
config_load cwmp
config_get wan_interface cpe default_wan_interface "wan"
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 [ "${skip_dhcp_boot_options}" -ne 1 ]; then
# Set dhcp option 43 if not already configured
enable_dhcp_option43 "${wan_interface}"
# Set dhcp option 60
set_vendor_id "${wan_interface}"
fi
fi
}
configure_ssl_path() {
local ssl_capath
config_load cwmp
config_get ssl_capath acs ssl_capath
if [ -n "${ssl_capath}" ]; then
regenerate_ssl_link "${ssl_capath}"
fi
}
configure_dhcp_discovery
configure_ssl_path

View File

@@ -1,17 +1,16 @@
#
# Copyright (C) 2020-2024 IOPSYS Software Solutions AB
# Copyright (C) 2025 Genexis Sweden AB
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ieee1905
PKG_VERSION:=8.7.33
PKG_VERSION:=8.7.8
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=cb5b8f76c854b89607cd1750d3a4052ecd71ac9d
PKG_SOURCE_VERSION:=9c507bfb7f45fad81097262f05dc7cd11760e6b0
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/ieee1905.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
@@ -106,7 +105,6 @@ TARGET_CFLAGS += -DHAS_UBUS
ifeq ($(CONFIG_IEEE1905_BUILD_TR181_PLUGIN),y)
TARGET_CFLAGS += -DBUILD_TR181_PLUGIN
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\"
endif
MAKE_FLAGS += \
@@ -116,7 +114,7 @@ MAKE_PATH:=src
define Package/ieee1905/install
$(CP) ./files/etc $(1)/
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
$(INSTALL_DIR) $(1)/usr/sbin

View File

@@ -1,23 +0,0 @@
{
"Device.IEEE1905.AL.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"{BBF_VENDOR_PREFIX}LocalOnlyMode": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"description": "Enable or disable interfaces from ieee1905.",
"datatype": "boolean"
}
}
}

View File

@@ -12,7 +12,6 @@ config al-iface
list ifname 'br-lan'
list ifname '/eth.*'
list ifname '/wl.*'
list ifname '/ra.*'
list ifname '/wds.*'
# ap sections are auto-generated/overwritten during onboarding

View File

@@ -1,9 +1,10 @@
#!/bin/sh
. /lib/functions/system.sh
BMAC=$(get_mac_label)
BMAC=$(db -q get hw.board.basemac)
BMAC=${BMAC//:/}
BMAC=${BMAC// /}
BMAC=$(printf "%12.12X" $((0x$BMAC)))
[ "$BMAC" == "" ] && exit 1

View File

@@ -4,7 +4,7 @@ PKG_NAME:=iopsys-analytics
PKG_RELEASE:=$(COMMITCOUNT)
PKG_LICENSE:=PROPRIETARY
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=25e32ac5a860aec6e53e3449565b71595073e014
PKG_SOURCE_VERSION:=00189cea0a78b7a30dbfdd363b6d8e836437d1bc
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
@@ -31,8 +31,8 @@ define Package/$(PKG_NAME)
+@PACKAGE_COLLECTD_ENCRYPTED_NETWORK \
# remote syslog
DEPENDS+= \
+@PACKAGE_syslog-ng:SYSLOGNG_LOGROTATE \
+PACKAGE_fluent-bit:logrotate \
+syslog-ng \
+@SYSLOGNG_LOGROTATE \
endef
@@ -44,13 +44,7 @@ endef
Build/Compile=
define Package/$(PKG_NAME)/install
$(CP) -r $(PKG_BUILD_DIR)/files/common/* $(1)/
ifneq ($(CONFIG_PACKAGE_fluent-bit),)
$(CP) -r $(PKG_BUILD_DIR)/files/fluent-bit/* $(1)/
endif
ifneq ($(CONFIG_PACKAGE_syslog-ng),)
$(CP) -r $(PKG_BUILD_DIR)/files/syslog-ng/* $(1)/
endif
$(CP) -r $(PKG_BUILD_DIR)/files/* $(1)/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@@ -6,13 +6,13 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ipt-trigger
PKG_VERSION:=1.0.3
PKG_VERSION:=1.0.2
PKG_LICENSE:=GPL-2.0
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=ac1beae4794f99533b28db7d0e6e80f4c268a3e8
PKG_SOURCE_VERSION:=4f3d4427403e0a9be7653c1b92907ae8ae5f21ae
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/ipt-trigger.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip

View File

@@ -1,55 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=json-schema-validator
PKG_VERSION:=2.3.0
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/pboettch/json-schema-validator.git
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_BUILD_DEPENDS:=nlohmann-json
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
CMAKE_OPTIONS += \
-DJSON_VALIDATOR_BUILD_TESTS=OFF \
-DJSON_VALIDATOR_BUILD_EXAMPLES=OFF \
-DJSON_VALIDATOR_INSTALL=ON \
-DJSON_VALIDATOR_SHARED_LIBS=OFF
define Package/json-schema-validator
SECTION:=libs
CATEGORY:=Libraries
TITLE:=JSON Schema Validator for nlohmann::json
URL:=https://github.com/pboettch/json-schema-validator
DEPENDS:=+libstdcpp +nlohmann-json
endef
define Package/json-schema-validator/description
A JSON Schema Validator for Modern C++ using nlohmann/json.
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/nlohmann
$(CP) $(PKG_BUILD_DIR)/src/nlohmann/json-schema.hpp $(1)/usr/include/nlohmann/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libnlohmann_json_schema_validator*.a $(1)/usr/lib/ 2>/dev/null || true
$(CP) $(PKG_BUILD_DIR)/libnlohmann_json_schema_validator*.so* $(1)/usr/lib/ 2>/dev/null || true
endef
define Package/json-schema-validator/install
true
endef
$(eval $(call BuildPackage,json-schema-validator))

View File

@@ -1,44 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=jsonval
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/jsonval
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Command-line JSON Schema Validator
DEPENDS:=+nlohmann-json +json-schema-validator +libstdcpp
endef
define Package/jsonval/description
A small CLI tool to validate JSON files against a schema using json-schema-validator and nlohmann/json.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
cp -r ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
$(TARGET_CXX) \
$(TARGET_CXXFLAGS) -std=c++17 \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/nlohmann \
-L$(STAGING_DIR)/usr/lib \
$(PKG_BUILD_DIR)/main.cpp \
-o $(PKG_BUILD_DIR)/jsonval \
-lnlohmann_json_schema_validator
endef
define Package/jsonval/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/jsonval $(1)/usr/bin/
endef
$(eval $(call BuildPackage,jsonval))

View File

@@ -1,64 +0,0 @@
#include <iostream>
#include <fstream>
#include <string>
#include <nlohmann/json.hpp>
#include <nlohmann/json-schema.hpp>
using nlohmann::json;
using nlohmann::json_schema::json_validator;
using namespace std;
void print_usage(const string& prog_name) {
cerr << "Usage: " << prog_name << " -s <schema.json> -j <data.json>" << endl;
}
int main(int argc, char* argv[]) {
string schema_path, data_path;
// Simple argument parsing
for (int i = 1; i < argc; ++i) {
string arg = argv[i];
if ((arg == "-s" || arg == "--schema") && i + 1 < argc) {
schema_path = argv[++i];
} else if ((arg == "-j" || arg == "--json") && i + 1 < argc) {
data_path = argv[++i];
} else {
print_usage(argv[0]);
return 1;
}
}
if (schema_path.empty() || data_path.empty()) {
print_usage(argv[0]);
return 1;
}
ifstream schema_file(schema_path);
ifstream data_file(data_path);
if (!schema_file.is_open() || !data_file.is_open()) {
cerr << "Error: Could not open one or both files." << endl;
return 2;
}
json schema, document;
try {
schema_file >> schema;
data_file >> document;
} catch (const json::parse_error& e) {
cerr << "Parse error: " << e.what() << endl;
return 3;
}
try {
json_validator validator;
validator.set_root_schema(schema);
validator.validate(document);
cout << "Valid" << endl;
} catch (const std::exception& e) {
cerr << "Validation failed: " << e.what() << endl;
return 4;
}
return 0;
}

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libdsl
PKG_VERSION:=7.3.0
PKG_VERSION:=7.2.100
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=20875ec79fcc7c546c2f1253c867d6afbc8bff75
PKG_SOURCE_URL:=https://dev.iopsys.eu/hal/libdsl.git
PKG_SOURCE_VERSION:=2a7a49fac35c3d8078ffe051594c0425d355cacd
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif
@@ -37,9 +37,6 @@ else ifeq ($(CONFIG_TARGET_x86),y)
else ifeq ($(CONFIG_TARGET_armvirt),y)
TARGET_PLATFORM=TEST
TARGET_CFLAGS +=-DIOPSYS_TEST
else ifeq ($(CONFIG_TARGET_airoha),y)
TARGET_PLATFORM=AIROHA
TARGET_CFLAGS +=-DIOPSYS_AIROHA
endif
TARGET_CFLAGS += \
@@ -60,7 +57,7 @@ define Package/libdsl
SUBMENU:=IOPSYS HAL libs
MENU:=1
TITLE:= xDSL library (libdsl)
DEPENDS+=TARGET_brcmbca:bcm963xx-bsp +TARGET_airoha:libeasy
DEPENDS+=TARGET_brcmbca:bcm963xx-bsp
endef
define Package/libdsl/description

View File

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

View File

@@ -17,11 +17,6 @@ SLIC=$(cat /proc/device-tree/airoha-voice/slic-type)
hasDect=$(db -q get hw.board.hasDect)
[ "$hasDect" = "1" ] || exit 0
# Set the DECT RFPI
. /lib/functions/iopsys-environment.sh
db set hw.board.dect_rfpi=$(get_dect_rfpi)
db commit
# configure the PCM for DECT/DCX81
[ -f "/proc/device-tree/aliases/dcx81-uart" ] && {
uci set dect.global.pcm_fsync='SHORT_LF'

View File

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

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=logmngr
PKG_VERSION:=1.0.17
PKG_VERSION:=1.0.15
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/system/logmngr.git
PKG_SOURCE_VERSION:=ad2636c642d56967e78c0c84bf82cb0e2b6311f2
PKG_SOURCE_VERSION:=1561b71a2225af737db9f091204247ab4e141abb
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -29,6 +29,7 @@ define Package/logmngr
CATEGORY:=Utilities
TITLE:=Logging Manager
DEPENDS:=+LOGMNGR_BACKEND_FLUENTBIT:fluent-bit
DEPENDS+=+@LOGMNGR_BACKEND_FLUENTBIT:BUSYBOX_CONFIG_KLOGD
DEPENDS+=+LOGMNGR_BACKEND_SYSLOG_NG:syslog-ng
DEPENDS+=+LOGMNGR_LOGROTATE:logrotate
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
@@ -60,6 +61,8 @@ define Package/logmngr/install
$(INSTALL_DIR) $(1)/lib/logmngr
ifeq ($(CONFIG_LOGMNGR_BACKEND_FLUENTBIT),y)
$(INSTALL_DATA) ./files/lib/logmngr/fluent-bit.sh $(1)/lib/logmngr/
$(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_BIN) ./files/logmngr-klogd $(1)/usr/libexec/
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/logread $(1)/sbin/
endif

View File

@@ -5,7 +5,6 @@
CONF_FILE=/etc/fluent-bit/fluent-bit.conf
TMP_CONF_FILE=/tmp/fluent-bit/fluent-bit.conf
FLUENT_BIT_CONF_DIR=/etc/fluent-bit/conf.d
append_conf() {
echo "$*" >> ${TMP_CONF_FILE}
@@ -15,14 +14,6 @@ create_config_file() {
mkdir -p /tmp/fluent-bit
rm -f ${TMP_CONF_FILE}
touch ${TMP_CONF_FILE}
# include all files placed in FLUENT_BIT_CONF_DIR directory
# fluent-bit does not support using directory in include directive
# also, if no file is found then fluent-bit aborts
# so only add include if any file is present in the FLUENT_BIT_CONF_DIR
if [ -d "$FLUENT_BIT_CONF_DIR" ] && [ "$(ls -A "$FLUENT_BIT_CONF_DIR")" ]; then
echo "@INCLUDE ${FLUENT_BIT_CONF_DIR}/*" >> ${TMP_CONF_FILE}
fi
echo "" >> ${TMP_CONF_FILE}
}
create_service_section() {
@@ -34,21 +25,6 @@ create_service_section() {
echo " log_level info" >> ${TMP_CONF_FILE}
echo " coro_stack_size 24576" >> ${TMP_CONF_FILE}
echo " parsers_file /etc/fluent-bit/parsers.conf" >> ${TMP_CONF_FILE}
echo " hot_reload on" >> ${TMP_CONF_FILE}
echo "" >> ${TMP_CONF_FILE}
# Generate default input for kmsg
echo "[INPUT]" >> ${TMP_CONF_FILE}
echo " name kmsg" >> ${TMP_CONF_FILE}
echo " Tag KMSG" >> ${TMP_CONF_FILE}
echo "" >> ${TMP_CONF_FILE}
echo "[OUTPUT]" >> ${TMP_CONF_FILE}
echo " name file" >> ${TMP_CONF_FILE}
echo " match KMSG" >> ${TMP_CONF_FILE}
echo " file /var/log/messages" >> ${TMP_CONF_FILE}
echo " format template" >> ${TMP_CONF_FILE}
echo " template {syslog_ts} {hostname} kernel: {msg}" >> ${TMP_CONF_FILE}
echo "" >> ${TMP_CONF_FILE}
}
@@ -354,4 +330,9 @@ logmngr_init() {
fi
procd_set_param respawn
procd_close_instance
procd_open_instance klogd
procd_set_param command /usr/libexec/logmngr-klogd
procd_set_param respawn
procd_close_instance
}

View File

@@ -4,14 +4,11 @@
LOGROTATE_FILE=/etc/logrotate.conf
LOGROTATE_TMP_FILE=/tmp/logrotate/logrotate.conf
CONF_DIR=/etc/logrotate.d
create_logrotate_file() {
mkdir -p /tmp/logrotate
rm -f ${LOGROTATE_TMP_FILE}
touch ${LOGROTATE_TMP_FILE}
echo -e "include ${CONF_DIR}" >> ${LOGROTATE_TMP_FILE}
echo -e "" >> ${LOGROTATE_TMP_FILE}
}
handle_logrotate() {

View File

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

View File

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

View File

@@ -61,14 +61,6 @@ remove_from_bridge() {
[ -n "$ifname" ] && brctl delif ${al_bridge} ${ifname}
}
get_network_id() {
local ifname=$1
[ -n "$ifname" ] || return
network_id=$(wpa_cli -i $ifname list_n|tail -n 1 | awk '{print $1}')
echo ${network_id}
}
update_bstas() {
section="$1"
action="$2"
@@ -76,15 +68,14 @@ update_bstas() {
config_get ifname "$section" ifname
config_get_bool enabled "$section" enabled 0
network_id=$(get_network_id $ifname)
if [ "$action" = "down" ]; then
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
wpa_cli -i "$ifname" disable_network $network_id > /dev/null 2>&1
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
elif [ "$action" = "up" ]; then
[ "$enabled" -eq 0 ] && return
wpa_cli -i "$ifname" reconnect > /dev/null 2>&1
wpa_cli -i "$ifname" enable_network $network_id > /dev/null 2>&1
wpa_cli -i "$ifname" enable_network 0 > /dev/null 2>&1
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
fi
}

View File

@@ -203,7 +203,7 @@ start_service() {
procd_open_instance
create_dir
procd_set_param command "/usr/sbin/mapagent" "-d" "-o" "/tmp/mapagent.log" "-f"
procd_set_param command "/usr/sbin/mapagent" "-d"
procd_set_param respawn
# procd_set_param stdout 1
# procd_set_param stderr 1

View File

@@ -6,9 +6,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map-controller
PKG_VERSION:=6.4.0.12
PKG_VERSION:=6.3.0.17
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=ae10f447f8d83ed6b98d2b82da2dda64be2c3183
PKG_SOURCE_VERSION:=7f55e5705fee1b879d651bbba872ec5d7152d5ab
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@genexis.eu>
LOCAL_DEV=0
@@ -74,29 +74,12 @@ ifeq ($(CONFIG_CONTROLLER_PROPAGATE_PROBE_REQ),y)
TARGET_CFLAGS += -DPROPAGATE_PROBE_REQ
endif
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/map-controller
$(INSTALL_DIR) $(1)/usr/include/map-controller/utils
$(CP) $(PKG_BUILD_DIR)/src/wifi_dataelements.h $(1)/usr/include/map-controller
$(CP) $(PKG_BUILD_DIR)/src/cntlr_commands_impl.h $(1)/usr/include/map-controller
$(CP) $(PKG_BUILD_DIR)/src/cntlr_commands.h $(1)/usr/include/map-controller
$(CP) $(PKG_BUILD_DIR)/src/cntlr_apis.h $(1)/usr/include/map-controller
$(CP) $(PKG_BUILD_DIR)/src/wifi_opclass.h $(1)/usr/include/map-controller
$(CP) $(PKG_BUILD_DIR)/src/steer_module.h $(1)/usr/include/map-controller
$(CP) $(PKG_BUILD_DIR)/src/timer.h $(1)/usr/include/map-controller
$(CP) $(PKG_BUILD_DIR)/src/timer_impl.h $(1)/usr/include/map-controller
$(CP) $(PKG_BUILD_DIR)/src/utils/debug.h $(1)/usr/include/map-controller/utils
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/src/libcntlr-apis.so $(1)/usr/lib
endef
define Package/map-controller/install
$(INSTALL_DIR) $(1)/etc
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mapcontroller $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/usr/lib/mapcontroller
$(CP) $(PKG_BUILD_DIR)/src/libcntlr-apis.so $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/src/plugins/steer/rcpi/rcpi.so $(1)/usr/lib/mapcontroller/rcpi.so
endef

View File

@@ -8,7 +8,9 @@ config controller 'controller'
option enable_ts '0'
option primary_vid '1'
option primary_pcp '0'
option allow_bgdfs '0'
option stale_sta_timeout '30d'
option channel_plan '0'
option de_collect_interval '60'
config sta_steering
@@ -24,10 +26,6 @@ config sta_steering
option plugins_policy 'any'
list plugins 'rcpi'
config channel_plan
option preclear_dfs '0'
option acs '0'
###################
# Default AP sections credentials will by updated
# by uci-defaults script 99-mapcntlr

View File

@@ -71,7 +71,7 @@ validate_ap_section() {
'encryption:or("sae", "sae+aes", "psk2",
"psk2+aes", "sae-mixed", "sae-mixed+aes",
"none", "psk-mixed", "psk-mixed+aes",
"psk", "psk+aes", "wpa", "wpa2", "wpa-mixed")' \
"psk", "psk+aes")' \
'key:string' \
'vid:range(1,65535):1' \
'type:or("backhaul", "fronthaul", "combined")' \

View File

@@ -1,11 +0,0 @@
if (PACKAGE_map-plugins)
menu "Options"
config STEER_RATE_PLUGIN
bool "STA steering based on estimated throughput of target-AP"
default PACKAGE_map-plugins-steer-rate
endmenu
endif

View File

@@ -1,68 +0,0 @@
#
# Copyright (C) 2025 Genexis Sweden AB
#
include $(TOPDIR)/rules.mk
PKG_NAME:=map-plugins
PKG_VERSION:=0.0.4
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=74bf151851112ecee731d447af016c8dc668adcf
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/map-plugins.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=PROPRIETARY GENEXIS
PKG_LICENSE_FILES:=LICENSE
PKG_CONFIG_DEPENDS := CONFIG_PACKAGE_mapcontroller
PKG_BUILD_DEPENDS := map-controller
include $(INCLUDE_DIR)/package.mk
include $(wildcard plugins/*.mk)
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS) -Wall"
plugins := \
$(if $(CONFIG_PACKAGE_map-plugins-steer-rate),steer-rate)
ppkg:=$(patsubst plugins/%.mk,map-plugins-%,$(wildcard plugins/*.mk))
define Package/map-plugins/Default
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Multi-AP value added services
endef
define Package/map-plugins/config
source "$(SOURCE)/Config.in"
endef
define Package/map-plugins
$(call Package/map-plugins/Default)
TITLE:=Multi-AP plugins modules
DEPENDS+=+libeasy +libwifiutils +map-controller
endef
define Package/map-plugins/description
Provides extra Multi-AP services viz. steering, channel-planning etc.
endef
define Package/map-plugins/install
:
endef
define Build/Compile
$(foreach p,$(ppkg),$(call Build/Compile/$(p),$(1)))
endef
$(eval $(call BuildPackage,map-plugins))
$(eval $(foreach p,$(ppkg),$(call BuildPackage,$(p))))

View File

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

View File

@@ -32,7 +32,7 @@ define Package/mcastmngr
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
DEPENDS+=+!TARGET_brcmbca:mcproxy +!TARGET_brcmbca:sipcalc
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service +!TARGET_brcmbca:kmod-ebt-igmpsnooping +!TARGET_brcmbca:kmod-ebt-mldsnooping
DEPENDS+=+!TARGET_brcmbca:ebtables-legacy +dm-agent
DEPENDS+=+!TARGET_brcmbca:ebtables-legacy +bridgemngr
endef
define Package/mcastmngr/description

View File

@@ -65,69 +65,12 @@ generate_igmp_proxy_config(){
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
}
generate_mld_snooping_config(){
local u_itf="$1"
uci add mcast snooping
uci rename mcast.@snooping[-1]="mc_snooping_MLD"
uci set mcast.@snooping[-1].enable="1"
uci set mcast.@snooping[-1].proto="mld"
uci set mcast.@snooping[-1].version="2"
uci set mcast.@snooping[-1].robustness="2"
uci set mcast.@snooping[-1].query_interval="125"
uci set mcast.@snooping[-1].query_response_interval="100"
uci set mcast.@snooping[-1].last_member_query_interval="10"
uci set mcast.@snooping[-1].fast_leave="1"
uci set mcast.@snooping[-1].snooping_mode="2"
uci set mcast.@snooping[-1].interface="$u_itf"
}
generate_igmp_snooping_config(){
local u_itf="$1"
uci add mcast snooping
uci rename mcast.@snooping[-1]="igmp_snooping_1"
uci set mcast.@snooping[-1].enable="1"
uci set mcast.@snooping[-1].proto="igmp"
uci set mcast.@snooping[-1].version="2"
uci set mcast.@snooping[-1].robustness="2"
uci set mcast.@snooping[-1].query_interval="125"
uci set mcast.@snooping[-1].query_response_interval="100"
uci set mcast.@snooping[-1].last_member_query_interval="10"
uci set mcast.@snooping[-1].fast_leave="1"
uci set mcast.@snooping[-1].snooping_mode="2"
uci set mcast.@snooping[-1].interface="$u_itf"
uci add_list mcast.@snooping[-1].filter="239.0.0.0/8"
}
check_wan_bridge() {
local config="$1"
local wan_device="$2"
local name type
[ $((is_wan_bridge)) -ne 0 ] && return
config_get type "$config" type
config_get name "$config" name
[ "$type" = "bridge" -a "$wan_device" = "$name" ] && is_wan_bridge=1
}
generate_mcast_config(){
local up_itf="$(uci -q get network.wan.device)"
local is_wan_bridge=0
config_load network
config_foreach check_wan_bridge device "$up_itf"
up_itf="$(uci -q get network.wan.device)"
if [ $((is_wan_bridge)) -eq 0 ]; then
generate_igmp_proxy_config "$up_itf"
generate_mld_proxy_config "$up_itf"
else
generate_igmp_snooping_config "$up_itf"
generate_mld_snooping_config "$up_itf"
fi
generate_igmp_proxy_config "$up_itf"
generate_mld_proxy_config "$up_itf"
}
interfaces_ok(){

View File

@@ -1,140 +1,2 @@
#!/bin/sh
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
ZONE_NAME_FILE="/tmp/mcast_fw_zone"
log() {
echo "${@}"|logger -t firewall.mcast -p info
}
collect_zone_name() {
local name network
config_get name "${1}" name ""
if [ -z "${name}" ]; then
return
fi
config_get network "${1}" network ""
for i in ${network}; do
var="${i}_zone"
echo "${var}=${name}" >> "${ZONE_NAME_FILE}"
done
}
load_zone_names() {
rm -f "${ZONE_NAME_FILE}"
config_load firewall
config_foreach collect_zone_name zone
}
get_firewall_zone() {
if [ ! -f "${ZONE_NAME_FILE}" ]; then
echo ""
return
fi
var="${1}_zone="
name="$(cat ${ZONE_NAME_FILE} | grep ${var} | head -n 1 | cut -d'=' -f 2)"
echo "${name}"
}
# Get interface name for a device (e.g., br-lan -> lan)
find_interface_for_device() {
local dev="${1}"
local intf=""
local intf_dump idx
if [ -z "${dev}" ]; then
echo ""
return
fi
intf_dump="$(ubus -t 5 call network.interface dump)"
if [ -z "${intf_dump}" ]; then
echo ""
return
fi
json_load "${intf_dump}"
json_select interface
if [ "$?" -ne 0 ]; then
echo ""
return
fi
idx=1
while json_is_a ${idx} object; do
json_select ${idx}
if [ "$?" -ne 0 ]; then
break
fi
json_get_var device device
if [ "${device}" = "${dev}" ]; then
json_get_var intf interface
break
fi
idx=$(( idx + 1 ))
json_select ..
done
echo "${intf}"
}
# Setup iptables rule to allow multicast from upstream to downstream
setup_multicast_rule() {
local upstream_dev="$1"
local downstream_dev="$2"
local upstream_zone downstream_zone
local upstream_iface downstream_iface
upstream_iface=$(find_interface_for_device "$upstream_dev")
downstream_iface=$(find_interface_for_device "$downstream_dev")
[ -z "$upstream_iface" ] || [ -z "$downstream_iface" ] && {
log "Failed to map devices to interfaces"
return
}
upstream_zone=$(get_firewall_zone "$upstream_iface")
downstream_zone=$(get_firewall_zone "$downstream_iface")
[ -z "$upstream_zone" ] || [ -z "$downstream_zone" ] && {
log "Failed to map interfaces to zones"
return
}
iptables -w -t filter -A zone_${upstream_zone}_forward -p udp \
-d 224.0.0.0/240.0.0.0 \
-m comment --comment "!fw3: Allow-Multicast-UDP" \
-j zone_${downstream_zone}_dest_ACCEPT
}
apply_mcast_rule() {
local cfg="$1"
local up down proto
config_get proto "$cfg" proto
[ "$proto" = "igmp" ] || return
config_get up "$cfg" upstream_interface
config_get down "$cfg" downstream_interface
[ -n "$up" ] && [ -n "$down" ] && setup_multicast_rule "$up" "$down"
}
add_multicast_rules() {
config_load mcast
config_foreach apply_mcast_rule proxy
}
load_zone_names
add_multicast_rules
rm -f "${ZONE_NAME_FILE}"
# Forward multicast packets from wan to lan
iptables -w -t filter -A zone_wan_forward -p udp -d 224.0.0.0/240.0.0.0 -m comment --comment "!fw3: Allow-Multicast-UDP" -j zone_lan_dest_ACCEPT

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=netmngr
PKG_VERSION:=1.1.8
PKG_VERSION:=1.1.6
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/netmngr.git
PKG_SOURCE_VERSION:=6310f32b80f8abeccbf99ad55ce88792b19342d6
PKG_SOURCE_VERSION:=f1422e4de76990f7037ca265431d5f1031621c93
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

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

View File

@@ -207,23 +207,6 @@
}
]
},
"Type": {
"type": "string",
"read": true,
"write": true,
"description": "Datatype for this argument",
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci_sec",
"data": "@Parent",
"key": "type"
}
]
},
"Description": {
"type": "string",
"read": true,

View File

View File

@@ -1,127 +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 set network.lan=interface
uci -q set network.lan.proto='dhcp'
uci -q set network.lan.vendorid="$(uci -q get network.wan.vendorid)"
uci -q set network.lan.clientid="$(uci -q get network.wan.clientid)"
uci -q set network.lan.reqopts="$(uci -q get network.wan.reqopts)"
uci -q set network.lan.sendopts="$(uci -q get network.wan.sendopts)"
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 set network.wan.disabled='1'
uci -q set network.wan6.disabled='1'
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
# Update gateway WAN Interface
uci -q set gateway.global.wan_interface="lan"
uci -q commit gateway
# disable firewall
uci -q set firewall.globals.enabled="0"
uci -q commit firewall
}
l2_network_config
l2_mcast_config
# If device is already boot-up, assume netmode changed during runtime
if [ -f /var/run/boot_complete ]; then
/etc/init.d/odhcpd stop 2>/dev/null
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
ubus call uci commit "{\"config\":\"$config\"}"
sleep 1
done
fi

View File

@@ -1,108 +0,0 @@
#!/bin/sh
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
source "/etc/device_info"
l3_mcast_config() {
# configure L3 mcast config
logger -s -p user.info -t "netmode" "Generating L3 mcast configuration"
rm -f /etc/config/mcast
sh /rom/etc/uci-defaults/61-mcast_config_generate
uci -q commit mcast
}
l3_network_config() {
logger -s -p user.info -t "netmode" "Generating L3 network configuration"
# Configure L3 Network Mode
uci -q set network.lan=interface
uci -q set network.lan.device='br-lan'
uci -q set network.lan.proto='static'
uci -q set network.lan.ipaddr='192.168.1.1'
uci -q set network.lan.netmask='255.255.255.0'
uci -q set network.lan.ip6assign='60'
uci -q delete network.lan.vendorid
uci -q delete network.lan.clientid
uci -q delete network.lan.reqopts
uci -q delete network.lan.sendopts
uci -q delete network.lan6
uci -q set network.wan=interface
uci -q set network.wan.proto='dhcp'
uci -q delete network.wan.disabled
uci -q delete network.wan.username
uci -q delete network.wan.password
uci -q set network.wan6=interface
uci -q set network.wan6.proto='dhcpv6'
uci -q delete network.wan6.disabled
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
if [ -n "$device" ]; then
uci -q set network.wan.device="$device"
uci -q set network.wan6.device="$device"
fi
json_cleanup
fi
uci -q commit network
# Enable DHCP Server
uci -q set dhcp.lan.ignore=0
uci -q set dhcp.wan.ignore=1
uci -q commit dhcp
/etc/init.d/odhcpd enable
# Enable SSDPD
uci -q set ssdpd.ssdp.enabled="1"
uci -q commit ssdpd
# Update CWMP Agent WAN Interface
uci -q set cwmp.cpe.default_wan_interface="wan"
uci -q commit cwmp
# Update gateway WAN Interface
uci -q set gateway.global.wan_interface="wan"
uci -q commit gateway
# Enable firewall
uci -q set firewall.globals.enabled="1"
uci -q commit firewall
}
l3_network_config
l3_mcast_config
# If device is already boot-up, assume netmode changed during runtime
if [ -f /var/run/boot_complete ]; then
/etc/init.d/odhcpd restart 2>/dev/null
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
ubus call uci commit "{\"config\":\"$config\"}"
sleep 1
done
fi

View File

@@ -1,106 +0,0 @@
#!/bin/sh
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
source "/etc/device_info"
l3_mcast_config() {
# configure L3 mcast config
logger -s -p user.info -t "netmode" "Generating L3 mcast configuration"
rm -f /etc/config/mcast
sh /rom/etc/uci-defaults/61-mcast_config_generate
uci -q commit mcast
}
l3_network_pppoe_config() {
logger -s -p user.info -t "netmode" "Generating L3 network configuration"
# Configure L3 Network Mode
uci -q set network.lan=interface
uci -q set network.lan.device='br-lan'
uci -q set network.lan.proto='static'
uci -q set network.lan.ipaddr='192.168.1.1'
uci -q set network.lan.netmask='255.255.255.0'
uci -q set network.lan.ip6assign='60'
uci -q delete network.lan.vendorid
uci -q delete network.lan.clientid
uci -q delete network.lan.reqopts
uci -q delete network.lan.sendopts
uci -q delete network.lan6
uci -q set network.wan=interface
uci -q set network.wan.proto='pppoe'
uci -q set network.wan.username="$NETMODE_username"
uci -q set network.wan.password="$NETMODE_password"
uci -q delete network.wan.disabled
uci -q set network.wan6.disabled='1'
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
if [ -n "$device" ]; then
uci -q set network.wan.device="$device"
uci -q set network.wan6.device="$device"
fi
json_cleanup
fi
uci -q commit network
# Enable DHCP Server
uci -q set dhcp.lan.ignore=0
uci -q set dhcp.wan.ignore=1
uci -q commit dhcp
/etc/init.d/odhcpd enable
# Enable SSDPD
uci -q set ssdpd.ssdp.enabled="1"
uci -q commit ssdpd
# Update CWMP Agent WAN Interface
uci -q set cwmp.cpe.default_wan_interface="wan"
uci -q commit cwmp
# Update gateway WAN Interface
uci -q set gateway.global.wan_interface="wan"
uci -q commit gateway
# Enable firewall
uci -q set firewall.globals.enabled="1"
uci -q commit firewall
}
l3_network_pppoe_config
l3_mcast_config
# If device is already boot-up, assume netmode changed during runtime
if [ -f /var/run/boot_complete ]; then
/etc/init.d/odhcpd restart 2>/dev/null
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
ubus call uci commit "{\"config\":\"$config\"}"
sleep 1
done
fi

View File

@@ -11,19 +11,21 @@
"supported_args": [
{
"name": "username",
"description": "PPPoE username",
"description": "PPoE username",
"required": true,
"type": "string",
"#value": "TestUser"
},
{
"name": "password",
"description": "PPPoE password",
"description": "PPoE password",
"required": true,
"type": "string",
"#value": "TestPassword"
}
]
},
{
"name": "bridged",
"description": "Bridged mode (Layer 2)"
}
]
}

View File

@@ -17,7 +17,7 @@ fi
configure_supp_modes_args()
{
local obj inst name description required value parent type
local obj inst name description required value parent
obj="${1}"
inst="${2}"
@@ -32,14 +32,12 @@ configure_supp_modes_args()
json_get_var description description
json_get_var value value
json_get_var required required
json_get_var type type
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}=supported_args
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.name="${name}"
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.description="${description}"
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.required="${required}"
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.value="${value}"
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.type="${type}"
uci -q set netmode.${parent}_supprted_args_${SUPP_ARGS}.dm_parent="${parent}"
json_select ..

View File

View File

@@ -1,25 +0,0 @@
#!/bin/sh
# This script is to cleanup dmmap and restart datamodel related services
# when wan mode changes
if [ -d "/etc/bbfdm/dmmap/" ]; then
rm -rf /etc/bbfdm/dmmap/*
fi
# If device is booting up, no need to restart services
if [ ! -f /var/run/boot_complete ]; then
return 0
fi
if [ -x "/etc/init.d/bbfdm.services" ]; then
/etc/init.d/bbfdm.services restart
fi
if [ -x "/etc/init.d/bbfdmd" ]; then
/etc/init.d/bbfdmd restart
fi
if [ -x "/etc/init.d/obuspa" ]; then
/etc/init.d/obuspa restart
fi

View File

@@ -1,42 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nlohmann-json
PKG_VERSION:=3.11.2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/nlohmann/json.git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.MIT
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/nlohmann-json
SECTION:=libs
CATEGORY:=Libraries
TITLE:=JSON for Modern C++ (nlohmann/json)
endef
define Package/nlohmann-json/description
JSON for Modern C++ is a single-header C++ library for working with JSON.
endef
define Build/Compile
# Header-only, nothing to compile
true
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/nlohmann
$(CP) $(PKG_BUILD_DIR)/single_include/nlohmann/json.hpp $(1)/usr/include/nlohmann/
endef
define Package/nlohmann-json/install
true
endef
$(eval $(call BuildPackage,nlohmann-json))

View File

@@ -1,43 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nng
PKG_VERSION:=1.11
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/nanomsg/nng.git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.txt
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/nng
SECTION:=libs
CATEGORY:=Libraries
TITLE:=NNG - nanomsg-next-gen
URL:=https://github.com/nanomsg/nng
DEPENDS:=+libpthread +libatomic
endef
define Package/nng/description
NNG is a lightweight messaging library, a successor to nanomsg.
endef
CMAKE_OPTIONS += \
-DBUILD_SHARED_LIBS=ON \
-DNNG_ENABLE_EXAMPLES=OFF \
-DNNG_ENABLE_TESTS=OFF
define Package/nng/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnng.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,nng))

View File

@@ -70,13 +70,4 @@ config OBUSPA_VENDOR_PREFIX
config OBUSPA_OVERRIDE_CT_ROLE
bool "Override ControllerTrust role with factory default roles"
default y
config OBUSPA_VC_POLL_PERIOD
int "Polling interval in sec for ValueChange Subscriptions"
range 15 120
default "15"
help
Obuspa relies on a polling mechanism to determine the ValueChange, Add, Del Subscriptions.
Short poll period could give more responsive subscription events, but might delay overall experience in slower CPUs with good amount of subscriptions, on the other hand, a bigger value results into less responsive subscription handling. This value must be in range of 15 to 120 secs. (default 15)
endif

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=obuspa
PKG_VERSION:=10.0.4.1
PKG_VERSION:=10.0.0.8
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
PKG_SOURCE_VERSION:=6b888812299de0d836a8dcf33bc899ec8ff16030
PKG_SOURCE_VERSION:=3e9299063e3c65565d2c834b5ab654fda830f749
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
@@ -107,10 +107,6 @@ ifneq ($(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM),)
TARGET_CFLAGS += -DOBUSPA_MAX_CONTROLLERS_NUM=$(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
endif
ifneq ($(CONFIG_OBUSPA_VC_POLL_PERIOD),)
TARGET_CFLAGS += -DOBUSPA_VC_POLL_PERIOD=$(CONFIG_OBUSPA_VC_POLL_PERIOD)
endif
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/

View File

@@ -10,4 +10,4 @@ config obuspa 'global'
#option client_cert '/etc/obuspa/client.pem'
option log_dest 'syslog'
option dm_caching_exclude '/etc/obuspa/transient_dm.json'
option dualstack_pref 'IPv6'

View File

@@ -241,8 +241,7 @@ validate_mqtt_client_section()
'Password:string' \
'ProtocolVersion:or("3.1", "3.1.1","5.0"):5.0' \
'TransportProtocol:or("TCP/IP","TLS"):TCP/IP' \
'ClientID:string' \
'RequestResponseInfo:bool:1'
'ClientID:string'
}
validate_challenge_section()
@@ -278,11 +277,6 @@ update_reset_reason()
fi
}
update_dual_stack_pref()
{
db_set Internal.DualStackPreference "${1}"
}
get_role_index()
{
local name drole
@@ -608,7 +602,7 @@ configure_stomp_connection() {
configure_mqtt_client() {
local BrokerAddress BrokerPort Enable Username Password ProtocolVersion
local TransportProtocol ClientID RequestResponseInfo
local TransportProtocol ClientID
local sec
sec="${1}"
@@ -633,7 +627,6 @@ configure_mqtt_client() {
db_set "${BASEPATH}.ProtocolVersion" "${ProtocolVersion}"
db_set "${BASEPATH}.TransportProtocol" "${TransportProtocol}"
db_set "${BASEPATH}.ClientID" "${ClientID}"
db_set "${BASEPATH}.RequestResponseInfo" "${RequestResponseInfo}"
}
@@ -994,8 +987,6 @@ db_init()
#log "Create reset file ...."
config_load $CONFIGURATION
config_get dualstack_pref global dualstack_pref "IPv6"
global_init
config_foreach configure_localagent localagent
global_init
@@ -1010,10 +1001,8 @@ db_init()
config_foreach configure_subscription subscription
global_init
config_foreach configure_challenges challenge
global_init
update_reset_reason
update_dual_stack_pref "${dualstack_pref}"
uci_commit ${CONFIGURATION}
cp /etc/config/obuspa /tmp/obuspa/

View File

@@ -1,8 +1,8 @@
Index: obuspa-10.0.4.0/src/core/device_controller.c
Index: obuspa-10.0.0.1/src/core/device_controller.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/device_controller.c
+++ obuspa-10.0.4.0/src/core/device_controller.c
@@ -4214,6 +4214,14 @@ int ProcessControllerAdded(int cont_inst
--- obuspa-10.0.0.1.orig/src/core/device_controller.c
+++ obuspa-10.0.0.1/src/core/device_controller.c
@@ -4211,6 +4211,14 @@ int ProcessControllerAdded(int cont_inst
goto exit;
}
@@ -17,7 +17,7 @@ Index: obuspa-10.0.4.0/src/core/device_controller.c
// Exit if unable to get the object instance numbers present in this controller's MTP table
USP_SNPRINTF(path, sizeof(path), "%s.%d.MTP", device_cont_root, cont_instance);
err = DATA_MODEL_GetInstances(path, &iv);
@@ -4255,14 +4263,6 @@ int ProcessControllerAdded(int cont_inst
@@ -4252,14 +4260,6 @@ int ProcessControllerAdded(int cont_inst
DEVICE_MQTT_UpdateControllerTopics();
#endif

View File

@@ -1,7 +1,7 @@
Index: obuspa-10.0.4.0/src/core/bdc_exec.c
Index: obuspa-10.0.0.1/src/core/bdc_exec.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/bdc_exec.c
+++ obuspa-10.0.4.0/src/core/bdc_exec.c
--- obuspa-10.0.0.1.orig/src/core/bdc_exec.c
+++ obuspa-10.0.0.1/src/core/bdc_exec.c
@@ -549,10 +549,25 @@ int StartSendingReport(bdc_connection_t
// Set the list of headers
@@ -30,10 +30,10 @@ Index: obuspa-10.0.4.0/src/core/bdc_exec.c
bc->headers = curl_slist_append(bc->headers, "Content-Encoding: gzip");
}
Index: obuspa-10.0.4.0/src/core/bdc_exec.h
Index: obuspa-10.0.0.1/src/core/bdc_exec.h
===================================================================
--- obuspa-10.0.4.0.orig/src/core/bdc_exec.h
+++ obuspa-10.0.4.0/src/core/bdc_exec.h
--- obuspa-10.0.0.1.orig/src/core/bdc_exec.h
+++ obuspa-10.0.0.1/src/core/bdc_exec.h
@@ -54,6 +54,8 @@ 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_GZIP 0x00000002 // If set, the reports contants are Gzipped
@@ -45,10 +45,10 @@ Index: obuspa-10.0.4.0/src/core/bdc_exec.h
+#define BDC_FLAG_HEADER_PER_ROW 0x00000020 // If set, report format in header would be csv ParameterPerRow
+#define BDC_FLAG_HEADER_PER_COL 0x00000040 // If set, report format in header would be csv ParameterPerColumn
#endif
Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/device_bulkdata.c
+++ obuspa-10.0.4.0/src/core/device_bulkdata.c
--- obuspa-10.0.0.1.orig/src/core/device_bulkdata.c
+++ obuspa-10.0.0.1/src/core/device_bulkdata.c
@@ -71,8 +71,12 @@
//------------------------------------------------------------------------------
@@ -95,7 +95,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
@@ -247,7 +259,8 @@ bulkdata_profile_t *bulkdata_find_free_p
bulkdata_profile_t *bulkdata_find_profile(int profile_id);
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map, combined_role_t *combined_role);
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp);
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
@@ -103,16 +103,16 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
int bulkdata_start_profile(bulkdata_profile_t *bp);
@@ -263,6 +276,8 @@ int bulkdata_platform_get_param_refs(int
int bulkdata_platform_calc_combined_role(int instance, combined_role_t **bulkdata_role, combined_role_t *combined_role, int *cont_instance);
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv, combined_role_t *combined_role);
@@ -262,6 +275,8 @@ char *bulkdata_platform_calc_uri_query_s
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv);
void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map);
+void append_string_to_target(char *str, char **output);
+char *csv_encode(const char *str);
int GetAuto_BulkDataController(dm_req_t *req, char *buf, int len);
#ifdef ENABLE_MQTT
int Validate_BulkDataMqttReference(dm_req_t *req, char *value);
@@ -301,7 +316,7 @@ int DEVICE_BULKDATA_Init(void)
void bulkdata_process_profile_mqtt(bulkdata_profile_t *bp);
@@ -299,7 +314,7 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT);
err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols));
@@ -121,7 +121,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT);
@@ -316,7 +331,7 @@ int DEVICE_BULKDATA_Init(void)
@@ -314,7 +329,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}.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);
@@ -129,8 +129,8 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE_JSON, Validate_BulkDataEncodingType, NULL, DM_STRING);
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_ReadOnlyAuto("Device.BulkData.Profile.{i}.Controller", GetAuto_BulkDataController, DM_STRING);
@@ -329,9 +344,16 @@ int DEVICE_BULKDATA_Init(void)
@@ -326,9 +341,16 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Parameter.{i}.Reference", "", Validate_BulkDataReference, NULL, DM_STRING);
// Device.BulkData.Profile.{i}.JSONEncoding
@@ -148,7 +148,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
// Device.BulkData.Profile.{i}.HTTP
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
@@ -687,9 +709,10 @@ int Validate_BulkDataProtocol(dm_req_t *
@@ -614,9 +636,10 @@ int Validate_BulkDataProtocol(dm_req_t *
int Validate_BulkDataEncodingType(dm_req_t *req, char *value)
{
// Exit if trying to set a value outside of the range we accept
@@ -162,7 +162,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
return USP_ERR_INVALID_VALUE;
}
@@ -793,9 +816,36 @@ int Validate_BulkDataReference(dm_req_t
@@ -720,9 +743,36 @@ int Validate_BulkDataReference(dm_req_t
int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
{
// Exit if trying to set a value outside of the range we accept
@@ -201,7 +201,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
return USP_ERR_INVALID_VALUE;
}
@@ -2151,6 +2201,14 @@ int bulkdata_platform_get_profile_contro
@@ -2053,6 +2103,14 @@ int bulkdata_platform_get_profile_contro
return err;
}
@@ -216,7 +216,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
// Exit if unable to get ReportTimestamp
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
@@ -2159,6 +2217,54 @@ int bulkdata_platform_get_profile_contro
@@ -2061,6 +2119,54 @@ int bulkdata_platform_get_profile_contro
return err;
}
@@ -271,7 +271,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
#ifdef ENABLE_MQTT
{
char protocol[32];
@@ -2492,7 +2598,7 @@ void bulkdata_process_profile_http(bulkd
@@ -2334,7 +2440,7 @@ void bulkdata_process_profile_http(bulkd
{
int err;
report_t *cur_report;
@@ -280,7 +280,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
profile_ctrl_params_t ctrl;
unsigned char *compressed_report;
int compressed_len;
@@ -2541,26 +2647,39 @@ void bulkdata_process_profile_http(bulkd
@@ -2373,10 +2479,23 @@ void bulkdata_process_profile_http(bulkd
}
// Exit if unable to generate the report
@@ -308,9 +308,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
return;
}
// Print out the JSON report, if debugging is enabled
- USP_LOG_Info("\nBULK DATA: %sing at time %s, to url=%s", ctrl.method, iso8601_cur_time(buf, sizeof(buf)), ctrl.url);
+ USP_LOG_Info("BULK DATA: %sing at time %s, to url=%s", ctrl.method, iso8601_cur_time(buf, sizeof(buf)), ctrl.url);
@@ -2385,14 +2504,14 @@ void bulkdata_process_profile_http(bulkd
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
if (enable_protocol_trace)
{
@@ -329,7 +327,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
}
// NOTE: From this point on, only the compressed_report exists
@@ -2590,8 +2709,15 @@ void bulkdata_process_profile_usp_event(
@@ -2422,8 +2541,15 @@ void bulkdata_process_profile_usp_event(
kv_vector_t event_args;
kv_pair_t kv;
report_t *cur_report;
@@ -343,11 +341,11 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
+ char escape_char[10];
+ char csv_format[20];
+ char row_timestamp[33];
combined_role_t *bulkdata_role;
combined_role_t combined_role;
int cont_instance;
@@ -2610,13 +2736,63 @@ void bulkdata_process_profile_usp_event(
return;
// 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).
@@ -2432,13 +2558,63 @@ void bulkdata_process_profile_usp_event(
goto exit;
}
- // Exit if unable to get ReportTimestamp
@@ -417,7 +415,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
// When sending via USP events, only one report is ever sent in each USP event
// So ensure all retained reports are removed. NOTE: Clearing the reports here is only necessary when switching protocol from HTTP to USP event, and where HTTP had some unsent reports
@@ -2634,11 +2810,17 @@ void bulkdata_process_profile_usp_event(
@@ -2456,11 +2632,17 @@ void bulkdata_process_profile_usp_event(
}
bp->num_retained_reports = 1;
@@ -438,7 +436,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
return;
}
@@ -2646,15 +2828,15 @@ void bulkdata_process_profile_usp_event(
@@ -2468,15 +2650,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()
kv.key = "Data";
@@ -448,7 +446,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
event_args.num_entries = 1;
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.Push!", bp->profile_id);
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args, cont_instance);
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args);
- // Free the report. No need to free the event_args as json_report is the only thing dynamically allocated in it
- free(json_report); // The report is not allocated via USP_MALLOC
@@ -457,7 +455,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
// 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
@@ -2736,15 +2918,28 @@ void bulkdata_process_profile_mqtt(bulkd
@@ -2548,11 +2730,24 @@ void bulkdata_process_profile_mqtt(bulkd
}
// Exit if unable to generate the report
@@ -487,21 +485,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
}
// Print out the JSON report, if debugging is enabled
- USP_LOG_Debug("\nBULK DATA: Sending at time %s to MQTT topic %s", iso8601_cur_time(buf, sizeof(buf)), ctrl.mqtt_publish_topic);
+ USP_LOG_Debug("BULK DATA: Sending at time %s to MQTT topic %s", iso8601_cur_time(buf, sizeof(buf)), ctrl.mqtt_publish_topic);
if (enable_protocol_trace)
{
USP_LOG_String(kLogLevel_Info, kLogType_Protocol, report);
@@ -2939,7 +3134,7 @@ int bulkdata_reduce_to_alt_name(char *sp
/*********************************************************************//**
**
-** bulkdata_generate_json_report
+** bulkdata_generate_json_name_value_pair_report
**
** Generates a JSON name-value pair format report
** NOTE: The report contains all retained failed reports, as well as the current report
@@ -2951,7 +3146,7 @@ int bulkdata_reduce_to_alt_name(char *sp
@@ -2763,7 +2958,7 @@ int bulkdata_reduce_to_alt_name(char *sp
** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
**
**************************************************************************/
@@ -510,7 +494,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
{
JsonNode *top; // top of report
JsonNode *array; // array of reports (retained + current)
@@ -3056,6 +3251,483 @@ char *bulkdata_generate_json_report(bulk
@@ -2868,6 +3063,483 @@ char *bulkdata_generate_json_report(bulk
return result;
}
@@ -994,7 +978,7 @@ Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
/*********************************************************************//**
**
** bulkdata_compress_report
@@ -3259,6 +3931,20 @@ int bulkdata_schedule_sending_http_repor
@@ -3071,6 +3743,20 @@ int bulkdata_schedule_sending_http_repor
flags |= BDC_FLAG_DATE_HEADER;
}

View File

@@ -1,7 +1,7 @@
Index: obuspa-10.0.4.0/src/core/expr_vector.c
Index: obuspa-10.0.0.1/src/core/expr_vector.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/expr_vector.c
+++ obuspa-10.0.4.0/src/core/expr_vector.c
--- obuspa-10.0.0.1.orig/src/core/expr_vector.c
+++ obuspa-10.0.0.1/src/core/expr_vector.c
@@ -59,6 +59,7 @@ char *expr_op_2_str[kExprOp_Max] =
"<", // kExprOp_LessThan
">", // kExprOp_GreaterThan
@@ -10,7 +10,7 @@ Index: obuspa-10.0.4.0/src/core/expr_vector.c
};
@@ -487,6 +488,15 @@ char *SplitOnOperator(char *buf, expr_op
@@ -483,6 +484,15 @@ char *SplitOnOperator(char *buf, expr_op
*op = '\0';
return &op[2];
}
@@ -26,10 +26,10 @@ Index: obuspa-10.0.4.0/src/core/expr_vector.c
// Exit if found the "<" operator
op = strchr(buf, '<');
Index: obuspa-10.0.4.0/src/core/path_resolver.c
Index: obuspa-10.0.0.1/src/core/path_resolver.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/path_resolver.c
+++ obuspa-10.0.4.0/src/core/path_resolver.c
--- obuspa-10.0.0.1.orig/src/core/path_resolver.c
+++ obuspa-10.0.0.1/src/core/path_resolver.c
@@ -1088,7 +1088,7 @@ int ResolveUniqueKey(char *resolved, cha
char temp[MAX_DM_PATH];
bool is_match;
@@ -107,10 +107,10 @@ Index: obuspa-10.0.4.0/src/core/path_resolver.c
// Determine the function to call to perform the comparison
if (type_flags & (DM_INT | DM_UINT | DM_ULONG | DM_LONG | DM_DECIMAL))
{
Index: obuspa-10.0.4.0/src/include/usp_api.h
Index: obuspa-10.0.0.1/src/include/usp_api.h
===================================================================
--- obuspa-10.0.4.0.orig/src/include/usp_api.h
+++ obuspa-10.0.4.0/src/include/usp_api.h
--- obuspa-10.0.0.1.orig/src/include/usp_api.h
+++ obuspa-10.0.0.1/src/include/usp_api.h
@@ -106,6 +106,7 @@ typedef enum
kExprOp_LessThan, // '<'
kExprOp_GreaterThan, // '>'

View File

@@ -1,8 +1,8 @@
Index: obuspa-10.0.4.0/src/core/device.h
Index: obuspa-10.0.0.2/src/core/device.h
===================================================================
--- obuspa-10.0.4.0.orig/src/core/device.h
+++ obuspa-10.0.4.0/src/core/device.h
@@ -310,6 +310,8 @@ void DEVICE_CTRUST_ApplyPermissionsToSub
--- obuspa-10.0.0.2.orig/src/core/device.h
+++ obuspa-10.0.0.2/src/core/device.h
@@ -305,6 +305,8 @@ void DEVICE_CTRUST_ApplyPermissionsToSub
char *DEVICE_CTRUST_InstSelToPermTarget(int role_index, void *is, int *perm_instance);
int DEVICE_CTRUST_SetRoleParameter(int instance, char *param_name, char *new_value);
int DEVICE_CTRUST_SetPermissionParameter(int instance1, int instance2, char *param_name, char *new_value);
@@ -11,11 +11,11 @@ Index: obuspa-10.0.4.0/src/core/device.h
int DEVICE_REQUEST_Init(void);
int DEVICE_REQUEST_Add(char *path, char *command_key, int *instance);
void DEVICE_REQUEST_OperationComplete(int instance, int err_code, char *err_msg, kv_vector_t *output_args);
Index: obuspa-10.0.4.0/src/core/device_ctrust.c
Index: obuspa-10.0.0.2/src/core/device_ctrust.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/device_ctrust.c
+++ obuspa-10.0.4.0/src/core/device_ctrust.c
@@ -236,6 +236,7 @@ credential_t *FindCredentialByCertInstan
--- obuspa-10.0.0.2.orig/src/core/device_ctrust.c
+++ obuspa-10.0.0.2/src/core/device_ctrust.c
@@ -235,6 +235,7 @@ credential_t *FindCredentialByCertInstan
int Get_CredentialRole(dm_req_t *req, char *buf, int len);
int Get_CredentialCertificate(dm_req_t *req, char *buf, int len);
int Get_CredentialNumEntries(dm_req_t *req, char *buf, int len);
@@ -23,7 +23,7 @@ Index: obuspa-10.0.4.0/src/core/device_ctrust.c
#ifndef REMOVE_DEVICE_SECURITY
int InitChallengeTable();
@@ -355,6 +356,10 @@ int DEVICE_CTRUST_Init(void)
@@ -354,6 +355,10 @@ int DEVICE_CTRUST_Init(void)
challenge_response_input_args, NUM_ELEM(challenge_response_input_args),
NULL, 0);
#endif
@@ -34,7 +34,7 @@ Index: obuspa-10.0.4.0/src/core/device_ctrust.c
// Exit if any errors occurred
if (err != USP_ERR_OK)
{
@@ -2939,3 +2944,139 @@ exit:
@@ -2908,3 +2913,139 @@ exit:
return err;
}
#endif // REMOVE_DEVICE_SECURITY

View File

@@ -35,16 +35,3 @@ Index: obuspa-10.0.0.2/src/core/data_model.c
return USP_ERR_OBJECT_DOES_NOT_EXIST;
}
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
index 388697a..444b4da 100644
--- a/src/core/mqtt.c
+++ b/src/core/mqtt.c
@@ -4020,7 +4020,7 @@ void MessageV5Callback(struct mosquitto *mosq, void *userdata, const struct mosq
if (mosquitto_property_read_string(props, RESPONSE_TOPIC,
&response_info_ptr, false) == NULL)
{
- USP_LOG_Warning("%s: No response topic in received MESSAGE frame", __FUNCTION__);
+ USP_LOG_Info("%s: No response topic in received MESSAGE frame", __FUNCTION__);
}
// Send the message to the data model thread for further processing

View File

@@ -1,8 +1,8 @@
Index: obuspa-10.0.4.0/src/core/device_bulkdata.c
Index: obuspa-10.0.0.1/src/core/device_bulkdata.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/device_bulkdata.c
+++ obuspa-10.0.4.0/src/core/device_bulkdata.c
@@ -378,6 +378,8 @@ int DEVICE_BULKDATA_Init(void)
--- obuspa-10.0.0.1.orig/src/core/device_bulkdata.c
+++ obuspa-10.0.0.1/src/core/device_bulkdata.c
@@ -375,6 +375,8 @@ int DEVICE_BULKDATA_Init(void)
// Device.BulkData.Profile.{i}.MQTT
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.Reference", "", Validate_BulkDataMqttReference, NULL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.PublishTopic", "", NULL, NULL, DM_STRING);

View File

@@ -1,8 +1,8 @@
Index: obuspa-10.0.4.0/src/core/device.h
Index: obuspa-10.0.0.2/src/core/device.h
===================================================================
--- obuspa-10.0.4.0.orig/src/core/device.h
+++ obuspa-10.0.4.0/src/core/device.h
@@ -352,6 +352,10 @@ void DEVICE_CONTROLLER_SetInheritedRole(
--- obuspa-10.0.0.2.orig/src/core/device.h
+++ obuspa-10.0.0.2/src/core/device.h
@@ -346,6 +346,10 @@ void DEVICE_CONTROLLER_SetInheritedRole(
int DEVICE_CONTROLLER_CountEnabledWebsockClientConnections(void);
#endif
@@ -13,10 +13,10 @@ Index: obuspa-10.0.4.0/src/core/device.h
#ifndef REMOVE_USP_BROKER
int DEVICE_SUBSCRIPTION_RouteNotification(Usp__Msg *usp, int instance, char *subscribed_path);
bool DEVICE_SUBSCRIPTION_MarkVendorLayerSubs(int broker_instance, subs_notify_t notify_type, char *path, int group_id);
Index: obuspa-10.0.4.0/src/core/device_controller.c
Index: obuspa-10.0.0.2/src/core/device_controller.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/device_controller.c
+++ obuspa-10.0.4.0/src/core/device_controller.c
--- obuspa-10.0.0.2.orig/src/core/device_controller.c
+++ obuspa-10.0.0.2/src/core/device_controller.c
@@ -968,6 +968,78 @@ int DEVICE_CONTROLLER_QueueBinaryMessage
return USP_ERR_OK;
}
@@ -96,10 +96,10 @@ Index: obuspa-10.0.4.0/src/core/device_controller.c
/*********************************************************************//**
**
** DEVICE_CONTROLLER_IsMTPConfigured
Index: obuspa-10.0.4.0/src/core/msg_handler.c
Index: obuspa-10.0.0.2/src/core/msg_handler.c
===================================================================
--- obuspa-10.0.4.0.orig/src/core/msg_handler.c
+++ obuspa-10.0.4.0/src/core/msg_handler.c
--- obuspa-10.0.0.2.orig/src/core/msg_handler.c
+++ obuspa-10.0.0.2/src/core/msg_handler.c
@@ -1220,6 +1220,15 @@ int ValidateUspRecord(UspRecord__Record
usp_service_instance = USP_BROKER_GetUspServiceInstance(rec->from_id, 0);
#endif

View File

@@ -1,401 +0,0 @@
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
index 70978501b1..96119fe080 100644
--- a/src/core/mqtt.c
+++ b/src/core/mqtt.c
@@ -53,6 +53,7 @@
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
+#include <netdb.h>
#include <mosquitto.h>
#include "mqtt.h"
@@ -201,8 +202,9 @@ int EnableMosquitto(mqtt_client_t *client);
void SetupCallbacks(mqtt_client_t *client);
void QueueUspConnectRecord_MQTT(mqtt_client_t *client, mtp_send_item_t *msi, char *controller_topic, time_t expiry_time);
int SendQueueHead(mqtt_client_t *client);
+bool check_connectivity(struct addrinfo *list_addr, unsigned int port, sa_family_t family, char *dst_ip, int size);
void Connect(mqtt_client_t *client);
-int PerformMqttClientConnect(mqtt_client_t *client);
+int PerformMqttClientConnect(mqtt_client_t *client, const char *host_ip);
int ConnectSetEncryption(mqtt_client_t *client);
void ConnectCallback(struct mosquitto *mosq, void *userdata, int result);
void ConnectV5Callback(struct mosquitto *mosq, void *userdata, int result, int flags, const mosquitto_property *props);
@@ -245,7 +247,7 @@ void HandleMqttReconnect(mqtt_client_t *client);
void HandleMqttReconnectAfterDisconnect(mqtt_client_t *client);
void HandleMqttDisconnect(mqtt_client_t *client);
void DisconnectIfAllSubscriptionsFailed(mqtt_client_t *client);
-bool IsMqttBrokerUp(mqtt_client_t *client);
+bool IsMqttBrokerUp(mqtt_client_t *client, char *dst_ip, int size);
void RemoveMqttQueueItem(mqtt_client_t *client, mqtt_send_item_t *queued_msg);
void RemoveExpiredMqttMessages(mqtt_client_t *client);
void ParseSubscribeTopicsFromConnack(mqtt_client_t *client, mosquitto_property *prop);
@@ -2350,6 +2352,143 @@ int SendQueueHead(mqtt_client_t *client)
return err;
}
+bool check_connectivity(struct addrinfo *list_addr, unsigned int port, sa_family_t family, char *dst_ip, int size)
+{
+ int err;
+ struct sockaddr_storage saddr;
+ socklen_t saddr_len;
+ sa_family_t sock_family;
+ int socket_fd = INVALID;
+ fd_set writefds;
+ struct timeval timeout;
+ int num_sockets;
+ int so_err;
+ socklen_t so_len = sizeof(so_err);
+ struct addrinfo *iterator;
+ struct sockaddr_in *a;
+ struct sockaddr_in6 *a6;
+ nu_ipaddr_t dst;
+
+ if (list_addr == NULL || dst_ip == NULL)
+ {
+ return false;
+ }
+
+ for (iterator=list_addr; iterator!=NULL; iterator=iterator->ai_next)
+ {
+ if (iterator->ai_family != family)
+ {
+ continue;
+ }
+
+ if (family == AF_INET)
+ {
+ a = (struct sockaddr_in *) iterator->ai_addr;
+ err = nu_ipaddr_from_inaddr(&a->sin_addr, &dst);
+
+ if (err != USP_ERR_OK)
+ {
+ USP_LOG_Error("%s: nu_ipaddr_from_inaddr() failed: %s", __FUNCTION__, strerror(err));
+ continue;
+ }
+ }
+ else
+ {
+ a6 = (struct sockaddr_in6 *) iterator->ai_addr;
+ err = nu_ipaddr_from_in6addr(&a6->sin6_addr, &dst);
+
+ if (err != USP_ERR_OK)
+ {
+ USP_LOG_Error("%s: nu_ipaddr_from_in6addr() failed: %s", __FUNCTION__, strerror(err));
+ continue;
+ }
+ }
+
+ // Next IP if unable to make a socket address structure to probe the MQTT server
+ err = nu_ipaddr_to_sockaddr(&dst, port, &saddr, &saddr_len);
+ if (err != USP_ERR_OK)
+ {
+ continue;
+ }
+
+ // Next IP if unable to determine which address family to use to contact the MQTT broker
+ err = nu_ipaddr_get_family(&dst, &sock_family);
+ if (err != USP_ERR_OK)
+ {
+ continue;
+ }
+
+ // Return if unable to create the socket
+ socket_fd = socket(sock_family, SOCK_STREAM, 0);
+ if (socket_fd == -1)
+ {
+ USP_LOG_Error("%s: failed to open socket", __FUNCTION__);
+ return false;
+ }
+
+ // Return if unable to set the socket as non blocking
+ // We do this before connecting so that we can timeout on connect taking too long
+ err = fcntl(socket_fd, F_SETFL, O_NONBLOCK);
+ if (err == -1)
+ {
+ USP_ERR_ERRNO("fcntl", errno);
+ close(socket_fd);
+ return false;
+ }
+
+ // Next IP if unable to connect to the MQTT Broker
+ // NOTE: The connect is performed in non-blocking mode
+ err = connect(socket_fd, (struct sockaddr *) &saddr, saddr_len);
+ if ((err == -1) && (errno != EINPROGRESS))
+ {
+ USP_ERR_ERRNO("connect", errno);
+ close(socket_fd);
+ continue;
+ }
+
+ // Set up arguments for the select() call
+ FD_ZERO(&writefds);
+ FD_SET(socket_fd, &writefds);
+ timeout.tv_sec = MQTT_CONNECT_TIMEOUT;
+ timeout.tv_usec = 0;
+
+ // Next IP if the connect timed out
+ num_sockets = select(socket_fd + 1, NULL, &writefds, NULL, &timeout);
+ if (num_sockets == 0)
+ {
+ USP_LOG_Error("%s: connect timed out", __FUNCTION__);
+ close(socket_fd);
+ continue;
+ }
+
+ // Next IP if unable to determine whether the connect was successful or not
+ err = getsockopt(socket_fd, SOL_SOCKET, SO_ERROR, &so_err, &so_len);
+ if (err == -1)
+ {
+ USP_ERR_ERRNO("getsockopt", errno);
+ close(socket_fd);
+ continue;
+ }
+
+ // Next IP if connect was not successful
+ if (so_err != 0)
+ {
+ USP_LOG_Error("%s: async connect failed", __FUNCTION__);
+ close(socket_fd);
+ continue;
+ }
+
+ close(socket_fd);
+
+ // Connect was successful
+ nu_ipaddr_str(&dst, dst_ip, size);
+
+ return true;
+ }
+
+ return false;
+}
+
/*********************************************************************//**
**
** IsMqttBrokerUp
@@ -2364,109 +2503,92 @@ int SendQueueHead(mqtt_client_t *client)
** \return true if the MQTT Broker is up, false otherwise
**
**************************************************************************/
-bool IsMqttBrokerUp(mqtt_client_t *client)
+bool IsMqttBrokerUp(mqtt_client_t *client, char *dst_ip, int size)
{
int err;
bool prefer_ipv6;
- nu_ipaddr_t dst;
- struct sockaddr_storage saddr;
- socklen_t saddr_len;
- sa_family_t family;
- int socket_fd = INVALID;
- fd_set writefds;
- struct timeval timeout;
- int num_sockets;
- int so_err;
- socklen_t so_len = sizeof(so_err);
+ bool ipv4_supported = false;
+ bool ipv6_supported = false;
bool result = false;
+ struct addrinfo *addr_list = NULL;
+ struct addrinfo hints;
// Get the preference for IPv4 or IPv6, if dual stack
prefer_ipv6 = DEVICE_LOCAL_AGENT_GetDualStackPreference();
- // Exit if unable to determine the IP address of the MQTT Broker
- err = tw_ulib_diags_lookup_host(client->conn_params.host, AF_UNSPEC, prefer_ipv6, NULL, &dst);
- if (err != USP_ERR_OK)
- {
- goto exit;
- }
+ USP_LOG_Debug("%s: dual-stack preference is: %s", __FUNCTION__, prefer_ipv6 ? "IPv6" : "IPv4");
- // Exit if unable to make a socket address structure to probe the MQTT server
- err = nu_ipaddr_to_sockaddr(&dst, client->conn_params.port, &saddr, &saddr_len);
- if (err != USP_ERR_OK)
- {
- goto exit;
- }
+ // Initialise the hints to use, when obtaining the IP address of the specified host using getaddrinfo()
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_flags |= AI_ADDRCONFIG;
- // Exit if unable to determine which address family to use to contact the MQTT broker
- // NOTE: This shouldn't fail if tw_ulib_diags_lookup_host() is correct
- err = nu_ipaddr_get_family(&dst, &family);
- if (err != USP_ERR_OK)
+ err = getaddrinfo(client->conn_params.host, NULL, &hints, &addr_list);
+ if (err != USP_ERR_OK || addr_list == NULL)
{
- goto exit;
+ USP_ERR_SetMessage("%s: getaddrinfo() failed to resolve: %s", __FUNCTION__, client->conn_params.host);
+ return result;
}
- // Exit if unable to create the socket
- socket_fd = socket(family, SOCK_STREAM, 0);
- if (socket_fd == -1)
+ // Exit if unable to determine which address families are supported by the device
+ // NOTE: In theory, setting getaddrinfo hints to AI_ADDRCONFIG, should filter by supported address family
+ // However, unfortunately that flag does not take into account whether the address is globally routable (for IPv6) as well
+ err = nu_ipaddr_get_ip_supported_families(&ipv4_supported, &ipv6_supported);
+ if (err != USP_ERR_OK)
{
- goto exit;
+ USP_LOG_Error("%s: Failed to determine device IP families", __FUNCTION__);
+ return result;
}
- // Exit if unable to set the socket as non blocking
- // We do this before connecting so that we can timeout on connect taking too long
- err = fcntl(socket_fd, F_SETFL, O_NONBLOCK);
- if (err == -1)
+ if (ipv4_supported == false && ipv6_supported == false)
{
- USP_ERR_ERRNO("fcntl", errno);
- goto exit;
+ // couldn't determine device ip mode
+ USP_LOG_Error("%s: Could not determine device IP families", __FUNCTION__);
+ return result;
}
- // Exit if unable to connect to the MQTT Broker
- // NOTE: The connect is performed in non-blocking mode
- err = connect(socket_fd, (struct sockaddr *) &saddr, saddr_len);
- if ((err == -1) && (errno != EINPROGRESS))
+ if (ipv6_supported == false)
{
- USP_ERR_ERRNO("connect", errno);
- goto exit;
+ // device has only ipv4 address so only try with ipv4 addresses
+ USP_LOG_Debug("%s: Check connectivity with IPv4 only", __FUNCTION__);
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET, dst_ip, size);
}
-
- // Set up arguments for the select() call
- FD_ZERO(&writefds);
- FD_SET(socket_fd, &writefds);
- timeout.tv_sec = MQTT_CONNECT_TIMEOUT;
- timeout.tv_usec = 0;
-
- // Exit if the connect timed out
- num_sockets = select(socket_fd + 1, NULL, &writefds, NULL, &timeout);
- if (num_sockets == 0)
+ else if (ipv4_supported == false)
{
- USP_LOG_Error("%s: connect timed out", __FUNCTION__);
- goto exit;
+ // device has only ipv6 address so only try with ipv6 addresses
+ USP_LOG_Debug("%s: Check connectivity with IPv6 only", __FUNCTION__);
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET6, dst_ip, size);
}
-
- // Exit if unable to determine whether the connect was successful or not
- err = getsockopt(socket_fd, SOL_SOCKET, SO_ERROR, &so_err, &so_len);
- if (err == -1)
+ else
{
- USP_ERR_ERRNO("getsockopt", errno);
- goto exit;
- }
+ // device has both ipv6 and ipv4 address, so we need to search as per preference
+ if (prefer_ipv6 == true)
+ {
- // Exit if connect was not successful
- if (so_err != 0)
- {
- USP_LOG_Error("%s: async connect failed", __FUNCTION__);
- goto exit;
+ // First try with v6 then fallback to v4
+ USP_LOG_Debug("%s: Check connectivity with IPv6 first", __FUNCTION__);
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET6, dst_ip, size);
+ if (result == false)
+ {
+ USP_LOG_Debug("%s: Check connectivity fallback with IPv4", __FUNCTION__);
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET, dst_ip, size);
+ }
+ }
+ else
+ {
+ // First try with v4 then fallback to v6
+ USP_LOG_Debug("%s: Check connectivity with IPv4 first", __FUNCTION__);
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET, dst_ip, size);
+ if (result == false)
+ {
+ USP_LOG_Debug("%s: Check connectivity fallback with IPv6", __FUNCTION__);
+ result = check_connectivity(addr_list, client->conn_params.port, AF_INET6, dst_ip, size);
+ }
+ }
}
- // Connect was successful
- result = true;
-
-exit:
- // Tidy up
- if (socket_fd != INVALID)
- {
- close(socket_fd);
+ if (addr_list != NULL) {
+ (void) freeaddrinfo(addr_list);
}
return result;
@@ -2487,18 +2609,20 @@ void Connect(mqtt_client_t *client)
{
int err = USP_ERR_OK;
bool is_up;
+ char dst_ip[INET6_ADDRSTRLEN] = {0};
// Exit if after probing the MQTT Broker, it is not up
// In this case, we do not attempt to call libmosquitto's connect function, as that function will end up blocking for 2 minutes (since the MQTT broker is down)
- is_up = IsMqttBrokerUp(client);
- if (is_up == false)
+ is_up = IsMqttBrokerUp(client, dst_ip, sizeof(dst_ip));
+ if (is_up == false || strlen(dst_ip) == 0)
{
+ USP_LOG_Debug("%s: MQTT broker(%s) is not UP", __FUNCTION__, client->conn_params.host);
err = USP_ERR_INTERNAL_ERROR;
goto exit;
}
// Start the MQTT Connect
- err = PerformMqttClientConnect(client);
+ err = PerformMqttClientConnect(client, dst_ip);
// Exit if failed to connect
if (err != USP_ERR_OK)
@@ -2531,7 +2655,7 @@ exit:
** \return USP_ERR_INTERNAL_ERROR if failed to connect (and should retry)
**
**************************************************************************/
-int PerformMqttClientConnect(mqtt_client_t *client)
+int PerformMqttClientConnect(mqtt_client_t *client, const char *host_ip)
{
int version;
mosquitto_property *proplist = NULL;
@@ -2601,19 +2725,19 @@ int PerformMqttClientConnect(mqtt_client_t *client)
// We do this to prevent the data model thread from potentially being blocked, whilst the connect call is taking place
OS_UTILS_UnlockMutex(&mqtt_access_mutex);
- USP_LOG_Info("Sending CONNECT frame to (host=%s, port=%d)", client->conn_params.host, client->conn_params.port);
+ USP_LOG_Info("Sending CONNECT frame to (host=%s, ip=%s, port=%d)", client->conn_params.host, host_ip, client->conn_params.port);
FRAME_TRACE_DUMP(client);
// Perform the TCP connect
// NOTE: TCP connect can block for around 2 minutes if the broker does not respond to the TCP handshake
if (version == kMqttProtocol_5_0)
{
- mosq_err = mosquitto_connect_bind_v5(client->mosq, client->conn_params.host, client->conn_params.port,
+ mosq_err = mosquitto_connect_bind_v5(client->mosq, host_ip, client->conn_params.port,
keep_alive, NULL, proplist);
}
else
{
- mosq_err = mosquitto_connect(client->mosq, client->conn_params.host, client->conn_params.port,
+ mosq_err = mosquitto_connect(client->mosq, host_ip, client->conn_params.port,
keep_alive);
}

View File

@@ -1,10 +1,12 @@
if PACKAGE_parental-control
config PARENTAL_CONTROL_URLFILTERING
bool "Enables URL Filter functions and datamodel"
default y
config PARENTAL_CONTROL_INCLUDE_URLFILTER_BUNDLES
bool "Include default bundle files"
default n
help
Set this option to include url filter feature
Set this option to include bundle files by default,
they are also included in the UCI, urlfilter
still needs to be enabled though.
config PARENTAL_CONTROL_VENDOR_PREFIX
string "Package specific datamodel Vendor Prefix for TR181 extensions"

View File

@@ -1,17 +1,17 @@
#
# Copyright (C) 2021-2025 IOPSYS
# Copyright (C) 2021-2024 IOPSYS
#
include $(TOPDIR)/rules.mk
PKG_NAME:=parental-control
PKG_VERSION:=1.2.1
PKG_VERSION:=1.1.6
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/parental-control.git
PKG_SOURCE_VERSION:=120dbcd6508b817d2ce3d579a1bfbd5bfd1a44cb
PKG_SOURCE_VERSION:=5128498a36c8f1ac48d320850c292c7e66256884
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -49,11 +49,8 @@ endif
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(VENDOR_PREFIX)\\\"
ifeq ($(CONFIG_PARENTAL_CONTROL_URLFILTERING),y)
TARGET_CFLAGS+=-DPARENTAL_CONTROL_ULRFILTER
endif
TARGET_LDFLAGS += -lcmph
TARGET_LDFLAGS += \
-lcmph
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
@@ -88,12 +85,8 @@ define Package/parental-control/install
$(BBFDM_REGISTER_SERVICES) -v ${VENDOR_PREFIX} ./bbfdm_service.json $(1) parentalcontrol
ifeq ($(CONFIG_PARENTAL_CONTROL_URLFILTERING),y)
$(INSTALL_DATA) ./files/etc/uci-defaults/55-add-default-bundles $(1)/etc/uci-defaults/
$(CP) ./files/urlbundle_override.json $(1)/etc/parentalcontrol/
else
$(BBFDM_INSTALL_MS_PLUGIN) -v ${VENDOR_PREFIX} ./files/urlbundle_override.json $(1) parentalcontrol
$(INSTALL_DATA) ./files/etc/uci-defaults/50-parental_control_urlfilter $(1)/etc/uci-defaults/
ifeq ($(CONFIG_PARENTAL_CONTROL_INCLUDE_URLFILTER_BUNDLES),y)
$(INSTALL_DATA) ./files/etc/parentalcontrol/urlbundles.tar.xz $(1)/etc/parentalcontrol/
endif
endef

View File

@@ -1,4 +1,93 @@
config globals 'globals'
option enable '0'
option loglevel '3'
option urlfilter '1'
config urlbundle 'urlbundle_1'
option enable '0'
option name 'Abuse'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/abuse-nl.txt'
config urlbundle 'urlbundle_2'
option enable '0'
option name 'Ads'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/ads-nl.txt'
config urlbundle 'urlbundle_3'
option enable '0'
option name 'Crypto'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/crypto-nl.txt'
config urlbundle 'urlbundle_4'
option enable '1'
option name 'Drugs'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/drugs-nl.txt'
config urlbundle 'urlbundle_5'
option enable '0'
option name 'Everything else'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/everything-nl.txt'
config urlbundle 'urlbundle_6'
option enable '1'
option name 'Facebook/Instagram'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/facebook-nl.txt'
config urlbundle 'urlbundle_7'
option enable '1'
option name 'Fraud'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/fraud-nl.txt'
config urlbundle 'urlbundle_8'
option enable '1'
option name 'Gambling'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/gambling-nl.txt'
config urlbundle 'urlbundle_9'
option enable '0'
option name 'Malware'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/malware-nl.txt'
config urlbundle 'urlbundle_10'
option enable '1'
option name 'Phishing'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/phishing-nl.txt'
config urlbundle 'urlbundle_11'
option enable '1'
option name 'Piracy'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/piracy-nl.txt'
config urlbundle 'urlbundle_12'
option enable '0'
option name 'Porn'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/porn-nl.txt'
config urlbundle 'urlbundle_13'
option enable '1'
option name 'Ransomware'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/ransomware-nl.txt'
config urlbundle 'urlbundle_14'
option enable '0'
option name 'Redirect'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/redirect-nl.txt'
config urlbundle 'urlbundle_15'
option enable '1'
option name 'Scam'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/scam-nl.txt'
config urlbundle 'urlbundle_16'
option enable '0'
option name 'TikTok'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/tiktok-nl.txt'
config urlbundle 'urlbundle_17'
option enable '0'
option name 'Torrent'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/torrent-nl.txt'
config urlbundle 'urlbundle_18'
option enable '0'
option name 'Tracking'
option download_url 'https://blocklistproject.github.io/Lists/alt-version/tracking-nl.txt'

View File

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

View File

@@ -12,8 +12,7 @@ validate_global_section() {
uci_validate_section parentalcontrol globals globals \
'enable:bool:1' \
'loglevel:uinteger:3' \
'bundle_path:string' \
'urlfilter:bool'
'bundle_path:string'
}
remove_fw_rules() {
@@ -24,36 +23,27 @@ remove_fw_rules() {
}
configure_fw_rules() {
local enable urlfilter
local enable
remove_fw_rules
config_load parentalcontrol
config_get_bool enable globals enable 0
config_get_bool urlfilter globals urlfilter 0
remove_fw_rules
if [ "${enable}" -eq "0" ]; then
# Parental control is disabled
return 0
fi
if [ "${urlfilter}" -eq "1" ]; then
if [ ! -f "${OVERRIDE_JSON}" ]; then
# throw error
log "ERROR: urlfiltering disabled at compile time but enabled in config"
else
# Now flush the existing connections, otherwise,
# URL filtering cannot be performed on already open sites.
if [ -n "$(which conntrack)" ]; then
sleep 5
conntrack -F
fi
# this is for urlfilter daemon
add_iptables_nfqueue_rules
fi
# Now flush the existing connections, otherwise,
# URL filtering cannot be performed on already open sites.
if [ -n "$(which conntrack)" ]; then
sleep 5
conntrack -F
fi
# this is for urlfilter daemon
add_iptables_nfqueue_rules
# this for internet_access and profile_bedtime_schedule sections
add_internet_schedule_rules
}
@@ -78,7 +68,7 @@ copy_dhcp_leases() {
}
start_service() {
local enable loglevel bundle_path urlfilter
local enable loglevel bundle_path
config_load parentalcontrol
validate_global_section
@@ -90,12 +80,6 @@ start_service() {
# add firewall rules
configure_fw_rules
if [ "${urlfilter}" -eq "1" ]; then
enable_urlfilter_dm
else
disable_urlfilter_dm
fi
# if the router is, for example, upgraded and then it boots up
# then /tmp/dhcp.leases will be empty until clients try to get a lease,
# in that case, hostnames will not be processed by the daemon,
@@ -104,7 +88,7 @@ start_service() {
# and will be used as a backup in case /tmp/dhcp.leases is empty
copy_dhcp_leases
procd_open_instance "parentalcontrol"
procd_open_instance "parentalcontrol_dm"
procd_set_param command nice -n 10 "${PROG}" # Lower priority
procd_append_param command -l ${loglevel}
procd_set_param respawn
@@ -119,7 +103,7 @@ stop_service() {
}
reload_service() {
ret=$(ubus call service list '{"name":"parentalcontrol"}' | jsonfilter -qe '@.parentalcontrol.instances.parentalcontrol.running')
ret=$(ubus call service list '{"name":"parentalcontrol"}' | jsonfilter -qe '@.parentalcontrol.instances.parentalcontrol_dm.running')
if [ "$ret" != "true" ]; then
stop
start

View File

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

View File

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

View File

@@ -311,9 +311,6 @@ parse_macs_or_hostnames() {
local input="$1"
local lease_file="/tmp/dhcp.leases"
[ -f "$lease_file" ] || lease_file="/etc/parentalcontrol/dhcp.leases"
[ -f "$lease_file" ] || { log "Error: No DHCP lease file found."; return 1; }
for item in $input; do
case "$item" in
??:??:??:??:??:??)
@@ -512,25 +509,3 @@ remove_internet_schedule_rules() {
ip6tables -w -X parentalcontrol_forward
fi
}
OVERRIDE_JSON="/etc/parentalcontrol/urlbundle_override.json"
DM_PLUGIN_PATH="/usr/share/bbfdm/micro_services/parentalcontrol/urlbundle_override.json"
enable_urlfilter_dm() {
if [ -f "${DM_PLUGIN_PATH}" ]; then
rm ${DM_PLUGIN_PATH}
echo "Please restart to apply"
fi
}
disable_urlfilter_dm() {
mkdir -p "$(dirname ${DM_PLUGIN_PATH})"
if [ ! -f "${DM_PLUGIN_PATH}" ]; then
if [ -f "${OVERRIDE_JSON}" ]; then
cp "${OVERRIDE_JSON}" "${DM_PLUGIN_PATH}"
echo "Please restart to apply"
fi
fi
}

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