diff options
Diffstat (limited to 'rc.inet1')
-rw-r--r-- | rc.inet1 | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -187,10 +187,11 @@ if_up() { if [ -e /proc/sys/net/ipv6 ]; then # ipv6 networking is available # Disable v6 IP auto configuration before trying to bring up the interface: echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf - # Disable Router Advertisment for this interface until it's needed: if [ "${USE_RA[$i]}" = "yes" ]; then + # Unconditionally accept router advertisements on this interface: echo "1" >/proc/sys/net/ipv6/conf/$1/accept_ra else + # Disable router advertisments on this interface until SLAAC is enabled: echo "0" >/proc/sys/net/ipv6/conf/$1/accept_ra fi fi @@ -214,13 +215,16 @@ if_up() { [ "${DHCP_KEEPNTP[$i]}" = "yes" ] && DHCP_OPTIONS+=("-C" "ntp.conf") [ "${DHCP_KEEPGW[$i]}" = "yes" ] && DHCP_OPTIONS+=("-G") [ "${DHCP_DEBUG[$i]}" = "yes" ] && DHCP_OPTIONS+=("-d") + # The -L option used to be hard coded into the dhcpcd command line in -current. Previous versions did not have + # this hard coded. The code here keeps the 14.2 behaviour, but can be altered to make the use of -L default as + # in -current. To change the behaviour, alter the test to be: [ "${DHCP_NOIPV4LL[$i]}" != "no" ] [ "${DHCP_NOIPV4LL[$i]}" = "yes" ] && DHCP_OPTIONS+=("-L") [ -n "${DHCP_IPADDR[$i]}" ] && DHCP_OPTIONS+=("-r" "${DHCP_IPADDR[$i]}") - echo "Polling for DHCP server on interface ${1}:" + echo "${1}: polling for DHCP server" # 15 seconds should be a reasonable default DHCP timeout. 30 was too much. echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS[@]} ${1}" | $LOGGER if /sbin/dhcpcd -t "${DHCP_TIMEOUT[$i]:-15}" "${DHCP_OPTIONS[@]}" ${1}; then - # Enable accepting of RA packets if explicitly told to. + # Enable accepting of RA packets if explicitly told to: if [ -e /proc/sys/net/ipv6 ] && [ "${USE_RA[$i]}" = "yes" ]; then echo "1" >/proc/sys/net/ipv6/conf/$1/accept_ra fi @@ -232,24 +236,25 @@ if_up() { fi fi if [ -e /proc/sys/net/ipv6 ] && [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" = "yes" ]; then # configure via SLAAC - echo "/etc/rc.d/rc.inet1: using Router Advertisement stateless auto configuration for ${1}" | $LOGGER - # Enable accepting of RA packets, unless explicitly configured not to. + # Enable accepting of RA packets, unless explicitly configured not to: if [ "${USE_RA[$i]}" = "no" ]; then echo "0" >/proc/sys/net/ipv6/conf/$1/accept_ra else + echo "/etc/rc.d/rc.inet1: enabling RA for ${1}" | $LOGGER echo "1" >/proc/sys/net/ipv6/conf/$1/accept_ra fi # Enable auto configuration of interfaces: + echo "/etc/rc.d/rc.inet1: enabling SLAAC for ${1}" | $LOGGER 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}..." + echo "${1}: waiting for router announcement" for ((j = ${SLAAC_TIMEOUT[$i]:=15} * 2; j--;)); do # by default, 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 "${1}: timed out" echo "/etc/rc.d/rc.inet1: failed to auto configure ${1} after ${SLAAC_TIMEOUT[$i]} seconds" | $LOGGER /sbin/ip address flush dev ${1} /sbin/ip link set dev ${1} down @@ -265,7 +270,7 @@ if_up() { /sbin/ip link set dev ${1} up; then IF_UP=1 else - echo "/etc/rc.d/rc.inet1: failed to a set IP ${IPADDR[$i]} for ${1}" | $LOGGER + echo "/etc/rc.d/rc.inet1: failed to set IP ${IPADDR[$i]} for ${1}" | $LOGGER /sbin/ip address flush dev ${1} /sbin/ip link set dev ${1} down fi @@ -290,7 +295,7 @@ if_up() { fi IF_UP=1 else - echo "/etc/rc.d/rc.inet1: failed to a set IP ${IP6ADDR[$i]} for ${1}" | $LOGGER + echo "/etc/rc.d/rc.inet1: failed to set IP ${IP6ADDR[$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 |