commit b1c8a57047592b9fd751f67f18185a5b16268b31
parent de83176b04be9324f5c44d2474bbb2c333a87c51
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Mon, 7 Jun 2021 23:26:26 +0200
ip-pool: Make host address valid even if prefix_len != 24
At the end of ip_pool_select_addr4() we'd check if the selected address
is equal to the subnet address and increment it by 1 to produce a valid
host address for the AP. That check was always correct only with 24-bit
prefix, extend it to actually use the prefix-dependent mask instead of
0xff. Fixes a testAP failure triggered 50% of the times because the
netmask is 28 bit long there.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ip-pool.c b/src/ip-pool.c
@@ -237,7 +237,7 @@ check_avail:
selected -= count;
}
- if ((host_addr & 0xff) == 0)
+ if ((host_addr & host_mask) == 0)
host_addr += 1;
done: