39 lines
1.2 KiB
Bash
Executable File
39 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
configure_dhcpv6()
|
|
{
|
|
# Alacn, 2018-01-28
|
|
# don't enable send ia-na by it self
|
|
return
|
|
|
|
|
|
|
|
local wanid=${WANID:-0}
|
|
local addrtype; eval addrtype=\${'WANConnectionDevice_'$wanid'_WANIP6Connection_AddressingType':-None}
|
|
|
|
# This script only activates on SLAAC+DHCP configurations
|
|
[ "$addrtype" != 'SLAAC+DHCP' ] && return
|
|
|
|
# We received a RA telling us to try DHCPv6 IANA
|
|
[ "${IFFLAGS%%ra_managed*}" = "${IFFLAGS}" ] && return
|
|
|
|
# Now, try to find a iana in configuration
|
|
local iaidx=0
|
|
local ialist; eval ialist=\${'WANConnectionDevice_'$wanid'_WANIP6Connection_DHCPv6_IA_List':-}
|
|
for iaidx in `strip $ialist`; do
|
|
local iatype; eval iatype=\${'WANConnectionDevice_'$wanid'_WANIP6Connection_DHCPv6_IA_'$iaidx'_Type':-}
|
|
[ "$iatype" != 'na' ] && continue
|
|
|
|
local iaen; eval iaen=\${'WANConnectionDevice_'$wanid'_WANIP6Connection_DHCPv6_IA_'$iaidx'_Enable':-1}
|
|
[ "$iaen" != 1 ] && {
|
|
base_log "Enabling IANA request for $IFNAME" debug
|
|
echo "cd WANConnectionDevice_${wanid}_WANIP6Connection_DHCPv6_IA_${iaidx}; set Enable 1; fcommit" | cli -s
|
|
}
|
|
return
|
|
done
|
|
|
|
base_log "Could not find a valid IANA configuration for $IFNAME, but RA tells us to try DHCPv6 ..." debug
|
|
}
|
|
|
|
configure_dhcpv6
|