mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-05 09:17:44 +03:00
networkd: link - drop foreign config when configuring link
This is a change in behavior: Before we would never remove any state, only add to it, we now drop unwanted state from any link the moment we start managing it. Note however, that we still will not remove any foreign state added at runtime, to avoid any feedback loops. However, we make no guarantees about coexisting with third-party tools that change the state of the links we manage.
This commit is contained in:
parent
3116c225d2
commit
5e5b137acc
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user