mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-26 03:53:58 +08:00
Compare commits
89 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4dc60395c2 | ||
|
|
3a9981bee0 | ||
|
|
81bfe4cc1b | ||
|
|
653cd5bb97 | ||
|
|
910c8e61e2 | ||
|
|
72a41b6d14 | ||
|
|
66303b874d | ||
|
|
65d1d7932c | ||
|
|
cfad5f2223 | ||
|
|
b47ff7b8c8 | ||
|
|
e5704ad7f2 | ||
|
|
729eeaba54 | ||
|
|
e5da615f25 | ||
|
|
6c41215c19 | ||
|
|
0b5d47b559 | ||
|
|
7eba12fb54 | ||
|
|
c0495af6e1 | ||
|
|
d04f1930d1 | ||
|
|
852eaf8fc9 | ||
|
|
9ce866a484 | ||
|
|
517e3d9f11 | ||
|
|
8f09187cba | ||
|
|
85c139d7b7 | ||
|
|
2c1aeae4e3 | ||
|
|
9d098e087f | ||
|
|
afb2d7f798 | ||
|
|
cb43510264 | ||
|
|
b78d6684bf | ||
|
|
a83ddcc563 | ||
|
|
c02eff7d9d | ||
|
|
c6c7d1177e | ||
|
|
b6c1bf5568 | ||
|
|
1b8de9ca51 | ||
|
|
c3199c3ea2 | ||
|
|
0e1ac637ac | ||
|
|
0975f022c5 | ||
|
|
93656b57db | ||
|
|
eab01d27dd | ||
|
|
435aafe744 | ||
|
|
b6dc071e35 | ||
|
|
df7872e3f0 | ||
|
|
fcd0e77ba8 | ||
|
|
f2f3f34859 | ||
|
|
69d2a50e2e | ||
|
|
2c51c4e23e | ||
|
|
581f1eb5db | ||
|
|
95bb5a5b48 | ||
|
|
9d56c142ad | ||
|
|
0aec0c5019 | ||
|
|
fae611801e | ||
|
|
7e0e2fcf9f | ||
|
|
955c461e1c | ||
|
|
2c6616ef05 | ||
|
|
3202e0fbba | ||
|
|
84b83560b4 | ||
|
|
7a61ff27bf | ||
|
|
d930fdd86d | ||
|
|
80d7e57441 | ||
|
|
a9fa5d9465 | ||
|
|
e5028b2980 | ||
|
|
f0d7922c40 | ||
|
|
8aeadf5fdc | ||
|
|
680c01b121 | ||
|
|
c08679e6c0 | ||
|
|
955ed436a1 | ||
|
|
157a7d3946 | ||
|
|
a4ad40ab4a | ||
|
|
298045a822 | ||
|
|
853ffee425 | ||
|
|
8e979cacc1 | ||
|
|
3b14454efe | ||
|
|
799050d650 | ||
|
|
7664dc719d | ||
|
|
bcc93577df | ||
|
|
a3cd8b5e03 | ||
|
|
24999bd690 | ||
|
|
b2c3d32b51 | ||
|
|
28280c4faf | ||
|
|
e0a4b0e62a | ||
|
|
033b7b9e33 | ||
|
|
fea3bd90b4 | ||
|
|
d6c6cb791f | ||
|
|
fb6a66096e | ||
|
|
cbb6862e18 | ||
|
|
a38c7d903a | ||
|
|
b6e9f80d2a | ||
|
|
de40c67ff2 | ||
|
|
1da95ba8c2 | ||
|
|
d038e4c845 |
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.0.8
|
||||
PKG_VERSION:=1.0.20
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=346c8412a426441fa928b53210d0bd6127ac72e8
|
||||
PKG_SOURCE_VERSION:=4a8d286201efdff814f106e92147c697c32a94a9
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -111,6 +111,7 @@ endif
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR181=ON
|
||||
-DBBF_WIFI_DATAELEMENTS=ON
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR104),y)
|
||||
CMAKE_OPTIONS += \
|
||||
@@ -165,7 +166,6 @@ CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_bbfdmd),y)
|
||||
CMAKE_OPTIONS += -DBBFDMD_ENABLED=ON
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBFDMD_MAX_MSG_LEN:Integer=10485760
|
||||
endif
|
||||
@@ -204,10 +204,12 @@ endef
|
||||
|
||||
define Package/bbfdmd/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
|
||||
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/src/bbfdmd $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/json/input.json $(1)/etc/bbfdm/
|
||||
|
||||
17
bbfdm/files/etc/hotplug.d/iface/85-bbfdm-sysctl
Normal file
17
bbfdm/files/etc/hotplug.d/iface/85-bbfdm-sysctl
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = "ifup" ] || exit 0
|
||||
|
||||
apply_sysctl_configuration() {
|
||||
local sysctl_conf
|
||||
|
||||
sysctl_conf="/etc/bbfdm/sysctl.conf"
|
||||
|
||||
[ -f "${sysctl_conf}" ] || touch "${sysctl_conf}"
|
||||
|
||||
sysctl -e -p "${sysctl_conf}" >&-
|
||||
}
|
||||
|
||||
|
||||
ubus -t 10 wait_for network.device
|
||||
apply_sysctl_configuration
|
||||
@@ -7,7 +7,6 @@ USE_PROCD=1
|
||||
PROG=/usr/sbin/bbfdmd
|
||||
|
||||
BBFDM_JSON_INPUT="/etc/bbfdm/input.json"
|
||||
TMP_JSON_INPUT="/tmp/bbfdm_input.json"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t bbfdmd.init -p info
|
||||
@@ -38,6 +37,24 @@ configure_bbfdmd()
|
||||
|
||||
[ "${enabled}" -eq 0 ] && return 0
|
||||
|
||||
[ ! -f "${BBFDM_JSON_INPUT}" ] && return 0
|
||||
|
||||
if [ -n "${loglevel}" ]; then
|
||||
echo "$(jq --arg res ${loglevel} '.daemon.config += {"loglevel": $res}' ${BBFDM_JSON_INPUT})" > ${BBFDM_JSON_INPUT}
|
||||
fi
|
||||
|
||||
if [ -n "${refresh_time}" ]; then
|
||||
echo "$(jq --arg res ${refresh_time} '.daemon.config += {"refresh_time": $res}' ${BBFDM_JSON_INPUT})" > ${BBFDM_JSON_INPUT}
|
||||
fi
|
||||
|
||||
if [ -n "${transaction_timeout}" ]; then
|
||||
echo "$(jq --arg res ${transaction_timeout} '.daemon.config += {"transaction_timeout": $res}' ${BBFDM_JSON_INPUT})" > ${BBFDM_JSON_INPUT}
|
||||
fi
|
||||
|
||||
if [ -n "${subprocess_level}" ]; then
|
||||
echo "$(jq --arg res ${subprocess_level} '.daemon.config += {"subprocess_level": $res}' ${BBFDM_JSON_INPUT})" > ${BBFDM_JSON_INPUT}
|
||||
fi
|
||||
|
||||
procd_set_param command ${PROG}
|
||||
if [ "${debug}" -eq 1 ]; then
|
||||
procd_set_param stdout 1
|
||||
@@ -47,60 +64,17 @@ configure_bbfdmd()
|
||||
if [ -f "${sock}" ]; then
|
||||
procd_append_param command -s "${sock}"
|
||||
fi
|
||||
|
||||
[ ! -f "${BBFDM_JSON_INPUT}" ] && return 0
|
||||
|
||||
cp -f ${BBFDM_JSON_INPUT} ${TMP_JSON_INPUT} 2>/dev/null
|
||||
|
||||
if [ -n "${loglevel}" ]; then
|
||||
echo "$(jq --arg res ${loglevel} '.daemon.config += {"loglevel": $res}' ${TMP_JSON_INPUT})" > ${TMP_JSON_INPUT}
|
||||
fi
|
||||
|
||||
if [ -n "${refresh_time}" ]; then
|
||||
echo "$(jq --arg res ${refresh_time} '.daemon.config += {"refresh_time": $res}' ${TMP_JSON_INPUT})" > ${TMP_JSON_INPUT}
|
||||
fi
|
||||
|
||||
if [ -n "${transaction_timeout}" ]; then
|
||||
echo "$(jq --arg res ${transaction_timeout} '.daemon.config += {"transaction_timeout": $res}' ${TMP_JSON_INPUT})" > ${TMP_JSON_INPUT}
|
||||
fi
|
||||
|
||||
if [ -n "${subprocess_level}" ]; then
|
||||
echo "$(jq --arg res ${subprocess_level} '.daemon.config += {"subprocess_level": $res}' ${TMP_JSON_INPUT})" > ${TMP_JSON_INPUT}
|
||||
fi
|
||||
|
||||
procd_append_param command -I "${TMP_JSON_INPUT}"
|
||||
}
|
||||
|
||||
apply_sysctl_configuration() {
|
||||
local sysctl_conf
|
||||
|
||||
sysctl_conf="/etc/bbfdm/sysctl.conf"
|
||||
|
||||
[ -f "${sysctl_conf}" ] || touch "${sysctl_conf}"
|
||||
|
||||
sysctl -e -p "${sysctl_conf}" >&-
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local sysctl_reload
|
||||
|
||||
ubus -t 5 wait_for network.device
|
||||
[ "$?" -eq 0 ] && sysctl_reload=1
|
||||
|
||||
procd_open_instance bbf
|
||||
start_service()
|
||||
{
|
||||
procd_open_instance "bbfdm"
|
||||
configure_bbfdmd
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
|
||||
[ "${sysctl_reload}" -eq 1 ] && apply_sysctl_configuration
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
ubus -t 5 wait_for network.device
|
||||
apply_sysctl_configuration
|
||||
procd_close_instance "bbfdm"
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "bbfdm" "network"
|
||||
procd_add_reload_trigger "bbfdm"
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=decollector
|
||||
PKG_VERSION:=4.0.2.0
|
||||
PKG_VERSION:=4.0.2.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=162654487bfbff7d68d0c87ae9498a3def738d84
|
||||
PKG_SOURCE_VERSION:=fa1b24690ca00a73401fec1386dbf98932545d05
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.5.8
|
||||
PKG_VERSION:=3.5.9
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=a9b4e716f5d48b543191ca47b14b4bceafdaa5b4
|
||||
PKG_SOURCE_VERSION:=ae9e8f3406f1087464b994cdfbc64a4ce2f86ed4
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ PKG_VERSION:=1.2.0
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=bb754ae620a9fc66fd6fc0745f0fead0708c7a17
|
||||
PKG_SOURCE_VERSION:=43dec92b1c86be7859521da337e7bd1168848b26
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dslmngr.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.3.4
|
||||
PKG_VERSION:=9.3.5
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/icwmp.git
|
||||
PKG_SOURCE_VERSION:=74d10bef9770da4a8f5bfdcdccdcba7720ec36b7
|
||||
PKG_SOURCE_VERSION:=caa4ac86b91b698e73e09a3ba8b60add36ea4b62
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ log() {
|
||||
echo "${@}"|logger -t firewall.cwmp -p info
|
||||
}
|
||||
|
||||
if [ ! -f "/var/state/cwmp" ]; then
|
||||
if [ ! -f "/var/state/icwmp" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
zone_name=$(uci -c /var/state -q get cwmp.acs.zonename)
|
||||
zone_name=$(uci -c /var/state -q get icwmp.acs.zonename)
|
||||
port=$(uci -q get cwmp.cpe.port)
|
||||
ipaddr=$(uci -c /var/state -q get cwmp.acs.ip)
|
||||
ip6addr=$(uci -c /var/state -q get cwmp.acs.ip6)
|
||||
ipaddr=$(uci -c /var/state -q get icwmp.acs.ip)
|
||||
ip6addr=$(uci -c /var/state -q get icwmp.acs.ip6)
|
||||
incoming_rule=$(uci -q get cwmp.cpe.incoming_rule|tr 'A-Z' 'a-z')
|
||||
|
||||
if [ -z "${zone_name}" ]; then
|
||||
@@ -76,5 +76,5 @@ if [ "$?" -eq 0 ]; then
|
||||
${cmd6}
|
||||
fi
|
||||
|
||||
uci -c /var/state -q set cwmp.cpe.firewall_restart="init"
|
||||
uci -c /var/state -q commit cwmp
|
||||
uci -c /var/state -q set icwmp.cpe.firewall_restart="init"
|
||||
uci -c /var/state -q commit icwmp
|
||||
|
||||
@@ -17,8 +17,8 @@ handle_icwmp_update() {
|
||||
ret=$(ubus call service list '{"name":"icwmpd"}' | jsonfilter -qe '@.icwmpd.instances.icwmp.running')
|
||||
|
||||
if [ "$ret" = "true" ]; then
|
||||
# read status from var/state/cwmp
|
||||
status=$(uci -q -c /var/state get cwmp.sess_status.current_status)
|
||||
# read status from var/state/icwmp
|
||||
status=$(uci -q -c /var/state get icwmp.sess_status.current_status)
|
||||
if [ "$status" != "running" ]; then
|
||||
log "Trigger out of bound inform, since last inform status was failure"
|
||||
ubus -t 10 call tr069 inform >/dev/null 2>&1
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=8.1.10
|
||||
PKG_VERSION:=8.1.11
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=52a11c4969039741f19a9a3d748c26761e702607
|
||||
PKG_SOURCE_VERSION:=90b8f44ca78b4711d5c86234fb0fc621ebd97fd9
|
||||
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
|
||||
|
||||
@@ -67,6 +67,8 @@ CONFIG_PACKAGE_map-controller=m
|
||||
CONFIG_PACKAGE_map-topology=y
|
||||
CONFIG_PACKAGE_decollector=y
|
||||
|
||||
CONFIG_IEEE1905_CMDU_SA_IS_ALMAC=y
|
||||
|
||||
# Network #
|
||||
CONFIG_PACKAGE_netmode=y
|
||||
CONFIG_PACKAGE_urlfilter=y
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
function feeds_update {
|
||||
|
||||
heads=1
|
||||
developer=0
|
||||
override=1
|
||||
start=$(date -u +'%s')
|
||||
while getopts "n" opt; do
|
||||
while getopts "inh" opt; do
|
||||
case $opt in
|
||||
i)
|
||||
heads=0
|
||||
;;
|
||||
n)
|
||||
override=0
|
||||
;;
|
||||
h|\?)
|
||||
echo "Usage: ./iop feeds_update [-i] [-n] [-h]"
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
echo " -i - Only update index. Do not change HEAD in feeds."
|
||||
echo " -n - Do not replace core packages with iopsys versions."
|
||||
echo " -h - Display this help message and exit."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -17,41 +28,42 @@ function feeds_update {
|
||||
|
||||
cp .config .genconfig_config_bak
|
||||
|
||||
#if -d argument is passed, clone feeds with ssh instead of http
|
||||
if [ $developer == 1 ]; then
|
||||
./scripts/feeds update -g
|
||||
else
|
||||
./scripts/feeds update
|
||||
if [ $heads == 1 ]; then
|
||||
if [ $developer == 1 ]; then
|
||||
./scripts/feeds update -g
|
||||
else
|
||||
./scripts/feeds update
|
||||
fi
|
||||
fi
|
||||
./scripts/feeds update -ai
|
||||
./scripts/feeds update -ai || exit 1
|
||||
|
||||
# replace core packages with iopsys versions
|
||||
if [ $override == 1 ]; then
|
||||
./scripts/feeds install -f -p openwrt_core -a
|
||||
./scripts/feeds install -f -p openwrt_core -a || exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update'
|
||||
echo 'FEED_DEVICES_DIRS:='
|
||||
find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h'
|
||||
) > target/linux/feed-devices/feed-devices-list.mk
|
||||
) > target/linux/feed-devices/feed-devices-list.mk || exit 1
|
||||
|
||||
# targets need to be installed explicitly
|
||||
for target in $(ls ./feeds/targets); do
|
||||
./scripts/feeds install -f -p targets $target
|
||||
./scripts/feeds install -f -p targets $target || exit 1
|
||||
done
|
||||
|
||||
# install all packages
|
||||
./scripts/feeds install -a
|
||||
./scripts/feeds install -a || exit 1
|
||||
|
||||
# remove broken symlinks ( for packages that are no longer in the feed )
|
||||
find -L package/feeds -maxdepth 2 -type l -delete
|
||||
find -L package/feeds -maxdepth 2 -type l -delete || exit 1
|
||||
|
||||
cp .genconfig_config_bak .config
|
||||
make defconfig
|
||||
make defconfig || exit 1
|
||||
|
||||
# record when we last run this script
|
||||
touch tmp/.iop_bootstrap
|
||||
touch tmp/.iop_bootstrap || exit 1
|
||||
|
||||
# always return true
|
||||
exit 0
|
||||
|
||||
@@ -19,6 +19,7 @@ function genconfig {
|
||||
armvirt_feed="target/linux/feeds/armvirt"
|
||||
mediatek_feed="target/linux/feeds/mediatek"
|
||||
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||
qualcomm_ipq53xx_feed="target/linux/feeds/ipq53xx"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -41,19 +42,13 @@ function genconfig {
|
||||
}
|
||||
|
||||
function verify_config {
|
||||
IFS=$'\n'
|
||||
org=$(<.genconfig.config)
|
||||
unset IFS
|
||||
local num
|
||||
local conf_opt
|
||||
local conf_org
|
||||
local conf_new
|
||||
|
||||
#echo "lines to check $tot_lines"
|
||||
num=0
|
||||
for line in $org
|
||||
while read -r line
|
||||
do
|
||||
conf_opt=$(echo $line | grep CONFIG_ | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|')
|
||||
conf_opt=$(echo $line | grep "^[ #]*CONFIG_" | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|')
|
||||
if [ -n "${conf_opt}" ]
|
||||
then
|
||||
conf_org=$(find_last ${conf_opt} .genconfig.config)
|
||||
@@ -74,8 +69,7 @@ function genconfig {
|
||||
#echo -e "wanted [$conf_org] got [$conf_new]"
|
||||
fi
|
||||
fi
|
||||
num=$((num+1))
|
||||
done
|
||||
done < .genconfig.config
|
||||
}
|
||||
|
||||
# Takes a board name and returns the target name in global var $target
|
||||
@@ -120,25 +114,20 @@ function genconfig {
|
||||
mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq53xx_feed/genconfig ] &&
|
||||
ipq53xx=$(cd $qualcomm_ipq53xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca airoha x86 armvirt mediatek ipq95xx; do
|
||||
for list in brcmbca airoha x86 armvirt mediatek ipq95xx ipq53xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
a=$(echo "${!list}" | sort)
|
||||
for b in $a; do
|
||||
echo -e "\t$b"
|
||||
done
|
||||
done
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $brcmbca; do
|
||||
if [ $p == $profile ]; then
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
@@ -178,6 +167,22 @@ function genconfig {
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $ipq53xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq53xx"
|
||||
target_config_path="$qualcomm_ipq53xx_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $brcmbca; do
|
||||
if [ $p == $profile ]; then
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
@@ -357,10 +362,15 @@ function genconfig {
|
||||
cat $target_config_path/$BOARDTYPE/config >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
|
||||
# hack to support custom-devices until we have deprecated this genconfig-script...
|
||||
if [ -f "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" ]; then
|
||||
cat "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | mediatek | brcmbca | ipq95xx)
|
||||
airoha | mediatek | brcmbca | ipq95xx | ipq53xx)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local subtarget="$(get_subtarget_for_device "${target/_/-}" "$BOARDTYPE")"
|
||||
@@ -460,7 +470,7 @@ function genconfig {
|
||||
if [ ! -e tmp/.iop_bootstrap ]; then
|
||||
echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration."
|
||||
echo "Run: iop feeds_update"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
@@ -497,7 +507,7 @@ function genconfig {
|
||||
CUSTREPO="${CUSTREPO:-git@dev.iopsys.eu:consumer/iopsys.git}"
|
||||
|
||||
setup_dirs
|
||||
create_and_copy_files "$@"
|
||||
create_and_copy_files "$@" || exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ function genconfig_min {
|
||||
armvirt_feed="target/linux/feeds/armvirt"
|
||||
mediatek_feed="target/linux/feeds/mediatek"
|
||||
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||
qualcomm_ipq53xx_feed="target/linux/feeds/ipq53xx"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -40,19 +41,13 @@ function genconfig_min {
|
||||
}
|
||||
|
||||
function verify_config {
|
||||
IFS=$'\n'
|
||||
org=$(<.genconfig.config)
|
||||
unset IFS
|
||||
local num
|
||||
local conf_opt
|
||||
local conf_org
|
||||
local conf_new
|
||||
|
||||
#echo "lines to check $tot_lines"
|
||||
num=0
|
||||
for line in $org
|
||||
while read -r line
|
||||
do
|
||||
conf_opt=$(echo $line | grep CONFIG_ | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|')
|
||||
conf_opt=$(echo $line | grep "^[ #]*CONFIG_" | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|')
|
||||
if [ -n "${conf_opt}" ]
|
||||
then
|
||||
conf_org=$(find_last ${conf_opt} .genconfig.config)
|
||||
@@ -73,8 +68,7 @@ function genconfig_min {
|
||||
#echo -e "wanted [$conf_org] got [$conf_new]"
|
||||
fi
|
||||
fi
|
||||
num=$((num+1))
|
||||
done
|
||||
done < .genconfig.config
|
||||
}
|
||||
|
||||
# Takes a board name and returns the target name in global var $target
|
||||
@@ -119,25 +113,20 @@ function genconfig_min {
|
||||
mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq53xx_feed/genconfig ] &&
|
||||
ipq53xx=$(cd $qualcomm_ipq53xx_feed; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca airoha x86 armvirt mediatek ipq95xx; do
|
||||
for list in brcmbca airoha x86 armvirt mediatek ipq95xx ipq53xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
a=$(echo "${!list}" | sort)
|
||||
for b in $a; do
|
||||
echo -e "\t$b"
|
||||
done
|
||||
done
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $brcmbca; do
|
||||
if [ $p == $profile ]; then
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $airoha; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
@@ -177,6 +166,22 @@ function genconfig_min {
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $ipq53xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq53xx"
|
||||
target_config_path="$qualcomm_ipq53xx_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $brcmbca; do
|
||||
if [ $p == $profile ]; then
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
@@ -331,10 +336,15 @@ function genconfig_min {
|
||||
cat $target_config_path/$BOARDTYPE/config >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
# hack to support custom-devices until we have deprecated this genconfig-script...
|
||||
if [ -f "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" ]; then
|
||||
cat "feeds/custom_devices/devices/$target/config/$BOARDTYPE/config" >> .config
|
||||
echo "" >> .config
|
||||
fi
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | mediatek | brcmbca | ipq95xx)
|
||||
airoha | mediatek | brcmbca | ipq95xx | ipq53xx)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local subtarget="$(get_subtarget_for_device "${target/_/-}" "$BOARDTYPE")"
|
||||
@@ -428,7 +438,7 @@ function genconfig_min {
|
||||
if [ ! -e tmp/.iop_bootstrap ]; then
|
||||
echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration."
|
||||
echo "Run: iop feeds_update"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
|
||||
@@ -449,7 +449,7 @@ insert_feed_hash_in_feeds_config()
|
||||
local feed=$1
|
||||
local TO=$(cd feeds/${feed}; git rev-parse HEAD)
|
||||
|
||||
sed -i feeds.conf -e "/ ${feed}/ s/\(.*\)[;^].*/\1^${TO}/"
|
||||
sed -i feeds.conf -e "/ ${feed} / s/\(.*\)[;^].*/\1^${TO}/"
|
||||
git add feeds.conf
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ PKG_VERSION:=7.2.99
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=54d53295b5e4ca74884045d0fa6bb0dc279ace3d
|
||||
PKG_SOURCE_VERSION:=f9f3fcd0f4140540db5bd41059bcca7ded083024
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libdsl.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -10,7 +10,7 @@ PKG_VERSION:=7.2.104
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=a64c8d1db59f6ca70424356186d279cc6e31213c
|
||||
PKG_SOURCE_VERSION:=d777636ca43302a95e571ab030ec44ef50905570
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libethernet.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -10,7 +10,7 @@ PKG_VERSION:=7.2.101
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=4287dbe76dc5c8b85368aa2cd101d9d9a445f968
|
||||
PKG_SOURCE_VERSION:=93ca0a66d6f82bca208bbe52b75ed582b20aa094
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libqos.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-airoha
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_VERSION:=1.0.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:=2a6ef141747ad0f7b32a536b5b5bd174834a7af5
|
||||
PKG_SOURCE_VERSION:=3043d53818166ce02644d53f99b5830d228f78dd
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -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:=401a392a72e2933f527eb92466faaf2907c38730
|
||||
PKG_SOURCE_VERSION:=dc227982c48ee6d722f3fe18dc9db71495ce9758
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-d2
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_VERSION:=1.0.4
|
||||
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:=7ca102e62fa439a7188f2c5e4c72e3fcfd3fb28a
|
||||
PKG_SOURCE_VERSION:=f2134d372b3f5e5810e18f34d64d5486d17fca64
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libwifi
|
||||
PKG_VERSION:=7.2.101
|
||||
PKG_VERSION:=7.2.104
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=04b01464cb6d8c7ffcdfded7f8acacba04a5ba4f
|
||||
PKG_SOURCE_VERSION:=a246bf9fd92a1a8c107ffff3eb3428a4174a67df
|
||||
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
|
||||
@@ -44,7 +44,7 @@ else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_CFLAGS +=-DIOPSYS_ECONET
|
||||
else ifeq ($(CONFIG_TARGET_ipq95xx),y)
|
||||
TARGET_PLATFORM=IPQ95XX
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_WIFI_TYPE=QUALCOMM MAC80211
|
||||
TARGET_CFLAGS +=-DIPQ95XX
|
||||
else ifeq ($(CONFIG_TARGET_mediatek),y)
|
||||
TARGET_PLATFORM=LINUX
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=4.3.2.3
|
||||
PKG_VERSION:=4.3.3.2
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=d8940d6ecc4b8611c7d2e4bd9a2d5cad302c9c6e
|
||||
PKG_SOURCE_VERSION:=6b1347b33333f3ef9884de0745aa862a0a1dabc8
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=4.3.0.3
|
||||
PKG_VERSION:=4.3.0.6
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=fb600940ac54456bcde650ccee7055f7c9bb785b
|
||||
PKG_SOURCE_VERSION:=cadbccc7654a40f16f96f2c48e584b998c03620e
|
||||
PKG_MAINTAINER:=Jakob Olsson <jakob.olsson@iopsys.eu>
|
||||
|
||||
LOCAL_DEV=0
|
||||
|
||||
@@ -70,7 +70,6 @@ validate_ap_section() {
|
||||
'encryption:or("sae", "sae+aes", "psk2",
|
||||
"psk2+aes", "sae-mixed", "sae-mixed+aes",
|
||||
"none", "psk-mixed", "psk-mixed+aes",
|
||||
"wpa", "wpa+aes", "wpa2", "wpa2+aes",
|
||||
"psk", "psk+aes")' \
|
||||
'key:string' \
|
||||
'vid:range(1,65535):1' \
|
||||
|
||||
@@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=map-topology
|
||||
PKG_VERSION:=2.5.1.20
|
||||
PKG_VERSION:=2.5.1.21
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_VERSION:=e570731d6544335568a48a5dc4c6e65aed401045
|
||||
PKG_SOURCE_VERSION:=693b79873af0017bd53ec001af7f3997565420e8
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/map-topology.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -20,7 +20,12 @@ compare_mcast_proxy_upstream() {
|
||||
|
||||
for dev in $upstream; do
|
||||
if [ "$l3device" == "$dev" ]; then
|
||||
ubus call uci commit '{"config":"mcast"}'
|
||||
running=$(ubus call service list '{"name": "mcast"}' | jsonfilter -e '@.mcast.instances')
|
||||
if [ -z "${running}" ];then
|
||||
/etc/init.d/mcast start
|
||||
else
|
||||
ubus call uci commit '{"config":"mcast"}'
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/mcast/common.sh
|
||||
. /lib/functions/network.sh
|
||||
|
||||
include /lib/network
|
||||
|
||||
@@ -67,6 +68,22 @@ config_mcproxy_interfaces() {
|
||||
done
|
||||
}
|
||||
|
||||
config_sysfs_mcast_snooping() {
|
||||
local devsec=
|
||||
local sectype=
|
||||
local devtype=
|
||||
local ports=
|
||||
|
||||
for downstream in $downstreams; do
|
||||
devsec="$(uci show network | grep name=.*$downstream | cut -d'.' -f2)"
|
||||
sectype="$(uci -q get network.$devsec)"
|
||||
devtype="$(uci -q get network.$devsec.type)"
|
||||
if [ "$sectype" == "device" -a "$devtype" == "bridge" ]; then
|
||||
echo 1 > /sys/class/net/$downstream/bridge/multicast_snooping
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
config_mcproxy_instance() {
|
||||
local protocol="$1"
|
||||
local version="$2"
|
||||
@@ -79,6 +96,7 @@ config_mcproxy_instance() {
|
||||
local exceptions=
|
||||
local upstreams=
|
||||
local downstreams=
|
||||
local intf_has_ip=
|
||||
|
||||
CONFFILE=/var/etc/mcproxy_"$protocol".conf
|
||||
rm -f $CONFFILE
|
||||
@@ -124,6 +142,11 @@ config_mcproxy_instance() {
|
||||
downstreams=$mld_p_down_interfaces
|
||||
fi
|
||||
|
||||
# for snooping to work we should enable it on the bridge, doing it from
|
||||
# here instead of from inside network config
|
||||
config_sysfs_mcast_snooping
|
||||
|
||||
[ -n "$max_groups" ] && echo -e "max_groups $max_groups;" >> $CONFFILE
|
||||
[ -n "$robustness" ] && echo -e "rv $robustness;" >> $CONFFILE
|
||||
[ -n "$query_interval" ] && echo -e "qi $query_interval;" >> $CONFFILE
|
||||
[ -n "$q_resp_interval" ] && echo -e "qri $q_resp_interval;" >> $CONFFILE
|
||||
@@ -136,7 +159,40 @@ config_mcproxy_instance() {
|
||||
[ -n "$upstreams" ] && [ -n "$downstreams" ] &&
|
||||
config_mcproxy_interfaces "$upstreams" "$downstreams" "$exceptions"
|
||||
|
||||
PROG_PARAMS="${PROG_PARAMS} -f ${CONFFILE}${PROG_PARAMS_SEPARATOR}"
|
||||
# In case on proxy, upstreams is a list. Iterating and running the mcproxy
|
||||
# for each valid upstream interface
|
||||
for upstream_device in $upstreams;
|
||||
do
|
||||
# Read the upstream interface for the upstream device
|
||||
# upstream device can have multiple logical interfaces like wan and wan6
|
||||
# but same l3 device
|
||||
local upstream_ifaces=$(get_network_of $upstream_device)
|
||||
|
||||
for iface in $upstream_ifaces;
|
||||
do
|
||||
if [ "$protocol" == "igmp" ]; then
|
||||
network_get_ipaddr upstream_ip $iface
|
||||
if [ ! -z "${upstream_ip}" ]; then
|
||||
intf_has_ip=1
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$protocol" == "mld" ]; then
|
||||
network_get_ipaddr6 upstream_ip $iface
|
||||
if [ ! -z "${upstream_ip}" ]; then
|
||||
intf_has_ip=1
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "${intf_has_ip}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
PROG_PARAMS="${PROG_PARAMS} -f ${CONFFILE}${PROG_PARAMS_SEPARATOR}"
|
||||
done
|
||||
}
|
||||
|
||||
config_mcproxy() {
|
||||
@@ -174,7 +230,16 @@ config_sysfs_mcast_fastleave() {
|
||||
configure_mcast() {
|
||||
config_global_params "set_max_groups_and_sources"
|
||||
|
||||
# mcproxy reserves two multicast subscriptions for igmp router service groups
|
||||
local mg=$(cat /proc/sys/net/ipv4/igmp_max_memberships)
|
||||
mg=$((mg+2))
|
||||
echo $mg > /proc/sys/net/ipv4/igmp_max_memberships
|
||||
|
||||
read_mcast_snooping_params
|
||||
read_mcast_proxy_params
|
||||
config_mcproxy
|
||||
|
||||
if [ -z "${PROG_PARAMS}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
151
mcastmngr/files/linux/usr/libexec/rpcd/mcast
Executable file
151
mcastmngr/files/linux/usr/libexec/rpcd/mcast
Executable file
@@ -0,0 +1,151 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
read_mcast_stats() {
|
||||
|
||||
temp_igmp_file='/tmp/igmp_stats_'$$
|
||||
# Sending signal to mcproxy to dump multicast data in /tmp/igmp_snooping_stats
|
||||
mcast_pids=$(pidof mcproxy)
|
||||
for pid in $mcast_pids
|
||||
do
|
||||
$(kill -10 $pid)
|
||||
done
|
||||
cat /tmp/igmp_snooping_stats > temp_igmp_file
|
||||
|
||||
local mcast_addrs=""
|
||||
local ifaces=""
|
||||
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
found_iface=0
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ -z "$ifaces" ]; then
|
||||
ifaces="$snoop_iface"
|
||||
continue
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for ifx in $ifaces; do
|
||||
if [ $ifx == $snoop_iface ]; then
|
||||
found_iface=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $found_iface -eq 0 ]; then
|
||||
ifaces="$ifaces $snoop_iface"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < temp_igmp_file
|
||||
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
found_ip=0
|
||||
grp_ip="$(echo $line | awk -F ' ' '{ print $2 }')"
|
||||
if [ -z "$mcast_addrs" ]; then
|
||||
mcast_addrs="$grp_ip"
|
||||
continue
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for ip_addr in $mcast_addrs; do
|
||||
if [ $ip_addr == $grp_ip ]; then
|
||||
found_ip=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $found_ip -eq 0 ]; then
|
||||
mcast_addrs="$mcast_addrs $grp_ip"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < temp_igmp_file
|
||||
|
||||
json_init
|
||||
json_add_array "snooping"
|
||||
json_add_object ""
|
||||
IFS=" "
|
||||
for intf in $ifaces; do
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < temp_igmp_file
|
||||
IFS=" "
|
||||
for gip_addr in $mcast_addrs; do
|
||||
grp_obj_added=0
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
grp_ip="$(echo $line | awk -F ' ' '{ print $2 }')"
|
||||
if [ "$grp_ip" != "$gip_addr" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ $grp_obj_added -eq 0 ]; then
|
||||
json_add_object ""
|
||||
gip="$(ipcalc.sh $gip_addr | grep IP | awk '{print substr($0,4)}')"
|
||||
json_add_string "groupaddr" "$gip"
|
||||
json_add_array "clients"
|
||||
grp_obj_added=1
|
||||
fi
|
||||
|
||||
json_add_object ""
|
||||
host_ip="$(echo $line | awk -F ' ' '{ print $3 }')"
|
||||
h_ip="$(ipcalc.sh $host_ip | grep IP | awk '{print substr($0,4)}')"
|
||||
json_add_string "ipaddr" "$h_ip"
|
||||
src_port="$(echo $line | awk -F ' ' '{ print $4 }')"
|
||||
json_add_string "device" "$src_port"
|
||||
timeout="$(echo $line | awk -F ' ' '{ print $5 }')"
|
||||
json_add_int "timeout" "$timeout"
|
||||
json_close_object #close the associated device object
|
||||
;;
|
||||
esac
|
||||
done < temp_igmp_file
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
done # close the loop for group addresses
|
||||
json_close_array #close the groups array
|
||||
done # close the loop for interfaces
|
||||
json_close_object # close the snooping object
|
||||
json_close_array # close the snooping array
|
||||
json_dump
|
||||
|
||||
rm -f temp_igmp_file
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "stats":{} }'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
stats)
|
||||
read_mcast_stats
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
@@ -23,7 +23,7 @@ config OBUSPA_MTP_ENABLE_COAP
|
||||
default y
|
||||
|
||||
config OBUSPA_CONTROLLER_MTP_VERIFY
|
||||
bool "Enable verification of MQTT response topic before processing the message"
|
||||
bool "Enable verification of controller MTP before processing the message"
|
||||
default n
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=7.0.2.9
|
||||
PKG_VERSION:=7.0.2.16
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||
PKG_SOURCE_VERSION:=0626e449c2d26787a28c40149dee0ddd8a607703
|
||||
PKG_SOURCE_VERSION:=312a739dc9106e8ff490288ba22270f4ce7e1fed
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -55,38 +55,28 @@ db_set_sql()
|
||||
value="$*"
|
||||
|
||||
if [ -n "${param}" ] && [ -n "${value}" ]; then
|
||||
${PROG} -f ${SQL_DB_FILE} -c dbset "${param}" "${value}" >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
db_del_sql()
|
||||
{
|
||||
local param
|
||||
|
||||
param="${1}"
|
||||
|
||||
if [ -n "${param}" ]; then
|
||||
${PROG} -f ${SQL_DB_FILE} -c dbdel "${param}" >/dev/null 2>&1
|
||||
if grep -q "${param} " ${DB_DUMP}; then
|
||||
value="${value//\//\\/}"
|
||||
sed -i "s/${param} .*/${param} \"${value}\"/g" ${DB_DUMP}
|
||||
else
|
||||
echo "${param} \"${value}\"" >> ${DB_DUMP}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
db_set()
|
||||
{
|
||||
# if sql db present, update sql db
|
||||
# else update reset file
|
||||
if [ -f "${SQL_DB_FILE}" ]; then
|
||||
# if sql db dump file present, update it
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
db_set_sql "$@"
|
||||
else
|
||||
db_set_reset_file "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
update_db_dump()
|
||||
dump_db()
|
||||
{
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
rm ${DB_DUMP}
|
||||
${PROG} -f ${SQL_DB_FILE} -c show database |sort > ${DB_DUMP}
|
||||
fi
|
||||
${PROG} -f ${SQL_DB_FILE} -c show database |awk 'NR>1 {print $1 " \"" $3 "\""}' | sort > ${DB_DUMP}
|
||||
}
|
||||
|
||||
# if db present then check if it matches with existing instances
|
||||
@@ -102,7 +92,7 @@ get_base_path()
|
||||
count=0
|
||||
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
path=$(grep "${refpath}\d.Alias => ${value}" ${DB_DUMP})
|
||||
path=$(grep "${refpath}\d.Alias \"${value}\"" ${DB_DUMP})
|
||||
path=${path%.*}
|
||||
if [ -z "${path}" ]; then
|
||||
path=$(grep -o "${refpath}\d" ${DB_DUMP} |sort -r|head -n 1)
|
||||
@@ -235,7 +225,9 @@ validate_controller_section()
|
||||
'Port:port' \
|
||||
'Path:string' \
|
||||
'EnableEncryption:bool' \
|
||||
'SessionMode:string'
|
||||
'PeriodicNotifInterval:uinteger' \
|
||||
'SessionMode:string:Allow'
|
||||
|
||||
}
|
||||
|
||||
validate_subscription_section()
|
||||
@@ -260,6 +252,7 @@ validate_mtp_section()
|
||||
'mqtt:string' \
|
||||
'stomp:string' \
|
||||
'Reference:string' \
|
||||
'PublishQoS:uinteger' \
|
||||
'EnableEncryption:bool'
|
||||
}
|
||||
|
||||
@@ -311,7 +304,6 @@ configure_localagent()
|
||||
}
|
||||
|
||||
db_set Device.LocalAgent.EndpointID "${EndpointID}"
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
update_reset_reason()
|
||||
@@ -328,7 +320,7 @@ configure_controller()
|
||||
local EndpointID Enable
|
||||
local Protocol Destination
|
||||
local Topic mqtt stomp assigned_role_name AssignedRole ParameterName
|
||||
local Host Port Path EnableEncryption Reference SessionMode
|
||||
local Host Port Path EnableEncryption Reference SessionMode PeriodicNotifInterval
|
||||
local dm_ref sec
|
||||
|
||||
sec="${1}"
|
||||
@@ -366,6 +358,10 @@ configure_controller()
|
||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||
db_set "${BASEPATH}.EndpointID" "${EndpointID}"
|
||||
|
||||
if [ -n "${PeriodicNotifInterval}" ]; then
|
||||
db_set "${BASEPATH}.PeriodicNotifInterval" "${PeriodicNotifInterval}"
|
||||
fi
|
||||
|
||||
if [ -n "${SessionMode}" ]; then
|
||||
db_set "${BASEPATH}.E2ESession.SessionMode" "${SessionMode}"
|
||||
fi
|
||||
@@ -410,9 +406,6 @@ configure_controller()
|
||||
db_set "${BASEPATH}.BootParameter.${_pnum}.ParameterName" "${param}"
|
||||
_pnum=$(( _pnum + 1 ))
|
||||
done
|
||||
|
||||
db_set
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
configure_subscription()
|
||||
@@ -505,7 +498,6 @@ configure_challenges()
|
||||
sec="${1}"
|
||||
validate_challenge_section "${1}" || {
|
||||
log "Validation of challenge section failed"
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sec="${sec/challenge_/cpe-}"
|
||||
@@ -538,7 +530,7 @@ configure_challenges()
|
||||
|
||||
configure_mtp() {
|
||||
local Enable Protocol ResponseTopicConfigured
|
||||
local Path Port EnableEncryption
|
||||
local Path Port EnableEncryption PublishQoS
|
||||
local stomp mqtt dm_ref sec
|
||||
|
||||
sec="${1}"
|
||||
@@ -577,6 +569,9 @@ configure_mtp() {
|
||||
if [ "${Protocol}" = "MQTT" ]; then
|
||||
db_set "${BASEPATH}.MQTT.Reference" "${dm_ref}"
|
||||
db_set "${BASEPATH}.MQTT.ResponseTopicConfigured" "${ResponseTopicConfigured}"
|
||||
if [ -n "${PublishQoS}" ]; then
|
||||
db_set "${BASEPATH}.MQTT.PublishQoS" "${PublishQoS}"
|
||||
fi
|
||||
elif [ "${Protocol}" = "STOMP" ]; then
|
||||
db_set "${BASEPATH}.STOMP.Reference" "${dm_ref}"
|
||||
db_set "${BASEPATH}.STOMP.Destination" "${Destination}"
|
||||
@@ -588,8 +583,6 @@ configure_mtp() {
|
||||
db_set "${BASEPATH}.WebSocket.Port" "${Port}"
|
||||
db_set "${BASEPATH}.WebSocket.EnableEncryption" "${EnableEncryption}"
|
||||
fi
|
||||
db_set
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
configure_stomp_connection() {
|
||||
@@ -620,8 +613,6 @@ configure_stomp_connection() {
|
||||
db_set "${BASEPATH}.EnableEncryption" "${EnableEncryption}"
|
||||
db_set "${BASEPATH}.EnableHeartbeats" "${EnableHeartbeats}"
|
||||
db_set "${BASEPATH}.VirtualHost" "${VirtualHost}"
|
||||
db_set
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
configure_mqtt_client() {
|
||||
@@ -651,9 +642,6 @@ configure_mqtt_client() {
|
||||
db_set "${BASEPATH}.ProtocolVersion" "${ProtocolVersion}"
|
||||
db_set "${BASEPATH}.TransportProtocol" "${TransportProtocol}"
|
||||
db_set "${BASEPATH}.ClientID" "${ClientID}"
|
||||
|
||||
db_set
|
||||
update_db_dump
|
||||
}
|
||||
|
||||
|
||||
@@ -707,6 +695,9 @@ configure_obuspa() {
|
||||
fi
|
||||
|
||||
if [ -f "${RESET_FILE}" ]; then
|
||||
if [ -f "${SQL_DB_FILE}" ]; then
|
||||
mv ${SQL_DB_FILE} ${SQL_DB_FILE}.old
|
||||
fi
|
||||
procd_append_param command -r ${RESET_FILE}
|
||||
fi
|
||||
|
||||
@@ -751,9 +742,9 @@ get_param_value_from_dump()
|
||||
return 0
|
||||
fi
|
||||
|
||||
value="$(grep "^${param} " ${DB_DUMP}|awk '{print $3}')"
|
||||
value="$(grep "^${param} " ${DB_DUMP}|awk '{print $2}')"
|
||||
|
||||
echo "$value"
|
||||
echo "${value//\"/}"
|
||||
}
|
||||
|
||||
update_uci_sec()
|
||||
@@ -777,7 +768,7 @@ sync_db_controller()
|
||||
{
|
||||
local cntrs copts sec pvalue protocol
|
||||
|
||||
copts="Enable EndpointID AssignedRole"
|
||||
copts="Enable EndpointID AssignedRole PeriodicNotifInterval"
|
||||
popts="Destination Topic Reference Host Port Path EnableEncryption"
|
||||
|
||||
cntrs="$(get_instances_from_db_dump Device.LocalAgent.Controller.)"
|
||||
@@ -810,7 +801,7 @@ sync_db_localagent_mtp()
|
||||
local mtps opts popts sec pvalue protocol
|
||||
|
||||
opts="Enable"
|
||||
popts="ResponseTopicConfigured Destination Port Path Reference EnableEncryption"
|
||||
popts="ResponseTopicConfigured Destination Port Path Reference EnableEncryption PublishQoS"
|
||||
ropts="mqtt stomp"
|
||||
|
||||
mtps="$(get_instances_from_db_dump Device.LocalAgent.MTP.)"
|
||||
@@ -926,10 +917,8 @@ delete_sql_db_entry_with_pattern()
|
||||
return 0;
|
||||
fi
|
||||
|
||||
params="$(grep "${pattern}" ${DB_DUMP}|awk '{print $1}')"
|
||||
for p in ${params}; do
|
||||
db_del_sql "${p}"
|
||||
done
|
||||
#log "Deleting with pattern [${pattern}] from ${DB_DUMP}"
|
||||
sed -i "/${pattern}/d" ${DB_DUMP}
|
||||
}
|
||||
|
||||
check_n_delete_db()
|
||||
@@ -945,7 +934,7 @@ check_n_delete_db()
|
||||
r="${3}"
|
||||
sec="${sec/${t}_/cpe-}"
|
||||
|
||||
path=$(grep "${r}\d.Alias => ${sec}" ${DB_DUMP})
|
||||
path=$(grep "${r}\d.Alias \"${sec}\"" ${DB_DUMP})
|
||||
path=${path%.*}
|
||||
|
||||
delete_sql_db_entry_with_pattern "${path}"
|
||||
@@ -973,28 +962,42 @@ db_init()
|
||||
|
||||
reason="${1}"
|
||||
mkdir -p /tmp/obuspa/
|
||||
|
||||
# Load configuration
|
||||
config_load $CONFIGURATION
|
||||
config_get SQL_DB_FILE global db_file "/tmp/obuspa/usp.db"
|
||||
|
||||
if [ -f "${SQL_DB_FILE}.old" ] && [ ! -f "${SQL_DB_FILE}" ]; then
|
||||
log "Copying old db, since new db not present ..."
|
||||
mv ${SQL_DB_FILE}.old ${SQL_DB_FILE}
|
||||
fi
|
||||
|
||||
# Dump datamodel parameters from DB
|
||||
if [ -f "${SQL_DB_FILE}" ]; then
|
||||
${PROG} -f ${SQL_DB_FILE} -c show database |sort > ${DB_DUMP}
|
||||
dump_db
|
||||
fi
|
||||
|
||||
# Only sync uci with db in case of non service triggers
|
||||
# In case of Reboot or service restart update the uci
|
||||
# from usp.db file
|
||||
if [ -f "${DB_DUMP}" ] && [ "${reason}" != "update" ]; then
|
||||
sync_uci_with_db
|
||||
# Only do this if db have reasonable data
|
||||
val="$(awk 'END{print NR}' ${DB_DUMP})"
|
||||
if [ "$val" -gt 15 ]; then
|
||||
log "Syncing obuspa uci with usp.db ...."
|
||||
sync_uci_with_db
|
||||
fi
|
||||
fi
|
||||
|
||||
# remove entries from db if deleted from uci
|
||||
# remove entries from db if deleted from uci, only in case of reload
|
||||
if [ -f "${DB_DUMP}" ] && [ "${reason}" = "update" ] && [ -f "/tmp/obuspa/obuspa" ]; then
|
||||
log "Deleting entries from usp.db if uci not present ...."
|
||||
reverse_update_db_with_uci
|
||||
fi
|
||||
|
||||
# Remove reset file if present
|
||||
[ -f "${RESET_FILE}" ] && rm -f ${RESET_FILE}
|
||||
[ -f "${RESET_FILE}" ] && mv ${RESET_FILE} ${RESET_FILE}.old
|
||||
|
||||
#log "Create reset file ...."
|
||||
config_load $CONFIGURATION
|
||||
global_init
|
||||
config_foreach configure_localagent localagent
|
||||
@@ -1015,8 +1018,9 @@ db_init()
|
||||
uci_commit ${CONFIGURATION}
|
||||
|
||||
cp /etc/config/obuspa /tmp/obuspa/
|
||||
|
||||
[ -f "${DB_DUMP}" ] && rm -f ${DB_DUMP}
|
||||
if [ -f "${DB_DUMP}" ]; then
|
||||
mv ${DB_DUMP} ${RESET_FILE}
|
||||
fi
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
117
obuspa/patches/0001-validate-controller-mtp.patch
Normal file
117
obuspa/patches/0001-validate-controller-mtp.patch
Normal file
@@ -0,0 +1,117 @@
|
||||
diff --git a/src/core/device.h b/src/core/device.h
|
||||
index 5ca0782..ee6d88c 100644
|
||||
--- a/src/core/device.h
|
||||
+++ b/src/core/device.h
|
||||
@@ -157,6 +157,9 @@ int DEVICE_CONTROLLER_Start(void);
|
||||
void DEVICE_CONTROLLER_Stop(void);
|
||||
int DEVICE_CONTROLLER_FindInstanceByEndpointId(char *endpoint_id);
|
||||
int DEVICE_CONTROLLER_QueueBinaryMessage(mtp_send_item_t *msi, char *endpoint_id, char *usp_msg_id, mtp_reply_to_t *mtp_reply_to, time_t expiry_time);
|
||||
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
||||
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_reply_to_t *mrt);
|
||||
+#endif
|
||||
bool DEVICE_CONTROLLER_IsMTPConfigured(char *endpoint_id, mtp_protocol_t protocol);
|
||||
char *DEVICE_CONTROLLER_FindEndpointIdByInstance(int instance);
|
||||
char *DEVICE_CONTROLLER_FindEndpointByMTP(mtp_reply_to_t *mrt);
|
||||
diff --git a/src/core/device_controller.c b/src/core/device_controller.c
|
||||
index ae609f5..a6335f5 100644
|
||||
--- a/src/core/device_controller.c
|
||||
+++ b/src/core/device_controller.c
|
||||
@@ -900,6 +900,78 @@ int DEVICE_CONTROLLER_QueueBinaryMessage(mtp_send_item_t *msi, char *endpoint_id
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
+** DEVICE_CONTROLLER_IsMTPAllowed
|
||||
+**
|
||||
+** Determines whether an MTP is allowed to be used by the specified controller
|
||||
+** This function is used by ValidateUspRecord() to determine whether to process a received USP message
|
||||
+**
|
||||
+** \param endpoint_id - Endpoint ID of controller that sent a USP message
|
||||
+** \param mrt - pointer to structure specifying on which MTP the message was received
|
||||
+**
|
||||
+** \return true if the MTP is allowed, false otherwise
|
||||
+**
|
||||
+**************************************************************************/
|
||||
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_reply_to_t *mrt)
|
||||
+{
|
||||
+ controller_t *cont = FindEnabledControllerByEndpointId(endpoint_id);
|
||||
+ controller_mtp_t *mtp;
|
||||
+
|
||||
+ // Disallow if no controller instance is found
|
||||
+ if (cont == NULL)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ mtp = FindFirstEnabledMtp(cont, mrt->protocol);
|
||||
+
|
||||
+#ifdef ENABLE_WEBSOCKETS
|
||||
+ // Allow websocket server if no other MTP is configured
|
||||
+ if ((mrt->protocol == kMtpProtocol_WebSockets) && (mrt->wsserv_conn_id != INVALID))
|
||||
+ {
|
||||
+ return mtp == NULL;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ // Disallow if there is no MTP configured with matching protocol
|
||||
+ if ((mtp == NULL) || (mtp->protocol != mrt->protocol))
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // Check that the configured MTP matches the MTP on which the message was received
|
||||
+ switch(mtp->protocol)
|
||||
+ {
|
||||
+#ifndef DISABLE_STOMP
|
||||
+ case kMtpProtocol_STOMP:
|
||||
+ return mtp->stomp_connection_instance == mrt->stomp_instance;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef ENABLE_COAP
|
||||
+ case kMtpProtocol_CoAP:
|
||||
+ return true; // More detailed checks are not implemented for CoAP
|
||||
+#endif
|
||||
+
|
||||
+#ifdef ENABLE_MQTT
|
||||
+ case kMtpProtocol_MQTT:
|
||||
+ return mtp->mqtt_connection_instance == mrt->mqtt_instance;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef ENABLE_WEBSOCKETS
|
||||
+ case kMtpProtocol_WebSockets:
|
||||
+ return (mrt->wsclient_cont_instance == cont->instance) && (mrt->wsclient_mtp_instance == mtp->instance);
|
||||
+#endif
|
||||
+ default:
|
||||
+ TERMINATE_BAD_CASE(mtp->protocol);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** DEVICE_CONTROLLER_IsMTPConfigured
|
||||
diff --git a/src/core/msg_handler.c b/src/core/msg_handler.c
|
||||
index 8313342..a953562 100644
|
||||
--- a/src/core/msg_handler.c
|
||||
+++ b/src/core/msg_handler.c
|
||||
@@ -759,6 +759,15 @@ int ValidateUspRecord(UspRecord__Record *rec, mtp_reply_to_t *mrt)
|
||||
return USP_ERR_RECORD_FIELD_INVALID;
|
||||
}
|
||||
|
||||
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
||||
+ // Exit if the controller is not allowed to use the MTP on which the message was received
|
||||
+ if (DEVICE_CONTROLLER_IsMTPAllowed(rec->from_id, mrt) == false)
|
||||
+ {
|
||||
+ USP_ERR_SetMessage("%s: Ignoring message from endpoint_id=%s (unauthorized MTP)", __FUNCTION__, rec->from_id);
|
||||
+ return USP_ERR_PERMISSION_DENIED;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
// Exit if the controller is unknown
|
||||
cur_msg_controller_instance = DEVICE_CONTROLLER_FindInstanceByEndpointId(rec->from_id);
|
||||
if (cur_msg_controller_instance == INVALID)
|
||||
@@ -10,7 +10,7 @@
|
||||
{
|
||||
--- a/src/core/data_model.h
|
||||
+++ b/src/core/data_model.h
|
||||
@@ -324,6 +324,7 @@ void DATA_MODEL_DumpSchema(void);
|
||||
@@ -325,6 +325,7 @@ void DATA_MODEL_DumpSchema(void);
|
||||
void DATA_MODEL_DumpInstances(void);
|
||||
char DATA_MODEL_GetJSONParameterType(char *path);
|
||||
int DATA_MODEL_SetParameterInDatabase(char *path, char *value);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/core/data_model.c
|
||||
+++ b/src/core/data_model.c
|
||||
@@ -1239,7 +1239,7 @@ int DATA_MODEL_NotifyInstanceAdded(char
|
||||
@@ -1242,7 +1242,7 @@ int DATA_MODEL_NotifyInstanceAdded(char
|
||||
// Exit if instance already exists - nothing to do
|
||||
if (exists)
|
||||
{
|
||||
@@ -9,7 +9,7 @@
|
||||
return USP_ERR_CREATION_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,7 @@ int DATA_MODEL_NotifyInstanceDeleted(cha
|
||||
@@ -1327,7 +1327,7 @@ int DATA_MODEL_NotifyInstanceDeleted(cha
|
||||
// Exit if instance does not exist - nothing to do
|
||||
if (exists == false)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
diff --git a/src/core/bdc_exec.c b/src/core/bdc_exec.c
|
||||
index 3670361..6a6325d 100644
|
||||
--- a/src/core/bdc_exec.c
|
||||
+++ b/src/core/bdc_exec.c
|
||||
@@ -547,11 +547,19 @@ int StartSendingReport(bdc_connection_t *bc)
|
||||
@@ -547,11 +547,19 @@ int StartSendingReport(bdc_connection_t
|
||||
|
||||
// Set the list of headers
|
||||
bc->headers = NULL;
|
||||
@@ -25,8 +23,6 @@ index 3670361..6a6325d 100644
|
||||
|
||||
if (bc->flags & BDC_FLAG_GZIP)
|
||||
{
|
||||
diff --git a/src/core/bdc_exec.h b/src/core/bdc_exec.h
|
||||
index ff37a2d..ee29c85 100644
|
||||
--- a/src/core/bdc_exec.h
|
||||
+++ b/src/core/bdc_exec.h
|
||||
@@ -53,6 +53,9 @@ void BDC_EXEC_ScheduleExit(void);
|
||||
@@ -40,8 +36,6 @@ index ff37a2d..ee29c85 100644
|
||||
+#define BDC_FLAG_HEADER_PER_COL 0x00000040 // If set, report format in header would be csv ParameterPerColumn
|
||||
|
||||
#endif
|
||||
diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c
|
||||
index a7d1b3e..fab9731 100755
|
||||
--- a/src/core/device_bulkdata.c
|
||||
+++ b/src/core/device_bulkdata.c
|
||||
@@ -67,9 +67,12 @@
|
||||
@@ -78,7 +72,7 @@ index a7d1b3e..fab9731 100755
|
||||
} profile_ctrl_params_t;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -208,6 +217,7 @@ int Validate_BulkDataEncodingType(dm_req_t *req, char *value);
|
||||
@@ -208,6 +217,7 @@ int Validate_BulkDataEncodingType(dm_req
|
||||
int Validate_BulkDataReportingInterval(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReference(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataReportFormat(dm_req_t *req, char *value);
|
||||
@@ -86,7 +80,7 @@ index a7d1b3e..fab9731 100755
|
||||
int Validate_BulkDataReportTimestamp(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataCompression(dm_req_t *req, char *value);
|
||||
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
|
||||
@@ -236,6 +246,8 @@ bulkdata_profile_t *bulkdata_find_profile(int profile_id);
|
||||
@@ -236,6 +246,8 @@ bulkdata_profile_t *bulkdata_find_profil
|
||||
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
|
||||
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
|
||||
char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
|
||||
@@ -95,7 +89,7 @@ index a7d1b3e..fab9731 100755
|
||||
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
|
||||
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
|
||||
int bulkdata_start_profile(bulkdata_profile_t *bp);
|
||||
@@ -250,6 +262,7 @@ char *bulkdata_platform_calc_uri_query_string(kv_vector_t *escaped_map);
|
||||
@@ -250,6 +262,7 @@ char *bulkdata_platform_calc_uri_query_s
|
||||
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
|
||||
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);
|
||||
@@ -135,7 +129,7 @@ index a7d1b3e..fab9731 100755
|
||||
// Device.BulkData.Profile.{i}.HTTP
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
|
||||
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
|
||||
@@ -591,9 +611,10 @@ int Validate_BulkDataProtocol(dm_req_t *req, char *value)
|
||||
@@ -591,9 +611,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
|
||||
@@ -148,12 +142,10 @@ index a7d1b3e..fab9731 100755
|
||||
return USP_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -674,6 +695,32 @@ int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
@@ -676,6 +697,32 @@ int Validate_BulkDataReportFormat(dm_req
|
||||
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
/*********************************************************************//**
|
||||
**
|
||||
+** Validate_BulkDataCSVReportFormat
|
||||
+**
|
||||
+** Validates Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat
|
||||
@@ -178,10 +170,12 @@ index a7d1b3e..fab9731 100755
|
||||
+ return USP_ERR_OK;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
** Validate_BulkDataReportTimestamp
|
||||
@@ -1970,6 +2017,14 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
|
||||
**
|
||||
** Validates Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
|
||||
@@ -1970,6 +2017,14 @@ int bulkdata_platform_get_profile_contro
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -196,7 +190,7 @@ index a7d1b3e..fab9731 100755
|
||||
// Exit if unable to get ReportTimestamp
|
||||
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
|
||||
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
|
||||
@@ -1986,6 +2041,46 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
|
||||
@@ -1986,6 +2041,46 @@ int bulkdata_platform_get_profile_contro
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -243,7 +237,7 @@ index a7d1b3e..fab9731 100755
|
||||
return USP_ERR_OK;
|
||||
}
|
||||
|
||||
@@ -2222,7 +2317,7 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
@@ -2222,7 +2317,7 @@ void bulkdata_process_profile_http(bulkd
|
||||
{
|
||||
int err;
|
||||
report_t *cur_report;
|
||||
@@ -252,7 +246,7 @@ index a7d1b3e..fab9731 100755
|
||||
profile_ctrl_params_t ctrl;
|
||||
unsigned char *compressed_report;
|
||||
int compressed_len;
|
||||
@@ -2261,10 +2356,23 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
@@ -2261,10 +2356,23 @@ void bulkdata_process_profile_http(bulkd
|
||||
}
|
||||
|
||||
// Exit if unable to generate the report
|
||||
@@ -280,7 +274,7 @@ index a7d1b3e..fab9731 100755
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2273,14 +2381,14 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
|
||||
@@ -2273,14 +2381,14 @@ void bulkdata_process_profile_http(bulkd
|
||||
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
|
||||
if (enable_protocol_trace)
|
||||
{
|
||||
@@ -299,7 +293,7 @@ index a7d1b3e..fab9731 100755
|
||||
}
|
||||
// NOTE: From this point on, only the compressed_report exists
|
||||
|
||||
@@ -2310,9 +2418,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
@@ -2310,9 +2418,15 @@ void bulkdata_process_profile_usp_event(
|
||||
kv_vector_t event_args;
|
||||
kv_pair_t kv;
|
||||
report_t *cur_report;
|
||||
@@ -316,7 +310,7 @@ index a7d1b3e..fab9731 100755
|
||||
|
||||
// Exit if the MTP has not been connected to successfully after bootup
|
||||
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
|
||||
@@ -2321,20 +2435,62 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
@@ -2321,20 +2435,62 @@ void bulkdata_process_profile_usp_event(
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -390,7 +384,7 @@ index a7d1b3e..fab9731 100755
|
||||
}
|
||||
|
||||
// When sending via USP events, only one report is ever sent in each USP event
|
||||
@@ -2354,10 +2510,16 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
@@ -2354,10 +2510,16 @@ void bulkdata_process_profile_usp_event(
|
||||
bp->num_retained_reports = 1;
|
||||
|
||||
// Exit if unable to generate the report
|
||||
@@ -410,7 +404,7 @@ index a7d1b3e..fab9731 100755
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2365,15 +2527,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
|
||||
@@ -2365,15 +2527,15 @@ void bulkdata_process_profile_usp_event(
|
||||
|
||||
// Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add()
|
||||
kv.key = "Data";
|
||||
@@ -429,12 +423,10 @@ index a7d1b3e..fab9731 100755
|
||||
|
||||
// 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
|
||||
@@ -2833,6 +2995,219 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||
return result;
|
||||
}
|
||||
@@ -2835,6 +2997,219 @@ char *bulkdata_generate_json_report(bulk
|
||||
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
/*********************************************************************//**
|
||||
**
|
||||
+** append_string_to_target
|
||||
+**
|
||||
+** concatenates the src string with target string in newly allocated memory
|
||||
@@ -646,10 +638,12 @@ index a7d1b3e..fab9731 100755
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
/*********************************************************************//**
|
||||
**
|
||||
+/*********************************************************************//**
|
||||
+**
|
||||
** bulkdata_compress_report
|
||||
@@ -2986,9 +3361,18 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
|
||||
**
|
||||
** Compresses the report to send
|
||||
@@ -2986,9 +3361,18 @@ int bulkdata_schedule_sending_http_repor
|
||||
flags |= BDC_FLAG_DATE_HEADER;
|
||||
}
|
||||
|
||||
|
||||
72
obuspc/Makefile
Normal file
72
obuspc/Makefile
Normal file
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# Copyright (C) 2023 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspc
|
||||
PKG_VERSION:=1.0.1.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa-test-controller.git
|
||||
PKG_SOURCE_VERSION:=f1f721bc1a4feaf63c7f7837eb7b0c86111e2f71
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/obuspc
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=USP Controller
|
||||
DEPENDS:=+libopenssl +libuci +libblobmsg-json +libcurl +libsqlite3 +libubox +libubus +libmosquitto-ssl +libwebsockets-openssl
|
||||
endef
|
||||
|
||||
define Package/obuspc/description
|
||||
OB-USP-Controller is a local usp controller based on User Services Platform (USP).
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE \
|
||||
-Wall \
|
||||
-Werror
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--localstatedir="/tmp/" \
|
||||
--enable-stomp \
|
||||
--enable-coap \
|
||||
--enable-mqtt \
|
||||
--enable-websockets
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/obuspa-test-controller/* $(PKG_BUILD_DIR)/
|
||||
$(Build/Patch)
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/obuspc/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/obuspc $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/obuspc $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-agent-endpoint $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DATA) ./files/etc/config/obuspc $(1)/etc/config/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,obuspc))
|
||||
19
obuspc/files/etc/config/obuspc
Normal file
19
obuspc/files/etc/config/obuspc
Normal file
@@ -0,0 +1,19 @@
|
||||
config obuspc 'global'
|
||||
option enabled '1'
|
||||
option debug '1'
|
||||
option log_level '1'
|
||||
option prototrace '1'
|
||||
|
||||
config mqtt 'mqtt'
|
||||
option BrokerAddress '127.0.0.1'
|
||||
option BrokerPort '1883'
|
||||
option TransportProtocol 'TCP/IP'
|
||||
|
||||
config controller 'controller'
|
||||
option EndpointID 'proto::interop-usp-controller'
|
||||
option Protocol 'MQTT'
|
||||
option ResponseTopicConfigured '/usp/controller'
|
||||
option mqtt 'mqtt'
|
||||
|
||||
config agent 'agent'
|
||||
option Topic '/usp/endpoint'
|
||||
349
obuspc/files/etc/init.d/obuspc
Executable file
349
obuspc/files/etc/init.d/obuspc
Executable file
@@ -0,0 +1,349 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
USE_PROCD=1
|
||||
|
||||
PROG=/usr/sbin/obuspc
|
||||
CONFIGURATION=obuspc
|
||||
|
||||
RESET_FILE="/tmp/usp/obuspc_param_reset.txt"
|
||||
SQL_DB_FILE="/tmp/usp/uspc.db"
|
||||
|
||||
BASEPATH=""
|
||||
INSTANCE_COUNT=0
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
global_init()
|
||||
{
|
||||
BASEPATH=""
|
||||
INSTANCE_COUNT=0
|
||||
}
|
||||
|
||||
log()
|
||||
{
|
||||
echo "$*"|logger -t obuspc.init -p debug
|
||||
}
|
||||
|
||||
db_set_reset_file()
|
||||
{
|
||||
local param value
|
||||
|
||||
param="${1}"
|
||||
shift
|
||||
value="$*"
|
||||
|
||||
if [ -n "${param}" ] && [ -n "${value}" ]; then
|
||||
echo "${param} \"${value}\"">>${RESET_FILE}
|
||||
else
|
||||
echo >>${RESET_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
db_set()
|
||||
{
|
||||
db_set_reset_file "$@"
|
||||
}
|
||||
|
||||
# if db present then check if it matches with existing instances
|
||||
# fallback to max instance present + 1
|
||||
# In case of no db get the count
|
||||
get_base_path()
|
||||
{
|
||||
local refpath value path count
|
||||
|
||||
refpath="${1}"
|
||||
value="${2}"
|
||||
path=""
|
||||
count=0
|
||||
|
||||
if [ -z "${path}" ]; then
|
||||
INSTANCE_COUNT=$(( INSTANCE_COUNT + 1 ))
|
||||
path="${refpath}${INSTANCE_COUNT}"
|
||||
fi
|
||||
BASEPATH="${path}"
|
||||
}
|
||||
|
||||
get_refrence_path()
|
||||
{
|
||||
local dmref value path
|
||||
|
||||
dmref="${1}"
|
||||
value="${2}"
|
||||
path=""
|
||||
|
||||
path=$(grep "${dmref}\d.Alias " ${RESET_FILE}|grep -w "${value}")
|
||||
path=${path%.*}
|
||||
echo "${path}"
|
||||
}
|
||||
|
||||
validate_global_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} obuspc "${1}" \
|
||||
'enabled:bool:1' \
|
||||
'debug:bool:0' \
|
||||
'prototrace:bool:0' \
|
||||
'log_level:uinteger' \
|
||||
'log_dest:string' \
|
||||
'db_file:string'
|
||||
}
|
||||
|
||||
validate_mqtt_client_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} mqtt "${1}" \
|
||||
'Enable:bool:1' \
|
||||
'BrokerAddress:string' \
|
||||
'BrokerPort:port:1883' \
|
||||
'Username:string' \
|
||||
'Password:string' \
|
||||
'ProtocolVersion:or("3.1", "3.1.1","5.0"):5.0' \
|
||||
'TransportProtocol:or("TCP/IP","TLS"):TCP/IP' \
|
||||
'ClientID:string'
|
||||
}
|
||||
|
||||
validate_controller_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} mtp "${1}" \
|
||||
'EndpointID:string' \
|
||||
'Protocol:or("MQTT", "WebSocket")' \
|
||||
'ResponseTopicConfigured:string' \
|
||||
'Destination:string' \
|
||||
'Port:port' \
|
||||
'Path:string' \
|
||||
'mqtt:string' \
|
||||
'stomp:string' \
|
||||
'Reference:string' \
|
||||
'EnableEncryption:bool:0'
|
||||
}
|
||||
|
||||
configure_controller() {
|
||||
local EndpointID Protocol ResponseTopicConfigured
|
||||
local Destination Path Port EnableEncryption Reference
|
||||
local stomp mqtt dm_ref sec
|
||||
|
||||
sec="${1}"
|
||||
validate_controller_section "${1}" || {
|
||||
log "Validation of mtp section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
if [ -z "${EndpointID}" ]; then
|
||||
log "EndpointID not defined for controller"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
db_set Device.LocalAgent.EndpointID "${EndpointID}"
|
||||
|
||||
sec="${sec/mtp_/cpe-}"
|
||||
get_base_path "Device.LocalAgent.MTP." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if [ -z "${Protocol}" ]; then
|
||||
log "Protocol not defined for the mtp[${1}] section"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
dm_ref=""
|
||||
if [ -z "${Reference}" ]; then
|
||||
if [ "${Protocol}" = "STOMP" ]; then
|
||||
stomp="${stomp/stomp_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||
elif [ "${Protocol}" = "MQTT" ]; then
|
||||
mqtt="${mqtt/mqtt_/cpe-}"
|
||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||
fi
|
||||
else
|
||||
dm_ref="${Reference}"
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.Alias" "${sec}"
|
||||
db_set "${BASEPATH}.Enable" "1"
|
||||
db_set "${BASEPATH}.Protocol" "${Protocol}"
|
||||
if [ "${Protocol}" = "MQTT" ]; then
|
||||
db_set "${BASEPATH}.MQTT.Reference" "${dm_ref}"
|
||||
db_set "${BASEPATH}.MQTT.ResponseTopicConfigured" "${ResponseTopicConfigured}"
|
||||
elif [ "${Protocol}" = "STOMP" ]; then
|
||||
db_set "${BASEPATH}.STOMP.Reference" "${dm_ref}"
|
||||
db_set "${BASEPATH}.STOMP.Destination" "${Destination}"
|
||||
elif [ "${Protocol}" = "CoAP" ]; then
|
||||
db_set "${BASEPATH}.CoAP.Path" "${Path}"
|
||||
db_set "${BASEPATH}.CoAP.Port" "${Port}"
|
||||
elif [ "${Protocol}" = "WebSocket" ]; then
|
||||
db_set "${BASEPATH}.WebSocket.Path" "${Path}"
|
||||
db_set "${BASEPATH}.WebSocket.Port" "${Port}"
|
||||
db_set "${BASEPATH}.WebSocket.EnableEncryption" "${EnableEncryption}"
|
||||
fi
|
||||
db_set
|
||||
}
|
||||
|
||||
validate_agent_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} agent "${1}" \
|
||||
'name:string' \
|
||||
'EndpointID:string' \
|
||||
'Topic:string'
|
||||
}
|
||||
|
||||
configure_agent() {
|
||||
local EndpointID Topic name
|
||||
local stomp mqtt dm_ref sec
|
||||
|
||||
sec="${1}"
|
||||
validate_agent_section "${1}" || {
|
||||
log "Validation of agent section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
if [ -z "${EndpointID}" ]; then
|
||||
log "EndpointID not defined for agent"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if [ -z "${Topic}" ]; then
|
||||
log "Topic not defined for agent"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
|
||||
sec="${sec/mtp_/cpe-}"
|
||||
get_base_path "Device.LocalAgent.Controller." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.Alias" "${sec}"
|
||||
db_set "${BASEPATH}.Enable" "1"
|
||||
db_set "${BASEPATH}.EndpointID" "${EndpointID}"
|
||||
db_set "${BASEPATH}.MTP.1.Enable" "1"
|
||||
db_set "${BASEPATH}.MTP.1.Protocol" "MQTT"
|
||||
db_set "${BASEPATH}.MTP.1.MQTT.Reference" "Device.MQTT.Client.1"
|
||||
db_set "${BASEPATH}.MTP.1.MQTT.Topic" "${Topic}"
|
||||
db_set
|
||||
}
|
||||
|
||||
configure_mqtt_client() {
|
||||
local BrokerAddress BrokerPort Enable Username Password ProtocolVersion
|
||||
local TransportProtocol ClientID
|
||||
local sec
|
||||
|
||||
sec="${1}"
|
||||
validate_mqtt_client_section "${1}" || {
|
||||
log "Validation of mqtt section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
sec="${sec/mqtt_/cpe-}"
|
||||
get_base_path "Device.MQTT.Client." "${sec}"
|
||||
if [ -z "${BASEPATH}" ]; then
|
||||
log "Failed to get path [$BASEPATH]"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
db_set "${BASEPATH}.Alias" "${sec}"
|
||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||
db_set "${BASEPATH}.BrokerAddress" "${BrokerAddress}"
|
||||
db_set "${BASEPATH}.BrokerPort" "${BrokerPort}"
|
||||
db_set "${BASEPATH}.Username" "${Username}"
|
||||
db_set "${BASEPATH}.Password" "${Password}"
|
||||
db_set "${BASEPATH}.ProtocolVersion" "${ProtocolVersion}"
|
||||
db_set "${BASEPATH}.TransportProtocol" "${TransportProtocol}"
|
||||
db_set "${BASEPATH}.ClientID" "${ClientID}"
|
||||
|
||||
db_set
|
||||
}
|
||||
|
||||
configure_obuspc() {
|
||||
local enabled trust_cert ifname interface debug prototrace log_level db_file log_dest
|
||||
local client_cert
|
||||
|
||||
validate_global_section "global"
|
||||
|
||||
if [ "${debug}" -ne "0" ]; then
|
||||
# Forward stdout of the command to logd
|
||||
procd_set_param stdout 1
|
||||
# Same for stderr
|
||||
procd_set_param stderr 1
|
||||
fi
|
||||
|
||||
procd_append_param command -u
|
||||
if [ "${prototrace}" -eq 1 ]; then
|
||||
procd_append_param command -p
|
||||
fi
|
||||
|
||||
if [ -n "${log_level}" ]; then
|
||||
procd_append_param command -v "${log_level}"
|
||||
fi
|
||||
|
||||
if [ -n "${log_dest}" ]; then
|
||||
procd_append_param command -l "${log_dest}"
|
||||
fi
|
||||
|
||||
if [ -f "${RESET_FILE}" ]; then
|
||||
procd_append_param command -r ${RESET_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
# Create factory reset file
|
||||
db_init()
|
||||
{
|
||||
# Load configuration
|
||||
config_load $CONFIGURATION
|
||||
config_get SQL_DB_FILE global db_file "/tmp/usp/uspc.db"
|
||||
|
||||
# Remove DB and generate from uci
|
||||
[ -f "${SQL_DB_FILE}" ] && rm -f "${SQL_DB_FILE}"
|
||||
|
||||
# Remove reset file if present
|
||||
[ -f "${RESET_FILE}" ] && rm -f ${RESET_FILE}
|
||||
|
||||
config_load $CONFIGURATION
|
||||
global_init
|
||||
config_foreach configure_mqtt_client mqtt
|
||||
global_init
|
||||
config_foreach configure_controller controller
|
||||
global_init
|
||||
config_foreach configure_agent agent
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
register_service()
|
||||
{
|
||||
procd_open_instance ${CONFIGURATION}
|
||||
procd_set_param command ${PROG}
|
||||
|
||||
configure_obuspc
|
||||
procd_set_param respawn \
|
||||
"${respawn_threshold:-5}" \
|
||||
"${respawn_timeout:-10}" "${respawn_retry:-3}"
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled
|
||||
|
||||
config_load ${CONFIGURATION}
|
||||
config_get_bool enabled global enabled 0
|
||||
|
||||
if [ "${enabled}" -eq 0 ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/usp/
|
||||
db_init
|
||||
register_service
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
${PROG} -c stop >/dev/null 2>&1
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "obuspc"
|
||||
}
|
||||
31
obuspc/files/etc/uci-defaults/99-fix-agent-endpoint
Normal file
31
obuspc/files/etc/uci-defaults/99-fix-agent-endpoint
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
get_oui_from_db()
|
||||
{
|
||||
db -q get device.deviceinfo.ManufacturerOUI
|
||||
}
|
||||
|
||||
get_serial_from_db()
|
||||
{
|
||||
db -q get device.deviceinfo.SerialNumber
|
||||
}
|
||||
|
||||
fix_agent_endpoint()
|
||||
{
|
||||
local AgentEndpointID serial oui user pass
|
||||
|
||||
# Get endpoint id from obuspa config first
|
||||
config_load obuspa
|
||||
config_get AgentEndpointID localagent EndpointID ""
|
||||
if [ -z "${AgentEndpointID}" ]; then
|
||||
serial=$(get_serial_from_db)
|
||||
oui=$(get_oui_from_db)
|
||||
AgentEndpointID="os::${oui}-${serial//+/%2B}"
|
||||
fi
|
||||
|
||||
uci -q set obuspc.agent.EndpointID="${AgentEndpointID}"
|
||||
}
|
||||
|
||||
fix_agent_endpoint
|
||||
@@ -17,14 +17,15 @@ init_xpon() {
|
||||
|
||||
procd_open_instance ponmgr_cfg
|
||||
procd_set_param command /userfs/bin/ponmgr_cfg
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
procd_open_instance omci
|
||||
procd_set_param command /userfs/bin/omci
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
deinit_xpon() {
|
||||
killall -9 omci 2>/dev/null
|
||||
killall -9 ponmgr_cfg 2>/dev/null
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@ get_burst_size_per_queue() {
|
||||
echo "0"
|
||||
}
|
||||
|
||||
# marking value be decimal for linux target as it uses set-mark whereas other
|
||||
# targets uses set-xmark, hence this function can't make it common
|
||||
ip_rule_get_converted_tos() {
|
||||
con_tos=$(printf %x $1)
|
||||
echo $con_tos
|
||||
}
|
||||
|
||||
configure_qos() {
|
||||
# queue configuration is being done after shaper configuration,
|
||||
# If port shapingrate configuration on DISC device is called after queue configuration then
|
||||
|
||||
@@ -180,6 +180,13 @@ iptables_set_traffic_class() {
|
||||
IP_RULE="$IP_RULE -j MARK --set-xmark 0x$1/0x$1"
|
||||
}
|
||||
|
||||
# marking value be decimal for linux target as it uses set-mark whereas other
|
||||
# targets uses set-xmark, hence this function can't make it common
|
||||
ip_rule_get_converted_tos() {
|
||||
con_tos=$(printf %x $1)
|
||||
echo $con_tos
|
||||
}
|
||||
|
||||
ebt_match_ipv6_dscp() {
|
||||
#when ethertype is not configured by user then both proto rules of ipv4
|
||||
#and ipv6 to be installed so update BR6_RULE string as well otherwise
|
||||
|
||||
@@ -1,52 +1,65 @@
|
||||
#!/bin/sh
|
||||
# add ip rule from qos uci
|
||||
|
||||
IP_RULE=""
|
||||
FWD_POLICY=""
|
||||
|
||||
init_ip_rule() {
|
||||
IP_RULE=""
|
||||
FWD_POLICY=""
|
||||
}
|
||||
|
||||
ip_rule_match_inif() {
|
||||
IP_RULE="$IP_RULE iif $1"
|
||||
FWD_POLICY="$FWD_POLICY iif $1"
|
||||
}
|
||||
|
||||
ip_rule_match_proto() {
|
||||
IP_RULE="$IP_RULE ipproto $1"
|
||||
FWD_POLICY="$FWD_POLICY ipproto $1"
|
||||
}
|
||||
|
||||
ip_rule_match_dest_port() {
|
||||
IP_RULE="$IP_RULE dport $1"
|
||||
FWD_POLICY="$FWD_POLICY dport $1"
|
||||
}
|
||||
|
||||
ip_rule_match_src_port() {
|
||||
IP_RULE="$IP_RULE sport $1"
|
||||
FWD_POLICY="$FWD_POLICY sport $1"
|
||||
}
|
||||
|
||||
ip_rule_match_dest_ip() {
|
||||
IP_RULE="$IP_RULE to $1"
|
||||
FWD_POLICY="$FWD_POLICY to $1"
|
||||
}
|
||||
|
||||
ip_rule_match_src_ip() {
|
||||
IP_RULE="$IP_RULE from $1"
|
||||
FWD_POLICY="$FWD_POLICY from $1"
|
||||
}
|
||||
|
||||
ip_rule_match_dest_port_range() {
|
||||
IP_RULE="$IP_RULE dport $1-$2"
|
||||
FWD_POLICY="$FWD_POLICY dport $1-$2"
|
||||
}
|
||||
|
||||
ip_rule_match_src_port_range() {
|
||||
IP_RULE="$IP_RULE sport $1-$2"
|
||||
}
|
||||
|
||||
ip_rule_match_tos() {
|
||||
dscp_filter=$1
|
||||
tos_val=$((dscp_filter<<2))
|
||||
IP_RULE="$IP_RULE tos 0x$tos_val"
|
||||
FWD_POLICY="$FWD_POLICY sport $1-$2"
|
||||
}
|
||||
|
||||
ip_rule_match_fwmark() {
|
||||
IP_RULE="$IP_RULE fwmark $1"
|
||||
FWD_POLICY="$FWD_POLICY fwmark $1"
|
||||
}
|
||||
|
||||
ip_rule_handle_match_tos() {
|
||||
local dscp="$2"
|
||||
local IPTOS_LOWDELAY="0x10"
|
||||
local tos_val="$((dscp<<2))"
|
||||
|
||||
# ip rule not accept beyond 0x10, to handle further value mark the tos
|
||||
# value through iptable and route with that marked value by fwmark
|
||||
# in ip rule
|
||||
if [ "$((tos_val))" -gt "$((IPTOS_LOWDELAY))" ]; then
|
||||
handle_iptables_rules $1 $(ip_rule_get_converted_tos $tos_val)
|
||||
ip_rule_match_fwmark $(printf 0x%x $tos_val)
|
||||
else
|
||||
FWD_POLICY="$FWD_POLICY tos $(printf %x $tos_val)"
|
||||
if [ -n "$3" ]; then
|
||||
ip_rule_match_fwmark $3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
handle_ip_rule() {
|
||||
@@ -60,7 +73,7 @@ handle_ip_rule() {
|
||||
config_get src_ip "$cid" "src_ip"
|
||||
config_get ifname "$cid" "ifname"
|
||||
config_get proto "$cid" "proto"
|
||||
config_get tos "$cid" "dscp_filter"
|
||||
config_get dscp "$cid" "dscp_filter"
|
||||
config_get fwmark "$cid" "traffic_class"
|
||||
config_get dest_port "$cid" "dest_port"
|
||||
config_get dest_port_range "$cid" "dest_port_range"
|
||||
@@ -92,14 +105,20 @@ handle_ip_rule() {
|
||||
ip_rule_match_src_port_range $src_port $src_port_range
|
||||
fi
|
||||
|
||||
[ -n "$tos" ] && ip_rule_match_tos $tos
|
||||
|
||||
[ -n "$fwmark" ] && ip_rule_match_fwmark $fwmark
|
||||
if [ -n "$dscp" ]; then
|
||||
# If tos and fwmark configured then fwmark be igroned/skipped
|
||||
# in the case of tos value greater than 0x10 and if tos value
|
||||
# less than 0x10 then both tos and fwmark then both configuration
|
||||
#considered/applied for ip rule.
|
||||
ip_rule_handle_match_tos $cid $dscp $fwmark
|
||||
elif [ -n "$fwmark" ]; then
|
||||
ip_rule_match_fwmark $fwmark
|
||||
fi
|
||||
|
||||
# forming full ip rule
|
||||
if [ -n "$IP_RULE" ]; then
|
||||
echo "ip rule add $IP_RULE table $fwding_policy" >> /tmp/qos/classify.iprule
|
||||
echo "ip rule del $IP_RULE table $fwding_policy" >> /tmp/qos/classify.del_iprule
|
||||
if [ -n "$FWD_POLICY" ]; then
|
||||
echo "ip rule add $FWD_POLICY table $fwding_policy" >> /tmp/qos/classify.iprule
|
||||
echo "ip rule del $FWD_POLICY table $fwding_policy" >> /tmp/qos/classify.del_iprule
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -70,10 +70,18 @@ handle_iptables_rules() {
|
||||
local cid="$1"
|
||||
local ip_version=0
|
||||
local is_l3_rule=0
|
||||
traffic_class=$2
|
||||
|
||||
init_iptables_rule
|
||||
|
||||
# If traffic class non empty/zero then function call for handling fowrwarding
|
||||
# policy in the case of tos greater than 0x10.
|
||||
# In this case, traffic class should not be read from config and use value in arg
|
||||
if [ -z "$traffic_class" ]; then
|
||||
config_get traffic_class "$cid" "traffic_class"
|
||||
fi
|
||||
|
||||
config_get proto "$cid" "proto"
|
||||
config_get traffic_class "$cid" "traffic_class"
|
||||
config_get dscp_mark "$cid" "dscp_mark"
|
||||
config_get dscp_filter "$cid" "dscp_filter"
|
||||
config_get dest_port "$cid" "dest_port"
|
||||
|
||||
@@ -155,6 +155,12 @@ iptables_set_traffic_class() {
|
||||
IP_RULE="$IP_RULE -j MARK --set-mark $1"
|
||||
}
|
||||
|
||||
# marking value be decimal for linux target as it uses set-mark whereas other
|
||||
# targets uses set-xmark, hence this function can't make it common
|
||||
ip_rule_get_converted_tos() {
|
||||
echo $1
|
||||
}
|
||||
|
||||
ebt_match_ipv6_dscp() {
|
||||
#when ethertype is not configured by user then both proto rules of ipv4
|
||||
#and ipv6 to be installed so update BR6_RULE string as well otherwise
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-base
|
||||
PKG_VERSION:=2.1.4
|
||||
PKG_VERSION:=2.2.5
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=a910afbc0b0e812155a445fb6be5c0e41d2b2c3b
|
||||
PKG_SOURCE_VERSION:=2964b4263ee25fe16a0a74e833e269889dc8375f
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
SULU_MOD:=core
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=2.1.4
|
||||
PKG_VERSION:=2.2.5
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=472f75509965b297bdeaf07c21d02c813dd25763
|
||||
PKG_SOURCE_VERSION:=046bb209b4650564cc07d288112f3eb367aabca2
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(PKG_VERSION)/sulu-builder-$(PKG_SOURCE_VERSION)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
config global 'global'
|
||||
option role_based_access '1'
|
||||
option SessionMode 'Require'
|
||||
list user 'admin'
|
||||
list user 'user'
|
||||
|
||||
@@ -8,7 +8,7 @@ location /sitemap.xml {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /ws {
|
||||
location /wss {
|
||||
proxy_pass_request_headers on;
|
||||
proxy_cache off;
|
||||
proxy_http_version 1.1;
|
||||
@@ -29,13 +29,11 @@ location /ws {
|
||||
|
||||
location / {
|
||||
autoindex on;
|
||||
expires -1;
|
||||
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range';
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
@@ -45,6 +43,7 @@ location / {
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
}
|
||||
expires -1;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
}
|
||||
|
||||
@@ -53,6 +53,11 @@ function _get_sulu_root()
|
||||
echo "${root:-/sulu}"
|
||||
}
|
||||
|
||||
function _get_sulu_session_mode()
|
||||
{
|
||||
echo "$(uci -q get sulu.global.SessionMode)"
|
||||
}
|
||||
|
||||
function _get_usp_upstream_port()
|
||||
{
|
||||
local port
|
||||
@@ -94,10 +99,11 @@ function update_nginx_template()
|
||||
|
||||
function generate_sulu_conn_config()
|
||||
{
|
||||
local rbac users SCONFIG
|
||||
local rbac users SCONFIG session
|
||||
|
||||
rbac="${1}"
|
||||
users="$(_get_sulu_users)"
|
||||
session="$(_get_sulu_session_mode)"
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
|
||||
json_init;
|
||||
@@ -110,7 +116,12 @@ function generate_sulu_conn_config()
|
||||
json_add_object 'rbac';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'path' "/wss";
|
||||
|
||||
if [ "${session}" = "Require" ]; then
|
||||
json_add_boolean 'useSession' 1;
|
||||
fi
|
||||
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_array 'auth';
|
||||
json_close_array;
|
||||
@@ -131,7 +142,7 @@ function generate_sulu_conn_config()
|
||||
json_add_string 'fromId' 'proto::interop-usp-controller';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'path' "/wss";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_string 'publishEndpoint' "/usp/endpoint";
|
||||
json_add_string 'subscribeEndpoint' "/usp/controller";
|
||||
@@ -209,7 +220,7 @@ function _update_obuspa_config()
|
||||
|
||||
function _remove_obuspa_config()
|
||||
{
|
||||
local restart
|
||||
local restart session
|
||||
|
||||
restart=0
|
||||
if [ "$(uci_get obuspa localmqtt)" == "mqtt" ]; then
|
||||
@@ -228,10 +239,11 @@ function _remove_obuspa_config()
|
||||
}
|
||||
|
||||
function _update_obuspa_config_rbac() {
|
||||
local agent users restart
|
||||
local agent users restart session
|
||||
|
||||
agent="$(_get_agent_id)"
|
||||
users="$(_get_sulu_users)"
|
||||
session="$(_get_sulu_session_mode)"
|
||||
restart=0
|
||||
|
||||
for f in ${users}; do
|
||||
@@ -268,6 +280,12 @@ function _update_obuspa_config_rbac() {
|
||||
uci_set obuspa ${sec} assigned_role_name "$f"
|
||||
restart=1
|
||||
fi
|
||||
|
||||
obMode="$(uci_get obuspa ${sec} SessionMode)"
|
||||
if [ "${session}" != "${obMode}" ]; then
|
||||
uci_set obuspa ${sec} SessionMode "${session}"
|
||||
restart=1
|
||||
fi
|
||||
done
|
||||
if [ -f "/etc/sulu/roles.json" ]; then
|
||||
uci_set obuspa global role_file "/etc/sulu/roles.json"
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-lcm
|
||||
PKG_VERSION:=2.1.0
|
||||
PKG_VERSION:=2.2.4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-lcm.git
|
||||
PKG_SOURCE_VERSION:=29515d3a3031d528cb603a8931156bf617fee885
|
||||
PKG_SOURCE_VERSION:=46975426ffa53ffcc3b0d9e9160f6b3d4b6d82fd
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
SULU_PLUGIN_INSTALL:=1
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-multi-ap
|
||||
PKG_VERSION:=2.1.4
|
||||
PKG_VERSION:=2.2.4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-multi-ap.git
|
||||
PKG_SOURCE_VERSION:=95ebfae55435b328f40fc753877fd62bf2e254f8
|
||||
PKG_SOURCE_VERSION:=d77f19d8d964c9ecf8ab6d2cc3c8ddc369135d7e
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=sulu-parental-control
|
||||
PKG_VERSION:=2.1.1
|
||||
PKG_VERSION:=2.2.3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-parental-control.git
|
||||
PKG_SOURCE_VERSION:=26192753a5580746210c32583f6c09ea995e425f
|
||||
PKG_SOURCE_VERSION:=27f3859e30efbbed211c033f923f35974b3619fd
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
include ../sulu-builder/sulu.mk
|
||||
|
||||
126
swmodd/Config.in
126
swmodd/Config.in
@@ -1,53 +1,83 @@
|
||||
menu "Configuration"
|
||||
config SWMODD_REGISTRY_PULL_SUPPORT
|
||||
bool "Add support to pull images from container image registries (i.e: docker.io, quay.io)"
|
||||
depends on PACKAGE_swmodd
|
||||
default n
|
||||
select PACKAGE_skopeo
|
||||
select PACKAGE_umoci
|
||||
|
||||
config SWMODD_LXC_SUPPORT
|
||||
bool "Handles LXC based containers"
|
||||
default y
|
||||
config SWMODD_LXC_SUPPORT
|
||||
bool "Handles LXC based containers"
|
||||
depends on PACKAGE_swmodd
|
||||
default y
|
||||
select PACKAGE_lxc
|
||||
select PACKAGE_lxc-attach
|
||||
select PACKAGE_lxc-auto
|
||||
select PACKAGE_lxc-cgroup
|
||||
select PACKAGE_lxc-checkconfig
|
||||
select PACKAGE_lxc-common
|
||||
select PACKAGE_lxc-config
|
||||
select PACKAGE_lxc-configs
|
||||
select PACKAGE_lxc-console
|
||||
select PACKAGE_lxc-create
|
||||
select PACKAGE_lxc-destroy
|
||||
select PACKAGE_lxc-execute
|
||||
select PACKAGE_lxc-freeze
|
||||
select PACKAGE_lxc-hooks
|
||||
select PACKAGE_lxc-info
|
||||
select PACKAGE_lxc-init
|
||||
select PACKAGE_lxc-ls
|
||||
select PACKAGE_lxc-device
|
||||
select PACKAGE_lxc-start
|
||||
select PACKAGE_lxc-stop
|
||||
select PACKAGE_lxc-templates
|
||||
select PACKAGE_lxc-top
|
||||
select PACKAGE_lxc-unfreeze
|
||||
select PACKAGE_lxc-unprivileged
|
||||
select PACKAGE_lxc-unshare
|
||||
select PACKAGE_lxc-user-nic
|
||||
select PACKAGE_lxc-usernsexec
|
||||
select PACKAGE_lxc-wait
|
||||
|
||||
config SWMODD_OCI_SUPPORT
|
||||
bool "Handles OCI containers"
|
||||
default y
|
||||
depends on PACKAGE_swmodd
|
||||
select PACKAGE_crun
|
||||
config SWMODD_OCI_SUPPORT
|
||||
bool "Handles OCI containers"
|
||||
depends on PACKAGE_swmodd
|
||||
default y
|
||||
select PACKAGE_crun
|
||||
|
||||
config SWMODD_REGISTRY_PULL_SUPPORT
|
||||
bool "Add support to pull images from container image registries (i.e: docker.io, quay.io)"
|
||||
default n
|
||||
depends on PACKAGE_swmodd
|
||||
select PACKAGE_skopeo
|
||||
select PACKAGE_umoci
|
||||
config SWMODD_KERNEL_OPTIONS
|
||||
bool "Enable kernel support for LXC and OCI containers"
|
||||
depends on PACKAGE_swmodd
|
||||
default y
|
||||
select LXC_KERNEL_OPTIONS
|
||||
select LXC_BUSYBOX_OPTIONS
|
||||
select LXC_SECCOMP
|
||||
select LXC_NETWORKING
|
||||
select KERNEL_CGROUPS
|
||||
select KERNEL_CGROUP_SCHED
|
||||
select KERNEL_CGROUP_DEVICE
|
||||
select KERNEL_CGROUP_FREEZER
|
||||
select KERNEL_CGROUP_CPUACCT
|
||||
select KERNEL_CGROUP_NET_PRIO
|
||||
select KERNEL_NET_CLS_CGROUP
|
||||
select KERNEL_NAMESPACES
|
||||
select KERNEL_DEVPTS_MULTIPLE_INSTANCES
|
||||
select KERNEL_POSIX_MQUEUE
|
||||
select KERNEL_FAIR_GROUP_SCHED
|
||||
select KERNEL_RT_GROUP_SCHED
|
||||
select KERNEL_MEMCG
|
||||
select KERNEL_MEMCG_KMEM
|
||||
select KERNEL_CPUSETS
|
||||
select PACKAGE_kmod-ikconfig
|
||||
help
|
||||
Select needed kernel options for LXC and CRUN related utilities. Options
|
||||
include cgroups, namespaces and other miscellaneous options. These
|
||||
options unfortunately can not be installed as a module.
|
||||
|
||||
config SWMODD_KERNEL_OPTIONS
|
||||
bool "Enable kernel support for LXC and OCI containers"
|
||||
default y
|
||||
select KERNEL_CGROUPS
|
||||
select KERNEL_CGROUP_SCHED
|
||||
select KERNEL_CGROUP_DEVICE
|
||||
select KERNEL_CGROUP_FREEZER
|
||||
select KERNEL_CGROUP_CPUACCT
|
||||
select KERNEL_CGROUP_NET_PRIO
|
||||
select KERNEL_NET_CLS_CGROUP
|
||||
select KERNEL_NAMESPACES
|
||||
select KERNEL_DEVPTS_MULTIPLE_INSTANCES
|
||||
select KERNEL_POSIX_MQUEUE
|
||||
select KERNEL_FAIR_GROUP_SCHED
|
||||
select KERNEL_RT_GROUP_SCHED
|
||||
select KERNEL_MEMCG
|
||||
select KERNEL_MEMCG_KMEM
|
||||
select KERNEL_CPUSETS
|
||||
select PACKAGE_kmod-ikconfig
|
||||
help
|
||||
Select needed kernel options for LXC and CRUN related utilities. Options
|
||||
include cgroups, namespaces and other miscellaneous options. These
|
||||
options unfortunately can not be installed as a module.
|
||||
|
||||
config SWMODD_NETWORKING
|
||||
bool "Enable networking support for LXC/OCI containers"
|
||||
default y
|
||||
select PACKAGE_kmod-veth
|
||||
select PACKAGE_kmod-macvlan
|
||||
help
|
||||
Enable "veth pair device" and "macvlan"
|
||||
|
||||
endmenu
|
||||
config SWMODD_NETWORKING
|
||||
bool "Enable networking support for LXC/OCI containers"
|
||||
depends on PACKAGE_swmodd
|
||||
default y
|
||||
select PACKAGE_kmod-veth
|
||||
select PACKAGE_kmod-macvlan
|
||||
help
|
||||
Enable "veth pair device" and "macvlan"
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.2.4
|
||||
PKG_VERSION:=2.3.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/lcm/swmodd.git
|
||||
PKG_SOURCE_VERSION:=25cbdf268e803eeed4f840419825512724df055d
|
||||
PKG_SOURCE_VERSION:=d29418d26e630894079de73fae66bf04b5db0ab3
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -28,8 +28,9 @@ define Package/swmodd
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:= Software Modules Daemon
|
||||
MENU:=1
|
||||
DEPENDS:=+libuci +libubox +ubus +libuuid +opkg +libcurl \
|
||||
+PACKAGE_liblxc:liblxc +@BUSYBOX_CONFIG_BUSYBOX \
|
||||
+PACKAGE_lxc:lxc +PACKAGE_liblxc:liblxc +@BUSYBOX_CONFIG_BUSYBOX \
|
||||
+@BUSYBOX_CONFIG_FEATURE_SHOW_SCRIPT +@BUSYBOX_CONFIG_SCRIPT \
|
||||
+swmodd-cgroup +jq +libbbfdm-api
|
||||
endef
|
||||
@@ -54,12 +55,12 @@ TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE \
|
||||
-Wall -Werror
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_crun),y)
|
||||
ifeq ($(CONFIG_SWMODD_OCI_SUPPORT),y)
|
||||
MAKE_FLAGS += \
|
||||
SWMOD_CRUN="yes"
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_liblxc),y)
|
||||
ifeq ($(CONFIG_SWMODD_LXC_SUPPORT),y)
|
||||
MAKE_FLAGS += \
|
||||
SWMOD_LXC="yes"
|
||||
endif
|
||||
@@ -76,23 +77,24 @@ define Package/swmodd/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/share/swmodd/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/init.d/swmodd $(1)/etc/init.d/swmodd
|
||||
$(INSTALL_BIN) ./files/etc/config/swmodd $(1)/etc/config/swmodd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/swmodd $(1)/usr/sbin/swmodd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libswmodd.so $(1)/usr/lib/bbfdm/libswmodd.so
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/opkg_offline.sh $(1)/usr/share/swmodd/opkg_offline
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-bundle-path $(1)/etc/uci-defaults/01-fix-bundle-path
|
||||
ifeq ($(CONFIG_PACKAGE_liblxc),y)
|
||||
$(INSTALL_DIR) $(1)/usr/share/lxc/templates/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/templates/lxc-iopsys $(1)/usr/share/lxc/templates/lxc-iopsys
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/02-migrate-lxc $(1)/etc/uci-defaults/02-migrate-lxc
|
||||
endif
|
||||
ifeq ($(CONFIG_PACKAGE_crun),y)
|
||||
$(INSTALL_DIR) $(1)/etc/swmodd
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/swmodd/run.sh $(1)/etc/swmodd/run.sh
|
||||
$(INSTALL_BIN) ./files/etc/init.d/crun $(1)/etc/init.d/crun
|
||||
$(INSTALL_BIN) ./files/etc/config/crun $(1)/etc/config/crun
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/crun_create $(1)/usr/sbin/crun_create
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-bundle-path $(1)/etc/uci-defaults/01-fix-bundle-path
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
@@ -14,6 +14,34 @@ is_container_running() {
|
||||
return $?
|
||||
}
|
||||
|
||||
|
||||
configure_lxc_container() {
|
||||
local requested_state name ctype du_status BUNDLE
|
||||
|
||||
ctype="${1}"
|
||||
name="${2}"
|
||||
requested_state="${3}"
|
||||
du_state="${4}"
|
||||
BUNDLE="${5}"
|
||||
|
||||
if [ "${ctype}" != "lxc" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${du_status}" = "Uninstalling" ]; then
|
||||
lxc-stop -q -k "${name}"
|
||||
if [ -d "${BUNDLE:?}/${name:?}" ]; then
|
||||
rm -rf "${BUNDLE:?}/${name:?}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${requested_state}" = "Idle" ]; then
|
||||
lxc-stop -q -k "${name}"
|
||||
elif [ "${requested_state}" = "Active" ]; then
|
||||
lxc-start -q "${name}" >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
configure_crun_container() {
|
||||
local name type autostart du_status requested_state url username password
|
||||
local BRIDGE BUNDLE BOOT
|
||||
@@ -38,6 +66,7 @@ configure_crun_container() {
|
||||
fi
|
||||
|
||||
if [ "${type}" != "crun" ]; then
|
||||
configure_lxc_container "${type}" "${name}" "${requested_state}" "${du_status}" "${BUNDLE}"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
|
||||
@@ -6,6 +6,11 @@ STOP=01
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/swmodd
|
||||
|
||||
log()
|
||||
{
|
||||
logger -t swmodd.init "$*"
|
||||
}
|
||||
|
||||
validate_globals_section()
|
||||
{
|
||||
uci_validate_section swmodd swmodd "globals" \
|
||||
@@ -18,15 +23,23 @@ validate_globals_section()
|
||||
}
|
||||
|
||||
start_lxc_container() {
|
||||
local root
|
||||
|
||||
config_get name "${1}" name ""
|
||||
config_get type "${1}" type ""
|
||||
config_get autostart "${1}" autostart "0"
|
||||
config_get timeout "${1}" timeout "300"
|
||||
root="${2}"
|
||||
|
||||
if [ -z "${name}" ] || [ -z "${type}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
# workaround to install lxc container with installdu and autostart them
|
||||
if [ -f "${root}/$name/config" ]; then
|
||||
type=lxc
|
||||
fi
|
||||
|
||||
if [ "${type}" != "lxc" ]; then
|
||||
return 0;
|
||||
fi
|
||||
@@ -39,12 +52,12 @@ start_lxc_container() {
|
||||
if [ "${autostart}" == "0" ]; then
|
||||
if [ "${state}" == "RUNNING" ]; then
|
||||
# stop the container if running
|
||||
lxc-stop -n "${name}" -t "${timeout}" &
|
||||
lxc-stop -k -n "${name}" &
|
||||
return 0;
|
||||
elif [ "${state}" == "FROZEN" ]; then
|
||||
# first unfreeze then stop
|
||||
lxc-unfreeze -n "${name}"
|
||||
lxc-stop -n "${name}" -t "${timeout}" &
|
||||
lxc-stop -k -n "${name}" &
|
||||
return 0;
|
||||
fi
|
||||
else
|
||||
@@ -59,6 +72,12 @@ start_lxc_container() {
|
||||
fi
|
||||
}
|
||||
|
||||
stop_lxc_containers() {
|
||||
for f in `lxc-ls`; do
|
||||
lxc-stop -k -n $f >/dev/null 2>&1;
|
||||
done
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled debug log_level sock lxc_bundle_root oci_bundle_root
|
||||
|
||||
@@ -70,9 +89,15 @@ start_service() {
|
||||
|
||||
[ "${enabled}" -eq 0 ] && return 0
|
||||
|
||||
# Create the bundle paths if not present
|
||||
[ -n "${lxc_bundle_root}" ] && mkdir -p "${lxc_bundle_root}"
|
||||
[ -n "${oci_bundle_root}" ] && mkdir -p "${oci_bundle_root}"
|
||||
if [ ! -d "${lxc_bundle_root}" ]; then
|
||||
log "# Not staring lxc [${lxc_bundle_root}] not present/defined"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -d "${oci_bundle_root}" ]; then
|
||||
log "# Not staring oci [${oci_bundle_root}] not present/defined"
|
||||
return 1
|
||||
fi
|
||||
|
||||
procd_open_instance swmodd
|
||||
procd_set_param command ${PROG}
|
||||
@@ -94,8 +119,17 @@ start_service() {
|
||||
if [ -f "${lxc_bundle_root}/lxccontainer" ]; then
|
||||
UCI_CONFIG_DIR="${lxc_bundle_root}"
|
||||
config_load lxccontainer
|
||||
config_foreach start_lxc_container container
|
||||
config_foreach start_lxc_container container ${lxc_bundle_root}
|
||||
fi
|
||||
if [ -f "${oci_bundle_root}/ocicontainer" ]; then
|
||||
UCI_CONFIG_DIR="${oci_bundle_root}"
|
||||
config_load ocicontainer
|
||||
config_foreach start_lxc_container du_eu_assoc ${oci_bundle_root}
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
stop_lxc_containers
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
|
||||
@@ -21,23 +21,18 @@ if [ -n "${lxc_bundle}" ]; then
|
||||
elif [ -n "${lxc}" ]; then
|
||||
# if lxc_bundle_root not define in swmodd, update it with lxc path
|
||||
uci_set swmodd globals lxc_bundle_root ${lxc}
|
||||
uci_commit
|
||||
else
|
||||
mkdir -p /etc/lxc
|
||||
echo "lxc.lxcpath = /srv/" > /etc/lxc/lxc.conf
|
||||
uci_set swmodd globals lxc_bundle_root "/srv/"
|
||||
uci_commit
|
||||
fi
|
||||
|
||||
if [ -z "${oci_bundle}" ] && [ -n "${lxc_bundle}" ]; then
|
||||
# if oci_bundle_root not defined in swmodd, update it with lxc_bundle_root if defined
|
||||
uci_set swmodd globals oci_bundle_root ${lxc_bundle}
|
||||
uci_commit
|
||||
elif [ -z "${oci_bundle}" ] && [ -n "${lxc}" ]; then
|
||||
# if oci_bundle_root not defined in swmodd, update it with lxc path
|
||||
uci_set swmodd globals oci_bundle_root ${lxc}
|
||||
uci_commit
|
||||
elif [ -z "${oci_bundle}" ]; then
|
||||
uci_set swmodd globals oci_bundle_root "/srv/"
|
||||
uci_commit
|
||||
fi
|
||||
|
||||
47
swmodd/files/etc/uci-defaults/02-migrate-lxc
Normal file
47
swmodd/files/etc/uci-defaults/02-migrate-lxc
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
config_change=0
|
||||
|
||||
migrate_lxc() {
|
||||
config_get name "${1}" name ""
|
||||
|
||||
if [ -z "${name}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
# Now lets check if already present in lxccontainer
|
||||
exist=$(uci -q -c "${2}" show lxccontainer | grep ".name='$name'")
|
||||
if [ -z "${exist}" ]; then
|
||||
# Not present, need to migrate
|
||||
sec=$(uci -q -c "${2}" add lxccontainer container)
|
||||
if [ -n "${sec}" ]; then
|
||||
uci -q -c "${2}" set lxccontainer."${sec}".name="${name}"
|
||||
uci -q -c "${2}" set lxccontainer."${sec}".type='lxc'
|
||||
uci -q -c "${2}" set lxccontainer."${sec}".autostart='1'
|
||||
uci -q -c "${2}" set lxccontainer."${sec}".timeout='300'
|
||||
config_change=1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
config_load swmodd
|
||||
config_get lxc_bundle globals lxc_bundle_root ""
|
||||
|
||||
if [ -z "${lxc_bundle}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -d "${lxc_bundle}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
touch "${lxc_bundle}"/lxccontainer
|
||||
|
||||
config_load lxc-auto
|
||||
config_foreach migrate_lxc container "${lxc_bundle}"
|
||||
|
||||
if [ $config_change -eq 1 ]; then
|
||||
uci -q -c "${lxc_bundle}" commit lxccontainer
|
||||
fi
|
||||
@@ -6,13 +6,13 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=urlfilter
|
||||
PKG_VERSION:=1.1.5
|
||||
PKG_VERSION:=1.1.7
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/urlfilter.git
|
||||
PKG_SOURCE_VERSION:=e55a2c2c7c992eb5071e82734bdc8850b71b02e0
|
||||
PKG_SOURCE_VERSION:=a726e4ce9fa3322e135cb0dd961f31b4fd7ae22a
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
"type": "profile"
|
||||
},
|
||||
"option": {
|
||||
"name": "@Name"
|
||||
"name": "name"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=usermngr
|
||||
PKG_VERSION:=1.1.2
|
||||
PKG_VERSION:=1.1.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/usermngr.git
|
||||
PKG_SOURCE_VERSION:=467e30c6a41ce4b133284283a7a17d763e6921ff
|
||||
PKG_SOURCE_VERSION:=2285d198a535e0dc05f5fb78e80442d7a2ccf5f8
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=voicemngr
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0.3
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@@ -19,7 +19,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=6f2cc99016eb3c06eb3a22e4d1a0e264208721e6
|
||||
PKG_SOURCE_VERSION:=11b27a3bbf80f87ddfe10ed984d2945655ce3ba1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user