]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: address-pool: also check conflicts with foreign addresses
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 17 Jan 2021 15:44:14 +0000 (00:44 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 17 Jan 2021 23:23:08 +0000 (23:23 +0000)
Fixes CI issue found in
https://github.com/systemd/systemd-centos-ci/pull/334.

src/network/networkd-address-pool.c

index a9f8872760d1be102eb1abdf579d746b258c3ed9..c60ece5db8c155b93bed9b051f7e3c6e502e78a9 100644 (file)
@@ -107,6 +107,15 @@ static bool address_pool_prefix_is_taken(
                                 return true;
                 }
 
+                /* Don't clash with assigned foreign addresses */
+                SET_FOREACH(a, l->addresses_foreign) {
+                        if (a->family != p->family)
+                                continue;
+
+                        if (in_addr_prefix_intersect(p->family, u, prefixlen, &a->in_addr, a->prefixlen))
+                                return true;
+                }
+
                 /* Don't clash with addresses already pulled from the pool, but not assigned yet */
                 SET_FOREACH(a, l->pool_addresses) {
                         if (a->family != p->family)