mirror of
https://github.com/systemd/systemd.git
synced 2025-02-28 05:57:33 +03:00
network: dhcp4: also release old lease in dhcp_lease_lost()
The lease lost may happen during renewing address. If it happens, assertion hits in dhcp4_release_old_lease().
This commit is contained in:
parent
8d5bb13d78
commit
75be72d139
@ -27,7 +27,7 @@ static int dhcp_remove_address(Link *link, sd_dhcp_lease *lease, const struct in
|
||||
static int dhcp4_update_address(Link *link, bool announce);
|
||||
static int dhcp4_remove_all(Link *link);
|
||||
|
||||
void dhcp4_release_old_lease(Link *link) {
|
||||
static void dhcp4_release_old_lease(Link *link) {
|
||||
struct in_addr address = {}, address_old = {};
|
||||
|
||||
assert(link);
|
||||
@ -793,6 +793,9 @@ static int dhcp_lease_lost(Link *link) {
|
||||
|
||||
link->dhcp4_configured = false;
|
||||
|
||||
/* dhcp_lease_lost() may be called during renewing IP address. */
|
||||
dhcp4_release_old_lease(link);
|
||||
|
||||
r = dhcp4_remove_all(link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -17,7 +17,6 @@ typedef enum DHCPClientIdentifier {
|
||||
_DHCP_CLIENT_ID_INVALID = -1,
|
||||
} DHCPClientIdentifier;
|
||||
|
||||
void dhcp4_release_old_lease(Link *link);
|
||||
int dhcp4_configure(Link *link);
|
||||
int dhcp4_set_client_identifier(Link *link);
|
||||
int dhcp4_set_promote_secondaries(Link *link);
|
||||
|
@ -800,8 +800,6 @@ int link_stop_clients(Link *link, bool may_keep_dhcp) {
|
||||
assert(link->manager);
|
||||
assert(link->manager->event);
|
||||
|
||||
dhcp4_release_old_lease(link);
|
||||
|
||||
bool keep_dhcp = may_keep_dhcp &&
|
||||
link->network &&
|
||||
(link->manager->restarting ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user