summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rc.inet116
1 files changed, 12 insertions, 4 deletions
diff --git a/rc.inet1 b/rc.inet1
index 1e3752a..325ee56 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -224,6 +224,11 @@ if_up() {
fi
fi
if [ "${USE_DHCP[$i]}" != "yes" ] && [ -n "${IPADDR[$i]}" ]; then # add a fixed v4 IP to the interface
+ # 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 "${NETMASK[$i]}" ]; then
echo "/etc/rc.d/rc.inet1: no NETMASK set for ${1} - assuming 24 (aka, 255.255.255.0)" | $LOGGER
NETMASK[$i]="24"
@@ -272,6 +277,11 @@ if_up() {
done
fi
if [ -n "${IPALIASES6[$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
ip="${ipalias%/*}"
nm="${ipalias#*/}"
@@ -292,10 +302,8 @@ if_up() {
echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} promisc on" | $LOGGER
/sbin/ip link set dev ${1} promisc on
fi
- # Some settings need a small time to come into effect on the interface.
- # This mostly affects IPv6, which needs time to make the interfaces available for the
- # daemons to bind() - without this delay, they fail to bind() v6 addresses.
- sleep 3
+ # Reset accept_dad back to default now all the IPs are configured:
+ cat /proc/sys/net/ipv6/conf/default/accept_dad >/proc/sys/net/ipv6/conf/$1/accept_dad
fi
else
debug_log "${1} is already up, skipping"