🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21870

Re: [PATCH net v7] arp: Do not update neighbours from ARP in L2 multicast/broadcast frames

#21870
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 14:47
177 lines
14838 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] When drop_unicast_in_l2_multicast is set, every ARP frame that
  arrives as L2 broadcast/multicast and that arp_process() does not…
- [Medium] The patch reuses the existing IP-only
  drop_unicast_in_l2_multicast knob to block all ARP neighbour learning…
- [Low] The documentation and in-function comments do not match the new
  behaviour.

--

arp: Do not update neighbours from ARP in L2 multicast/broadcast frames

This patch extends the drop_unicast_in_l2_multicast sysctl to ARP. When
the sysctl is set, ARP packets received in link-layer broadcast or
multicast frames are no longer passed to neigh_event_ns() or
neigh_update(), so they cannot create or change neighbour entries.
Requests for local and proxied addresses are still answered.

> diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
> index d3523c9064a22..fd2ffb2d28126 100644
> --- a/Documentation/networking/ip-sysctl.rst
> +++ b/Documentation/networking/ip-sysctl.rst
> @@ -2302,7 +2302,9 @@ promote_secondaries - BOOLEAN
>  
>  drop_unicast_in_l2_multicast - BOOLEAN
>  	Drop any unicast IP packets that are received in link-layer
> -	multicast (or broadcast) frames.
> +	multicast (or broadcast) frames. ARP packets received in such
> +	frames are not used to create or update neighbour entries,
> +	but ARP requests for local addresses are still answered.

[Severity: Low]
This isn't a bug, but should this text also mention proxied addresses?

The commit message says "Requests for local and proxied addresses are
still answered". In arp_process(), the IN_DEV_FORWARD branch still handles
BMC frames when arp_fwd_proxy(), arp_fwd_pvlan() or pneigh_lookup()
matches. It either replies through arp_send_dst() or defers through
pneigh_enqueue().

Separately, the comment block above the request handling in arp_process()
still says:

 *  and in the case of requests for us we add the requester to the arp
 *  cache.

That is no longer true when bmc_no_learn is set. Could that comment be
updated too?

> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index 3bc8db6ccd68e..cc69ea07fc2de 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c

[ ... ]

> @@ -794,6 +795,10 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)
>  	    (!IN_DEV_ROUTE_LOCALNET(in_dev) && ipv4_is_loopback(tip)))
>  		goto out_free_skb;
>  
> +	bmc_no_learn = (skb->pkt_type == PACKET_BROADCAST ||
> +			skb->pkt_type == PACKET_MULTICAST) &&
> +		       IN_DEV_ORCONF(in_dev, DROP_UNICAST_IN_L2_MULTICAST);
> +

[ ... ]

> @@ -890,6 +902,10 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)
>  		}
>  	}
>  
> +	/* ARP received in L2 BMC frames must not change the neighbour table */
> +	if (bmc_no_learn)
> +		goto out_drop_dst;
> +
>  	/* Update our ARP tables */
>  
>  	n = ipv4_neigh_lookup(dev, &sip);

[Severity: Medium]
Is this exit also meant to catch broadcast ARP replies and gratuitous ARP?

ARPOP_REPLY never enters the request branch. So every reply or
announcement that arrives in a BMC frame now leaves here, before the
neigh_update() block. That also skips the existing handling for broadcast
replies further down:

		if (arp->ar_op != htons(ARPOP_REPLY) ||
		    skb->pkt_type != PACKET_HOST)
			state = NUD_STALE;
		neigh_update(n, sha, state,
			     override ? NEIGH_UPDATE_F_OVERRIDE : 0, 0);

On hosts that already have drop_unicast_in_l2_multicast enabled (commonly
Wi-Fi clients), some behaviour seems to change:

IPv4 link-local peers that broadcast their ARP replies, as RFC 3927
section 2.5 requires, would never resolve. Our INCOMPLETE entry never gets
an lladdr and goes to FAILED. Before this patch, the broadcast reply
resolved it as NUD_STALE.

Gratuitous ARP and announcements sent after an IP takeover or MAC change
are ignored. Examples are arp_notify, bonding, VRRP/keepalived failover
and VM migration. Traffic keeps going to the old MAC until NUD probing
fails.

arp_accept no longer has any effect for BMC frames on such interfaces.

This changes the semantics of an existing IP-only knob, and the patch
carries a Fixes: tag, so it will likely be backported to stable. Should
the commit message and the ip-sysctl.rst text describe these effects?

> @@ -953,6 +969,9 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)
>  	dst_release(reply_dst);
>  	return NET_RX_SUCCESS;
>  
> +out_drop_dst:
> +	dst_release(reply_dst);
> +
>  out_free_skb:
>  	kfree_skb(skb);
>  	return NET_RX_DROP;

[Severity: Medium]
Should these packets be consumed instead of dropped?

With the sysctl set, every BMC ARP that arp_process() does not answer now
takes goto out_drop_dst. Ordinary broadcast who-has requests for other
hosts on the LAN are the common case. They end in kfree_skb() with
SKB_DROP_REASON_NOT_SPECIFIED and return NET_RX_DROP. Before this patch,
the same frames went through consume_skb() and returned NET_RX_SUCCESS.

Normal background ARP would then show up as unexplained drops in
drop_monitor, dropwatch and the skb:kfree_skb tracepoint.

NF_HOOK returns the okfn result, so arp_rcv() also returns NET_RX_DROP to
netif_receive_skb(). Drivers that count that return value would then
increment rx_dropped. One example is rx_default_dqrr() in dpaa_eth.c:

	if (unlikely(netif_receive_skb(skb) == NET_RX_DROP)) {
		percpu_stats->rx_dropped++;

arp_rcv() in the same file avoids this on purpose for ARP that it
ignores:

	/* do not tweak dropwatch on an ARP we will ignore */
	if (dev->flags & IFF_NOARP ||
	    skb->pkt_type == PACKET_OTHERHOST ||
	    skb->pkt_type == PACKET_LOOPBACK)
		goto consumeskb;

The other users of the same sysctl, ip_rcv_finish_core() and
ip6_rcv_core(), use SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST when they
drop.

The ip-sysctl.rst text and the commit message say these ARP packets are
not used for neighbour entries. Neither says they are dropped. The v6
changelog does say "Drop the frame and release reply_dst on that path", so
the drop looks intentional.

If the drop is intended, could it at least use a specific drop reason?
Otherwise, could this path go to out_consume_skb, so the frame is consumed
and NET_RX_SUCCESS is returned?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123144535.155300-1-starchang%40google.com
Technical Details
Message-ID: <179553165359.3135.5730863120205025514@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370474-linux-kernel-netdev=dewy.ru
References: <20261123144535.155300-1-starchang@google.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370474-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v7] arp: Do not update neighbours from ARP in L2
 multicast/broadcast frames
Date: Tue, 24 Nov 2026 14:47:33 +0000
Organization: Usenet Network
Message-ID: <179553165359.3135.5730863120205025514@kernel.org>
References: <20261123144535.155300-1-starchang@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4161196"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:L5SXqeh8n22jNjFlMPUDnBUNjvY= sha256:id8tOE+wlioUcJJJou4nCo2eyq8EKF/Bp1vw8Qggj1s=
	sha1:cQEZToTuvgYbU5bG44cl2RZ+vcE= sha256:A0GYVUI5+LWDqJXsBwWHG/vfoHA6WoB45Z+a0i1hthM=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 7EA82125E19; Tue, 24 Nov 2026 17:48:03 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id vO2r5oRkj-O1;
	Tue, 24 Nov 2026 17:47:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370474-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 211AE125E1A; Tue, 24 Nov 2026 17:47:46 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 90F0A3ABF5; Tue, 24 Nov 2026 14:47:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795531661;
	b=RggnHrR7T0ug68HTPF8IlV58iPtFD3ooiJ5N4INQby10MtkV6JHdiQTsnV6SW9HV99U9
	 sKbf/YMZCmr3xVHOeyycNuqKHq3HVl0CkRkxry/2hq7bHR1ROccN7uq/S8Wv60k1EdzU+
	 O2W7N6tMUjWM5hHI8ZE7EN3JE8iMSxdAkE/dDTdL3LLlFAw4XK0LRciRTrapVKs3RRBLt
	 6MWSMM98e98WtfAVULi/VFFE8LTOdZ8X6ymVMGshfneHiMy2iFfKZzmlu6OYmlXl/oAEG
	 MmA8zoxLUjb7qsjZaLFzUQx892edq8Q35NPY0hnFENzNanF1+1TuUal8shALTgx8C4Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795531661;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=yF49Z1BigzOsvjFQC+5yrWqssjl3iTCT5GlauHiBNgU=;
	b=FxSanpk1do82Ia9F2yobszRceVgYtYd6x5MlUD9+uBESxsadcX0ELU9Z85HZ5cHRYXys
	 KUw0m5jc7M2JKbg3rr67Pqyd5t6bKUzjdjcuMIeF1Xgxj1DpcgY/ujkSk5GbaMJCzLYZE
	 YWcrrUuaSZOCnRaf/vSgM9xtaMaJ9tu5VYW8B3K3m2GqErsISl5EXWhuXA0bcrxkLPNEF
	 uXszePro3IRcFBYJp/WuFSVoKsumgWPPScFURFNDTxdhX3zXkVJ7dJy+rI3O0ZutnbydN
	 D2kp9EZhQVCMZsiQRT2tC+MSNnXhzTkTT/E8bRxqbwlVrlFCF0UtOsjm8Aw5fNQl/Hg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JJURJPKz;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 95E82606A331;
	Tue, 24 Nov 2026 14:47:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JJURJPKz
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795531655;
	b=SGmn9RJuv4LeuEdaA6LcPH3EMfrhMzxb90nPRY6cUgxUo8So/FDAxoTqtNcrH9dFoEUN
	 j30XbyEbK+ETup5UYY7Lg4hssHqOBvVU9GYiNxUiJKKUvQjhDFvrPzrwfBq9EojGTXQ9Q
	 qSCQk5RaSkMAYiT4hP4UDkvqTHR2VjbujbZgPgrfCwHp9n0paU7lT2b4P0dS9nKQWA3Z2
	 V8EpeSfnF/3usPoF4C4gskAtqWvNzofaWgJ9VLR9gnA1s/WAuZk1Cd8VWbDeoB5HFbD6N
	 dck99hj/QbsfdytuBaC6E6hVRh65RrzYji5eAd53XRK040we+QGd/cOR6jDZDwWt4vg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795531655;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=yF49Z1BigzOsvjFQC+5yrWqssjl3iTCT5GlauHiBNgU=;
	b=p0p3RfqzK3aIybqp1R6N2cZA+9ScY98h55sFA5oskn2rQslOsrZ2zHHqjrOwzEBTuHE1
	 mmZiJGhliLl67wjdNfYkG7qWTyahZHvsfMUn0hmNl2yX6WmtSk10AdldVVScuSyS5FOHK
	 B++f46FZXP9OMUcC0kqM9F1VW7Ij2lJdIPCvfGA8w78dDq7+KIidlI/SEl/QRNa7fEez8
	 bQvBGsGwRm91IpITAnrzkh0f7t9wTiUPDHS7ulMB2DXbuTNNCqKFSU5JUxi+QPILsDX43
	 YIngQfwKKyVa2rUlFzx2twTEutOeGR3VTT04MOrNMtFzxaS8oyiaiwt7EYQBf30/4ew==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JJURJPKz;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B01DC606A31E;
	Tue, 24 Nov 2026 14:47:35 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20B151F000C0;
	Tue, 24 Nov 2026 14:47:34 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795531655;
	bh=yF49Z1BigzOsvjFQC+5yrWqssjl3iTCT5GlauHiBNgU=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=JJURJPKzk5VxQ2NUQyKsRXz/HG+t2htw2wOXyITw2ENEnBufzQNwol4wUk6k2Yy7a
	 L3iz//qxA2+y82R7MNQ5s7EfxM2/EY9RD7v6R6ws6GBLAG4BemPIRmOpQPEmy7jeof
	 DUQB1uaEhwwOZTiACOqmtET9qmP4tIGos8LM9QZJB+LGmB+2t2FQOzBYJpYUYzvTek
	 N0FIirMUoaq/AqOeBb5XYs5oZi7k8FoZZRZRvkw9y6O6zKqRvxWtDtL0k7g8cy54cY
	 s/QdRiAN+f3hT9kv8zMAIgY97fcrAGvH0r4VVZMwk0q+ufQvAn0cdtx0TsmI/D+7Sw
	 XYi1RPDUSvKHw==
X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, willemb@google.com, horms@kernel.org, dsahern@kernel.org,
 idosch@nvidia.com, ja@ssi.bg, johannes@sipsolutions.net, corbet@lwn.net,
 skhan@linuxfoundation.org, rdunlap@infradead.org, netdev@vger.kernel.org,
 linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, wangroger@google.com
X-In-Reply-To: <20261123144535.155300-1-starchang@google.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list