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 ++++++++++++++-------------- rc.inet1.conf | 59 ++++++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 33 deletions(-) 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" diff --git a/rc.inet1.conf b/rc.inet1.conf index 090d799..c1e1060 100644 --- a/rc.inet1.conf +++ b/rc.inet1.conf @@ -1,6 +1,7 @@ # /etc/rc.d/rc.inet1.conf # # This file contains the configuration settings for network interfaces. + # If USE_DHCP[interface] is set to "yes", this overrides any other settings. # If you don't have an interface, leave the settings null (""). @@ -11,54 +12,68 @@ # Several other parameters are available, the end of this file contains a # comprehensive set of examples. +# Important note for IPv6 stateless auto configuration (SLAAC) users: +# From Slackware 15.0 onwards, you need to set USE_SLAAC[0]="yes" (etc) below + # ============================================================================= -# Config information for eth0: +# IPv4 config information for eth0: IPADDR[0]="" NETMASK[0]="" IPALIASES[0]="" USE_DHCP[0]="" DHCP_HOSTNAME[0]="" -# Config information for eth1: +# IPv4 config information for eth1: IPADDR[1]="" NETMASK[1]="" IPALIASES[1]="" USE_DHCP[1]="" DHCP_HOSTNAME[1]="" -# Config information for eth2: +# IPv4 config information for eth2: IPADDR[2]="" NETMASK[2]="" IPALIASES[2]="" USE_DHCP[2]="" DHCP_HOSTNAME[2]="" -# Config information for eth3: +# IPv4 config information for eth3: IPADDR[3]="" NETMASK[3]="" IPALIASES[3]="" USE_DHCP[3]="" DHCP_HOSTNAME[3]="" -# Default gateway IP address: +# IPv4 default gateway IP address: GATEWAY="" -# IPv6 configuration options: -#IPADDR6[0]= -#PREFIX6[0]= -#IPALIASES6[0]= -#USE_DHCP6[0]= -#USE_AUTOCONF6[0]= +# ============================================================================= + +# IPv6 config information for eth0: +IP6ADDR[0]="" +PREFIXLEN[0]="" +IP6ALIASES[0]="" +USE_SLAAC[0]="" +USE_DHCP6[0]="" -# Default gateway IPv6 address: -#GATEWAY6="" +# IPv6 config information for eth1: +IP6ADDR[1]="" +PREFIXLEN[1]="" +IP6ALIASES[1]="" +USE_SLAAC[1]="" +USE_DHCP6[1]="" -# Change this to "yes" for debugging output to stdout. Unfortunately, -# /sbin/hotplug seems to disable stdout so you'll only see debugging output -# when rc.inet1 is called directly. +# IPv6 default gateway address: +GATEWAY6="" + +# ============================================================================= + +# Change this to "yes" for debugging output to stdout. DEBUG_ETH_UP="no" +# ============================================================================= + # Example of how to configure a bridge: # Note the added "BRNICS" variable which contains a space-separated list # of the physical or virtual network interfaces you want to add to the bridge. @@ -70,6 +85,8 @@ DEBUG_ETH_UP="no" #USE_DHCP[0]="" #DHCP_HOSTNAME[0]="" +# ============================================================================= + # Virtual interfaces to create - these are created before any address # configuration or bridge setup is done, so you may use these interfaces # as IFNAME or BRNICS values. These can be tun or tap interfaces: @@ -89,6 +106,8 @@ DEBUG_ETH_UP="no" #VIRTIFUSER[1]="someuser" #VIRTIFGROUP[1]="somegroup" +# ============================================================================= + ## Example config information for wlan0. Uncomment the lines you need and fill ## in your data. (You may not need all of these for your wireless network) #IFNAME[4]="wlan0" @@ -110,6 +129,8 @@ DEBUG_ETH_UP="no" #WLAN_WPADRIVER[4]="wext" #WLAN_WPAWAIT[4]=30 +# ============================================================================= + ## Some examples of additional network parameters that you can use. ## Config information for wlan0: #IFNAME[4]="wlan0" # Use a different interface name instead of @@ -135,9 +156,9 @@ DEBUG_ETH_UP="no" # server is not found (ipv4ll link-local # adresses in the IP range 169.254.0.0/16 are # also known as "zeroconf" addresses) -#AUTOCONF6_TIMEOUT[4]="15" # The default timeout for auto configuration to - # wait for the interface to come up is 15 sec. - # Increase the timeout if required. +#SLAAC_TIMEOUT[4]="15" # The default timeout for auto configuration to + # wait for the interface to come up is 15 sec. + # Increase the timeout if required. #WLAN_ESSID[4]=DARKSTAR # An example of how you can override _any_ # parameter defined in rc.wireless.conf, by # prepending 'WLAN_' to the parameter's name. -- cgit v1.2.3