summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren 'Tadgy' Austin <darren@afterdark.org.uk>2018-09-15 13:44:51 +0100
committerRobby Workman <rworkman@slackware.com>2018-11-26 02:04:37 -0600
commiteb0f51a47d1f9dc566fee941738008f2d0bc2463 (patch)
tree9e6d713bd483bba98222db15a0e2db7466d588d6
parent8d3ed3a4ddcf35b75f7d99b75852ef420740c72c (diff)
downloadslacknetsetup-eb0f51a47d1f9dc566fee941738008f2d0bc2463.tar.xz
In if_down(), only perform IPv6 operations if IPv6 is active
Signed-off-by: Robby Workman <rworkman@slackware.com>
-rw-r--r--rc.inet112
1 files 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