mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 23:21:22 +03:00
Merge pull request #20108 from yuwata/network-fix-ndisc-and-dhcp6-issue-20050
network: remove old addresses and routes after new ones are configured
This commit is contained in:
commit
5f9fa7a5f3
@ -145,7 +145,7 @@ static int dhcp6_pd_remove_old(Link *link, bool force) {
|
||||
assert(link);
|
||||
assert(link->manager);
|
||||
|
||||
if (!force && (link->dhcp6_pd_address_messages != 0 || link->dhcp6_pd_route_messages != 0))
|
||||
if (!force && (link->dhcp6_pd_address_messages > 0 || link->dhcp6_pd_route_messages > 0))
|
||||
return 0;
|
||||
|
||||
if (set_isempty(link->dhcp6_pd_addresses_old) && set_isempty(link->dhcp6_pd_routes_old))
|
||||
@ -740,7 +740,7 @@ static int dhcp6_remove_old(Link *link, bool force) {
|
||||
|
||||
assert(link);
|
||||
|
||||
if (!force && (!link->dhcp6_address_configured || !link->dhcp6_route_configured))
|
||||
if (!force && (link->dhcp6_address_messages > 0 || link->dhcp6_route_messages > 0))
|
||||
return 0;
|
||||
|
||||
if (set_isempty(link->dhcp6_addresses_old) && set_isempty(link->dhcp6_routes_old))
|
||||
|
@ -519,7 +519,8 @@ void link_check_ready(Link *link) {
|
||||
/* When DHCP[46], NDisc, or IPv4LL is enabled, at least one protocol must be finished. */
|
||||
return (void) log_link_debug(link, "%s(): dynamic addresses or routes are not configured.", __func__);
|
||||
|
||||
log_link_debug(link, "%s(): dhcp4:%s ipv4ll:%s dhcp6_addresses:%s dhcp_routes:%s dhcp_pd_addresses:%s dhcp_pd_routes:%s ndisc_addresses:%s ndisc_routes:%s",
|
||||
log_link_debug(link, "%s(): dhcp4:%s ipv4ll:%s dhcp6_addresses:%s dhcp6_routes:%s "
|
||||
"dhcp6_pd_addresses:%s dhcp6_pd_routes:%s ndisc_addresses:%s ndisc_routes:%s",
|
||||
__func__,
|
||||
yes_no(link->dhcp4_configured),
|
||||
yes_no(link->ipv4ll_address_configured),
|
||||
|
@ -128,9 +128,6 @@ static int ndisc_remove_old_one(Link *link, const struct in6_addr *router, bool
|
||||
if (!force) {
|
||||
bool set_callback = false;
|
||||
|
||||
if (!link->ndisc_addresses_configured || !link->ndisc_routes_configured)
|
||||
return 0;
|
||||
|
||||
SET_FOREACH(na, link->ndisc_addresses)
|
||||
if (!na->marked && in6_addr_equal(&na->router, router)) {
|
||||
set_callback = true;
|
||||
@ -212,6 +209,10 @@ static int ndisc_remove_old(Link *link) {
|
||||
|
||||
assert(link);
|
||||
|
||||
if (link->ndisc_addresses_messages > 0 ||
|
||||
link->ndisc_routes_messages > 0)
|
||||
return 0;
|
||||
|
||||
routers = set_new(&in6_addr_hash_ops);
|
||||
if (!routers)
|
||||
return -ENOMEM;
|
||||
@ -818,8 +819,10 @@ static int ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *r
|
||||
r = address_get(link, address, &e);
|
||||
if (r > 0) {
|
||||
/* If the address is already assigned, but not valid anymore, then refuse to
|
||||
* update the address. */
|
||||
if (e->cinfo.tstamp / 100 + e->cinfo.ifa_valid < time_now / USEC_PER_SEC)
|
||||
* update the address, and it will be removed. */
|
||||
if (e->cinfo.ifa_valid != CACHE_INFO_INFINITY_LIFE_TIME &&
|
||||
usec_add(e->cinfo.tstamp / 100 * USEC_PER_SEC,
|
||||
e->cinfo.ifa_valid * USEC_PER_SEC) < time_now)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user