summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren 'Tadgy' Austin <darren@afterdark.org.uk>2018-07-28 00:01:15 +0100
committerRobby Workman <rworkman@slackware.com>2018-11-25 19:01:46 -0600
commit715b71ad6a647d99559bf19cda2e3df9b56e0090 (patch)
treed17ac6a39f4f8e1519f8d321e24ae9dc90b4eff7
parentb39783acaf7739d459450dea0e7c1094dbf6a4b9 (diff)
downloadslacknetsetup-715b71ad6a647d99559bf19cda2e3df9b56e0090.tar.xz
Set autoconf to 0 for dhcp/fixed IP, 1 for stateless autoconfig
Signed-off-by: Robby Workman <rworkman@slackware.com>
-rw-r--r--rc.inet111
1 files changed, 5 insertions, 6 deletions
diff --git a/rc.inet1 b/rc.inet1
index ae37ff6..8701c9f 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -157,12 +157,6 @@ if_up() {
if [ -e /sys/class/net/${1%%:*} ]; then # interface exists
if ! /sbin/ip address show permanent scope global dev ${1} 2>/dev/null | grep -Ewq '(inet|inet6)' || \
! /sbin/ip link show dev ${1} | grep -wq "state UP" ; then # interface not up or not configured
- # Enable/disable v6 IP auto configuration.
- if [ "${USE_STATELESS[$i]}" = "yes" ]; then
- echo "1" >/proc/sys/net/ipv6/conf/$1/autoconf
- else
- echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf
- fi
if [ -n "${HWADDR[$i]}" ]; then # Set hardware address _before_ the interface goes up:
echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} address ${HWADDR[$i]}" | $LOGGER
/sbin/ip link set dev ${1} address ${HWADDR[$i]}
@@ -175,6 +169,8 @@ if_up() {
. /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters
fi
if [ "${USE_DHCP[$i]}" = "yes" ] || [ "${USE_DHCP6[$i]}" = "yes" ]; then # use dhcpcd to bring interface up
+ # Disable v6 IP auto configuration.
+ echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf
# Clear DHCP_OPTIONS before adding new options to it:
unset DHCP_OPTIONS
# Set DHCP_OPTIONS for this interface:
@@ -225,6 +221,8 @@ if_up() {
fi
fi
elif [ -n "${IPADDR[$i]}" ] || [ -n "${IPADDR6[$i]}" ]; then # use a fixed IP to bring interface up
+ # Disable v6 IP auto configuration.
+ echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf
if [ -n "${IPADDR[$i]}" ]; then # skip unconfigured interfaces
# Set up the network card:
echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1}" | $LOGGER
@@ -252,6 +250,7 @@ if_up() {
fi
elif [ "${USE_STATELESS[$i]}" = "yes" ]; then # interface should configure itself via stateless RA auto config
echo "/etc/rc.d/rc.inet1: using stateless Router Advertisement auto configuration for ${1}" | $LOGGER
+ echo "1" >/proc/sys/net/ipv6/conf/$1/autoconf
else # interface is unconfigured
debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf"
fi