mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
obuspa: Fix dhcp opt125 for controller discovery
This commit is contained in:
parent
0d9ca4aa94
commit
aeb966b798
3 changed files with 89 additions and 60 deletions
|
|
@ -108,8 +108,8 @@ define Package/obuspa/install
|
|||
echo "$(CONFIG_BBF_VENDOR_PREFIX)" > $(1)/etc/obuspa/vendor_prefix
|
||||
$(INSTALL_DATA) ./files/etc/obuspa/dmcaching_exclude.json $(1)/etc/obuspa/dmcaching_exclude.json
|
||||
$(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) ./files/etc/uci-defaults/60-generate-ctrust-defaults $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/obuspa-set-dhcp-option $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_obuspa_opt125.user
|
||||
$(BBFDM_INSTALL_CORE_PLUGIN) ./files/etc/bbfdm/json/USPAgent.json $(1)
|
||||
ifeq ($(CONFIG_OBUSPA_ENABLE_TEST_CONTROLLER),y)
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
#!/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
|
||||
88
obuspa/files/etc/uci-defaults/obuspa-set-dhcp-option
Normal file
88
obuspa/files/etc/uci-defaults/obuspa-set-dhcp-option
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
get_access_role()
|
||||
{
|
||||
local mode lan_proto
|
||||
|
||||
lan_proto="$(uci -q get network.lan.proto)"
|
||||
|
||||
if [ "${lan_proto}" == "dhcp" ]; then
|
||||
mode="extender"
|
||||
else
|
||||
mode="full_access"
|
||||
fi
|
||||
|
||||
echo "$mode"
|
||||
}
|
||||
|
||||
configure_dhcp_options() {
|
||||
local enabled inerface discovery
|
||||
config_load obuspa
|
||||
config_get_bool enabled global enabled 1
|
||||
config_get interface global interface
|
||||
config_get_bool discovery global dhcp_discovery 1
|
||||
|
||||
if [ "${enabled}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "${discovery}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "${interface}" ]; then
|
||||
role="$(get_access_role)"
|
||||
|
||||
if [ "${role}" = "extender" ]; then
|
||||
interface="lan"
|
||||
uci -q set obuspa.global.interface="lan"
|
||||
uci commit obuspa
|
||||
else
|
||||
interface="wan"
|
||||
fi
|
||||
fi
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
configure_dhcp_options
|
||||
Loading…
Add table
Reference in a new issue