network: drop pending requests when a DHCP lease is lost or a client is stopped
When a DHCP lease is lost or a client is stopped, there may exist
requests not processed yet. We need to cancel them, otherwise an
address or route requested by the lost lease may be configured later.
(cherry picked from commit 830b60ae1f)
This commit is contained in:
committed by
Luca Boccassi
parent
ae6dc22b40
commit
64f2911bac
@@ -271,6 +271,10 @@ int dhcp_pd_remove(Link *link, bool only_marked) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!only_marked)
|
||||
/* Also drop pending requests when the lease is lost or the client is stopped. */
|
||||
RET_GATHER(ret, link_drop_requests(link, NETWORK_CONFIG_SOURCE_DHCP_PD));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,6 +272,10 @@ static int dhcp4_remove_address_and_routes(Link *link, bool only_marked) {
|
||||
RET_GATHER(ret, address_remove_and_cancel(address, link));
|
||||
}
|
||||
|
||||
if (!only_marked)
|
||||
/* Also drop pending requests when the lease is lost or the client is stopped. */
|
||||
RET_GATHER(ret, link_drop_requests(link, NETWORK_CONFIG_SOURCE_DHCP4));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,10 @@ static int dhcp6_remove(Link *link, bool only_marked) {
|
||||
RET_GATHER(ret, address_remove_and_cancel(address, link));
|
||||
}
|
||||
|
||||
if (!only_marked)
|
||||
/* Also drop pending requests when the lease is lost or the client is stopped. */
|
||||
RET_GATHER(ret, link_drop_requests(link, NETWORK_CONFIG_SOURCE_DHCP6));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -3194,6 +3194,9 @@ int ndisc_stop(Link *link) {
|
||||
void ndisc_flush(Link *link) {
|
||||
assert(link);
|
||||
|
||||
/* First, drop pending requests. */
|
||||
(void) link_drop_requests(link, NETWORK_CONFIG_SOURCE_NDISC);
|
||||
|
||||
/* Remove all addresses, routes, RDNSS, DNSSL, DNR, and Captive Portal entries, without exception. */
|
||||
(void) ndisc_drop_outdated(link, /* router= */ NULL, /* timestamp_usec= */ USEC_INFINITY);
|
||||
(void) ndisc_drop_redirect(link, /* router= */ NULL);
|
||||
|
||||
Reference in New Issue
Block a user