From c7a874a5fbc5954d4d3064ae6341bdeeddeee141 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Fri, 24 Aug 2018 17:00:18 +0100 Subject: Various fixups for nomenclature - see full commit message * USE_AUTOCONF->USE_SLAAC to be more consistent with IPv6 terminology * PREFIX6->PREFIXLEN to be more consistent with IPv6 terminology Thanks to David Spencer (idlemoor) for the patch to the above * AUTOCONF_TIMEOUT->SLAAC_TIMEOUT to be consistent with USE_SLAAC change Since some options for IPv6 no longer end in '6', we can relax the naming of others, so these make sense: IPADDR6->IP6ADDR ; IPALIASES6->IP6ALIASES Update to rc.inet1.conf example file - thanks to David Spencer. Signed-off-by: Robby Workman --- rc.inet1 | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'rc.inet1') diff --git a/rc.inet1 b/rc.inet1 index 1e54098..971d045 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -164,8 +164,8 @@ if_up() { # If the interface is a bridge, then create it first: [ -n "${BRNICS[$i]}" ] && br_open $i # Skip unconfigured interfaces: - if [ -z "${IPADDR[$i]}" ] && [ "${USE_DHCP[$i]}" != "yes" ] && [ -z "${IPADDR6[$i]}" ] && \ - [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_AUTOCONF6[$i]}" != "yes" ]; then + if [ -z "${IPADDR[$i]}" ] && [ "${USE_DHCP[$i]}" != "yes" ] && [ -z "${IP6ADDR[$i]}" ] && \ + [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" != "yes" ]; then debug_log "skipping ${1} early, interface is not configured in /etc/rc.d/rc.inet1.conf" return fi @@ -216,7 +216,7 @@ 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 + if [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$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 @@ -224,13 +224,13 @@ if_up() { # Bring the interface up: /sbin/ip link set dev ${1} up echo "Waiting for router announcement on ${1}..." - for ((j = ${AUTOCONF6_TIMEOUT[$i]:=15} * 2; j--;)); do # by default, wait a max of 15 seconds for the interface to configure + 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 "/etc/rc.d/rc.inet1: failed to auto configure ${1} after ${AUTOCONF6_TIMEOUT[$i]} seconds" | $LOGGER + 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 fi @@ -255,17 +255,17 @@ if_up() { /sbin/ip link set dev ${1} down fi fi - 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 - PREFIX6[$i]="64" + if [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" != "yes" ] && [ -n "${IP6ADDR[$i]}" ]; then # add a fixed v6 IP + if [ -z "${PREFIXLEN[$i]}" ]; then + echo "/etc/rc.d/rc.inet1: no PREFIXLEN set for ${1} - assuming 64" | $LOGGER + PREFIXLEN[$i]="64" fi - echo "/etc/rc.d/rc.inet1: /sbin/ip -6 address add ${IPADDR6[$i]}/${PREFIX6[$i]#/} dev ${1}" | $LOGGER - if /sbin/ip -6 address add ${IPADDR6[$i]}/${PREFIX6[$i]#/} dev ${1} && \ + echo "/etc/rc.d/rc.inet1: /sbin/ip -6 address add ${IP6ADDR[$i]}/${PREFIXLEN[$i]#/} dev ${1}" | $LOGGER + if /sbin/ip -6 address add ${IP6ADDR[$i]}/${PREFIXLEN[$i]#/} dev ${1} && \ /sbin/ip link set dev ${1} up; then IF_UP=1 else - echo "/etc/rc.d/rc.inet1: failed to a set IP ${IPADDR6[$i]} for ${1}" | $LOGGER + echo "/etc/rc.d/rc.inet1: failed to a 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 @@ -288,13 +288,13 @@ if_up() { fi done fi - if [ -n "${IPALIASES6[$i]}" ]; then + if [ -n "${IP6ALIASES[$i]}" ]; then # IPv6's Duplicate Address Detection (DAD) causes a race condition when bringing up interfaces, as # described here: https://www.agwa.name/blog/post/beware_the_ipv6_dad_race_condition # Disable DAD while bringing up the interface - but note that this means the loss of detection of a # duplicate address. It's a trade off, unfortunately. echo "0" >/proc/sys/net/ipv6/conf/$1/accept_dad - for ipalias in ${IPALIASES6[$i]}; do + for ipalias in ${IP6ALIASES[$i]}; do ip="${ipalias%/*}" nm="${ipalias#*/}" [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="64" -- cgit v1.2.3