From eb0f51a47d1f9dc566fee941738008f2d0bc2463 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Sat, 15 Sep 2018 13:44:51 +0100 Subject: In if_down(), only perform IPv6 operations if IPv6 is active Signed-off-by: Robby Workman --- rc.inet1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rc.inet1 b/rc.inet1 index 22f788d..02c1193 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -367,8 +367,10 @@ if_down() { echo "/etc/rc.d/rc.inet1: failed to stop dhcpcd for interface ${1}" | $LOGGER 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 + if [ -e /proc/sys/net/ipv6 ]; then + echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf + echo "0" >/proc/sys/net/ipv6/conf/$1/accept_ra + fi 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 @@ -377,8 +379,10 @@ if_down() { echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} down" | $LOGGER /sbin/ip link set dev ${1} down # Reset autoconf and accept_ra back to defaults: - cat /proc/sys/net/ipv6/conf/default/autoconf >/proc/sys/net/ipv6/conf/$1/autoconf - cat /proc/sys/net/ipv6/conf/default/accept_ra >/proc/sys/net/ipv6/conf/$1/accept_ra + if [ -e /proc/sys/net/ipv6 ]; then + cat /proc/sys/net/ipv6/conf/default/autoconf >/proc/sys/net/ipv6/conf/$1/autoconf + cat /proc/sys/net/ipv6/conf/default/accept_ra >/proc/sys/net/ipv6/conf/$1/accept_ra + fi # Kill wireless daemons if any: if [ -x /etc/rc.d/rc.wireless ]; then . /etc/rc.d/rc.wireless ${1} stop -- cgit v1.2.3