diff options
author | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2018-07-28 04:08:20 +0100 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2018-11-25 19:10:41 -0600 |
commit | 53d193c5314113e40aadd4675f75beeab910daca (patch) | |
tree | 7f9723c71f3d0f59576604a00b6385914ce64f19 /rc.inet1 | |
parent | b31ef834247afa5abfcfd56cf214d55bc3fff048 (diff) | |
download | slacknetsetup-53d193c5314113e40aadd4675f75beeab910daca.tar.xz |
Added IPALIASES setting for v4 and v6; removed old IPALIASES code
Signed-off-by: Robby Workman <rworkman@slackware.com>
Diffstat (limited to 'rc.inet1')
-rw-r--r-- | rc.inet1 | 33 |
1 files changed, 22 insertions, 11 deletions
@@ -240,17 +240,6 @@ if_up() { fi fi /sbin/ip link set dev ${1} up # Bring up interface - # Add extra IP addresses, if defined, to interface - if [ -n "${IPALIASES[$i]}" ]; then - num=0 - for ipalias in ${IPALIASES[$i]}; do - ip="${ipalias%/*}" - nm="${ipalias#*/}" - [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32" - /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num} - num=$(($num + 1)) - done - 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/accept_ra @@ -268,6 +257,28 @@ if_up() { debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf" return fi + # Add extra IPv4 and v6 addresses, if defined, to the interface + if [ -n "${IPALIASES[$i]}" ]; then + num=0 + for ipalias in ${IPALIASES[$i]}; do + ip="${ipalias%/*}" + nm="${ipalias#*/}" + [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="24" + echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num}" | $LOGGER + /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num} + num=$(($num + 1)) + done + fi + if [ -n "${IPALIASES6[$i]}" ]; then + for ipalias in ${IPALIASES6[$i]}; do + ip="${ipalias%/*}" + nm="${ipalias#*/}" + [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="64" + # Unluke IPv4, v6 addresses don't get a label. + echo "/etc/rc.d/rc.inet1: /sbin/ip -6 address add ${ip}/${nm} dev ${1}" | $LOGGER + /sbin/ip -6 address add ${ip}/${nm} dev ${1} + done + fi if [ -n "${MTU[$i]}" ]; then # Force an MTU (possibly over-riding that set by DHCP) echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} mtu ${MTU[$i]}" | $LOGGER /sbin/ip link set dev ${1} mtu ${MTU[$i]} |