network/address: acquire address from DHCP server lease file
If the DHCP server on an interface is configured with its server address is null, then let's reuse the previous server address if possible. Otherwise, if networkd is restarted or the host is rebooted, then possibly new subnet is picked, and clients that already have addresses in the previous subnet cannot access the server. Prompted by https://github.com/systemd/systemd/pull/30021#discussion_r1518478633.
This commit is contained in:
@@ -1495,6 +1495,10 @@ static int address_acquire(Link *link, const Address *address, union in_addr_uni
|
||||
assert(address);
|
||||
assert(ret);
|
||||
|
||||
r = address_acquire_from_dhcp_server_leases_file(link, address, ret);
|
||||
if (r != -ENOENT)
|
||||
return r;
|
||||
|
||||
r = address_pool_acquire(link->manager, address->family, address->prefixlen, &a);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user