diff options
author | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2018-08-11 19:03:54 +0100 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2018-11-25 19:53:46 -0600 |
commit | f68ac2636c9129984600257b059d38018877244f (patch) | |
tree | c8be47045f9ec76e9ef10d994a798b4f29246aa4 /rc.inet1 | |
parent | 895aa3741e87e38b75373f5f870517cf5b8751c4 (diff) | |
download | slacknetsetup-f68ac2636c9129984600257b059d38018877244f.tar.xz |
Flush and down interface if configuration fails
Signed-off-by: Robby Workman <rworkman@slackware.com>
Diffstat (limited to 'rc.inet1')
-rw-r--r-- | rc.inet1 | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -198,6 +198,8 @@ if_up() { IF_UP=1 else echo "/etc/rc.d/rc.inet1: failed to obtain DHCP lease for ${1}" | $LOGGER + /sbin/ip address flush dev ${1} + /sbin/ip link set dev ${1} down fi fi if [ "${USE_DHCP[$i]}" != "yes" ] && [ -n "${IPADDR[$i]}" ]; then # add a fixed v4 IP to the interface @@ -211,6 +213,8 @@ if_up() { IF_UP=1 else echo "/etc/rc.d/rc.inet1: failed to a set IP ${IPADDR[$i]} for ${1}" | $LOGGER + /sbin/ip address flush dev ${1} + /sbin/ip link set dev ${1} down fi fi if [ "${USE_DHCP6[$i]}" != "yes" ] && [ -n "${IPADDR6[$i]}" ]; then # add a fixed v6 IP to the interface @@ -224,10 +228,15 @@ if_up() { IF_UP=1 else echo "/etc/rc.d/rc.inet1: failed to a set IP ${IPADDR6[$i]} for ${1}" | $LOGGER + if (($IF_UP != 1)); then # a v4 address was configured, don't flush it + /sbin/ip address flush dev ${1} + /sbin/ip link set dev ${1} down + fi fi fi +# FIXME: Remove the ipaddr6 test? if [ "${USE_DHCP6[$i]}" != "yes" ] && [ -z "${IPADDR6[$i]}" ] && \ - [ "${USE_AUTOCONF6[$i]}" = "yes" ]; then # interface should configure itself via stateless auto config: + [ "${USE_AUTOCONF6[$i]}" = "yes" ]; then # interface should configure itself via stateless auto config echo "/etc/rc.d/rc.inet1: using Router Advertisement stateless auto configuration for ${1}" | $LOGGER # Enable accepting of router advertisment packets, and auto configuration of interfaces: echo "1" >/proc/sys/net/ipv6/conf/$1/accept_ra @@ -240,9 +249,10 @@ if_up() { sleep 0.5 done if (($IF_UP != 1)); then - /sbin/ip link set dev ${1} down echo "Timed out!" echo "/etc/rc.d/rc.inet1: failed to auto configure ${1} after 15 seconds" | $LOGGER + /sbin/ip address flush dev ${1} + /sbin/ip link set dev ${1} down fi fi if (($IF_UP == 1)); then # only do further config if the interface came up |