From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202410 header.b=SFqO2fvS; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 6E1CE5A004C for ; Fri, 18 Oct 2024 03:36:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202410; t=1729215357; bh=HbEpKuJW5h/u/coqu0CeQ0IGtPJw43o7WPfY/PIo8QI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SFqO2fvSqUgnlFCjQTxPz3BFcstPF5n6CcyZMW8J8ueE7pLjQ09M1c2Mf/rxpi4mW lxshJ+jNcVBVR6cCbC4QNA9a5XUoeGbWdYejU90q2VKRC6ucrAekY1hzYUqu9YpyrW 6Cll/oInpPQI77vj8xx/Rv0P0QFYuEmCZyJyqlX31k8CEEnKWsh3har0zGBE1XkAav 1ror9CFIkiLQzhEQOcv8xV7eUS5T+8P/ZFCFlbVh861EjTLrPupoiSf0tR1XXBf42g SfJUynEGxuK/8z39aSBSW3PBMaSZf9PtvGTKixmJpAKSuYgoL37oA/dwPtjzPKXIqE 6st5iFEfrJE4Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4XV6jT1MqPz4wc1; Fri, 18 Oct 2024 12:35:57 +1100 (AEDT) Date: Fri, 18 Oct 2024 11:43:41 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v4 1/7] arp: Fix a handful of small warts Message-ID: References: <20241017053304.909386-1-david@gibson.dropbear.id.au> <20241017053304.909386-2-david@gibson.dropbear.id.au> <20241017104524.13004949@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ozaySXAAMhQABVCl" Content-Disposition: inline In-Reply-To: <20241017104524.13004949@elisabeth> Message-ID-Hash: SC5SNZ5L5WKGUOYVR7IS7WTVMJAI2OCO X-Message-ID-Hash: SC5SNZ5L5WKGUOYVR7IS7WTVMJAI2OCO X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --ozaySXAAMhQABVCl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 17, 2024 at 10:45:24AM +0200, Stefano Brivio wrote: > On Thu, 17 Oct 2024 16:32:58 +1100 > David Gibson wrote: >=20 > > 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 da= ys > > * 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?) >=20 > Right, yes, I added the part below later, in 64c0f20ab3f8 ("arp: Don't > resolve own, configured IPv4 address"). >=20 > 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. >=20 > > Signed-off-by: David Gibson > > --- > > arp.c | 8 +++----- > > 1 file changed, 3 insertions(+), 5 deletions(-) > >=20 > > 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 !=3D htons(ARPOP_REQUEST)) > > return 1; > > =20 > > - /* 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; > > =20 > > - /* Don't resolve our own address, either. */ > > + /* Don't resolve guest's assigned address, either. */ >=20 > Nit: "the guest's assigned address". Fixed. > > if (!memcmp(am->tip, &c->ip4.addr, sizeof(am->tip))) > > return 1; >=20 --=20 David Gibson (he or they) | 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 --ozaySXAAMhQABVCl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmcRrzUACgkQzQJF27ox 2Gd+2g//UH9KkxpI4L3LtO1qB9+X4BJBtONQoajQb0/M+igsBr3nqnPb0bTtPVkX OHOWhPgTpyt1wdLplZ2pt09GH825k70RD8JgNhdVqRr17eXxXNuxBuwmwt2h9IuY qAZlIY3LKh6QhklWyIJJsJOvCnsi1nlcxAiGCqtyNiXf+3qQLnNp1AggdArkM2lc kFggN+l69G3iBUeXgIHJbEEmQ5wxL1flDg3nB2rtiGudB3sm2DkrgKRdjJe+Qv7i 17NWwjtFLgdVO+ZGp1I9jcr7zCLoULH/30I5gygIDhrwKBmaoqI+/nObE03x3RJO +LLYiY7wMaWpXmeYbelr8RueQULZy0A13I4mAI2UP++YcVBUjV/4BmZtWFs5yzsD 5JXGR6g7miZHk2CRbkrQWA9wiAuMyz3TEpDi7wOgWvAGBBN0UNzYbQ/YcnrkXZt0 D34Lf30huMWfP8S+MVDNLb8145WD0EcKdxDECbQ2y3D6nYIAbvlrHI+5weJLmQzj s/e74E7mlYbAAb6ltIliA5ZzEwZd9TBQIwnw3rVv2MUCNmZErWniSOcaqAmZFlVG 2rO+WuDkaZwZ7rTszdg3LmH0ZmWeL1FER9r5ZiuNX0D84+GFLxGyQhyQNlEDu/HK yQYMz9PoUAN6SvP9vnefwRi2J5W3V7WTPmld1f/hFnvqQ5/mG6s= =445X -----END PGP SIGNATURE----- --ozaySXAAMhQABVCl--