On Wed, Nov 09, 2022 at 06:38:33PM +0100, Stefano Brivio wrote:Reported-by: Paul Holzinger <pholzing(a)redhat.com> Fixes: dd09cceaee21 ("Minor improvements to IPv4 netmask handling") Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>Reviewed-by: David Gibson <david(a)gibson.dropbear.id.au>--- conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/conf.c b/conf.c index bfecdff..1adcf83 100644 --- a/conf.c +++ b/conf.c @@ -884,7 +884,10 @@ static void conf_print(const struct ctx *c) if (c->ifi4) { if (!c->no_dhcp) { - uint32_t mask = htonl(0xffffffff << c->ip4.prefix_len); + uint32_t mask; + + mask = htonl(0xffffffff << (32 - c->ip4.prefix_len)); + info("DHCP:"); info(" assign: %s", inet_ntop(AF_INET, &c->ip4.addr, buf4, sizeof(buf4)));-- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson