mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-26 12:03:44 +08:00
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06ea9f7057 | ||
|
|
8e0bcaef5f | ||
|
|
a1e93540c5 | ||
|
|
d37e6944f5 | ||
|
|
794c6f09b4 | ||
|
|
39f2dab3f2 | ||
|
|
a53706b95b | ||
|
|
53e13bc58c | ||
|
|
9ed7feed87 | ||
|
|
4b05713ae7 | ||
|
|
08a31cccad | ||
|
|
5ed51849bb | ||
|
|
677c712117 | ||
|
|
04fb03e1f4 | ||
|
|
d6cddef202 | ||
|
|
c4a417a4b0 | ||
|
|
8e6d97453d | ||
|
|
60d606e0fb | ||
|
|
5c1afe5b78 | ||
|
|
aefcd070d6 | ||
|
|
2a8316d7a1 | ||
|
|
cf16fa7a6f | ||
|
|
ee58c5e429 | ||
|
|
a17b91452c | ||
|
|
185fd76b46 | ||
|
|
07eb27b1dd | ||
|
|
548ae9605b | ||
|
|
a4f4add21b | ||
|
|
fe8f39cd5a | ||
|
|
77626b51b0 | ||
|
|
d10ca5330e | ||
|
|
c2e77a5fbe | ||
|
|
93b9aa8312 | ||
|
|
937ad7c0fc | ||
|
|
cb6d5bdc36 | ||
|
|
df3d450671 | ||
|
|
16951b9c31 | ||
|
|
cd9149efad | ||
|
|
c4965c9c05 | ||
|
|
d439066686 | ||
|
|
826aeb477e | ||
|
|
63b776f97d | ||
|
|
a7383806cd | ||
|
|
81d15db29c | ||
|
|
07bf2de658 | ||
|
|
5c94394a6b | ||
|
|
224a40f7b4 | ||
|
|
f7bc58530b | ||
|
|
c11bf82271 | ||
|
|
4bf446929a | ||
|
|
85c916aa6d | ||
|
|
a142950c90 | ||
|
|
0f28109363 | ||
|
|
e2c593662d | ||
|
|
749713615c | ||
|
|
e6ff986010 | ||
|
|
7f8869cdae | ||
|
|
9a5658fa23 | ||
|
|
9874a26de2 | ||
|
|
ee54c28426 | ||
|
|
71d8a2ac30 | ||
|
|
b35cc044b4 | ||
|
|
8d80e4d38f | ||
|
|
55afb62ba0 | ||
|
|
07a8753149 | ||
|
|
5d3027c777 | ||
|
|
8c2421018a | ||
|
|
a4f7d4650b | ||
|
|
ab92e503bc | ||
|
|
f0f3560789 | ||
|
|
a7577d8975 | ||
|
|
243e034156 | ||
|
|
ea242d4e4d | ||
|
|
2c154d09e6 | ||
|
|
62166c5465 | ||
|
|
89264fa175 | ||
|
|
6091b22937 | ||
|
|
e0f2f11174 | ||
|
|
1df0c1472f | ||
|
|
cc5348a282 | ||
|
|
d18a1b6788 | ||
|
|
8553a5c00f | ||
|
|
67d2e0fe01 |
@@ -1,44 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2022 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=airties-edge
|
||||
PKG_VERSION:=1.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/3rdparty/airties-edge.git
|
||||
PKG_SOURCE_VERSION:=2824fbc580f6cfc39b6a5faa4f0e4d168169ed22
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/airties-edge
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Airties Edge library
|
||||
DEPENDS:=+libubox +libubus +libblobmsg-json +libjson-c
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DVENDOR_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\"
|
||||
#TARGET_CFLAGS += -DLIB_VERSION=\\\"$(PKG_VERSION)\\\"
|
||||
|
||||
define Package/airties-edge/install
|
||||
#$(INSTALL_DIR) $(1)/airties-edge
|
||||
#$(INSTALL_DIR) $(1)/airties-edge/lib
|
||||
#$(CP) $(PKG_BUILD_DIR)/lib_airties_edge/libairtiesedge.so $(1)/airties-edge/lib
|
||||
$(INSTALL_DIR) $(1)/usr
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(CP) $(PKG_BUILD_DIR)/bbf_plugin/libairtiesedge_dm.so $(1)/usr/lib/bbfdm
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,airties-edge))
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=6.8.6
|
||||
PKG_VERSION:=6.8.12
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_VERSION:=1db92e1259673e6bf2a92f905aa1b54674dc12c1
|
||||
PKG_SOURCE_VERSION:=78157b22411816642f2bab81119c6d997c180c37
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -158,6 +158,10 @@ define Package/libbbfdm/default/install
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
|
||||
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||
ifeq ($(CONFIG_PACKAGE_mosquitto-ssl),y)
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/94-mosquitto-config $(1)/etc/uci-defaults/94-mosquitto-config
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default/prerm
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
]
|
||||
},
|
||||
"Port": {
|
||||
"type": "string",
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"version": "2.0",
|
||||
@@ -50,6 +50,11 @@
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"range": [
|
||||
{
|
||||
"max": 65535
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
|
||||
47
bbf/files/etc/uci-defaults/94-mosquitto-config
Normal file
47
bbf/files/etc/uci-defaults/94-mosquitto-config
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
config_mosquitto_owrt() {
|
||||
sec=$(uci -q get mosquitto.owrt)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto owrt)
|
||||
uci -q rename mosquitto."${sec}"="owrt"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.owrt.use_uci="1"
|
||||
uci -q set mosquitto.owrt.write_pid="0"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
config_mosquitto_general() {
|
||||
sec=$(uci -q get mosquitto.mosquitto)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto mosquitto)
|
||||
uci -q rename mosquitto."${sec}"="mosquitto"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.mosquitto.log_dest="syslog"
|
||||
uci -q set mosquitto.mosquitto.include_dir="/etc/mosquitto/conf.d"
|
||||
uci -q set mosquitto.mosquitto.log_facility="5"
|
||||
uci -q set mosquitto.mosquitto.log_timestamp="1"
|
||||
uci -q set mosquitto.mosquitto.log_types="error warning notice"
|
||||
uci -q set mosquitto.mosquitto.per_listener_settings="1"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
config_mosquitto_persistence() {
|
||||
sec=$(uci -q get mosquitto.persistence)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q add mosquitto persistence)
|
||||
uci -q rename mosquitto."${sec}"="persistence"
|
||||
fi
|
||||
|
||||
uci -q set mosquitto.persistence.persistence="0"
|
||||
uci -q set mosquitto.persistence.location="/var/run"
|
||||
uci -q commit mosquitto
|
||||
}
|
||||
|
||||
if [ -f "/etc/config/mosquitto" ]; then
|
||||
config_mosquitto_owrt
|
||||
config_mosquitto_general
|
||||
config_mosquitto_persistence
|
||||
fi
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=6.7.7
|
||||
PKG_VERSION:=6.8.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=055ffe68d293616f02a430692343b9d051d96f5b
|
||||
PKG_SOURCE_VERSION:=ddc7b272bec5e3b5c2a216a1f86cd5589a1a4a19
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.1.2
|
||||
PKG_VERSION:=9.1.3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
PKG_SOURCE_VERSION:=b964edb3570797286584793dbadfbef323cddbeb
|
||||
PKG_SOURCE_VERSION:=71488fdc4e1a97416fa7f8ad356314c80e4c0b87
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -83,6 +83,7 @@ define Package/icwmp/default/install
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
|
||||
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
|
||||
$(INSTALL_BIN) ./files/etc/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||
@@ -92,6 +93,7 @@ define Package/icwmp/default/install
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/update.sh $(1)/etc/icwmpd/update.sh
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_icwmp.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp.user
|
||||
endef
|
||||
|
||||
Package/icwmp-openssl/install = $(Package/icwmp/default/install)
|
||||
|
||||
122
icwmp/files/etc/udhcpc.user.d/udhcpc_icwmp.user
Normal file
122
icwmp/files/etc/udhcpc.user.d/udhcpc_icwmp.user
Normal file
@@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
|
||||
CLASS=""
|
||||
OUI=""
|
||||
SERIAL=""
|
||||
|
||||
get_vivsoi() {
|
||||
# opt125 environment variable has data in below format
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | enterprise-number1 |
|
||||
# | |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | data-len1 | |
|
||||
# +-+-+-+-+-+-+-+-+ option-data1 |
|
||||
# / /
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -----
|
||||
# | enterprise-number2 | ^
|
||||
# | | |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
# | data-len2 | | optional
|
||||
# +-+-+-+-+-+-+-+-+ option-data2 | |
|
||||
# / / |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
# ~ ... ~ V
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -----
|
||||
|
||||
# Enterprise Id Len Sub Op SLen Data Sub Op SLen Data Sub Op SLen Data
|
||||
# +-------------+-----+------+------+----+------+-----+----+-----+------+-----+----+
|
||||
# | id | n | 1 | n1 | D1 | 2 | n2 | D2 | ... | 6 | n6 | D6 |
|
||||
# +-------------+-----+------+------+----+------+-----+----+-----+------+-----+----+
|
||||
|
||||
local opt125="$1"
|
||||
local len="$2"
|
||||
local ent_id
|
||||
|
||||
#hex-string 2 character=1 Byte
|
||||
# length in hex string will be twice of actual Byte length
|
||||
[ "$len" -gt "8" ] || return
|
||||
|
||||
data="${opt125}"
|
||||
rem_len="${len}"
|
||||
while [ $rem_len -gt 0 ]; do
|
||||
ent_id=${data:0:8}
|
||||
ent_id=$(printf "%d\n" "0x$ent_id")
|
||||
|
||||
if [ $ent_id -ne 3561 ]; then
|
||||
len_val=${data:8:2}
|
||||
data_len=$(printf "%d\n" "0x$len_val")
|
||||
# add 4 byte for ent_id and 1 byte for len
|
||||
data_len=$(( data_len * 2 + 10 ))
|
||||
# move ahead data to next enterprise id
|
||||
data=${data:"${data_len}":"${rem_len}"}
|
||||
rem_len=$(( rem_len - $data_len ))
|
||||
continue
|
||||
fi
|
||||
|
||||
# read the length of enterprise data
|
||||
len_val=${data:8:2}
|
||||
opt_len=$(printf "%d\n" "0x$len_val")
|
||||
[ $opt_len -eq 0 ] && return
|
||||
|
||||
# populate the option data of enterprise id
|
||||
sub_data_len=$(( opt_len * 2))
|
||||
# starting 10 means ahead of length field
|
||||
sub_data=${data:10:"${sub_data_len}"}
|
||||
|
||||
# parsing of suboption of option 125
|
||||
while [ $sub_data_len -gt 0 ]; do
|
||||
# get the suboption id
|
||||
sub_opt_id=${sub_data:0:2}
|
||||
sub_opt_id=$(printf "%d\n" "0x$sub_opt_id")
|
||||
|
||||
# get the length of suboption
|
||||
sub_opt_len=${sub_data:2:2}
|
||||
sub_opt_len=$(printf "%d\n" "0x$sub_opt_len")
|
||||
sub_opt_len=$(( sub_opt_len * 2 ))
|
||||
|
||||
# get the value of sub option starting 4 means starting after length
|
||||
sub_opt_val=${sub_data:4:${sub_opt_len}}
|
||||
|
||||
# assign the value found in sub option
|
||||
case "${sub_opt_id}" in
|
||||
"4") OUI=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"5") SERIAL=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
"6") CLASS=$(echo -n $sub_opt_val | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf && echo '')
|
||||
;;
|
||||
esac
|
||||
|
||||
# add 2 bytes for sub_opt id and sub_opt len field
|
||||
sub_opt_end=$(( sub_opt_len + 4 ))
|
||||
|
||||
# fetch next sub option hex string
|
||||
sub_data=${sub_data:${sub_opt_end}:${sub_data_len}}
|
||||
|
||||
# update the remaining sub option hex string length
|
||||
sub_data_len=$((sub_data_len - sub_opt_end))
|
||||
done
|
||||
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
wan_intf=$(uci -q get cwmp.cpe.default_wan_interface)
|
||||
if [ -n "${wan_intf}" ] && [ "${wan_intf}" == "${INTERFACE}" ]; then
|
||||
if [ -n "$opt125" ]; then
|
||||
len=$(printf "$opt125"|wc -c)
|
||||
get_vivsoi "$opt125" "$len"
|
||||
fi
|
||||
|
||||
sec=$(uci -q -c /var/state get cwmp.gatewayinfo)
|
||||
if [ -z "${sec}" ]; then
|
||||
sec=$(uci -q -c /var/state add cwmp gatewayinfo)
|
||||
uci -q -c /var/state rename cwmp."${sec}"="gatewayinfo"
|
||||
fi
|
||||
|
||||
uci -q -c /var/state set cwmp.gatewayinfo.class="$CLASS"
|
||||
uci -q -c /var/state set cwmp.gatewayinfo.oui="$OUI"
|
||||
uci -q -c /var/state set cwmp.gatewayinfo.serial="$SERIAL"
|
||||
uci -q -c /var/state commit cwmp
|
||||
fi
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=6.0.1
|
||||
PKG_VERSION:=6.0.20
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b466c02716acbc55f552e7d35dcfec95bbd7fa78
|
||||
PKG_SOURCE_VERSION:=166fc0543f578336089f0940d9f5d2c27fac73a6
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -82,8 +82,10 @@ start_service() {
|
||||
validate_ieee1905_config || return 1;
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "/usr/sbin/ieee1905d"
|
||||
procd_set_param command "/usr/sbin/ieee1905d" "-o" "/tmp/ieee1905.log" "-f"
|
||||
procd_set_param respawn
|
||||
procd_set_param limits core="unlimited"
|
||||
# procd_set_param env IEEE1905_LOG_CMDU=1
|
||||
# procd_set_param stdout 1
|
||||
# procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
|
||||
@@ -76,6 +76,7 @@ CONFIG_PACKAGE_urlfilter=y
|
||||
CONFIG_PACKAGE_imonitor=m
|
||||
CONFIG_PACKAGE_questd=y
|
||||
CONFIG_PACKAGE_rulengd=y
|
||||
CONFIG_PACKAGE_usermngr=y
|
||||
|
||||
# TR-x69 #
|
||||
CONFIG_PACKAGE_uspd-mbedtls=y
|
||||
|
||||
@@ -388,12 +388,15 @@ function genconfig {
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
local GIT_REV=$(git rev-parse --short HEAD)
|
||||
local GIT_VER="$GIT_TAG"
|
||||
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
|
||||
local git_version
|
||||
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||
local version_lower="${version,,}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Package source tree override if selected
|
||||
|
||||
@@ -379,12 +379,15 @@ function genconfig_min {
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
local GIT_REV=$(git rev-parse --short HEAD)
|
||||
local GIT_VER="$GIT_TAG"
|
||||
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
|
||||
local git_version
|
||||
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||
local version_lower="${version,,}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Package source tree override if selected
|
||||
|
||||
61
libvoice-broadcom/Makefile
Normal file
61
libvoice-broadcom/Makefile
Normal file
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright (C) 2022 IOPSYS Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-broadcom
|
||||
PKG_VERSION:=0.1
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
LOCAL_SRC_DIR:=~/git/voip/$(PKG_NAME)
|
||||
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:=b53e93ca1a2fdda56ca9caffb6020e158e684f3d
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
# All config variable that are passed to the make invocation, directly or
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||
|
||||
export CONFIG_BRCM_SDK_VER_504040
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS libvoice for Broadcom
|
||||
URL:=
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Libvoice is a library that provides a uniform set of APIs and data types with hardware abstract layer for DSP/SLIC from different vendors
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -av --exclude=.* $(LOCAL_SRC_DIR)/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
# Although there is nothing needs to be installed, but the install section must NOT be empty. Otherwise the package will be skipped as below.
|
||||
# WARNING: skipping libvoice-broadcom -- package has no install section
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
58
libvoice-d2/Makefile
Normal file
58
libvoice-d2/Makefile
Normal file
@@ -0,0 +1,58 @@
|
||||
#
|
||||
# Copyright (C) 2022 IOPSYS Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libvoice-d2
|
||||
PKG_VERSION:=0.1
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
LOCAL_SRC_DIR:=~/git/voip/$(PKG_NAME)
|
||||
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:=45e7d35f97f258f5e13c3afa0542db724bf59828
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
# All config variable that are passed to the make invocation, directly or
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS libvoice for D2 which is software DSP
|
||||
URL:=
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Libvoice is a library that provides a uniform set of APIs and data types with hardware abstract layer for DSP/SLIC from different vendors
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -av --exclude=.* $(LOCAL_SRC_DIR)/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
# Although there is nothing needs to be installed, but the install section must NOT be empty. Otherwise the package will be skipped as below.
|
||||
# WARNING: skipping libvoice-d2 -- package has no install section
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -13,6 +13,9 @@ config AGENT_ISLAND_PREVENTION
|
||||
config AGENT_EASYMESH_R2_CERT
|
||||
bool "Compile for WFA test bed"
|
||||
|
||||
config AGENT_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 2
|
||||
|
||||
config AGENT_EASYMESH_VENDOR_EXT
|
||||
bool "Enable extra features through Easymesh vendor extension"
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=2.10.3.28
|
||||
PKG_VERSION:=2.10.4.13
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=5deb9717bdf4832734bc710bf51cf27a69a9d7eb
|
||||
PKG_SOURCE_VERSION:=fdce58318b082b8683f80688c5d284e21efa7908
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -59,6 +59,8 @@ TARGET_CFLAGS += \
|
||||
-Wno-error=deprecated-declarations \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_AGENT_EASYMESH_VERSION)
|
||||
|
||||
ifeq ($(CONFIG_AGENT_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
||||
TARGET_CFLAGS += -DAGENT_SYNC_DYNAMIC_CNTLR_CONFIG
|
||||
endif
|
||||
|
||||
@@ -7,6 +7,7 @@ config agent 'agent'
|
||||
option island_prevention '0'
|
||||
option eth_onboards_wifi_bhs '0'
|
||||
# option controller_macaddr '0a:1b:2c:3d:4e:50'
|
||||
option scan_on_boot_only '0'
|
||||
|
||||
config dynamic_backhaul
|
||||
option missing_bh_timer '60'
|
||||
|
||||
@@ -34,7 +34,8 @@ validate_agent_section() {
|
||||
'resend_num:uinteger:0' \
|
||||
'dyn_cntlr_sync:bool:true' \
|
||||
'island_prevention:bool:false' \
|
||||
'eth_onboards_wifi_bhs:bool:false'
|
||||
'eth_onboards_wifi_bhs:bool:false' \
|
||||
'scan_on_boot_only:bool:false'
|
||||
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
|
||||
@@ -14,6 +14,10 @@ config CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
string
|
||||
default "\\\\x11\\\\x22\\\\x33"
|
||||
|
||||
config CONTROLLER_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 2
|
||||
|
||||
config CONTROLLER_EASYMESH_VENDOR_EXT_OUI
|
||||
string "Vendor OUI in '\\\\xAB\\\\xCD\\\\xEF' format"
|
||||
default CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=2.11.0.14
|
||||
PKG_VERSION:=2.11.0.21
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=8a71dffdd66b2dcacf67353efcb09cb9127c1ea9
|
||||
PKG_SOURCE_VERSION:=24fb4d95c3a1d0b736239de28a8e14ab7a185630
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
@@ -45,6 +45,8 @@ TARGET_CFLAGS += \
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_CONTROLLER_EASYMESH_VERSION)
|
||||
|
||||
ifeq ($(CONFIG_CONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
||||
TARGET_CFLAGS += -DCONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG
|
||||
endif
|
||||
|
||||
@@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=map-topology
|
||||
PKG_VERSION:=2.5.1.8
|
||||
PKG_VERSION:=2.5.1.13
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_VERSION:=ee72703a5c89983c881d8faedcdc749b54278790
|
||||
PKG_SOURCE_VERSION:=aaa55a72e719184af32d57a9b40bec1c440774a9
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/map-topology.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=6.0.0.10
|
||||
PKG_VERSION:=6.0.0.12
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
|
||||
@@ -2,7 +2,7 @@ config obuspa 'global'
|
||||
option enabled '1'
|
||||
option debug '1'
|
||||
option log_level '1'
|
||||
option prototrace '1'
|
||||
option prototrace '0'
|
||||
option db_file '/etc/obuspa/usp.db'
|
||||
#option role_file '/etc/obuspa/roles.json'
|
||||
option dm_caching_exclude '/etc/obuspa/dmcaching_exclude.json'
|
||||
@@ -11,54 +11,22 @@ config obuspa 'global'
|
||||
#option log_dest '/var/log/obuspa'
|
||||
|
||||
# Adds Device.LocalAgent.MTP.
|
||||
config mtp 'agent_mtp'
|
||||
config mtp 'test_mtp'
|
||||
option Protocol 'MQTT'
|
||||
option ResponseTopicConfigured '/usp/endpoint'
|
||||
option mqtt 'localmqtt'
|
||||
option mqtt 'testmqtt'
|
||||
|
||||
# Adds Device.MQTT.Client.
|
||||
config mqtt 'localmqtt'
|
||||
config mqtt 'testmqtt'
|
||||
option BrokerAddress '127.0.0.1'
|
||||
option BrokerPort '1883'
|
||||
option TransportProtocol 'TCP/IP'
|
||||
|
||||
# Adds Device.LocalAgent.Controller.
|
||||
config controller 'localcontroller'
|
||||
config controller 'testcontroller'
|
||||
option EndpointID 'proto::interop-usp-controller'
|
||||
option Protocol 'MQTT'
|
||||
option Topic '/usp/controller'
|
||||
option mqtt 'localmqtt'
|
||||
option mqtt 'testmqtt'
|
||||
option assigned_role_name 'full_access'
|
||||
|
||||
# Add Device.LocalAgent.Subscription.
|
||||
#config subscription 'sub_event'
|
||||
# option ID 'uci-sub-events'
|
||||
# option NotifType 'Event'
|
||||
# list ReferenceList 'Device.Boot!'
|
||||
# list ReferenceList 'Device.LocalAgent.TransferComplete!'
|
||||
# option Persistent 'true'
|
||||
# option controller 'localcontroller'
|
||||
|
||||
#config subscription 'sub_op_comp'
|
||||
# option ID 'uci-sub-op_complete'
|
||||
# option NotifType 'OperationComplete'
|
||||
# list ReferenceList 'Device.DeviceInfo.FirmwareImage.*.Download()'
|
||||
# list ReferenceList 'Device.DeviceInfo.FirmwareImage.*.Activate()'
|
||||
# option Persistent 'true'
|
||||
# option controller 'localcontroller'
|
||||
|
||||
#config challenge 'admin'
|
||||
# option Description 'Request to get Administrative access'
|
||||
# option role_name 'full_access'
|
||||
# option Enable '1'
|
||||
# option Value 'YWRtaW4='
|
||||
# option Retries 2
|
||||
# option LockoutPeriod 60
|
||||
|
||||
#config challenge 'user'
|
||||
# option Description 'Request to get User access'
|
||||
# option role_name 'user'
|
||||
# option Enable '1'
|
||||
# option Value 'dXNlcg=='
|
||||
# option Retries 3
|
||||
# option LockoutPeriod 30
|
||||
|
||||
@@ -314,7 +314,7 @@ publish_endpoint()
|
||||
{
|
||||
local AgentEndpointID serial oui user pass
|
||||
|
||||
if ! uci -q get obuspa.localmqtt; then
|
||||
if ! uci -q get obuspa.testmqtt; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
@@ -330,11 +330,11 @@ publish_endpoint()
|
||||
if [ -z "${AgentEndpointID}" ]; then
|
||||
serial=$(get_serial_from_db)
|
||||
oui=$(get_oui_from_db)
|
||||
AgentEndpointID="os::${oui}-${serial}"
|
||||
AgentEndpointID="os::${oui}-${serial//+/%2B}"
|
||||
fi
|
||||
|
||||
config_get user localmqtt Username
|
||||
config_get pass localmqtt Password
|
||||
config_get user testmqtt Username
|
||||
config_get pass testmqtt Password
|
||||
|
||||
# publish Agent's EndpointID in mosquito broker for discovery by usp-js
|
||||
# This is a work around till obuspa adds supports for mDNS discovery
|
||||
|
||||
@@ -39,6 +39,8 @@ ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||
else ifneq ($(CONFIG_TARGET_airoha),)
|
||||
$(CP) ./files/airoha/* $(1)/
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(CP) ./files/etc/bbfdm/json/* $(1)/etc/bbfdm/json/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ponmngr))
|
||||
|
||||
656
ponmngr/files/etc/bbfdm/json/xpon.json
Normal file
656
ponmngr/files/etc/bbfdm/json/xpon.json
Normal file
@@ -0,0 +1,656 @@
|
||||
{
|
||||
"json_plugin_version": 1,
|
||||
"Device.XPON.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"dependency": "file:/etc/config/xpon",
|
||||
"ONUNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU.@Count"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Device.XPON.ONU.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Enable": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Enable"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Version": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"range": [
|
||||
{
|
||||
"max": 14
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Version"
|
||||
}
|
||||
]
|
||||
},
|
||||
"EquipmentID": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"range": [
|
||||
{
|
||||
"max": 20
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "EquipmentID"
|
||||
}
|
||||
]
|
||||
},
|
||||
"SoftwareImageNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].softwareImage.@Count"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"EthernetUNINumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].EthernetUNI.@Count"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ANINumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].ANI.@Count"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Device.XPON.ONU.{i}.SoftwareImage.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].softwareImage"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ID": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedInt",
|
||||
"range": [
|
||||
{
|
||||
"min": 0,
|
||||
"max": 1
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "ID"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Version": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"range": [
|
||||
{
|
||||
"max": 14
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Version"
|
||||
}
|
||||
]
|
||||
},
|
||||
"IsCommitted": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "IsCommitted"
|
||||
}
|
||||
]
|
||||
},
|
||||
"IsActive": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "IsActive"
|
||||
}
|
||||
]
|
||||
},
|
||||
"IsValid": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "IsValid"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"Device.XPON.ONU.{i}.EthernetUNI.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].EthernetUNI"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Enable": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Enable"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Status": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"enumerations": [
|
||||
"Up",
|
||||
"Down",
|
||||
"unknown",
|
||||
"Dormant",
|
||||
"NotPresent",
|
||||
"LowerLayerDown",
|
||||
"Error"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Status"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ANIs": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"range": [
|
||||
{
|
||||
"max": 1024
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "ANIs"
|
||||
}
|
||||
]
|
||||
},
|
||||
"InterdomainID": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"range": [
|
||||
{
|
||||
"max": 256
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "InterDomainID"
|
||||
}
|
||||
]
|
||||
},
|
||||
"InterdomainName": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"range": [
|
||||
{
|
||||
"max": 25
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "InterDomainName"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Device.XPON.ONU.{i}.EthernetUNI.{i}.Stats.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats"
|
||||
}
|
||||
],
|
||||
"BytesSent": {
|
||||
"type": "unsignedLong",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats.BytesSent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"BytesReceived": {
|
||||
"type": "unsignedLong",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats.BytesReceived"
|
||||
}
|
||||
]
|
||||
},
|
||||
"PacketsSent": {
|
||||
"type": "unsignedLong",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats.PacketsSent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"PacketsReceived": {
|
||||
"type": "unsignedLong",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats.PacketsReceived"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Device.XPON.ONU.{i}.ANI.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "xpon",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ONU[@index].ANI"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Enable": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Enable"
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "xpon",
|
||||
"section": {
|
||||
"name": "ani"
|
||||
},
|
||||
"option": {
|
||||
"name": "enable"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Status": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"enumerations": [
|
||||
"Up",
|
||||
"Down",
|
||||
"Dormant",
|
||||
"Unknown",
|
||||
"NotPresent",
|
||||
"Error"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Status"
|
||||
}
|
||||
]
|
||||
},
|
||||
"PONMode": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "string",
|
||||
"enumerations": [
|
||||
"GPON",
|
||||
"XG-PON",
|
||||
"NG-PON2",
|
||||
"XGS-PON"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "PONMode"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Device.XPON.ONU.{i}.ANI.{i}.Stats.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats"
|
||||
}
|
||||
],
|
||||
"BytesSent": {
|
||||
"type": "unsignedLong",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats.BytesSent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"BytesReceived": {
|
||||
"type": "unsignedLong",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats.BytesReceived"
|
||||
}
|
||||
]
|
||||
},
|
||||
"PacketsSent": {
|
||||
"type": "unsignedLong",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats.PacketsSent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"PacketsReceived": {
|
||||
"type": "unsignedLong",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"datatype": "unsignedLong",
|
||||
"mapping": [
|
||||
{
|
||||
"data": "@Parent",
|
||||
"type": "json",
|
||||
"key": "Stats.PacketsReceived"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=questd
|
||||
PKG_VERSION:=5.2.4
|
||||
PKG_VERSION:=5.2.5
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/questd
|
||||
PKG_SOURCE_VERSION:=2ca3ae0c29dcbbf01282f6118eb8d5e5bc9a1c45
|
||||
PKG_SOURCE_VERSION:=38af3655416c80933f89f5a03638403a7c051a42
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
47
ssdpd/Makefile
Normal file
47
ssdpd/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# Copyright (C) 2022 OpenWrt.org
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ssdpd
|
||||
PKG_RELEASE:=1.0.0
|
||||
|
||||
PKG_VERSION:=1.6.0
|
||||
PKG_SOURCE_URL:=http://miniupnp.free.fr/files/
|
||||
PKG_SOURCE:=mini$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_HASH:=f4c2dea6a472e0a5cc9dca2dc4c1fc36ba5538eacf8d793825293251725546bd
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/mini$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ssdpd
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+libnfnetlink +libpthread +libubox +libubus +libblobmsg-json +libcurl +mxml
|
||||
TITLE:=MiniSSDPd - SSDP daemon
|
||||
URL:=https://miniupnp.tuxfamily.org/minissdpd.html
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE \
|
||||
-Wall -Wextra -Werror
|
||||
|
||||
TARGET_LDFLAGS += \
|
||||
-lpthread -lubox -lubus -lblobmsg_json -lcurl -lmxml
|
||||
|
||||
define Package/ssdpd/install
|
||||
$(INSTALL_DIR) $(1)/etc/upnp
|
||||
$(INSTALL_DIR) $(1)/etc/upnp/description
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_CONF) ./files/etc/config/ssdpd $(1)/etc/config/ssdpd
|
||||
$(INSTALL_BIN) ./files/etc/init.d/ssdpd $(1)/etc/init.d/ssdpd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/minissdpd $(1)/usr/sbin/ssdpd
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ssdpd))
|
||||
7
ssdpd/files/etc/config/ssdpd
Normal file
7
ssdpd/files/etc/config/ssdpd
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
config ssdpd 'ssdp'
|
||||
option enabled '1'
|
||||
option ipv6_enabled '0'
|
||||
option socket_path '/var/run/minissdpd.sock'
|
||||
option ttl '2'
|
||||
option interface ''
|
||||
73
ssdpd/files/etc/init.d/ssdpd
Executable file
73
ssdpd/files/etc/init.d/ssdpd
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
STOP=02
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/ssdpd
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t ssdp.init -p info
|
||||
}
|
||||
|
||||
validate_ssdpd_ssdp_section()
|
||||
{
|
||||
uci_validate_section ssdpd ssdpd "ssdp" \
|
||||
'enabled:bool:true' \
|
||||
'ipv6_enabled:bool:false' \
|
||||
'socket_path:string' \
|
||||
'ttl:uinteger' \
|
||||
'interface:string'
|
||||
}
|
||||
|
||||
configure_ssdp()
|
||||
{
|
||||
local enabled ipv6_enabled socket_path ttl interface
|
||||
|
||||
config_load ssdpd
|
||||
|
||||
validate_ssdpd_ssdp_section || {
|
||||
log "Validation of ssdp section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ ${enabled} -eq 0 ] && return 0
|
||||
|
||||
if [ ${ipv6_enabled} -eq 1 ]; then
|
||||
procd_append_param command -6
|
||||
fi
|
||||
|
||||
if [ -n "${socket_path}" ]; then
|
||||
procd_append_param command -s ${socket_path}
|
||||
fi
|
||||
|
||||
if [ -n "${ttl}" ]; then
|
||||
procd_append_param command -t ${ttl}
|
||||
fi
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
iface=$(uci -q get cwmp.cpe.default_lan_interface)
|
||||
interface=$(ifstatus ${iface} | jsonfilter -e @.device)
|
||||
fi
|
||||
|
||||
procd_append_param command -i ${interface}
|
||||
procd_append_param command -d
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance ssdp
|
||||
procd_set_param command ${PROG}
|
||||
configure_ssdp
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "ssdpd"
|
||||
}
|
||||
20
ssdpd/patches/001-fix-gcc-warnings
Normal file
20
ssdpd/patches/001-fix-gcc-warnings
Normal file
@@ -0,0 +1,20 @@
|
||||
--- a/openssdpsocket.c
|
||||
+++ b/openssdpsocket.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
--- a/ifacewatch.c
|
||||
+++ b/ifacewatch.c
|
||||
@@ -130,6 +130,7 @@ ProcessInterfaceWatch(int s, int s_ssdp,
|
||||
/* case RTM_DELLINK: */
|
||||
case RTM_DELADDR:
|
||||
is_del = 1;
|
||||
+ // fall through
|
||||
case RTM_NEWADDR:
|
||||
/* http://linux-hacks.blogspot.fr/2009/01/sample-code-to-learn-netlink.html */
|
||||
ifa = (struct ifaddrmsg *)NLMSG_DATA(nlhdr);
|
||||
11
ssdpd/patches/010-add-test-object
Normal file
11
ssdpd/patches/010-add-test-object
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -41,7 +41,7 @@ endif
|
||||
EXECUTABLES = minissdpd testminissdpd testcodelength \
|
||||
showminissdpdnotif
|
||||
MINISSDPDOBJS = minissdpd.o openssdpsocket.o daemonize.o upnputils.o \
|
||||
- ifacewatch.o getroute.o getifaddr.o asyncsendto.o
|
||||
+ ifacewatch.o getroute.o getifaddr.o asyncsendto.o ssdpd.o
|
||||
TESTMINISSDPDOBJS = testminissdpd.o printresponse.o
|
||||
SHOWMINISSDPDNOTIFOBJS = showminissdpdnotif.o printresponse.o
|
||||
|
||||
629
ssdpd/patches/011-add-ubus-object
Normal file
629
ssdpd/patches/011-add-ubus-object
Normal file
@@ -0,0 +1,629 @@
|
||||
--- /dev/null
|
||||
+++ b/ssdpd.c
|
||||
@@ -0,0 +1,626 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2022 iopsys Software Solutions AB
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU Lesser General Public License version 2.1
|
||||
+ * as published by the Free Software Foundation
|
||||
+ *
|
||||
+ * Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
|
||||
+ */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <sys/un.h>
|
||||
+#include <net/if.h>
|
||||
+#include <syslog.h>
|
||||
+
|
||||
+#include <curl/curl.h>
|
||||
+#include <libubox/uloop.h>
|
||||
+#include <libubox/blobmsg_json.h>
|
||||
+#include <libubox/list.h>
|
||||
+#include <libubus.h>
|
||||
+#include <mxml.h>
|
||||
+
|
||||
+#include "codelength.h"
|
||||
+
|
||||
+struct UPNPDev {
|
||||
+ struct list_head list;
|
||||
+ char *descURL;
|
||||
+ char *st;
|
||||
+ char *usn;
|
||||
+};
|
||||
+
|
||||
+struct desc_list_elt {
|
||||
+ struct list_head list;
|
||||
+ char *url;
|
||||
+ char *desc_path;
|
||||
+ bool is_device_desc;
|
||||
+};
|
||||
+
|
||||
+#define UPNP_DESC_PATH "/etc/upnp/description"
|
||||
+#define UPNP_DISCOVER_TIMEOUT (30 * 1000)
|
||||
+
|
||||
+#ifndef MIN
|
||||
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
+#endif /* MIN */
|
||||
+
|
||||
+/* macros used to read from unix socket */
|
||||
+#define READ_BYTE_BUFFER(c) \
|
||||
+ if ((int)bufferindex >= n) { \
|
||||
+ n = read(s, buffer, sizeof(buffer)); \
|
||||
+ if (n <= 0) break; \
|
||||
+ bufferindex = 0; \
|
||||
+ } \
|
||||
+ c = buffer[bufferindex++];
|
||||
+
|
||||
+#define READ_COPY_BUFFER(dst, len) \
|
||||
+ for (l = len, p = (unsigned char *)dst; l > 0; ) { \
|
||||
+ unsigned int lcopy; \
|
||||
+ if ((int)bufferindex >= n) { \
|
||||
+ n = read(s, buffer, sizeof(buffer)); \
|
||||
+ if ( n<= 0) break; \
|
||||
+ bufferindex = 0; \
|
||||
+ } \
|
||||
+ lcopy = MIN(l, (n - bufferindex)); \
|
||||
+ memcpy(p, buffer + bufferindex, lcopy); \
|
||||
+ l -= lcopy; \
|
||||
+ p += lcopy; \
|
||||
+ bufferindex += lcopy; \
|
||||
+ }
|
||||
+
|
||||
+LIST_HEAD(dev_list);
|
||||
+LIST_HEAD(desc_list);
|
||||
+
|
||||
+char *ssdp_sockpath = NULL;
|
||||
+
|
||||
+static void upnp_discover_devices(struct uloop_timeout *timeout);
|
||||
+static struct uloop_timeout upnpdiscover_timer = { .cb = upnp_discover_devices };
|
||||
+
|
||||
+static void add_dev_to_dev_list(char *descURL, char *st, char *usn)
|
||||
+{
|
||||
+ struct UPNPDev *dev = NULL;
|
||||
+
|
||||
+ dev = calloc(1, sizeof(struct UPNPDev));
|
||||
+ list_add_tail(&dev->list, &dev_list);
|
||||
+
|
||||
+ dev->descURL = descURL;
|
||||
+ dev->st = st;
|
||||
+ dev->usn = usn;
|
||||
+}
|
||||
+
|
||||
+void free_all_dev_list(void)
|
||||
+{
|
||||
+ struct UPNPDev *dev = NULL;
|
||||
+
|
||||
+ while (dev_list.next != &dev_list) {
|
||||
+ dev = list_entry(dev_list.next, struct UPNPDev, list);
|
||||
+ free(dev->descURL);
|
||||
+ free(dev->st);
|
||||
+ free(dev->usn);
|
||||
+ free(dev);
|
||||
+ list_del(&dev->list);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int connectToMiniSSDPD(void)
|
||||
+{
|
||||
+ int s = 0;
|
||||
+ struct sockaddr_un addr;
|
||||
+
|
||||
+ s = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
+ if(s < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ char *ssdp_s = ssdp_sockpath ? ssdp_sockpath : "/var/run/minissdpd.sock";
|
||||
+
|
||||
+ memset(&addr, 0, sizeof(addr));
|
||||
+ addr.sun_family = AF_UNIX;
|
||||
+
|
||||
+ strncpy(addr.sun_path, ssdp_s, sizeof(addr.sun_path));
|
||||
+
|
||||
+ if(connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0) {
|
||||
+ close(s);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return s;
|
||||
+}
|
||||
+
|
||||
+static int disconnectFromMiniSSDPD(int s)
|
||||
+{
|
||||
+ if (close(s) < 0)
|
||||
+ return -1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int requestDevicesFromMiniSSDPD(int s)
|
||||
+{
|
||||
+ unsigned char buffer[256];
|
||||
+ unsigned char *p = NULL;
|
||||
+ unsigned int stsize = 0, l = 0;
|
||||
+ char *devtype = "ssdp:all";
|
||||
+
|
||||
+ buffer[0] = 3; /* request type 3 : everything */
|
||||
+ stsize = strlen(devtype);
|
||||
+
|
||||
+ p = buffer + 1;
|
||||
+ l = stsize; CODELENGTH(l, p);
|
||||
+ if (p + stsize > buffer + sizeof(buffer))
|
||||
+ return -1;
|
||||
+
|
||||
+ memcpy(p, devtype, stsize);
|
||||
+ p += stsize;
|
||||
+ if (write(s, buffer, p - buffer) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int receiveDevicesFromMiniSSDPD(int s)
|
||||
+{
|
||||
+ unsigned char buffer[256];
|
||||
+ ssize_t n;
|
||||
+ unsigned char *p;
|
||||
+ unsigned int bufferindex;
|
||||
+ unsigned int i, ndev;
|
||||
+ unsigned int urlsize, stsize, usnsize, l;
|
||||
+ char *url, *st, *usn;
|
||||
+
|
||||
+ n = read(s, buffer, sizeof(buffer));
|
||||
+ if (n <= 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ ndev = buffer[0];
|
||||
+ bufferindex = 1;
|
||||
+ for (i = 0; i < ndev; i++) {
|
||||
+ DECODELENGTH_READ(urlsize, READ_BYTE_BUFFER);
|
||||
+ if (n <= 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ url = (char *)malloc(urlsize);
|
||||
+ if (url == NULL)
|
||||
+ return -1;
|
||||
+
|
||||
+ READ_COPY_BUFFER(url, urlsize);
|
||||
+ if (n <= 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ DECODELENGTH_READ(stsize, READ_BYTE_BUFFER);
|
||||
+ if (n <= 0)
|
||||
+ goto free_url_and_return;
|
||||
+
|
||||
+ st = (char *)malloc(stsize);
|
||||
+ if (st == NULL)
|
||||
+ goto free_url_and_return;
|
||||
+
|
||||
+ READ_COPY_BUFFER(st, stsize);
|
||||
+ if (n <= 0)
|
||||
+ goto free_url_and_st_and_return;
|
||||
+
|
||||
+ DECODELENGTH_READ(usnsize, READ_BYTE_BUFFER);
|
||||
+ if (n <= 0)
|
||||
+ goto free_url_and_st_and_return;
|
||||
+
|
||||
+ usn = (char *)malloc(usnsize);
|
||||
+ if (usn == NULL)
|
||||
+ goto free_url_and_st_and_return;
|
||||
+
|
||||
+ READ_COPY_BUFFER(usn, usnsize);
|
||||
+ if (n <= 0)
|
||||
+ goto free_url_and_st_and_usn_and_return;
|
||||
+
|
||||
+ add_dev_to_dev_list(url, st, usn);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+free_url_and_st_and_usn_and_return:
|
||||
+ free(usn);
|
||||
+free_url_and_st_and_return:
|
||||
+ free(st);
|
||||
+free_url_and_return:
|
||||
+ free(url);
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+static int getDevicesFromMiniSSDPD(void)
|
||||
+{
|
||||
+ int s = 0;
|
||||
+ int res = 0;
|
||||
+
|
||||
+ s = connectToMiniSSDPD();
|
||||
+ if (s < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ res = requestDevicesFromMiniSSDPD(s);
|
||||
+ if (res < 0)
|
||||
+ goto close_socket_and_return;
|
||||
+
|
||||
+ res = receiveDevicesFromMiniSSDPD(s);
|
||||
+
|
||||
+close_socket_and_return:
|
||||
+ disconnectFromMiniSSDPD(s);
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+static void download_file(char *file_path, const char *url)
|
||||
+{
|
||||
+ CURL *curl = curl_easy_init();
|
||||
+ if (curl) {
|
||||
+ curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
+ curl_easy_setopt(curl, CURLOPT_TIMEOUT, 500);
|
||||
+
|
||||
+ FILE *fp = fopen(file_path, "wb");
|
||||
+ if (fp) {
|
||||
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
|
||||
+ curl_easy_perform(curl);
|
||||
+ fclose(fp);
|
||||
+ }
|
||||
+
|
||||
+ curl_easy_cleanup(curl);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static bool is_desc_exist(const char *desc_url)
|
||||
+{
|
||||
+ struct desc_list_elt *desc_elt = NULL;
|
||||
+
|
||||
+ if (!desc_url)
|
||||
+ return false;
|
||||
+
|
||||
+ list_for_each_entry(desc_elt, &desc_list, list) {
|
||||
+ if (strcmp(desc_elt->url, desc_url) == 0)
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static void get_desc_name(const char *desc_url, char *str, size_t len)
|
||||
+{
|
||||
+ if (!desc_url || !str || len == 0)
|
||||
+ return;
|
||||
+
|
||||
+ char *p = strstr(desc_url, "://");
|
||||
+
|
||||
+ snprintf(str, len, "%s", p ? p + 3 : desc_url);
|
||||
+
|
||||
+ for (int i = 0; str[i]; i++) {
|
||||
+ if (str[i] == '/')
|
||||
+ str[i] = '_';
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void add_desc_to_desc_list(const char *desc_path, const char *url, int is_device_desc)
|
||||
+{
|
||||
+ struct desc_list_elt *desc_elt;
|
||||
+
|
||||
+ desc_elt = calloc(1, sizeof(struct desc_list_elt));
|
||||
+ list_add_tail(&desc_elt->list, &desc_list);
|
||||
+
|
||||
+ desc_elt->desc_path = strdup(desc_path);
|
||||
+ desc_elt->url = strdup(url);
|
||||
+ desc_elt->is_device_desc = is_device_desc;
|
||||
+}
|
||||
+
|
||||
+static void free_all_desc_list(void)
|
||||
+{
|
||||
+ struct desc_list_elt *desc_elt = NULL;
|
||||
+
|
||||
+ while (desc_list.next != &desc_list) {
|
||||
+ desc_elt = list_entry(desc_list.next, struct desc_list_elt, list);
|
||||
+ free(desc_elt->desc_path);
|
||||
+ free(desc_elt->url);
|
||||
+ free(desc_elt);
|
||||
+ list_del(&desc_elt->list);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void __upnp_discover_devices(void)
|
||||
+{
|
||||
+ struct UPNPDev *dev = NULL;
|
||||
+ char desc_name[128] = {0};
|
||||
+ char file_path[256] = {0};
|
||||
+ int res = 0, is_device_desc = 0;
|
||||
+
|
||||
+ /*
|
||||
+ * Discover devices
|
||||
+ */
|
||||
+ if (!list_empty(&dev_list))
|
||||
+ free_all_dev_list();
|
||||
+
|
||||
+ res = getDevicesFromMiniSSDPD();
|
||||
+ if (res)
|
||||
+ goto end;
|
||||
+
|
||||
+ /*
|
||||
+ * Download description files
|
||||
+ */
|
||||
+ list_for_each_entry_reverse(dev, &dev_list, list) {
|
||||
+
|
||||
+ if (is_desc_exist(dev->descURL))
|
||||
+ continue;
|
||||
+
|
||||
+ get_desc_name(dev->descURL, desc_name, sizeof(desc_name));
|
||||
+ snprintf(file_path, sizeof(file_path), "%s/%s", UPNP_DESC_PATH, desc_name);
|
||||
+ is_device_desc = (dev->usn && strstr(dev->usn, ":service:")) ? 0 : 1;
|
||||
+
|
||||
+ // Download Description
|
||||
+ download_file(file_path, dev->descURL);
|
||||
+
|
||||
+ // Add description to descriptions list
|
||||
+ add_desc_to_desc_list(file_path, dev->descURL, is_device_desc);
|
||||
+ }
|
||||
+
|
||||
+end:
|
||||
+ uloop_timeout_set(&upnpdiscover_timer, UPNP_DISCOVER_TIMEOUT);
|
||||
+}
|
||||
+
|
||||
+static int upnp_discovery_res(struct ubus_context *ctx, struct ubus_object *obj __attribute__((unused)),
|
||||
+ struct ubus_request_data *req, const char *method __attribute__((unused)), struct blob_attr *msg __attribute__((unused)))
|
||||
+{
|
||||
+ struct blob_buf bb = {0};
|
||||
+ struct UPNPDev *dev = NULL;
|
||||
+
|
||||
+ memset(&bb,0,sizeof(struct blob_buf));
|
||||
+ blob_buf_init(&bb, 0);
|
||||
+
|
||||
+ void *devices_array = blobmsg_open_array(&bb, "devices");
|
||||
+ list_for_each_entry_reverse(dev, &dev_list, list) {
|
||||
+ // Parse Root device and devices
|
||||
+ if ((dev->st && strstr(dev->st, ":rootdevice") != NULL) || (dev->usn && strstr(dev->usn, ":device:") != NULL)) {
|
||||
+ void *device_obj = blobmsg_open_table(&bb, NULL);
|
||||
+ blobmsg_add_string(&bb, "descurl", dev->descURL);
|
||||
+ blobmsg_add_string(&bb, "st", dev->st);
|
||||
+ blobmsg_add_string(&bb, "usn", dev->usn);
|
||||
+ blobmsg_add_string(&bb, "is_root_device", dev->st && strstr(dev->st, ":rootdevice") ? "1" : "0");
|
||||
+ blobmsg_close_table(&bb, device_obj);
|
||||
+ }
|
||||
+ }
|
||||
+ blobmsg_close_array(&bb, devices_array);
|
||||
+
|
||||
+ void *services_array = blobmsg_open_array(&bb, "services");
|
||||
+ list_for_each_entry_reverse(dev, &dev_list, list) {
|
||||
+ // Parse Services
|
||||
+ if (dev->usn && strstr(dev->usn, ":service:") != NULL) {
|
||||
+ void *service_obj = blobmsg_open_table(&bb, NULL);
|
||||
+ blobmsg_add_string(&bb, "descurl", dev->descURL);
|
||||
+ blobmsg_add_string(&bb, "st", dev->st);
|
||||
+ blobmsg_add_string(&bb, "usn", dev->usn);
|
||||
+ blobmsg_close_table(&bb, service_obj);
|
||||
+ }
|
||||
+ }
|
||||
+ blobmsg_close_array(&bb, services_array);
|
||||
+
|
||||
+ ubus_send_reply(ctx, req, bb.head);
|
||||
+ blob_buf_free(&bb);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void fill_device_instances(struct blob_buf *bb, mxml_node_t *device)
|
||||
+{
|
||||
+ void *device_obj = NULL;
|
||||
+ mxml_node_t *b = device;
|
||||
+ char buf[64] = {0};
|
||||
+ bool new_device_discovery = false;
|
||||
+
|
||||
+ while (b) {
|
||||
+
|
||||
+ if (mxmlGetType(b) != MXML_ELEMENT) {
|
||||
+ b = mxmlWalkNext(b, device, MXML_DESCEND);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ const char *elm_name = mxmlGetElement(b);
|
||||
+ const char *elm_val = mxmlGetOpaque(b);
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "device") == 0) {
|
||||
+
|
||||
+ if (new_device_discovery && device_obj)
|
||||
+ blobmsg_close_table(bb, device_obj);
|
||||
+
|
||||
+ device_obj = blobmsg_open_table(bb, NULL);
|
||||
+ blobmsg_add_string(bb, "parent_dev", buf);
|
||||
+ new_device_discovery = true;
|
||||
+ }
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "deviceType") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "deviceType", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "friendlyName") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "friendlyName", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "manufacturer") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "manufacturer", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "manufacturerURL") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "manufacturerURL", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "modelDescription") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "modelDescription", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "modelName") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "modelName", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "modelNumber") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "modelNumber", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "modelURL") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "modelURL", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "serialNumber") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "serialNumber", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "UDN") == 0 && new_device_discovery) {
|
||||
+ snprintf(buf, sizeof(buf), "%s", elm_val ? elm_val : "");
|
||||
+ blobmsg_add_string(bb, "UDN", buf);
|
||||
+ }
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "UPC") == 0 && new_device_discovery)
|
||||
+ blobmsg_add_string(bb, "UPC", elm_val ? elm_val : "");
|
||||
+
|
||||
+ b = mxmlWalkNext(b, device, MXML_DESCEND);
|
||||
+ }
|
||||
+
|
||||
+ if (new_device_discovery && device_obj)
|
||||
+ blobmsg_close_table(bb, device_obj);
|
||||
+}
|
||||
+
|
||||
+static void fill_service_element(struct blob_buf *bb, mxml_node_t *service)
|
||||
+{
|
||||
+ mxml_node_t *b = service;
|
||||
+ void *service_obj = NULL;
|
||||
+ char buf[64] = {0};
|
||||
+ bool new_srv_discovery = false;
|
||||
+
|
||||
+ while (b) {
|
||||
+
|
||||
+ if (mxmlGetType(b) != MXML_ELEMENT) {
|
||||
+ b = mxmlWalkNext(b, service, MXML_DESCEND);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ const char *elm_name = mxmlGetElement(b);
|
||||
+ const char *elm_val = mxmlGetOpaque(b);
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "UDN") == 0)
|
||||
+ snprintf(buf, sizeof(buf), "%s", elm_val ? elm_val : "");
|
||||
+
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "service") == 0) {
|
||||
+
|
||||
+ if (new_srv_discovery && service_obj)
|
||||
+ blobmsg_close_table(bb, service_obj);
|
||||
+
|
||||
+ service_obj = blobmsg_open_table(bb, NULL);
|
||||
+ blobmsg_add_string(bb, "parent_dev", buf);
|
||||
+ new_srv_discovery = true;
|
||||
+ }
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "serviceType") == 0 && new_srv_discovery)
|
||||
+ blobmsg_add_string(bb, "serviceType", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "serviceId") == 0 && new_srv_discovery)
|
||||
+ blobmsg_add_string(bb, "serviceId", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "SCPDURL") == 0 && new_srv_discovery)
|
||||
+ blobmsg_add_string(bb, "SCPDURL", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "controlURL") == 0 && new_srv_discovery)
|
||||
+ blobmsg_add_string(bb, "controlURL", elm_val ? elm_val : "");
|
||||
+
|
||||
+ if (elm_name && strcmp(elm_name, "eventSubURL") == 0 && new_srv_discovery)
|
||||
+ blobmsg_add_string(bb, "eventSubURL", elm_val ? elm_val : "");
|
||||
+
|
||||
+ b = mxmlWalkNext(b, service, MXML_DESCEND);
|
||||
+ }
|
||||
+
|
||||
+ if (new_srv_discovery && service_obj)
|
||||
+ blobmsg_close_table(bb, service_obj);
|
||||
+}
|
||||
+
|
||||
+static int upnp_description_res(struct ubus_context *ctx, struct ubus_object *obj __attribute__((unused)),
|
||||
+ struct ubus_request_data *req, const char *method __attribute__((unused)), struct blob_attr *msg __attribute__((unused)))
|
||||
+{
|
||||
+ struct desc_list_elt *desc_elt = NULL;
|
||||
+ struct blob_buf bb = {0};
|
||||
+
|
||||
+ memset(&bb,0,sizeof(struct blob_buf));
|
||||
+ blob_buf_init(&bb, 0);
|
||||
+
|
||||
+ void *desc_array = blobmsg_open_array(&bb, "descriptions");
|
||||
+ list_for_each_entry(desc_elt, &desc_list, list) {
|
||||
+ void *device_obj = blobmsg_open_table(&bb, NULL);
|
||||
+ blobmsg_add_string(&bb, "desc_url", desc_elt->url);
|
||||
+ blobmsg_add_u32(&bb, "is_device_desc", desc_elt->is_device_desc);
|
||||
+ blobmsg_close_table(&bb, device_obj);
|
||||
+
|
||||
+ }
|
||||
+ blobmsg_close_array(&bb, desc_array);
|
||||
+
|
||||
+ list_for_each_entry(desc_elt, &desc_list, list) {
|
||||
+
|
||||
+ FILE *fp = fopen(desc_elt->desc_path, "r");
|
||||
+ if (!fp)
|
||||
+ continue;
|
||||
+
|
||||
+ mxml_node_t *tree = mxmlLoadFile(NULL, fp, MXML_OPAQUE_CALLBACK);
|
||||
+ fclose(fp);
|
||||
+
|
||||
+ if (tree) {
|
||||
+ void *devices_array = blobmsg_open_array(&bb, "devices");
|
||||
+ mxml_node_t *device = mxmlFindElement(tree, tree, "device", NULL, NULL, MXML_DESCEND);
|
||||
+ fill_device_instances(&bb, device);
|
||||
+ blobmsg_close_array(&bb, devices_array);
|
||||
+
|
||||
+ void *services_array = blobmsg_open_array(&bb, "services");
|
||||
+ mxml_node_t *service = mxmlFindElement(tree, tree, "device", NULL, NULL, MXML_DESCEND);
|
||||
+ fill_service_element(&bb, service);
|
||||
+ blobmsg_close_array(&bb, services_array);
|
||||
+
|
||||
+ mxmlDelete(tree);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ubus_send_reply(ctx, req, bb.head);
|
||||
+ blob_buf_free(&bb);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct ubus_method upnp_methods[] = {
|
||||
+ UBUS_METHOD_NOARG("discovery", upnp_discovery_res),
|
||||
+ UBUS_METHOD_NOARG("description", upnp_description_res),
|
||||
+};
|
||||
+
|
||||
+static struct ubus_object_type upnp_type = UBUS_OBJECT_TYPE("upnp", upnp_methods);
|
||||
+
|
||||
+static void upnp_discover_devices(struct uloop_timeout *timeout __attribute__((unused)))
|
||||
+{
|
||||
+ __upnp_discover_devices();
|
||||
+}
|
||||
+
|
||||
+static struct ubus_object upnp_object = {
|
||||
+ .name = "upnp",
|
||||
+ .type = &upnp_type,
|
||||
+ .methods = upnp_methods,
|
||||
+ .n_methods = ARRAY_SIZE(upnp_methods),
|
||||
+};
|
||||
+
|
||||
+void upnp_thread_discover_devices(void)
|
||||
+{
|
||||
+ struct ubus_context *ctx = NULL;
|
||||
+ const char *ubus_socket = NULL;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ uloop_init();
|
||||
+
|
||||
+ ctx = ubus_connect(ubus_socket);
|
||||
+ if (!ctx) {
|
||||
+ syslog(LOG_ERR, "Failed to connect to ubus\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ubus_add_uloop(ctx);
|
||||
+
|
||||
+ __upnp_discover_devices();
|
||||
+
|
||||
+ ret = ubus_add_object(ctx, &upnp_object);
|
||||
+ if (ret) {
|
||||
+ syslog(LOG_ERR, "Failed to add 'upnp' ubus object: %s\n", ubus_strerror(ret));
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
+ uloop_run();
|
||||
+
|
||||
+end:
|
||||
+ free_all_desc_list();
|
||||
+ free_all_dev_list();
|
||||
+ uloop_done();
|
||||
+ ubus_free(ctx);
|
||||
+}
|
||||
70
ssdpd/patches/012-ubus-runner-thread-hook
Normal file
70
ssdpd/patches/012-ubus-runner-thread-hook
Normal file
@@ -0,0 +1,70 @@
|
||||
--- a/minissdpd.c
|
||||
+++ b/minissdpd.c
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#endif
|
||||
+/* for uloop thread */
|
||||
+#include <pthread.h>
|
||||
|
||||
/* LOG_PERROR does not exist on Solaris */
|
||||
#ifndef LOG_PERROR
|
||||
@@ -52,6 +54,9 @@
|
||||
#define MIN(x,y) (((x)<(y))?(x):(y))
|
||||
#endif
|
||||
|
||||
+extern char *ssdp_sockpath;
|
||||
+void upnp_thread_discover_devices(void);
|
||||
+
|
||||
/* current request management structure */
|
||||
struct reqelem {
|
||||
int socket;
|
||||
@@ -1220,6 +1225,12 @@ static void ssdpDiscover(int s, int ipv6
|
||||
}
|
||||
}
|
||||
|
||||
+static void *thread_discover_devices(void *args __attribute__((unused)))
|
||||
+{
|
||||
+ upnp_thread_discover_devices();
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
/* main(): program entry point */
|
||||
int main(int argc, char * * argv)
|
||||
{
|
||||
@@ -1264,6 +1275,7 @@ int main(int argc, char * * argv)
|
||||
unsigned char ttl = 2; /* UDA says it should default to 2 */
|
||||
const char * searched_device = NULL; /* if not NULL, search/filter a specific device type */
|
||||
int opt;
|
||||
+ pthread_t upnp_thread;
|
||||
|
||||
LIST_INIT(&reqlisthead);
|
||||
LIST_INIT(&servicelisthead);
|
||||
@@ -1309,6 +1321,7 @@ int main(int argc, char * * argv)
|
||||
break;
|
||||
case 's':
|
||||
sockpath = optarg;
|
||||
+ ssdp_sockpath = optarg;
|
||||
break;
|
||||
#ifndef NO_BACKGROUND_NO_PIDFILE
|
||||
case 'p':
|
||||
@@ -1496,6 +1509,11 @@ int main(int argc, char * * argv)
|
||||
if(s_ssdp6 >= 0)
|
||||
ssdpDiscover(s_ssdp6, 1, searched_device);
|
||||
|
||||
+ int err = pthread_create(&upnp_thread, NULL, &thread_discover_devices, NULL);
|
||||
+ if (err < 0) {
|
||||
+ syslog(LOG_ERR, "Error when creating upnp thread");
|
||||
+ }
|
||||
+
|
||||
/* Main loop */
|
||||
while(!quitting) {
|
||||
/* fill readfds fd_set */
|
||||
@@ -1704,6 +1722,7 @@ quit:
|
||||
if(unlink(pidfilename) < 0)
|
||||
syslog(LOG_ERR, "unlink(%s): %m", pidfilename);
|
||||
#endif
|
||||
+ pthread_join(upnp_thread, NULL);
|
||||
closelog();
|
||||
return ret;
|
||||
}
|
||||
@@ -13,7 +13,7 @@ menu "SULU_CORE"
|
||||
|
||||
config SULU_CORE_VERSION
|
||||
string "SULU repo version"
|
||||
default "472c41d1fe969f4d3b6cf74d27c220a6e2f5a5e0"
|
||||
default "80815db11f7b0c1913ae551ff50ed2c89676f489"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_LCM"
|
||||
@@ -35,7 +35,7 @@ menu "SULU_PLUGIN_LCM"
|
||||
config SULU_PLUGIN_LCM_VERSION
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "Version"
|
||||
default "6258dc0bca7a4bb648a77175ab85913d73851ced"
|
||||
default "ccd70b399b31530dc1af6a871eee94fbb179d794"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_MULTIAP"
|
||||
@@ -57,7 +57,7 @@ menu "SULU_PLUGIN_MULTIAP"
|
||||
config SULU_PLUGIN_MULTIAP_VERSION
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "Version"
|
||||
default "53eef156a02b9e93bd566997b5ff6f47fba29e46"
|
||||
default "3e662d50c5a14225354f6287d1c6a47414b694a6"
|
||||
endmenu
|
||||
|
||||
menu "SULU_THEME_IOPSYS"
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=1.3.11
|
||||
PKG_VERSION:=1.3.24
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=aeb6db93a584cbdc7b5435a4503242833d90ad33
|
||||
PKG_SOURCE_VERSION:=696ef814e0b16345f2e8ee0104f3ee1eeaeea5dc
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -22,7 +22,7 @@ define Package/${PKG_NAME}
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Build sulu from source
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
CONFLICTS:=sulu
|
||||
endef
|
||||
|
||||
@@ -40,7 +40,7 @@ define Download/sulu_core
|
||||
FILE:=$(SULU_DL_FILE)
|
||||
URL:=$(CONFIG_SULU_CORE_URL)
|
||||
PROTO:=git
|
||||
SUBDIR:=core
|
||||
SUBDIR:=sulu
|
||||
VERSION:=${CONFIG_SULU_CORE_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
@@ -139,6 +139,10 @@ ifeq ($(CONFIG_SULU_THEME_CUSTOM_ENABLE),y)
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
VERSION="v${PKG_VERSION}" $(MAKE) -C $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/install
|
||||
$(INSTALL_DIR) $(1)/sulu
|
||||
$(INSTALL_DIR) $(1)/sulu/config
|
||||
@@ -163,15 +167,15 @@ endif
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/conf.d/sulu.conf $(1)/etc/mosquitto/conf.d/
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/sulu.password $(1)/etc/mosquitto/sulu.password
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/conf.d
|
||||
$(INSTALL_DATA) ./files/etc/nginx/conf.d/sulu.conf $(1)/etc/nginx/conf.d/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/sulu
|
||||
$(INSTALL_DATA) ./files/etc/sulu/roles.json $(1)/etc/sulu/
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,${PKG_NAME}))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
config global 'global'
|
||||
option enabled '1'
|
||||
option enable_system_credentials '1'
|
||||
option role_based_access '1'
|
||||
list user 'admin'
|
||||
|
||||
@@ -34,7 +34,7 @@ start_service() {
|
||||
fi
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 1
|
||||
update_nginx_config "${enabled}"
|
||||
update_sulu_connection_port
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
@@ -45,5 +45,5 @@ reload_service() {
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "sulu"
|
||||
procd_add_reload_trigger "sulu" "nginx"
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
server {
|
||||
listen 8080;
|
||||
listen [::]:8080;
|
||||
server_name _sulu;
|
||||
root /sulu;
|
||||
location /config/ {
|
||||
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;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
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';
|
||||
}
|
||||
}
|
||||
}
|
||||
50
sulu-builder/files/etc/sulu/nginx.locations
Normal file
50
sulu-builder/files/etc/sulu/nginx.locations
Normal file
@@ -0,0 +1,50 @@
|
||||
error_page 497 301 =307 https://$host:$server_port$request_uri;
|
||||
|
||||
location /robots.txt {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /sitemap.xml {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /ws {
|
||||
proxy_pass_request_headers on;
|
||||
proxy_cache off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
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;
|
||||
proxy_pass http://websocket;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
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';
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
SULU_CONFIG="/sulu/config/connectionConfig.json"
|
||||
ACL_FILE="/tmp/sulu/mqtt.acl"
|
||||
MB_SULU_CONF="/etc/mosquitto/conf.d/sulu.conf"
|
||||
_RESTART_SERVICES="0"
|
||||
|
||||
mkdir -p /tmp/sulu/
|
||||
@@ -22,9 +20,10 @@ function _get_agent_id()
|
||||
if [ -z "${endpointid}" ]; then
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
echo "${oui}-${serial}"
|
||||
echo "${oui}-${serial//+/%2B}"
|
||||
else
|
||||
echo "$(echo "${endpointid/::/,}"|cut -d "," -f 2)"
|
||||
endpointid="$(echo "${endpointid/::/,}"|cut -d "," -f 2)"
|
||||
endpointid="${endpointid//+/%2B}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -36,9 +35,9 @@ function _get_endpoint_id()
|
||||
if [ -z "${endpointid}" ]; then
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
echo "os::${oui}-${serial}"
|
||||
echo "os::${oui}-${serial//+/%2B}"
|
||||
else
|
||||
echo "${endpointid}"
|
||||
echo "${endpointid//+/%2B}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -47,12 +46,31 @@ function _get_sulu_users()
|
||||
echo "$(uci -q get sulu.global.user)"
|
||||
}
|
||||
|
||||
function _get_sulu_root()
|
||||
{
|
||||
local root
|
||||
|
||||
root="$(uci -q get nginx._sulu_s.root)"
|
||||
echo "${root:-/sulu}"
|
||||
}
|
||||
|
||||
function _get_sulu_tls_port()
|
||||
{
|
||||
local port listen
|
||||
|
||||
listen="$(uci -q get nginx._sulu_s.listen)"
|
||||
port="$(echo $listen|grep -Eo '[0-9]+'|head -n 1)"
|
||||
|
||||
echo "${port:-8443}"
|
||||
}
|
||||
|
||||
function generate_sulu_conn_config()
|
||||
{
|
||||
local rbac users
|
||||
local rbac users SCONFIG
|
||||
|
||||
rbac="${1}"
|
||||
users="$(_get_sulu_users)"
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
|
||||
json_init;
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
@@ -63,8 +81,9 @@ function generate_sulu_conn_config()
|
||||
json_add_object 'connections';
|
||||
json_add_object 'rbac';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' 9001;
|
||||
json_add_string 'protocol' 'ws';
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_array 'auth';
|
||||
json_close_array;
|
||||
|
||||
@@ -83,8 +102,9 @@ function generate_sulu_conn_config()
|
||||
json_add_object 'main';
|
||||
json_add_string 'fromId' 'proto::interop-usp-controller';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' 9001;
|
||||
json_add_string 'protocol' 'ws';
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_string 'publishEndpoint' "/usp/endpoint";
|
||||
json_add_string 'subscribeEndpoint' "/usp/controller";
|
||||
json_add_array 'auth';
|
||||
@@ -92,24 +112,40 @@ function generate_sulu_conn_config()
|
||||
json_close_object;
|
||||
json_close_object;
|
||||
|
||||
json_dump > ${SULU_CONFIG}
|
||||
json_dump > ${SCONFIG}
|
||||
}
|
||||
|
||||
function set_sulu_connection_mode()
|
||||
{
|
||||
local rbac profile config
|
||||
local rbac profile config SCONFIG
|
||||
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
rbac="${1}"
|
||||
|
||||
profile="$(jq '.currentConnection' ${SULU_CONFIG})"
|
||||
profile="$(jq '.currentConnection' ${SCONFIG})"
|
||||
if [ "$rbac" -eq "1" -a "${profile}" == "\"main\"" ]; then
|
||||
config="$(jq '.currentConnection = "rbac"' ${SULU_CONFIG})"
|
||||
echo "${config}" > ${SULU_CONFIG}
|
||||
config="$(jq '.currentConnection = "rbac"' ${SCONFIG})"
|
||||
echo "${config}" > ${SCONFIG}
|
||||
elif [ "$rbac" -eq "0" -a "${profile}" == "\"rbac\"" ]; then
|
||||
config="$(jq '.currentConnection = "main"' ${SULU_CONFIG})"
|
||||
echo "${config}" > ${SULU_CONFIG}
|
||||
config="$(jq '.currentConnection = "main"' ${SCONFIG})"
|
||||
echo "${config}" > ${SCONFIG}
|
||||
fi
|
||||
}
|
||||
|
||||
function update_sulu_connection_port()
|
||||
{
|
||||
local port ws_port SCONF
|
||||
|
||||
SCONF="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
ws_port="$(_get_sulu_tls_port)"
|
||||
|
||||
port="$(jq '.connections.rbac.port' ${SCONF})"
|
||||
if [ "${port}" -ne "${ws_port}" ]; then
|
||||
jq ".connections.main.port = ${ws_port} | .connections.rbac.port = ${ws_port}" ${SCONF} > /tmp/sulu/ss_port.json
|
||||
mv /tmp/sulu/ss_port.json ${SCONF}
|
||||
fi
|
||||
}
|
||||
|
||||
function _update_obuspa_config()
|
||||
{
|
||||
local restart
|
||||
@@ -175,7 +211,7 @@ function _update_obuspa_config_rbac() {
|
||||
|
||||
# Add mqtt
|
||||
sec="mqtt_sulu_${f}"
|
||||
if ! uci_get obuspa mqtt ${sec} >/dev/null 2>&1; then
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa mqtt ${sec}
|
||||
uci_set obuspa ${sec} BrokerAddress "127.0.0.1"
|
||||
uci_set obuspa ${sec} BrokerPort "1883"
|
||||
@@ -185,7 +221,7 @@ function _update_obuspa_config_rbac() {
|
||||
|
||||
# Add mtp
|
||||
sec="mtp_sulu_${f}"
|
||||
if ! uci_get obuspa mtp ${sec} >/dev/null 2>&1; then
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa mtp ${sec}
|
||||
uci_set obuspa ${sec} Protocol "MQTT"
|
||||
uci_set obuspa ${sec} ResponseTopicConfigured "/usp/${agent}/${f}/endpoint"
|
||||
@@ -195,7 +231,7 @@ function _update_obuspa_config_rbac() {
|
||||
|
||||
# Add controller
|
||||
sec="controller_sulu_${f}"
|
||||
if ! uci_get obuspa controller ${sec} >/dev/null 2>&1; then
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa controller ${sec}
|
||||
uci_set obuspa ${sec} EndpointID "self::sulu-${f}"
|
||||
uci_set obuspa ${sec} Protocol "MQTT"
|
||||
@@ -264,6 +300,7 @@ function update_mosquitto_broker_config()
|
||||
{
|
||||
local system_cred rbac restart
|
||||
|
||||
MB_SULU_CONF="/etc/mosquitto/conf.d/sulu.conf"
|
||||
system_cred="${1}"
|
||||
rbac="${2}"
|
||||
restart=0
|
||||
@@ -334,29 +371,6 @@ function update_obuspa_config()
|
||||
fi
|
||||
}
|
||||
|
||||
function update_nginx_config()
|
||||
{
|
||||
local enabled restart
|
||||
|
||||
restart=0
|
||||
enabled="${1:-0}"
|
||||
if [ "${enabled}" -eq "1" ]; then
|
||||
if [ ! -f "/etc/nginx/conf.d/sulu.conf" ]; then
|
||||
cp /etc/sulu/nginx.conf /etc/nginx/conf.d/sulu.conf
|
||||
restart=1
|
||||
fi
|
||||
else
|
||||
if [ -f "/etc/nginx/conf.d/sulu.conf" ]; then
|
||||
rm -f /etc/nginx/conf.d/sulu.conf
|
||||
restart=1
|
||||
fi
|
||||
fi
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -eq "1" ]; then
|
||||
slog "Restarting nginx..."
|
||||
ubus call uci commit '{"config":"nginx"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function configure_sulu()
|
||||
{
|
||||
local sys_cred rbac restart
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
UCI_TEMPLATE="/etc/nginx/uci.conf.template"
|
||||
update_nginx_uci_template()
|
||||
{
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ map $http_upgrade $connection_upgrade { default upgrade; "" close; }' ${UCI_TEMPLATE}
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ upstream websocket { server 127.0.0.1:9001; }' ${UCI_TEMPLATE}
|
||||
}
|
||||
|
||||
update_nginx_uci_template
|
||||
35
sulu-builder/files/etc/uci-defaults/40-add-sulu-nginx-config
Executable file
35
sulu-builder/files/etc/uci-defaults/40-add-sulu-nginx-config
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
add_sulu_nginx_uci()
|
||||
{
|
||||
uci_load nginx
|
||||
|
||||
if ! uci_get nginx _sulu_s >/dev/null 2>&1; then
|
||||
uci_add nginx server _sulu_s
|
||||
uci_set nginx _sulu_s root '/sulu'
|
||||
uci_add_list nginx _sulu_s listen "8443 http2 ssl"
|
||||
uci_add_list nginx _sulu_s listen "[::]:8443 http2 ssl"
|
||||
uci_set nginx _sulu_s server_name '_sulu_s'
|
||||
uci_add_list nginx _sulu_s include 'restrict_locally'
|
||||
uci_add_list nginx _sulu_s include '/etc/sulu/nginx.locations'
|
||||
uci_set nginx _sulu_s uci_manage_ssl 'self-signed'
|
||||
uci_set nginx _sulu_s ssl_certificate '/etc/nginx/conf.d/_lan.crt'
|
||||
uci_set nginx _sulu_s ssl_certificate_key '/etc/nginx/conf.d/_lan.key'
|
||||
uci_set nginx _sulu_s ssl_session_cache 'shared:SSL:32k'
|
||||
uci_set nginx _sulu_s ssl_session_timeout '64m'
|
||||
uci_set nginx _sulu_s access_log 'off; # logd openwrt'
|
||||
fi
|
||||
|
||||
if ! uci_get nginx _suluredirect >/dev/null 2>&1; then
|
||||
uci_add nginx server _suluredirect
|
||||
uci_add_list nginx _suluredirect listen "8080"
|
||||
uci_add_list nginx _suluredirect listen "[::]:8080"
|
||||
uci_set nginx _suluredirect server_name '_suluredirect'
|
||||
uci_set nginx _suluredirect return 'https://$host:8443$request_uri'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
add_sulu_nginx_uci
|
||||
@@ -5,8 +5,6 @@
|
||||
config_load sulu
|
||||
config_get enable_system_credentials global enable_system_credentials 1
|
||||
config_get role_based_access global role_based_access 0
|
||||
config_get enabled global enabled 0
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 0
|
||||
update_nginx_config "${enabled}"
|
||||
generate_sulu_conn_config "${role_based_access}"
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu
|
||||
PKG_VERSION:=1.3.11
|
||||
PKG_VERSION:=1.3.24
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=aeb6db93a584cbdc7b5435a4503242833d90ad33
|
||||
PKG_SOURCE_VERSION:=696ef814e0b16345f2e8ee0104f3ee1eeaeea5dc
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
@@ -27,7 +27,7 @@ define Package/sulu
|
||||
SECTION:=sulu
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=SULU-CE ReactJS based Web UI Package
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow +usermngr +jq
|
||||
endef
|
||||
|
||||
define Package/sulu/description
|
||||
@@ -54,15 +54,15 @@ endif
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/conf.d/sulu.conf $(1)/etc/mosquitto/conf.d/
|
||||
$(INSTALL_DATA) ./files/etc/mosquitto/sulu.password $(1)/etc/mosquitto/sulu.password
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/conf.d
|
||||
$(INSTALL_DATA) ./files/etc/nginx/conf.d/sulu.conf $(1)/etc/nginx/conf.d/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/sulu
|
||||
$(INSTALL_DATA) ./files/etc/sulu/roles.json $(1)/etc/sulu/
|
||||
$(INSTALL_BIN) ./files/etc/sulu/sulu.sh $(1)/etc/sulu/
|
||||
$(INSTALL_DATA) ./files/etc/sulu/nginx.locations $(1)/etc/sulu/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/99-fix-sulu-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/40-add-sulu-nginx-config $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-update-nginx-uci-template $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sulu))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
config global 'global'
|
||||
option enabled '1'
|
||||
option enable_system_credentials '1'
|
||||
option role_based_access '1'
|
||||
list user 'admin'
|
||||
|
||||
@@ -34,7 +34,7 @@ start_service() {
|
||||
fi
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 1
|
||||
update_nginx_config "${enabled}"
|
||||
update_sulu_connection_port
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
@@ -45,5 +45,5 @@ reload_service() {
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "sulu"
|
||||
procd_add_reload_trigger "sulu" "nginx"
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
server {
|
||||
listen 8080;
|
||||
listen [::]:8080;
|
||||
server_name _sulu;
|
||||
root /sulu;
|
||||
location /config/ {
|
||||
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;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
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';
|
||||
}
|
||||
}
|
||||
}
|
||||
50
sulu/files/etc/sulu/nginx.locations
Normal file
50
sulu/files/etc/sulu/nginx.locations
Normal file
@@ -0,0 +1,50 @@
|
||||
error_page 497 301 =307 https://$host:$server_port$request_uri;
|
||||
|
||||
location /robots.txt {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /sitemap.xml {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
||||
location /ws {
|
||||
proxy_pass_request_headers on;
|
||||
proxy_cache off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
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;
|
||||
proxy_pass http://websocket;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
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';
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
SULU_CONFIG="/sulu/config/connectionConfig.json"
|
||||
ACL_FILE="/tmp/sulu/mqtt.acl"
|
||||
MB_SULU_CONF="/etc/mosquitto/conf.d/sulu.conf"
|
||||
_RESTART_SERVICES="0"
|
||||
|
||||
mkdir -p /tmp/sulu/
|
||||
@@ -22,9 +20,10 @@ function _get_agent_id()
|
||||
if [ -z "${endpointid}" ]; then
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
echo "${oui}-${serial}"
|
||||
echo "${oui}-${serial//+/%2B}"
|
||||
else
|
||||
echo "$(echo "${endpointid/::/,}"|cut -d "," -f 2)"
|
||||
endpointid="$(echo "${endpointid/::/,}"|cut -d "," -f 2)"
|
||||
endpointid="${endpointid//+/%2B}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -36,9 +35,9 @@ function _get_endpoint_id()
|
||||
if [ -z "${endpointid}" ]; then
|
||||
oui="$(db -q get device.deviceinfo.ManufacturerOUI)"
|
||||
serial="$(db -q get device.deviceinfo.SerialNumber)"
|
||||
echo "os::${oui}-${serial}"
|
||||
echo "os::${oui}-${serial//+/%2B}"
|
||||
else
|
||||
echo "${endpointid}"
|
||||
echo "${endpointid//+/%2B}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -47,12 +46,31 @@ function _get_sulu_users()
|
||||
echo "$(uci -q get sulu.global.user)"
|
||||
}
|
||||
|
||||
function _get_sulu_root()
|
||||
{
|
||||
local root
|
||||
|
||||
root="$(uci -q get nginx._sulu_s.root)"
|
||||
echo "${root:-/sulu}"
|
||||
}
|
||||
|
||||
function _get_sulu_tls_port()
|
||||
{
|
||||
local port listen
|
||||
|
||||
listen="$(uci -q get nginx._sulu_s.listen)"
|
||||
port="$(echo $listen|grep -Eo '[0-9]+'|head -n 1)"
|
||||
|
||||
echo "${port:-8443}"
|
||||
}
|
||||
|
||||
function generate_sulu_conn_config()
|
||||
{
|
||||
local rbac users
|
||||
local rbac users SCONFIG
|
||||
|
||||
rbac="${1}"
|
||||
users="$(_get_sulu_users)"
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
|
||||
json_init;
|
||||
if [ "${rbac}" -eq "1" ]; then
|
||||
@@ -63,8 +81,9 @@ function generate_sulu_conn_config()
|
||||
json_add_object 'connections';
|
||||
json_add_object 'rbac';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' 9001;
|
||||
json_add_string 'protocol' 'ws';
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_array 'auth';
|
||||
json_close_array;
|
||||
|
||||
@@ -83,8 +102,9 @@ function generate_sulu_conn_config()
|
||||
json_add_object 'main';
|
||||
json_add_string 'fromId' 'proto::interop-usp-controller';
|
||||
json_add_string 'toId' "$(_get_endpoint_id)";
|
||||
json_add_int 'port' 9001;
|
||||
json_add_string 'protocol' 'ws';
|
||||
json_add_int 'port' "$(_get_sulu_tls_port)";
|
||||
json_add_string 'path' "/ws";
|
||||
json_add_string 'protocol' 'wss';
|
||||
json_add_string 'publishEndpoint' "/usp/endpoint";
|
||||
json_add_string 'subscribeEndpoint' "/usp/controller";
|
||||
json_add_array 'auth';
|
||||
@@ -92,24 +112,40 @@ function generate_sulu_conn_config()
|
||||
json_close_object;
|
||||
json_close_object;
|
||||
|
||||
json_dump > ${SULU_CONFIG}
|
||||
json_dump > ${SCONFIG}
|
||||
}
|
||||
|
||||
function set_sulu_connection_mode()
|
||||
{
|
||||
local rbac profile config
|
||||
local rbac profile config SCONFIG
|
||||
|
||||
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
rbac="${1}"
|
||||
|
||||
profile="$(jq '.currentConnection' ${SULU_CONFIG})"
|
||||
profile="$(jq '.currentConnection' ${SCONFIG})"
|
||||
if [ "$rbac" -eq "1" -a "${profile}" == "\"main\"" ]; then
|
||||
config="$(jq '.currentConnection = "rbac"' ${SULU_CONFIG})"
|
||||
echo "${config}" > ${SULU_CONFIG}
|
||||
config="$(jq '.currentConnection = "rbac"' ${SCONFIG})"
|
||||
echo "${config}" > ${SCONFIG}
|
||||
elif [ "$rbac" -eq "0" -a "${profile}" == "\"rbac\"" ]; then
|
||||
config="$(jq '.currentConnection = "main"' ${SULU_CONFIG})"
|
||||
echo "${config}" > ${SULU_CONFIG}
|
||||
config="$(jq '.currentConnection = "main"' ${SCONFIG})"
|
||||
echo "${config}" > ${SCONFIG}
|
||||
fi
|
||||
}
|
||||
|
||||
function update_sulu_connection_port()
|
||||
{
|
||||
local port ws_port SCONF
|
||||
|
||||
SCONF="$(_get_sulu_root)/config/connectionConfig.json"
|
||||
ws_port="$(_get_sulu_tls_port)"
|
||||
|
||||
port="$(jq '.connections.rbac.port' ${SCONF})"
|
||||
if [ "${port}" -ne "${ws_port}" ]; then
|
||||
jq ".connections.main.port = ${ws_port} | .connections.rbac.port = ${ws_port}" ${SCONF} > /tmp/sulu/ss_port.json
|
||||
mv /tmp/sulu/ss_port.json ${SCONF}
|
||||
fi
|
||||
}
|
||||
|
||||
function _update_obuspa_config()
|
||||
{
|
||||
local restart
|
||||
@@ -175,7 +211,7 @@ function _update_obuspa_config_rbac() {
|
||||
|
||||
# Add mqtt
|
||||
sec="mqtt_sulu_${f}"
|
||||
if ! uci_get obuspa mqtt ${sec} >/dev/null 2>&1; then
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa mqtt ${sec}
|
||||
uci_set obuspa ${sec} BrokerAddress "127.0.0.1"
|
||||
uci_set obuspa ${sec} BrokerPort "1883"
|
||||
@@ -185,7 +221,7 @@ function _update_obuspa_config_rbac() {
|
||||
|
||||
# Add mtp
|
||||
sec="mtp_sulu_${f}"
|
||||
if ! uci_get obuspa mtp ${sec} >/dev/null 2>&1; then
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa mtp ${sec}
|
||||
uci_set obuspa ${sec} Protocol "MQTT"
|
||||
uci_set obuspa ${sec} ResponseTopicConfigured "/usp/${agent}/${f}/endpoint"
|
||||
@@ -195,7 +231,7 @@ function _update_obuspa_config_rbac() {
|
||||
|
||||
# Add controller
|
||||
sec="controller_sulu_${f}"
|
||||
if ! uci_get obuspa controller ${sec} >/dev/null 2>&1; then
|
||||
if ! uci_get obuspa ${sec} >/dev/null 2>&1; then
|
||||
uci_add obuspa controller ${sec}
|
||||
uci_set obuspa ${sec} EndpointID "self::sulu-${f}"
|
||||
uci_set obuspa ${sec} Protocol "MQTT"
|
||||
@@ -264,6 +300,7 @@ function update_mosquitto_broker_config()
|
||||
{
|
||||
local system_cred rbac restart
|
||||
|
||||
MB_SULU_CONF="/etc/mosquitto/conf.d/sulu.conf"
|
||||
system_cred="${1}"
|
||||
rbac="${2}"
|
||||
restart=0
|
||||
@@ -334,29 +371,6 @@ function update_obuspa_config()
|
||||
fi
|
||||
}
|
||||
|
||||
function update_nginx_config()
|
||||
{
|
||||
local enabled restart
|
||||
|
||||
restart=0
|
||||
enabled="${1:-0}"
|
||||
if [ "${enabled}" -eq "1" ]; then
|
||||
if [ ! -f "/etc/nginx/conf.d/sulu.conf" ]; then
|
||||
cp /etc/sulu/nginx.conf /etc/nginx/conf.d/sulu.conf
|
||||
restart=1
|
||||
fi
|
||||
else
|
||||
if [ -f "/etc/nginx/conf.d/sulu.conf" ]; then
|
||||
rm -f /etc/nginx/conf.d/sulu.conf
|
||||
restart=1
|
||||
fi
|
||||
fi
|
||||
if [ "${_RESTART_SERVICES}" -eq "1" -a "${restart}" -eq "1" ]; then
|
||||
slog "Restarting nginx..."
|
||||
ubus call uci commit '{"config":"nginx"}'
|
||||
fi
|
||||
}
|
||||
|
||||
function configure_sulu()
|
||||
{
|
||||
local sys_cred rbac restart
|
||||
|
||||
10
sulu/files/etc/uci-defaults/01-update-nginx-uci-template
Normal file
10
sulu/files/etc/uci-defaults/01-update-nginx-uci-template
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
UCI_TEMPLATE="/etc/nginx/uci.conf.template"
|
||||
update_nginx_uci_template()
|
||||
{
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ map $http_upgrade $connection_upgrade { default upgrade; "" close; }' ${UCI_TEMPLATE}
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ upstream websocket { server 127.0.0.1:9001; }' ${UCI_TEMPLATE}
|
||||
}
|
||||
|
||||
update_nginx_uci_template
|
||||
35
sulu/files/etc/uci-defaults/40-add-sulu-nginx-config
Executable file
35
sulu/files/etc/uci-defaults/40-add-sulu-nginx-config
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
add_sulu_nginx_uci()
|
||||
{
|
||||
uci_load nginx
|
||||
|
||||
if ! uci_get nginx _sulu_s >/dev/null 2>&1; then
|
||||
uci_add nginx server _sulu_s
|
||||
uci_set nginx _sulu_s root '/sulu'
|
||||
uci_add_list nginx _sulu_s listen "8443 http2 ssl"
|
||||
uci_add_list nginx _sulu_s listen "[::]:8443 http2 ssl"
|
||||
uci_set nginx _sulu_s server_name '_sulu_s'
|
||||
uci_add_list nginx _sulu_s include 'restrict_locally'
|
||||
uci_add_list nginx _sulu_s include '/etc/sulu/nginx.locations'
|
||||
uci_set nginx _sulu_s uci_manage_ssl 'self-signed'
|
||||
uci_set nginx _sulu_s ssl_certificate '/etc/nginx/conf.d/_lan.crt'
|
||||
uci_set nginx _sulu_s ssl_certificate_key '/etc/nginx/conf.d/_lan.key'
|
||||
uci_set nginx _sulu_s ssl_session_cache 'shared:SSL:32k'
|
||||
uci_set nginx _sulu_s ssl_session_timeout '64m'
|
||||
uci_set nginx _sulu_s access_log 'off; # logd openwrt'
|
||||
fi
|
||||
|
||||
if ! uci_get nginx _suluredirect >/dev/null 2>&1; then
|
||||
uci_add nginx server _suluredirect
|
||||
uci_add_list nginx _suluredirect listen "8080"
|
||||
uci_add_list nginx _suluredirect listen "[::]:8080"
|
||||
uci_set nginx _suluredirect server_name '_suluredirect'
|
||||
uci_set nginx _suluredirect return 'https://$host:8443$request_uri'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
add_sulu_nginx_uci
|
||||
@@ -5,8 +5,6 @@
|
||||
config_load sulu
|
||||
config_get enable_system_credentials global enable_system_credentials 1
|
||||
config_get role_based_access global role_based_access 0
|
||||
config_get enabled global enabled 0
|
||||
|
||||
configure_sulu "${enable_system_credentials}" "${role_based_access}" 0
|
||||
update_nginx_config "${enabled}"
|
||||
generate_sulu_conn_config "${role_based_access}"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.1.18
|
||||
PKG_VERSION:=2.1.19
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=0617f1017511854b0e3d384799f2bf63800a27c0
|
||||
PKG_SOURCE_VERSION:=d7a069beab09ee1134ba1bc784c3bc9269df2e23
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/swmodd.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
56
usermngr/Makefile
Normal file
56
usermngr/Makefile
Normal file
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (C) 2022 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=usermngr
|
||||
PKG_VERSION:=1.0.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/usermngr.git
|
||||
PKG_SOURCE_VERSION:=9d5f529e236e03c91e41c421de7702923a24664e
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/usermngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
DEPENDS:= +shadow-utils +libbbf_api
|
||||
TITLE:=Package to add Device.Users. datamodel support
|
||||
endef
|
||||
|
||||
define Package/usermngr/description
|
||||
Package to add Device.Users. datamodel support
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/usermngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/usermngr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/init.d/users $(1)/etc/init.d/users
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/uci-defaults/90-indicate-bootstrap $(1)/etc/uci-defaults/90-indicate-bootstrap
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/uci-defaults/91-sync-shells $(1)/etc/uci-defaults/91-sync-shells
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/libusermngr.so $(1)/usr/lib/bbfdm/libusermngr.so
|
||||
$(INSTALL_BIN) ./files/etc/config/users $(1)/etc/config/users
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,usermngr))
|
||||
7
usermngr/files/etc/config/users
Normal file
7
usermngr/files/etc/config/users
Normal file
@@ -0,0 +1,7 @@
|
||||
config user 'admin'
|
||||
option enabled '1'
|
||||
option remote_access '1'
|
||||
|
||||
config user 'user'
|
||||
option enabled '1'
|
||||
option remote_access '1'
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uspd
|
||||
PKG_VERSION:=2.2.19
|
||||
PKG_VERSION:=2.2.22
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/uspd.git
|
||||
PKG_SOURCE_VERSION:=6d970e79ecffaee9a67908442080add3565e17ca
|
||||
PKG_SOURCE_VERSION:=828abe8f0234eb7cd36115bb2e4a5b4113c0510f
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -3,3 +3,4 @@ config uspd 'usp'
|
||||
option debug '0'
|
||||
option loglevel '1'
|
||||
option refresh_time '5'
|
||||
option transaction_timeout '10'
|
||||
|
||||
@@ -4,19 +4,21 @@
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
export LIBVOICE_MAKE_OPTS:=$(TOPDIR)/tmp/.libvoice-opts.mk
|
||||
include $(TOPDIR)/rules.mk
|
||||
-include $(LIBVOICE_MAKE_OPTS)
|
||||
|
||||
PKG_NAME:=voicemngr
|
||||
PKG_VERSION:=0.1
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
LOCAL_SRC_DIR:=~/git/voip/voicemngr
|
||||
LOCAL_SRC_DIR:=~/git/voip/$(PKG_NAME)
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/voicemngr.git
|
||||
PKG_SOURCE_VERSION:=13a14593daa610a87c363a1a0acd19f31f405a71
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
|
||||
PKG_SOURCE_VERSION:=8cdd77393ac6a631649eac71ff33603bfc2b55b3
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -25,29 +27,22 @@ endif
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
TARGET_PLATFORM:=
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_PLATFORM:=BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_qualcomm),y)
|
||||
TARGET_PLATFORM:=QUALCOMM
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
export CONFIG_BRCM_SDK_VER_504040
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
define Package/voicemngr
|
||||
export LIBVOICE_CFLAGS
|
||||
export LIBVOICE_LIBS
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=IOPSYS Voice Manager
|
||||
URL:=
|
||||
DEPENDS:= +libubox +ubus +libpicoevent +uci +TARGET_brcmbca:bcmkernel +TARGET_iopsys_qualcomm:vtsp
|
||||
DEPENDS:= +libubox +ubus +libpicoevent +uci +TARGET_brcmbca:bcmkernel +TARGET_brcmbca:libvoice-broadcom \
|
||||
+TARGET_ipq95xx:libvoice-d2
|
||||
endef
|
||||
|
||||
define Package/voicemngr/description
|
||||
define Package/$(PKG_NAME)/description
|
||||
Voice manager is a daemon that bridges Asterisk and platform specific DSP/SLIC APIs
|
||||
endef
|
||||
|
||||
@@ -55,16 +50,22 @@ ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
@echo "Building from the local source. TARGET_PLATFORM=$(TARGET_PLATFORM)"
|
||||
rsync -av --exclude=.* $(LOCAL_SRC_DIR)/* $(PKG_BUILD_DIR)/
|
||||
$(LN) $(LIBVOICE_PKG_BUILD_DIR)/*.[ch] $(PKG_BUILD_DIR)/libvoice/
|
||||
endef
|
||||
else
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(LN) $(LIBVOICE_PKG_BUILD_DIR)/*.[ch] $(PKG_BUILD_DIR)/libvoice/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/voicemngr/install
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/voicemngr $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
|
||||
$(CP) $(PKG_BUILD_DIR)/libvoice/libvoice.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,voicemngr))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
menu "Configuration"
|
||||
|
||||
config WFA_DELM_MULTIAP_MODE
|
||||
bool "Enable Multi-AP mode"
|
||||
default y
|
||||
config DECOLLECTOR_EASYMESH_VERSION
|
||||
int "Support Easymesh version"
|
||||
default 2
|
||||
|
||||
config WIFI_DELM_DEBUG
|
||||
bool "Enable debug logs"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wfadatad
|
||||
PKG_VERSION:=2.10.0.4
|
||||
PKG_VERSION:=2.11.0.4
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b5b6e881b110d86c6ea725c30c1be4de77e9ecfb
|
||||
PKG_SOURCE_VERSION:=24dcb18f3e60082c70ab17b0707073fd2981f0a9
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wfadatad.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -73,6 +73,7 @@ endif
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_DECOLLECTOR_EASYMESH_VERSION)
|
||||
|
||||
EXECS := \
|
||||
$(if $(CONFIG_PACKAGE_wfadatad),agent/deagent) \
|
||||
|
||||
Reference in New Issue
Block a user