diff options
author | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2018-08-12 19:24:53 +0100 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2018-11-25 19:56:51 -0600 |
commit | e296e830894fa98c872479f9f80117899469a397 (patch) | |
tree | 6d1502f3a1bf702afe78fd50a96b7191feafe6e6 /rc.inet1 | |
parent | 0d0d986cf498b6c07b18fc4e9aa53e175a16b169 (diff) | |
download | slacknetsetup-e296e830894fa98c872479f9f80117899469a397.tar.xz |
Added support for AUTOCONF6_TIMEOUT[x] option
Removed unneeded sleep when taking interface down
Signed-off-by: Robby Workman <rworkman@slackware.com>
Diffstat (limited to 'rc.inet1')
-rw-r--r-- | rc.inet1 | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -194,6 +194,8 @@ if_up() { echo "Polling for DHCP server on interface ${1}:" # 15 seconds should be a reasonable default DHCP timeout. 30 was too much. echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS[@]} ${1}" | $LOGGER + # For some reason, -L is given as a hard option to dhcpcd despite it being a conditional option from the tests above. + # No one seems to have noticed since this has been in Slackware for a long time, so keep doing it that way... if /sbin/dhcpcd -L -t "${DHCP_TIMEOUT[$i]:-15}" "${DHCP_OPTIONS[@]}" ${1}; then IF_UP=1 else @@ -210,13 +212,13 @@ if_up() { # Bring the interface up: /sbin/ip link set dev ${1} up echo "Waiting for router announcement on ${1}..." - for ((j = 30; j--;)); do # wait a max of 15 seconds for the interface to configure + for ((j = ${AUTOCONF6_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 "Timed out!" - echo "/etc/rc.d/rc.inet1: failed to auto configure ${1} after 15 seconds" | $LOGGER + echo "/etc/rc.d/rc.inet1: failed to auto configure ${1} after ${AUTOCONF6_TIMEOUT[$i]} seconds" | $LOGGER /sbin/ip address flush dev ${1} /sbin/ip link set dev ${1} down fi @@ -322,12 +324,11 @@ if_down() { echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd $DHCP_OPTIONS -k -d ${1}" | $LOGGER /sbin/dhcpcd $DHCP_OPTIONS -k -d ${1} 2>/dev/null || \ echo "/etc/rc.d/rc.inet1: failed to stop dhcpcd for interface ${1}" | $LOGGER - sleep 0.5 fi # Disable v6 IP auto configuration and RA before trying to clear the IP from the interface: echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf echo "0" >/proc/sys/net/ipv6/conf/$1/accept_ra - sleep 0.5 + sleep 0.5 # allow time for dhcp/ra to unconfigure the interface # Flush any remaining IPs: echo "/etc/rc.d/rc.inet1: /sbin/ip address flush dev ${1}" | $LOGGER /sbin/ip address flush dev ${1} |