From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KNZSSiHm; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 3E5DA5A004C for ; Thu, 17 Oct 2024 10:45:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729154730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ztfexar2ij8Xo64cQBUCukeTavpxRLlOviu4NN3s5yI=; b=KNZSSiHm7Kp+Y/GWS5XZ6ghppOl94kjIAJM5BGyJOSQLMW9q+gggfA9deTahtO+DJe7iWg MNdJpMbBEhFH0g2gGZlhfOGkxX8a/uXEQReH8P7TKszc0SDzvFLAcLeX5t1nhgL6bz0Eic 1jIaWl6YMOVnWHB45CqPb9uL17ZIyd8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-546-tliP3H9ZNjKM_QoBupkcWQ-1; Thu, 17 Oct 2024 04:45:28 -0400 X-MC-Unique: tliP3H9ZNjKM_QoBupkcWQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4315e8e9b1cso343115e9.1 for ; Thu, 17 Oct 2024 01:45:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729154727; x=1729759527; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ztfexar2ij8Xo64cQBUCukeTavpxRLlOviu4NN3s5yI=; b=mEm7Ou/D3G6aK1vSKW/bwFrQ6kkwftI5nrf9cYEMs/IyvTao0zgtjrTiqTkDofJ4Sc 6YQ3o8tUximMMg2khi21hOVDGpNK4WqZlmNg/KHX0iroQfBK5U/QSCSQCuRfJafMswVh eMJUGHzzSF/0aKX3FZ3ZQwhQoZn0Pc1dNj+B8uBGoDmVIc7+OCbIB9SUTJBFhypIqRyR Bc+YOwMyG9ZsO+Gyl8NeLOI/oXXco8AqOLsuLgqxSEH+DlCTlpL2v44wBKajU6XecAvB u7ytgB4WCHr6YicDhHhDKcgYe8mLJ13uH6Yr1qz21yKiZOf/UO2AWQ7yZOSxgmP3NAfv ZKOQ== X-Gm-Message-State: AOJu0YxxgSh0GoOB70+mAyp15yVjAq6eAfysnNtLGATMvzA+sjKxtQso 6ezyfX7irTv5k8ocYvJQ+wusIR5NRv5Y4G8Pf+ijmjiUPvcyUXq/r7RQB4wgIXyANBZnpuR1TCz /nnVXQ1dQTCZN1ljgPbr0paTzeO/NFN7QO8aggpZxx6t6bl0qOqOWK5ZzWg== X-Received: by 2002:a05:600c:4fd2:b0:426:5e32:4857 with SMTP id 5b1f17b1804b1-4315866ed2dmr15161935e9.0.1729154726992; Thu, 17 Oct 2024 01:45:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHg+0VFQj10s1n9MdhmX7+R5KSO4ju7/unlICn/4E7YFHqcFZPHNU/d6zm/HCmjs/on4IlWaA== X-Received: by 2002:a05:600c:4fd2:b0:426:5e32:4857 with SMTP id 5b1f17b1804b1-4315866ed2dmr15161725e9.0.1729154726585; Thu, 17 Oct 2024 01:45:26 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43150469a35sm40673965e9.1.2024.10.17.01.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 01:45:25 -0700 (PDT) Date: Thu, 17 Oct 2024 10:45:24 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v4 1/7] arp: Fix a handful of small warts Message-ID: <20241017104524.13004949@elisabeth> In-Reply-To: <20241017053304.909386-2-david@gibson.dropbear.id.au> References: <20241017053304.909386-1-david@gibson.dropbear.id.au> <20241017053304.909386-2-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: IZVADRJDCON7EDTWA4OCA5LAQBH6G5BZ X-Message-ID-Hash: IZVADRJDCON7EDTWA4OCA5LAQBH6G5BZ X-MailFrom: sbrivio@redhat.com 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: On Thu, 17 Oct 2024 16:32:58 +1100 David Gibson 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 > --- > 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