1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

inetwork/address-pool: also check queued addresses

After 0a0c2672db, acquired and queued
addresses are not directly saved into Link object, but it will be saved
later the addresses are really assigned to the interface. So, when
searching free address space, we also need to check the queued
addresses.
This commit is contained in:
Yu Watanabe 2023-08-22 12:22:13 +09:00
parent 4212d6a122
commit 826a46fc33

View File

@ -4,7 +4,7 @@
#include "networkd-address-pool.h"
#include "networkd-address.h"
#include "networkd-manager.h"
#include "set.h"
#include "networkd-queue.h"
#include "string-util.h"
#define RANDOM_PREFIX_TRIAL_MAX 1024
@ -107,6 +107,7 @@ static bool address_pool_prefix_is_taken(
Address *a;
Link *l;
Network *n;
Request *req;
assert(p);
assert(u);
@ -123,6 +124,15 @@ static bool address_pool_prefix_is_taken(
if (address_intersect(a, p->family, u, prefixlen))
return true;
/* Also check queued addresses. */
ORDERED_SET_FOREACH(req, p->manager->request_queue) {
if (req->type != REQUEST_TYPE_ADDRESS)
continue;
if (address_intersect(req->userdata, p->family, u, prefixlen))
return true;
}
return false;
}