Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit 484e436

Browse files
committed
F #227, #86: Workaround sporadic IPv6 SLAAC privacy address on Ubuntus
1 parent 0af852d commit 484e436

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/etc/one-context.d/loc-10-network

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ case "$action" in
155155
reconfigure)
156156
configure_network
157157
reload_network
158-
# wait_online
159158
;;
160159
*)
161160
echo "ERROR [!]: Unknown ACTION: ${action}" >&2

src/etc/one-context.d/loc-10-network.d/netcfg-interfaces

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ stop_network()
6969
for _iface in $_ifaces; do
7070
if [ "${_iface}" != 'lo' ] ; then
7171
/sbin/ifdown "${_iface}"
72-
/sbin/ip addr flush dev "${_iface}"
72+
/sbin/ip link set dev "${_iface}" down || true
73+
/sbin/ip addr flush dev "${_iface}" || true
7374
fi
7475
done
7576
;;
@@ -181,6 +182,8 @@ gen_dhcp_conf()
181182
;;
182183
esac
183184
fi
185+
186+
echo ""
184187
}
185188

186189
gen_alias_conf()
@@ -250,9 +253,10 @@ EOT
250253
esac
251254
fi
252255

256+
echo ""
257+
253258
if [ -n "${ip6_ula}" ]; then
254259
cat <<EOT
255-
256260
iface ${dev} inet6 static
257261
address ${ip6_ula}
258262
netmask 64
@@ -279,8 +283,15 @@ gen_dhcp6_conf()
279283
echo " pre-up echo 0 > /proc/sys/net/ipv6/conf/${dev}/use_tempaddr"
280284
;;
281285
debian|ubuntu|devuan)
282-
echo " privext 0" # this might not be effective in "dhcp" mode
286+
# Privext might not be effective in "dhcp" mode, so we better
287+
# directly configure also sysctl parameters. Also, there might
288+
# be a race condition between activating IPv4 and IPv6 part of
289+
# interface if IPv4 is dhcp. As a aresult, IPv6 SLAAC privacy
290+
# address might appear. So, for safety we better drop any global
291+
# IPv6 addresses as part of pre-up.
292+
echo " privext 0"
283293
echo " pre-up echo 0 > /proc/sys/net/ipv6/conf/${dev}/use_tempaddr"
294+
echo " pre-up ip -6 addr flush dev ${dev} scope global || /bin/true"
284295

285296
if [ -n "${mtu}" ]; then
286297
# Ignores "mtu x", IPv6-only interfaces would not be configured
@@ -292,6 +303,8 @@ gen_dhcp6_conf()
292303
exit 1
293304
;;
294305
esac
306+
307+
echo ""
295308
}
296309

297310
gen_alias6_conf()
@@ -313,6 +326,8 @@ EOT
313326
;;
314327
esac
315328

329+
echo ""
330+
316331
if [ -n "${ip6_ula}" ]; then
317332
cat <<EOT
318333

0 commit comments

Comments
 (0)