summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2013-05-16 23:19:25 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2013-05-17 10:52:51 +0200
commit032dfba32c67ba59161a0856e8bc819fceefd1e0 (patch)
treec9a0e7327d68d1911b339ed84bd2a71114522729 /src
parent55adbd5a83f245af22896adb13fd120b6df0253d (diff)
downloadnetctl-032dfba32c67ba59161a0856e8bc819fceefd1e0.tar.gz
netctl-032dfba32c67ba59161a0856e8bc819fceefd1e0.tar.xz
Flush the interface configuration in ip_unset instead of bring_interface_down.
When switching networks in auto.action, the addresses are not flushed. This is especially problematic with stateless ipv6 autoconfigutation, as invalid IPs may stay around until their (potentially very long) lifetime has expired. bring_interface_down is always called after ip_unset everywhere else, so this change does not affect anything else. V2: Make sure not to flush the link local address.
Diffstat (limited to 'src')
-rw-r--r--src/lib/ip5
-rwxr-xr-xsrc/lib/network1
2 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/ip b/src/lib/ip
index 2a84c0d..14ed727 100644
--- a/src/lib/ip
+++ b/src/lib/ip
@@ -175,7 +175,7 @@ ip_set() {
}
-## Clean up the dynamic part of an IP configuration
+## Clean up the IP configuration
# $Interface: interface name
# $IP: type of IPv4 configuration
# $IP6: type of IPv6 configuration
@@ -202,6 +202,9 @@ ip_unset() {
fi
[[ $DNS ]] && resolvconf -d "$Interface"
+ ip addr flush dev "$Interface" scope host &>/dev/null
+ ip addr flush dev "$Interface" scope site &>/dev/null
+ ip addr flush dev "$Interface" scope global &>/dev/null
}
diff --git a/src/lib/network b/src/lib/network
index 6ac9d75..7dfe0b5 100755
--- a/src/lib/network
+++ b/src/lib/network
@@ -31,7 +31,6 @@ bring_interface_up() {
# $1: interface name
bring_interface_down() {
local interface=$1
- ip addr flush dev "$interface" &>/dev/null
ip link set dev "$interface" down &>/dev/null
# We reuse the up timeout (down normally is faster)
timeout_wait "${TimeoutUp:-5}" '! interface_is_up "$interface"'