From: Danielle Ratson <danieller@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <donald.hunter@gmail.com>, <kuba@kernel.org>,
<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
<horms@kernel.org>, <razor@blackwall.org>, <idosch@nvidia.com>,
<andrew+netdev@lunn.ch>, <shuah@kernel.org>, <ast@fiberby.net>,
<liuhangbin@gmail.com>, <daniel@iogearbox.net>,
<aroulin@nvidia.com>, <fmaurer@redhat.com>,
<sdf.kernel@gmail.com>, <sd@queasysnail.net>, <kees@kernel.org>,
<nickgarlis@gmail.com>, <amorenoz@redhat.com>,
<alasdair@mcwilliam.dev>,
<johannes.wiesboeck@aisec.fraunhofer.de>, <petrm@nvidia.com>,
<linux-kernel@vger.kernel.org>, <bridge@lists.linux.dev>,
<linux-kselftest@vger.kernel.org>,
Danielle Ratson <danieller@nvidia.com>
Subject: [PATCH net-next 4/6] bridge: Add port-level netlink handling for neigh_forward_grat
Date: Sun, 3 May 2026 10:35:30 +0300 [thread overview]
Message-ID: <20260503073532.2138165-5-danieller@nvidia.com> (raw)
In-Reply-To: <20260503073532.2138165-1-danieller@nvidia.com>
Add netlink handlers for the port-level neigh_forward_grat option via
IFLA_BRPORT_NEIGH_FORWARD_GRAT attribute.
The default value of OFF preserves existing behavior, i.e. gratuitous ARP
and unsolicited NA are suppressed when neigh_suppress is enabled. Users can
explicitly set it to ON to allow these packets through.
Example for enabling control via 'bridge link' command:
# bridge link set dev eth0 neigh_suppress on
# bridge link set dev eth0 neigh_forward_grat on
Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
---
net/bridge/br_netlink.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 6fd5386a1d64..898326c201ef 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -190,6 +190,7 @@ static inline size_t br_port_info_size(void)
+ nla_total_size(1) /* IFLA_BRPORT_LOCKED */
+ nla_total_size(1) /* IFLA_BRPORT_MAB */
+ nla_total_size(1) /* IFLA_BRPORT_NEIGH_VLAN_SUPPRESS */
+ + nla_total_size(1) /* IFLA_BRPORT_NEIGH_FORWARD_GRAT */
+ nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_ROOT_ID */
+ nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_BRIDGE_ID */
+ nla_total_size(sizeof(u16)) /* IFLA_BRPORT_DESIGNATED_PORT */
@@ -282,7 +283,9 @@ static int br_port_fill_attrs(struct sk_buff *skb,
nla_put_u8(skb, IFLA_BRPORT_LOCKED, !!(p->flags & BR_PORT_LOCKED)) ||
nla_put_u8(skb, IFLA_BRPORT_MAB, !!(p->flags & BR_PORT_MAB)) ||
nla_put_u8(skb, IFLA_BRPORT_NEIGH_VLAN_SUPPRESS,
- !!(p->flags & BR_NEIGH_VLAN_SUPPRESS)))
+ !!(p->flags & BR_NEIGH_VLAN_SUPPRESS)) ||
+ nla_put_u8(skb, IFLA_BRPORT_NEIGH_FORWARD_GRAT,
+ !!(p->flags & BR_NEIGH_FORWARD_GRAT)))
return -EMSGSIZE;
timerval = br_timer_value(&p->message_age_timer);
@@ -902,6 +905,7 @@ static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = {
[IFLA_BRPORT_MCAST_MAX_GROUPS] = { .type = NLA_U32 },
[IFLA_BRPORT_NEIGH_VLAN_SUPPRESS] = NLA_POLICY_MAX(NLA_U8, 1),
[IFLA_BRPORT_BACKUP_NHID] = { .type = NLA_U32 },
+ [IFLA_BRPORT_NEIGH_FORWARD_GRAT] = NLA_POLICY_MAX(NLA_U8, 1),
};
/* Change the state of the port and notify spanning tree */
@@ -970,6 +974,8 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[],
br_set_port_flag(p, tb, IFLA_BRPORT_MAB, BR_PORT_MAB);
br_set_port_flag(p, tb, IFLA_BRPORT_NEIGH_VLAN_SUPPRESS,
BR_NEIGH_VLAN_SUPPRESS);
+ br_set_port_flag(p, tb, IFLA_BRPORT_NEIGH_FORWARD_GRAT,
+ BR_NEIGH_FORWARD_GRAT);
if ((p->flags & BR_PORT_MAB) &&
(!(p->flags & BR_PORT_LOCKED) || !(p->flags & BR_LEARNING))) {
--
2.51.0
next prev parent reply other threads:[~2026-05-03 7:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-03 7:35 [PATCH net-next 0/6] bridge: Add selective forwarding of gratuitous neighbor announcements Danielle Ratson
2026-05-03 7:35 ` [PATCH net-next 1/6] bridge: uapi: Add neigh_forward_grat netlink attributes Danielle Ratson
2026-05-04 7:41 ` Nikolay Aleksandrov
2026-05-03 7:35 ` [PATCH net-next 2/6] bridge: Add internal flags for neigh_forward_grat Danielle Ratson
2026-05-04 7:41 ` Nikolay Aleksandrov
2026-05-03 7:35 ` [PATCH net-next 3/6] bridge: Add selective forwarding of gratuitous neighbor announcements Danielle Ratson
2026-05-04 7:41 ` Nikolay Aleksandrov
2026-05-03 7:35 ` Danielle Ratson [this message]
2026-05-04 7:42 ` [PATCH net-next 4/6] bridge: Add port-level netlink handling for neigh_forward_grat Nikolay Aleksandrov
2026-05-03 7:35 ` [PATCH net-next 5/6] bridge: Add per-VLAN " Danielle Ratson
2026-05-04 7:43 ` Nikolay Aleksandrov
2026-05-03 7:35 ` [PATCH net-next 6/6] selftests: net: Add tests for neigh_forward_grat option Danielle Ratson
2026-05-04 7:44 ` Nikolay Aleksandrov
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=20260503073532.2138165-5-danieller@nvidia.com \
--to=danieller@nvidia.com \
--cc=alasdair@mcwilliam.dev \
--cc=amorenoz@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=aroulin@nvidia.com \
--cc=ast@fiberby.net \
--cc=bridge@lists.linux.dev \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=fmaurer@redhat.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=johannes.wiesboeck@aisec.fraunhofer.de \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nickgarlis@gmail.com \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=razor@blackwall.org \
--cc=sd@queasysnail.net \
--cc=sdf.kernel@gmail.com \
--cc=shuah@kernel.org \
/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