summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren 'Tadgy' Austin <darren@afterdark.org.uk>2018-07-28 04:08:20 +0100
committerRobby Workman <rworkman@slackware.com>2018-11-25 19:10:41 -0600
commit53d193c5314113e40aadd4675f75beeab910daca (patch)
tree7f9723c71f3d0f59576604a00b6385914ce64f19
parentb31ef834247afa5abfcfd56cf214d55bc3fff048 (diff)
downloadslacknetsetup-53d193c5314113e40aadd4675f75beeab910daca.tar.xz
Added IPALIASES setting for v4 and v6; removed old IPALIASES code
Signed-off-by: Robby Workman <rworkman@slackware.com>
-rw-r--r--rc.inet133
1 files changed, 22 insertions, 11 deletions
diff --git a/rc.inet1 b/rc.inet1
index 07c3f77..e9e0b58 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -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]}