From: Hengyu Liang <hengyul@cs.unc.edu>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Kuniyuki Iwashima <kuniyu@google.com>,
David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>, Simon Horman <horms@kernel.org>,
Sabrina Dubroca <sd@queasysnail.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net] neighbour: do not update an existing proxy entry on SIOCSARP
Date: Fri, 13 Nov 2026 14:33:55 -0500 [thread overview]
Message-ID: <20261113193355.3820232-1-hengyul@cs.unc.edu> (raw)
Commit dc2a27e524ac ("neighbour: Update pneigh_entry in
pneigh_create().") moved the update of flags, protocol and permanent
from neigh_add() into pneigh_create().
However, arp_req_set_public() also calls pneigh_create(), with all
three set to zero. As of now, SIOCSARP on an address that already has a
proxy entry clears the flags of the entry and makes it non-permanent.
The entry is then removed when the carrier goes down, and the host no
longer answers ARP requests for the address.
A similar issue happened before with the protocol. It was fixed by
commit cbada1048847 ("neighbour: restore protocol != 0 check in pneigh
update"). Perhaps flags and permanent need a fix as well.
The issue can be reproduced with:
ip link add d0 type veth peer name d1
ip link set d0 up
ip link set d1 up
ip neigh add proxy 10.9.9.9 dev d0
arp -i d0 -Ds 10.9.9.9 d0 pub
ip link set d1 down
sleep 1
ip neigh show proxy
Before commit dc2a27e524ac ("neighbour: Update pneigh_entry in
pneigh_create()."), the result is:
10.9.9.9 dev d0 proxy
After that commit, the result is empty.
This patch will add an update argument to pneigh_create(). Only
neigh_add() sets it, so SIOCSARP leaves an existing entry alone again.
Fixes: dc2a27e524ac ("neighbour: Update pneigh_entry in pneigh_create().")
Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
---
Tested on net: with this patch, the entry stays after the carrier goes
down and the host still answers ARP requests for the address, as before
the commit. "ip neigh add/replace/change proxy" still update an
existing entry, and SIOCSARP still creates an entry when there is none.
include/net/neighbour.h | 2 +-
net/core/neighbour.c | 9 ++++++---
net/ipv4/arp.c | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 79a5a548a129..d6d691fec124 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -394,7 +394,7 @@ struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl,
const void *key, struct net_device *dev);
int pneigh_create(struct neigh_table *tbl, const void *key,
struct net_device *dev, u32 flags, u8 protocol,
- bool permanent);
+ bool permanent, bool update);
int pneigh_delete(struct neigh_table *tbl, const void *key,
struct net_device *dev);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index d6e9c7c59a89..ae2db3912454 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -783,7 +783,7 @@ struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl,
int pneigh_create(struct neigh_table *tbl,
const void *pkey, struct net_device *dev,
- u32 flags, u8 protocol, bool permanent)
+ u32 flags, u8 protocol, bool permanent, bool update)
{
struct pneigh_entry *n;
unsigned int key_len;
@@ -793,8 +793,11 @@ int pneigh_create(struct neigh_table *tbl,
mutex_lock(&tbl->phash_lock);
n = pneigh_lookup(tbl, pkey, dev);
- if (n)
+ if (n) {
+ if (!update)
+ goto out;
goto update;
+ }
key_len = tbl->key_len;
n = kzalloc(sizeof(*n) + key_len, GFP_KERNEL);
@@ -2155,7 +2158,7 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh,
}
err = pneigh_create(tbl, dst, dev, ndm_flags, protocol,
- !!(ndm->ndm_state & NUD_PERMANENT));
+ !!(ndm->ndm_state & NUD_PERMANENT), true);
goto out;
}
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 1ca4ced280ae..3bc8db6ccd68 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1099,7 +1099,7 @@ static int arp_req_set_public(struct net *net, struct arpreq *r,
if (mask) {
__be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
- return pneigh_create(tbl, &ip, dev, 0, 0, false);
+ return pneigh_create(tbl, &ip, dev, 0, 0, false, false);
}
return arp_req_set_proxy(net, dev, 1);
base-commit: ead6fa9a0ab194f02a2f36d634b193e9c5f9a1c6
--
2.53.0
next reply other threads:[~2026-11-13 19:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 19:33 Hengyu Liang [this message]
2026-11-13 19:37 ` netdev-bot+sinfo
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=20261113193355.3820232-1-hengyul@cs.unc.edu \
--to=hengyul@cs.unc.edu \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
/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®