aboutgitcodebugslistschat
path: root/conf.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-11-09 18:35:17 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-11-10 11:18:09 +0100
commit4129764ecaebf05a33e22d8d95bb3d8deaa14c14 (patch)
treeee0ad3bc4efeb4cacdf3595f04cdc40bf8b41705 /conf.c
parent817eedc28a63c4067e592753988c9d8a97babaf1 (diff)
downloadpasst-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>
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c5
1 files changed, 4 insertions, 1 deletions
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)));