mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
obuspa: Support dhcp deployment via option 125
This commit is contained in:
parent
8c70ba4f00
commit
047e533140
4 changed files with 73 additions and 5 deletions
|
|
@ -5,13 +5,13 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=obuspa
|
PKG_NAME:=obuspa
|
||||||
PKG_VERSION:=7.0.2.23
|
PKG_VERSION:=7.0.2.24
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||||
PKG_SOURCE_VERSION:=cb4f6a8370bca0fc350c74f46399b30b71813332
|
PKG_SOURCE_VERSION:=23f8a46822c3a0911abb3c764b6b4106a7bea6a5
|
||||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
|
|
@ -102,6 +102,7 @@ define Package/obuspa/install
|
||||||
$(INSTALL_DIR) $(1)/etc/obuspa
|
$(INSTALL_DIR) $(1)/etc/obuspa
|
||||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
|
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/obuspa $(1)/usr/sbin/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/obuspa $(1)/usr/sbin/
|
||||||
$(INSTALL_BIN) ./files/etc/init.d/obuspa $(1)/etc/init.d/
|
$(INSTALL_BIN) ./files/etc/init.d/obuspa $(1)/etc/init.d/
|
||||||
$(INSTALL_DATA) ./files/etc/config/obuspa $(1)/etc/config/
|
$(INSTALL_DATA) ./files/etc/config/obuspa $(1)/etc/config/
|
||||||
|
|
@ -110,6 +111,8 @@ define Package/obuspa/install
|
||||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/USPAgent.json $(1)/etc/bbfdm/json/USPAgent.json
|
$(INSTALL_DATA) ./files/etc/bbfdm/json/USPAgent.json $(1)/etc/bbfdm/json/USPAgent.json
|
||||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/TransferComplete.json $(1)/etc/bbfdm/json/TransferComplete.json
|
$(INSTALL_DATA) ./files/etc/bbfdm/json/TransferComplete.json $(1)/etc/bbfdm/json/TransferComplete.json
|
||||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
|
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
|
||||||
|
$(INSTALL_BIN) ./files/etc/uci-defaults/02-obuspa-dhcp-option $(1)/etc/uci-defaults/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,obuspa))
|
$(eval $(call BuildPackage,obuspa))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
config obuspa 'global'
|
config obuspa 'global'
|
||||||
option enabled '1'
|
option enabled '1'
|
||||||
option debug '0'
|
option debug '0'
|
||||||
|
option dhcp_discovery '1'
|
||||||
|
option interface 'wan'
|
||||||
option log_level '1'
|
option log_level '1'
|
||||||
option prototrace '0'
|
option prototrace '0'
|
||||||
option db_file '/etc/obuspa/usp.db'
|
option db_file '/etc/obuspa/usp.db'
|
||||||
|
|
|
||||||
|
|
@ -226,8 +226,8 @@ validate_controller_section()
|
||||||
'Path:string' \
|
'Path:string' \
|
||||||
'EnableEncryption:bool' \
|
'EnableEncryption:bool' \
|
||||||
'PeriodicNotifInterval:uinteger' \
|
'PeriodicNotifInterval:uinteger' \
|
||||||
'SessionMode:string:Allow'
|
'SessionMode:string:Allow' \
|
||||||
|
'ProvisioningCode:string'
|
||||||
}
|
}
|
||||||
|
|
||||||
validate_subscription_section()
|
validate_subscription_section()
|
||||||
|
|
@ -319,7 +319,7 @@ configure_controller()
|
||||||
{
|
{
|
||||||
local EndpointID Enable
|
local EndpointID Enable
|
||||||
local Protocol Destination
|
local Protocol Destination
|
||||||
local Topic mqtt stomp assigned_role_name AssignedRole ParameterName
|
local Topic mqtt stomp assigned_role_name AssignedRole ParameterName ProvisioningCode
|
||||||
local Host Port Path EnableEncryption Reference SessionMode PeriodicNotifInterval
|
local Host Port Path EnableEncryption Reference SessionMode PeriodicNotifInterval
|
||||||
local dm_ref sec
|
local dm_ref sec
|
||||||
|
|
||||||
|
|
@ -358,6 +358,10 @@ configure_controller()
|
||||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||||
db_set "${BASEPATH}.EndpointID" "${EndpointID}"
|
db_set "${BASEPATH}.EndpointID" "${EndpointID}"
|
||||||
|
|
||||||
|
if [ -n "${ProvisioningCode}" ]; then
|
||||||
|
db_set "${BASEPATH}.ProvisioningCode" "${ProvisioningCode}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${PeriodicNotifInterval}" ]; then
|
if [ -n "${PeriodicNotifInterval}" ]; then
|
||||||
db_set "${BASEPATH}.PeriodicNotifInterval" "${PeriodicNotifInterval}"
|
db_set "${BASEPATH}.PeriodicNotifInterval" "${PeriodicNotifInterval}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
59
obuspa/files/etc/uci-defaults/02-obuspa-dhcp-option
Normal file
59
obuspa/files/etc/uci-defaults/02-obuspa-dhcp-option
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
configure_dhcp_options() {
|
||||||
|
local enabled inerface discovery
|
||||||
|
config_load obuspa
|
||||||
|
config_get_bool enabled global enabled 1
|
||||||
|
config_get interface global interface "wan"
|
||||||
|
config_get_bool discovery global dhcp_discovery 1
|
||||||
|
|
||||||
|
if [ "${enabled}" -eq 0 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${discovery}" -eq 1 ]; then
|
||||||
|
network_uci_update=0
|
||||||
|
reqopts="$(uci -q get network."${interface}".reqopts)"
|
||||||
|
proto="$(uci -q get network."${interface}".proto)"
|
||||||
|
local req125_present=0
|
||||||
|
|
||||||
|
for ropt in $reqopts; do
|
||||||
|
case $ropt in
|
||||||
|
125) req125_present=1 ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
sendopts="$(uci -q get network."${interface}".sendopts)"
|
||||||
|
opt124="124:"
|
||||||
|
send124_present=0
|
||||||
|
for sopt in $sendopts; do
|
||||||
|
if [[ "$sopt" == "$opt124"* ]]; then
|
||||||
|
send124_present=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${proto}" = "dhcp" ]; then
|
||||||
|
if [ ${req125_present} -eq 0 ]; then
|
||||||
|
newreqopts="$reqopts 125"
|
||||||
|
uci -q set network."${interface}".reqopts="$newreqopts"
|
||||||
|
network_uci_update=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${send124_present} -eq 0 ]; then
|
||||||
|
newsendopts="${sendopts} 124:00:00:0D:E9:04:03:75:73:70"
|
||||||
|
uci -q set network."${interface}".sendopts="$newsendopts"
|
||||||
|
network_uci_update=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${network_uci_update} -eq 1 ]; then
|
||||||
|
uci commit network
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_dhcp_options
|
||||||
Loading…
Add table
Reference in a new issue