summaryrefslogtreecommitdiffstats
path: root/rc.inet1
diff options
context:
space:
mode:
authorDarren 'Tadgy' Austin <darren@afterdark.org.uk>2018-08-21 16:44:36 +0100
committerRobby Workman <rworkman@slackware.com>2018-11-25 20:03:04 -0600
commit15b6fc1b646b28a9f7895c88c1ad37dac9f7ed1a (patch)
tree9c039366a81495817abf2e4c6be47403bd87d379 /rc.inet1
parente5923958f49481b634c1720b1121759d033a18ce (diff)
downloadslacknetsetup-15b6fc1b646b28a9f7895c88c1ad37dac9f7ed1a.tar.xz
Mitigate a race condition with Duplicate Address Detection
https://www.agwa.name/blog/post/beware_the_ipv6_dad_race_condition This removes the need to sleep for 3 seconds after setting up the interfaces, but does mean we lose detection of address clashes on the inteface - it's a trade off Signed-off-by: Robby Workman <rworkman@slackware.com>
Diffstat (limited to 'rc.inet1')
-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"