summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rc.inet148
1 files changed, 23 insertions, 25 deletions
diff --git a/rc.inet1 b/rc.inet1
index a606205..8f3318b 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -174,7 +174,7 @@ if_up() {
# Disable Router Advertisment for this interface until it's needed:
echo "0" >/proc/sys/net/ipv6/conf/$1/accept_ra
IF_UP=0
- # Slackware historically favours DHCP over fixed IP to configure interfaces, so keep that tradition:
+ # Slackware historically favours dynamic configuration over fixed IP to configure interfaces, so keep that tradition:
if [ "${USE_DHCP[$i]}" = "yes" ] || [ "${USE_DHCP6[$i]}" = "yes" ]; then # use dhcpcd to bring interface up
# Declare DHCP_OPTIONS array before adding new options to it:
declare -a DHCP_OPTIONS=()
@@ -202,9 +202,28 @@ if_up() {
/sbin/ip link set dev ${1} down
fi
fi
+ if [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_AUTOCONF6[$i]}" = "yes" ]; then # configure interface 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
+ echo "1" >/proc/sys/net/ipv6/conf/$1/autoconf
+ # 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
+ /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
+ /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
if [ -z "${NETMASK[$i]}" ]; then
- echo "/etc/rc.d/rc.inet1: no NETMASK set for ${1} - assuming /24 (aka, 255.255.255.0)" | $LOGGER
+ echo "/etc/rc.d/rc.inet1: no NETMASK set for ${1} - assuming 24 (aka, 255.255.255.0)" | $LOGGER
NETMASK[$i]="24"
fi
echo "/etc/rc.d/rc.inet1: /sbin/ip -4 address add ${IPADDR[$i]}/${NETMASK[$i]#/} broadcast + dev ${1}" | $LOGGER
@@ -217,9 +236,9 @@ if_up() {
/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
+ if [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_AUTOCONF6[$i]}" != "yes" ] && [ -n "${IPADDR6[$i]}" ]; then # add a fixed v6 IP
if [ -z "${PREFIX6[$i]}" ]; then
- echo "/etc/rc.d/rc.inet1: no PREFIX6 set for ${1} - assuming /64" | $LOGGER
+ echo "/etc/rc.d/rc.inet1: no PREFIX6 set for ${1} - assuming 64" | $LOGGER
PREFIX6[$i]="64"
fi
echo "/etc/rc.d/rc.inet1: /sbin/ip -6 address add ${IPADDR6[$i]}/${PREFIX6[$i]#/} dev ${1}" | $LOGGER
@@ -234,27 +253,6 @@ if_up() {
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
- 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
- echo "1" >/proc/sys/net/ipv6/conf/$1/autoconf
- # 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
- /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
- /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
# Add extra IPv4 and v6 addresses to the interface:
if [ -n "${IPALIASES[$i]}" ]; then