summaryrefslogtreecommitdiffstats
path: root/rc.inet1
diff options
context:
space:
mode:
Diffstat (limited to 'rc.inet1')
-rw-r--r--rc.inet140
1 files changed, 22 insertions, 18 deletions
diff --git a/rc.inet1 b/rc.inet1
index 9a6fd61..ae9280b 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -281,31 +281,35 @@ if_up() {
fi
fi
if [ -e /proc/sys/net/ipv6 ] && [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" != "yes" ] && \
- [ -n "${IP6ADDR[$i]}" ]; then # add a fixed v6 IP
+ [ -n "${IP6ADDRS[$i]}" ]; then # add fixed v6 IPs
# 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
- 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 ${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
- # Enable accepting of RA packets if explicitly told to.
- if [ "${USE_RA[$i]}" = "yes" ]; then
- echo "1" >/proc/sys/net/ipv6/conf/$1/accept_ra
+ for v6ip in ${IP6ADDRS[$i]}; do
+ ip="${v6ip%/*}"
+ prefix="${v6ip#*/}"
+ if [ -z "$prefix" ] || [ "$ip" == "$prefix" ]; then
+ echo "/etc/rc.d/rc.inet1: no prefix length set for ${ip} - assuming 64" | $LOGGER
+ prefix="64"
fi
- IF_UP=1
- else
- 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
+ echo "/etc/rc.d/rc.inet1: /sbin/ip -6 address add ${ip}/${prefix} dev ${1}" | $LOGGER
+ if /sbin/ip -6 address add ${ip}/${prefix} dev ${1} && \
+ /sbin/ip link set dev ${1} up; then
+ # Enable accepting of RA packets if explicitly told to.
+ if [ "${USE_RA[$i]}" = "yes" ]; then
+ echo "1" >/proc/sys/net/ipv6/conf/$1/accept_ra
+ fi
+ IF_UP=1
+ else
+ echo "/etc/rc.d/rc.inet1: failed to set IP ${ip} 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
+ fi
fi
- fi
+ done
fi
if (($IF_UP == 1)); then # only do further config if the interface came up
# Add extra IPv4 and v6 addresses to the interface: