public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v4 1/7] arp: Fix a handful of small warts
Date: Thu, 17 Oct 2024 10:45:24 +0200	[thread overview]
Message-ID: <20241017104524.13004949@elisabeth> (raw)
In-Reply-To: <20241017053304.909386-2-david@gibson.dropbear.id.au>

On Thu, 17 Oct 2024 16:32:58 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> This fixes a number of harmless but slightly ugly warts in the ARP
> resolution code:
>  * Use in4addr_any to represent 0.0.0.0 rather than hand constructing an
>    example.
>  * When comparing am->sip against 0.0.0.0 use sizeof(am->sip) instead of
>    sizeof(am->tip) (same value, but makes more logical sense)
>  * Described the guest's assigned address as such, rather than as "our
>    address" - that's not usually what we mean by "our address" these days
>  * Remove "we might have the same IP address" comment which I can't make
>    sense of in context (possibly it's relating to the statement below,
>    which already has its own comment?)

Right, yes, I added the part below later, in 64c0f20ab3f8 ("arp: Don't
resolve own, configured IPv4 address").

The first check comes from 2166c5872e9b ("arp: Don't answer announcements
from guest or namespace") instead. The commit title makes it obvious, the
comment not so much.

> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  arp.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/arp.c b/arp.c
> index 53334da..d34b20e 100644
> --- a/arp.c
> +++ b/arp.c
> @@ -59,14 +59,12 @@ int arp(const struct ctx *c, const struct pool *p)
>  	    ah->ar_op  != htons(ARPOP_REQUEST))
>  		return 1;
>  
> -	/* Discard announcements (but not 0.0.0.0 "probes"): we might have the
> -	 * same IP address, hide that.
> -	 */
> -	if (memcmp(am->sip, (unsigned char[4]){ 0 }, sizeof(am->tip)) &&
> +	/* Discard announcements, but not 0.0.0.0 "probes" */
> +	if (memcmp(am->sip, &in4addr_any, sizeof(am->sip)) &&
>  	    !memcmp(am->sip, am->tip, sizeof(am->sip)))
>  		return 1;
>  
> -	/* Don't resolve our own address, either. */
> +	/* Don't resolve guest's assigned address, either. */

Nit: "the guest's assigned address".

>  	if (!memcmp(am->tip, &c->ip4.addr, sizeof(am->tip)))
>  		return 1;

-- 
Stefano


  reply	other threads:[~2024-10-17  8:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17  5:32 [PATCH v4 0/7] Don't expose container loopback services to the host David Gibson
2024-10-17  5:32 ` [PATCH v4 1/7] arp: Fix a handful of small warts David Gibson
2024-10-17  8:45   ` Stefano Brivio [this message]
2024-10-18  0:43     ` David Gibson
2024-10-17  5:32 ` [PATCH v4 2/7] test: Explicitly wait for DAD to complete on SLAAC addresses David Gibson
2024-10-17  5:33 ` [PATCH v4 3/7] test: Wait for DAD on DHCPv6 addresses David Gibson
2024-10-17  8:45   ` Stefano Brivio
2024-10-18  1:13     ` David Gibson
2024-10-17  5:33 ` [PATCH v4 4/7] passt.1: Mark --stderr as deprecated more prominently David Gibson
2024-10-17  5:33 ` [PATCH v4 5/7] passt.1: Clarify and update "Handling of local addresses" section David Gibson
2024-10-17  5:33 ` [PATCH v4 6/7] test: Clarify test for spliced inbound transfers David Gibson
2024-10-17  5:33 ` [PATCH v4 7/7] fwd: Direct inbound spliced forwards to the guest's external address David Gibson

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=20241017104524.13004949@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /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).