From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, Paul Holzinger <pholzing@redhat.com>
Subject: Re: [PATCH] conf: Fix mask calculation from prefix_len in conf_print()
Date: Thu, 10 Nov 2022 11:14:58 +1100 [thread overview]
Message-ID: <Y2xCgs2JoacSByAY@yekko> (raw)
In-Reply-To: <20221109173833.3356429-1-sbrivio@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]
On Wed, Nov 09, 2022 at 06:38:33PM +0100, Stefano Brivio wrote:
> 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>
> ---
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2022-11-10 0:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 17:38 [PATCH] conf: Fix mask calculation from prefix_len in conf_print() Stefano Brivio
2022-11-10 0:14 ` David Gibson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y2xCgs2JoacSByAY@yekko \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=pholzing@redhat.com \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).