summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-11 18:47:12 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-11 18:47:12 +0100
commit237602039372192ebf4f05fced3e5ee3820747b0 (patch)
treeae86c0280c3cc4e3a720310327e9f6780708015b
parenta1350640ba605cf5876b25abfee886488a33e50b (diff)
parent5e5b137acc7094c9a1b8e7634b426dd445688bf0 (diff)
Merge pull request #1851 from teg/networkd-drop-foreign
networkd: link - drop foreign config when configuring link
-rw-r--r--src/network/networkd-link.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index a7d0908bdd..00c57b2960 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -2017,6 +2017,35 @@ static int link_set_ipv6_hop_limit(Link *link) {
return 0;
}
+static int link_drop_foreign_config(Link *link) {
+ Address *address;
+ Route *route;
+ Iterator i;
+ int r;
+
+ SET_FOREACH(address, link->addresses_foreign, i) {
+ /* we consider IPv6LL addresses to be managed by the kernel */
+ if (address->family == AF_INET6 && in_addr_is_link_local(AF_INET6, &address->in_addr) == 1)
+ continue;
+
+ r = address_remove(address, link, link_address_remove_handler);
+ if (r < 0)
+ return r;
+ }
+
+ SET_FOREACH(route, link->routes_foreign, i) {
+ /* do not touch routes managed by the kernel */
+ if (route->protocol == RTPROT_KERNEL)
+ continue;
+
+ r = route_remove(route, link, link_address_remove_handler);
+ if (r < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static int link_configure(Link *link) {
int r;
@@ -2024,6 +2053,10 @@ static int link_configure(Link *link) {
assert(link->network);
assert(link->state == LINK_STATE_PENDING);
+ r = link_drop_foreign_config(link);
+ if (r < 0)
+ return r;
+
r = link_set_bridge_fdb(link);
if (r < 0)
return r;