From: Star Chang <starchang@google.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: johannes@sipsolutions.net, netdev@vger.kernel.org,
dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, linux-kernel@vger.kernel.org,
wangroger@google.com
Subject: Re: [PATCH net v4] net: Fix Hole-196 vulnerability by dropping unicast ARP/IP in L2 BMC
Date: Mon, 16 Nov 2026 13:37:33 +0000 [thread overview]
Message-ID: <20261116133734.607866-1-starchang@google.com> (raw)
In-Reply-To: <0f9ce5de-4e1c-52a3-1bee-aecb1cd836db@ssi.bg>
Hi Julian,
You are right, any broadcast request with sip = GW can do it, not only
GARP, so drop_gratuitous_arp does not help here.
Following your suggestion, when drop_unicast_in_l2_multicast is set, ARP
received in L2 BMC frames skips neigh_event_ns() and neigh_update(), so
it cannot create or change any neighbour entry. Requests for us are
still answered. Something like:
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -714,6 +714,7 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)
struct neighbour *n;
struct dst_entry *reply_dst = NULL;
bool is_garp = false;
+ bool bmc_no_override;
/* arp_rcv below verifies the ARP header and verifies the device
* is ARP'able.
@@ -791,6 +792,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_override = (skb->pkt_type == PACKET_BROADCAST ||
+ skb->pkt_type == PACKET_MULTICAST) &&
+ IN_DEV_ORCONF(in_dev, DROP_UNICAST_IN_L2_MULTICAST);
+
/*
* For some 802.11 wireless deployments (and possibly other networks),
* there will be an ARP proxy and gratuitous ARP frames are attacks
@@ -850,14 +855,19 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)
if (!dont_send && IN_DEV_ARPFILTER(in_dev))
dont_send = arp_filter(sip, tip, dev);
if (!dont_send) {
- n = neigh_event_ns(&arp_tbl, sha, &sip, dev);
- if (n) {
- arp_send_dst(ARPOP_REPLY, ETH_P_ARP,
- sip, dev, tip, sha,
- dev->dev_addr, sha,
- reply_dst);
- neigh_release(n);
+ n = NULL;
+ /* Do not learn the sender from a BMC frame */
+ if (!bmc_no_override) {
+ n = neigh_event_ns(&arp_tbl, sha, &sip, dev);
+ if (!n)
+ goto out_consume_skb;
}
+ arp_send_dst(ARPOP_REPLY, ETH_P_ARP,
+ sip, dev, tip, sha,
+ dev->dev_addr, sha,
+ reply_dst);
+ if (n)
+ neigh_release(n);
}
goto out_consume_skb;
} else if (IN_DEV_FORWARD(in_dev)) {
@@ -866,9 +876,11 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)
arp_fwd_pvlan(in_dev, dev, rt, sip, tip) ||
(rt->dst.dev != dev &&
pneigh_lookup(&arp_tbl, net, &tip, dev)))) {
- n = neigh_event_ns(&arp_tbl, sha, &sip, dev);
- if (n)
- neigh_release(n);
+ if (!bmc_no_override) {
+ n = neigh_event_ns(&arp_tbl, sha, &sip, dev);
+ if (n)
+ neigh_release(n);
+ }
if (NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED ||
skb->pkt_type == PACKET_HOST ||
@@ -887,6 +899,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_override)
+ goto out_consume_skb;
+
/* Update our ARP tables */
n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
If this looks OK I will send v6.
Thanks,
Star
next prev parent reply other threads:[~2026-11-16 13:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 15:05 [PATCH net v3] " Star Chang
2026-10-27 1:56 ` [PATCH net v4] " Star Chang
2026-10-27 12:16 ` Julian Anastasov
2026-10-28 6:16 ` Star Chang
2026-10-28 15:22 ` Julian Anastasov
2026-10-29 9:02 ` Star Chang
2026-10-30 5:20 ` Julian Anastasov
2026-10-30 22:21 ` Johannes Berg
2026-10-30 3:07 ` Star Chang
[not found] ` <65cf2338-7bb4-3151-f3b1-ef171bb5723b@ssi.bg>
2026-10-30 6:52 ` Star Chang
2026-10-30 18:46 ` Julian Anastasov
[not found] ` <c2780bb291244cf32c1dbda63f0dcf594d22da30.camel@sipsolutions.net>
2026-11-02 7:05 ` Star Chang
2026-11-02 21:27 ` Julian Anastasov
2026-11-16 13:37 ` Star Chang [this message]
2026-10-29 16:56 ` netdev-bot+sashiko
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=20261116133734.607866-1-starchang@google.com \
--to=starchang@google.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=ja@ssi.bg \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wangroger@google.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®