diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c index 85c5233472..c5757ac8f2 100644 --- a/src/network/networkd-dhcp-prefix-delegation.c +++ b/src/network/networkd-dhcp-prefix-delegation.c @@ -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; } diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 468c3eb920..bd5cf845a6 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -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; } diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 799caeb15b..db3d9297c2 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -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; } diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 4198a6d017..3476effb2f 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -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);