Compare commits

...

1 Commits

Author SHA1 Message Date
vdutta
268265818d Config option to select ssl utility library 2022-03-04 14:45:38 +05:30
8 changed files with 142 additions and 65 deletions

View File

@@ -1,7 +1,5 @@
if PACKAGE_libbbfdm
menu "Configuration"
config BBF_VENDOR_EXTENSION
bool "Enable Vendor Extension"
default y
@@ -33,5 +31,19 @@ config BBFDM_ENABLE_JSON_PLUGIN
config BBFDM_ENABLE_DOTSO_PLUGIN
bool "Enable shared library plugin to extend datamodel"
default n
endmenu
choice
prompt "Select SSL utility"
default BBF_USE_WOLFSSL
config BBF_USE_WOLFSSL
bool "Use WolfSSL for ssl utilities"
select CONFIG_PACKAGE_libwolfssl
config BBF_USE_OPENSSL
bool "Use OpenSSL for ssl utilities"
select CONFIG_PACKAGE_libopenssl
endchoice
endif

View File

@@ -9,7 +9,7 @@ PKG_VERSION:=6.6.5
PKG_FIXUP:=autoreconf
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=e3fe55623b73d6da33d3a1915bd3d8877ba028a0
PKG_SOURCE_VERSION:=8675f66168482e7e3f07e0cf7b092c80c7aead3a
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
@@ -27,7 +27,7 @@ define Package/libbbf_api
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Library for libbbfdm API
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libopenssl +libwolfssl
endef
define Package/libbbfdm
@@ -35,7 +35,8 @@ define Package/libbbfdm
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Library for broadband-forum data model
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libtrace +libbbf_api +libwolfssl +libcurl
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libtrace +libbbf_api +libcurl +libopenssl +libwolfssl
MENU:=1
endef
define Package/libbbfdm/config
@@ -76,11 +77,6 @@ CONFIGURE_ARGS += \
--enable-tr143
endif
ifeq ($(CONFIG_PACKAGE_libwolfssl),y)
CONFIGURE_ARGS += \
--enable-libssl
endif
ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
CONFIGURE_ARGS += \
--enable-vendor-extension
@@ -101,6 +97,18 @@ CONFIGURE_ARGS += \
--enable-shared-library
endif
ifeq ($(CONFIG_BBF_USE_WOLFSSL), y)
CONFIGURE_ARGS += --enable-libwolfssl
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/wolfssl
TARGET_LDFLAGS += "-lwolfssl"
endif
ifeq ($(CONFIG_BBF_USE_OPENSSL), y)
CONFIGURE_ARGS += --enable-libopenssl
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/
TARGET_LDFLAGS += "-lssl"
endif
define Package/libbbf_api/install
$(INSTALL_DIR) $(1)/lib
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/.libs/libbbf_api.so* $(1)/lib/

View File

@@ -1,6 +1,5 @@
if PACKAGE_icwmp
menu "Configuration"
choice
prompt "Select ACS sever"
default CWMP_ACS_MULTI
@@ -19,6 +18,19 @@ config CWMP_DEBUG
config CWMP_DEVEL_DEBUG
bool "Compile with development debug options"
default n
endmenu
choice
prompt "Select SSL utility"
default CWMP_USE_WOLFSSL
config CWMP_USE_WOLFSSL
bool "Use WolfSSL for ssl utilities"
select CONFIG_PACKAGE_libwolfssl
config CWMP_USE_OPENSSL
bool "Use OpenSSL for ssl utilities"
select CONFIG_PACKAGE_libopenssl
endchoice
endif

View File

@@ -8,11 +8,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=8.3.0
PKG_VERSION:=8.3.1
PKG_FIXUP:=autoreconf
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=9bd32215e6b9b82c1ac152d58a66b468855d3b48
PKG_SOURCE_VERSION:=de67b77b52dd46df9145c1c26a6bb0c5a03596c6
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
@@ -36,7 +36,8 @@ define Package/$(PKG_NAME)
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=CWMP client
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libwolfssl +curl +libcurl
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libwolfssl +curl +libcurl +libopenssl
MENU := 1
endef
define Package/$(PKG_NAME)/description
@@ -78,6 +79,18 @@ CONFIGURE_ARGS += \
--enable-devel
endif
ifeq ($(CONFIG_CWMP_USE_WOLFSSL), y)
CONFIGURE_ARGS += --enable-libwolfssl
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/wolfssl
TARGET_LDFLAGS += "-lwolfssl"
endif
ifeq ($(CONFIG_CWMP_USE_OPENSSL), y)
CONFIGURE_ARGS += --enable-libopenssl
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/
TARGET_LDFLAGS += "-lssl"
endif
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc/icwmpd
$(INSTALL_DIR) $(1)/usr/sbin

View File

@@ -1,24 +1,27 @@
#!/bin/sh
log() {
echo $@ |logger -t cwmp.update -p info
echo "$@" |logger -t cwmp.update -p info
}
handle_icwmp_update() {
local defwan=$(uci -q get cwmp.cpe.default_wan_interface)
local vendorspecinf=`ifstatus ${defwan} | jsonfilter -e "@.data.vendorspecinf"`
local defwan vendorspecinf update
log "Handling dhcp option value ${vendorspecinf}"
update="0"
defwan="$(uci -q get cwmp.cpe.default_wan_interface)"
vendorspecinf="$(ifstatus "${defwan}" | jsonfilter -e "@.data.vendorspecinf")"
log "Handling dhcp option value [${vendorspecinf}]"
[ -n "$vendorspecinf" ] && {
local update=""
local url=""
local old_url="$(uci -q get cwmp.acs.dhcp_url)"
local prov_code=""
local old_prov_code="$(uci -q get cwmp.cpe.dhcp_provisioning_code)"
local min_wait_interval=""
local old_min_wait_interval="$(uci -q get cwmp.acs.dhcp_retry_min_wait_interval)"
local retry_interval_multiplier=""
local old_retry_interval_multiplier="$(uci -q get cwmp.acs.dhcp_retry_interval_multiplier)"
local url old_url
local prov_code old_prov_code
local min_wait_interval old_min_wait_interval
local retry_interval_multiplier old_retry_interval_multiplier
old_url="$(uci -q get cwmp.acs.dhcp_url)"
old_prov_code="$(uci -q get cwmp.cpe.dhcp_provisioning_code)"
old_min_wait_interval="$(uci -q get cwmp.acs.dhcp_retry_min_wait_interval)"
old_retry_interval_multiplier="$(uci -q get cwmp.acs.dhcp_retry_interval_multiplier)"
case $vendorspecinf in
http://*|https://*)
@@ -28,16 +31,16 @@ handle_icwmp_update() {
for optval in $vendorspecinf; do
case $optval in
1=*)
url="$(echo $optval | cut -d"=" -f2-)"
url="$(echo "$optval" | cut -d"=" -f2-)"
;;
2=*)
prov_code="$(echo $optval | cut -d"=" -f2-)"
prov_code="$(echo "$optval" | cut -d"=" -f2-)"
;;
3=*)
min_wait_interval="$(echo $optval | cut -d"=" -f2-)"
min_wait_interval="$(echo "$optval" | cut -d"=" -f2-)"
;;
4=*)
retry_interval_multiplier="$(echo $optval | cut -d"=" -f2-)"
retry_interval_multiplier="$(echo "$optval" | cut -d"=" -f2-)"
;;
esac
done
@@ -72,11 +75,19 @@ handle_icwmp_update() {
update=1
fi
fi
if [ -n "$update" ]; then
log "Restarting icwmp"
ubus call uci commit '{"config":"cwmp"}'
fi
}
if [ "${update}" -eq "1" ]; then
log "CWMP uci changes, reload cwmp with uci commit"
ubus call uci commit '{"config":"cwmp"}'
else
if ubus list tr069 >/dev/null 2>&1 ; then
log "Trigger out of bound inform"
ubus call tr069 inform
else
log "Restarting icwmp tr069 object not found"
/etc/init.d/icwmpd restart
fi
fi
}
handle_icwmp_update

View File

@@ -36,7 +36,7 @@ enable_dhcp_option43() {
fi
newreqopts="$reqopts 43"
if [ $proto == "dhcp" ]; then
if [ "${proto}" == "dhcp" ]; then
uci -q set network.$wan.reqopts="$newreqopts"
uci commit network
ubus call network reload
@@ -50,25 +50,25 @@ wait_for_resolvfile() {
local resolvfile="$(uci -q get dhcp.@dnsmasq[0].resolvfile)"
[ -n "$resolvfile" ] || return
while [ ! -f $resolvfile ]; do
while [ ! -f "$resolvfile" ]; do
sleep 1
[ $tm -ge $time ] && break
[ "$tm" -ge "$time" ] && break
tm=$((tm+1))
done
}
set_wan_interface() {
local wan_interface="${1}"
local l3_device=""
local device
if [ -z "${wan_interface}" ]; then
return 0;
return 1;
fi
json_load "$(ifstatus ${wan_interface})"
json_get_var l3_device l3_device
if [ -n "$l3_device" ]; then
uci -q set cwmp.cpe.interface="${l3_device}"
json_load "$(ifstatus "${wan_interface}")"
json_get_var device device
if [ -n "$device" ]; then
uci -q set cwmp.cpe.interface="${device}"
uci -q commit cwmp
fi
}
@@ -161,7 +161,7 @@ validate_defaults() {
return 1;
}
[ -z "${url}" -a -z "${dhcp_url}" ] && {
[ -z "${url}" ] && [ -z "${dhcp_url}" ] && {
log "ACS url is empty can't start"
return 1;
}
@@ -171,23 +171,17 @@ validate_defaults() {
return 1;
}
[ -z "${default_wan_interface}" ] && {
log "Wan interface is empty"
return 1;
}
return 0;
}
boot() {
local dhcp_url=""
local discovery="1"
local dhcp_url dhcp_discovery
config_load cwmp
config_get_bool dhcp_discovery acs dhcp_discovery 1
config_get dhcp_url acs dhcp_url ""
if [ "${dhcp_discovery}" == "enable" -o "${dhcp_discovery}" == "1" ]; then
if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then
if [ -z "${dhcp_url}" ]; then
log "dhcp discovery enabled but no dhcp url, trigger update"
/etc/icwmpd/update.sh
@@ -206,7 +200,7 @@ start_service() {
config_get dhcp_discovery acs dhcp_discovery
config_get wan_interface cpe default_wan_interface "wan"
if [ "$enable_cwmp" = "0" -o "$enable_cwmp" = "false" ]; then
if [ "$enable_cwmp" = "0" ] || [ "$enable_cwmp" = "false" ]; then
log "CWMP is not enabled"
return 0
fi
@@ -215,7 +209,7 @@ start_service() {
set_wan_interface "${wan_interface}"
# Set dhcp option 43 if dhcp discovery enabled
if [ "${dhcp_discovery}" == "enable" -o "${dhcp_discovery}" == "1" ]; then
if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then
enable_dhcp_option43 "${wan_interface}"
fi
@@ -223,20 +217,20 @@ start_service() {
[ -f /usr/sbin/dnsmasq ] && log "Waiting for DNS Proxy to be started ..." && ubus -t 5 wait_for dnsmasq
[ -f /etc/config/dhcp ] && log "Waiting for DNS Server(s) ..." && wait_for_resolvfile 20
# Copy backup data so that if it restart latter on it gets the info
copy_cwmp_etc_files_to_varstate
validate_defaults || {
log "Validation of defaults failed"
return 1;
}
# Copy backup data so that if it restart latter on it gets the info
copy_cwmp_etc_files_to_varstate
procd_open_instance icwmp
procd_set_param command "$PROG"
procd_append_param command -b
procd_set_param respawn \
${respawn_threshold:-5} \
${respawn_timeout:-10} ${respawn_retry:-3}
"${respawn_threshold:-5}" \
"${respawn_timeout:-10}" "${respawn_retry:-3}"
procd_set_param watch network.interface
procd_close_instance

17
stunc/Config.in Normal file
View File

@@ -0,0 +1,17 @@
if PACKAGE_stunc
choice
prompt "Select SSL utility"
default STUNC_USE_WOLFSSL
config STUNC_USE_WOLFSSL
bool "Use WolfSSL for ssl utilities"
select CONFIG_PACKAGE_libwolfssl
config STUNC_USE_OPENSSL
bool "Use OpenSSL for ssl utilities"
select CONFIG_PACKAGE_libopenssl
endchoice
endif

View File

@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=stunc
PKG_VERSION:=1.1.0
PKG_VERSION:=1.1.1
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=eb1dbd92fefdc4282fd3138d421f39cdf04503f4
PKG_SOURCE_VERSION:=86c6fb779b6202bedf58a3322f84b24d3949a5a1
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/stunc.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
@@ -32,17 +32,27 @@ define Package/$(PKG_NAME)
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=BBF STUN Client
DEPENDS:=+libubus +libuci +libubox +libjson-c +libwolfssl +libblobmsg-json +libbbf_api
DEPENDS:=+libubus +libuci +libubox +libjson-c +libwolfssl +libblobmsg-json +libbbf_api +libopenssl
MENU := 1
endef
define Package/$(PKG_NAME)/description
BBF STUN Client
endef
define Package/$(PKG_NAME)/config
source "$(SOURCE)/Config.in"
endef
TARGET_CFLAGS += \
-D_GNU_SOURCE \
-Wall -Werror
ifeq ($(CONFIG_STUNC_USE_WOLFSSL), y)
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/wolfssl
TARGET_LDFLAGS += -lwolfssl
endif
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ~/git/stunc/* $(PKG_BUILD_DIR)/