diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-11-09 18:35:17 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-11-10 11:18:09 +0100 |
commit | 4129764ecaebf05a33e22d8d95bb3d8deaa14c14 (patch) | |
tree | ee0ad3bc4efeb4cacdf3595f04cdc40bf8b41705 | |
parent | 817eedc28a63c4067e592753988c9d8a97babaf1 (diff) | |
download | passt-4129764ecaebf05a33e22d8d95bb3d8deaa14c14.tar passt-4129764ecaebf05a33e22d8d95bb3d8deaa14c14.tar.gz passt-4129764ecaebf05a33e22d8d95bb3d8deaa14c14.tar.bz2 passt-4129764ecaebf05a33e22d8d95bb3d8deaa14c14.tar.lz passt-4129764ecaebf05a33e22d8d95bb3d8deaa14c14.tar.xz passt-4129764ecaebf05a33e22d8d95bb3d8deaa14c14.tar.zst passt-4129764ecaebf05a33e22d8d95bb3d8deaa14c14.zip |
conf: Fix mask calculation from prefix_len in conf_print()2022_11_10.4129764
Reported-by: Paul Holzinger <pholzing@redhat.com>
Fixes: dd09cceaee21 ("Minor improvements to IPv4 netmask handling")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r-- | conf.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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))); |