From e296e830894fa98c872479f9f80117899469a397 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Sun, 12 Aug 2018 19:24:53 +0100 Subject: Added support for AUTOCONF6_TIMEOUT[x] option Removed unneeded sleep when taking interface down Signed-off-by: Robby Workman --- rc.inet1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'rc.inet1') diff --git a/rc.inet1 b/rc.inet1 index 8f3318b..a919e28 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -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} -- cgit v1.2.3