diff options
author | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2021-03-07 00:18:27 +0000 |
---|---|---|
committer | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2021-03-07 00:18:27 +0000 |
commit | 3e1ccbec898c6bff7755061bfe698b8004b4d994 (patch) | |
tree | 550c1cf21dd55980de45bfda7044f23ef0bc2af1 | |
parent | 632052d77a10b3ab41ffa2bf2bd0da4188a0aec8 (diff) | |
download | slacknetsetup-3e1ccbec898c6bff7755061bfe698b8004b4d994.tar.xz |
Move configuration of SLACC before DHCP.
This seems to improve the ability to obtain a SLAAC address without
waiting for up to 5 minutes. Thanks to davjohn on LQ for the patch.
-rw-r--r-- | rc.inet1 | 58 |
1 files changed, 29 insertions, 29 deletions
@@ -323,6 +323,35 @@ if_up() { debug_log "/sbin/ip address flush dev ${1}" /sbin/ip address flush dev ${1} IF_UP=0 + if [ -e /proc/sys/net/ipv6 ] && [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" = "yes" ]; then # configure via SLAAC + info_log "${1}: enabling SLAAC" + # Enable accepting of RA packets, unless explicitly configured not to: + if [ "${USE_RA[$i]}" = "no" ]; then + debug_log "${1}: ignoring IPv6 RA" + echo "0" >/proc/sys/net/ipv6/conf/${1}/accept_ra + else + debug_log "${1}: accepting IPv6 RA" + echo "1" >/proc/sys/net/ipv6/conf/${1}/accept_ra + fi + # Enable auto configuration of interfaces: + echo "1" >/proc/sys/net/ipv6/conf/${1}/autoconf + # Bring the interface up: + debug_log "/sbin/ip link set dev ${1} up" + /sbin/ip link set dev ${1} up + echo "${1}: waiting for router announcement" + for ((j = ${SLAAC_TIMEOUT[$i]:=15} * 2; j--;)); do # by default, wait a max of 15 seconds for the interface to configure + /sbin/ip -6 address show dynamic dev ${1} 2>/dev/null | grep -Ewq 'inet6' && { IF_UP=1; break; } + sleep 0.5 + done + if ((IF_UP != 1)); then + echo "${1}: timed out" + info_log "${1}: failed to auto configure after ${SLAAC_TIMEOUT[$i]} seconds" + debug_log "/sbin/ip address flush dev ${1}" + /sbin/ip address flush dev ${1} + debug_log "/sbin/ip link set dev ${1} down" + /sbin/ip link set dev ${1} down + fi + fi # Slackware historically favours dynamic configuration over fixed IP to configure interfaces, so keep that tradition: if [ "${USE_DHCP[$i]}" = "yes" ] || { [ -e /proc/sys/net/ipv6 ] && [ "${USE_DHCP6[$i]}" = "yes" ]; }; then # use dhcpcd info_log "${1}: starting dhcpcd" @@ -368,35 +397,6 @@ if_up() { /sbin/ip link set dev ${1} down fi fi - if [ -e /proc/sys/net/ipv6 ] && [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" = "yes" ]; then # configure via SLAAC - info_log "${1}: enabling SLAAC" - # Enable accepting of RA packets, unless explicitly configured not to: - if [ "${USE_RA[$i]}" = "no" ]; then - debug_log "${1}: ignoring IPv6 RA" - echo "0" >/proc/sys/net/ipv6/conf/${1}/accept_ra - else - debug_log "${1}: accepting IPv6 RA" - echo "1" >/proc/sys/net/ipv6/conf/${1}/accept_ra - fi - # Enable auto configuration of interfaces: - echo "1" >/proc/sys/net/ipv6/conf/${1}/autoconf - # Bring the interface up: - debug_log "/sbin/ip link set dev ${1} up" - /sbin/ip link set dev ${1} up - echo "${1}: waiting for router announcement" - for ((j = ${SLAAC_TIMEOUT[$i]:=15} * 2; j--;)); do # by default, wait a max of 15 seconds for the interface to configure - /sbin/ip -6 address show dynamic dev ${1} 2>/dev/null | grep -Ewq 'inet6' && { IF_UP=1; break; } - sleep 0.5 - done - if ((IF_UP != 1)); then - echo "${1}: timed out" - info_log "${1}: failed to auto configure after ${SLAAC_TIMEOUT[$i]} seconds" - debug_log "/sbin/ip address flush dev ${1}" - /sbin/ip address flush dev ${1} - debug_log "/sbin/ip link set dev ${1} down" - /sbin/ip link set dev ${1} down - fi - fi if [ -e /proc/sys/net/ipv6 ] && [ -n "${IP6ADDRS[$i]}" ]; then # add v6 IPs info_log "${1}: setting IPv6 addresses" # IPv6's Duplicate Address Detection (DAD) causes a race condition when bringing up interfaces, as |