[PATCH net-next v2 09/13] net: rtnetlink: Report port ID in fallback FDB notifications

From
Petr Machata <petrm@nvidia.com>
Date
2026-11-30 13:05:44
Also in
bridge
Reply to
Petr Machata, 2026-11-30
The previous patch made the bridge and VXLAN drivers report the port ID of
the requester in the FDB notifications that they emit. Other drivers that
implement ndo_fdb_add and ndo_fdb_del, as well as the default
implementations ndo_dflt_fdb_add() and ndo_dflt_fdb_del(), do not send
notifications themselves. Instead rtnl_fdb_add() and rtnl_fdb_del() send
one on their behalf through rtnl_fdb_notify(), and that always uses port ID
of zero.

Pass the port ID of the requester to rtnl_fdb_notify() as well, so that
the notifications sent for these devices carry it in nlmsg_pid just like
the ones from bridge and VXLAN.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
---
 net/core/rtnetlink.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e1607a3232c7..51713666f0e3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -4721,7 +4721,7 @@ static inline size_t rtnl_fdb_nlmsg_size(const struct net_device *dev)
 }
 
 static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type,
-			    u16 ndm_state)
+			    u16 ndm_state, u32 portid)
 {
 	struct net *net = dev_net(dev);
 	struct sk_buff *skb;
@@ -4732,7 +4732,7 @@ static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type,
 		goto errout;
 
 	err = nlmsg_populate_fdb_fill(skb, dev, addr, vid,
-				      0, 0, type, NTF_SELF, 0, ndm_state);
+				      portid, 0, type, NTF_SELF, 0, ndm_state);
 	if (err < 0) {
 		kfree_skb(skb);
 		goto errout;
@@ -4888,7 +4888,7 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 		if (!err && !notified) {
 			rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH,
-					ndm->ndm_state);
+					ndm->ndm_state, parms.portid);
 			ndm->ndm_flags &= ~NTF_SELF;
 		}
 	}
@@ -5033,7 +5033,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
 		if (!err) {
 			if (!del_bulk && !notified)
 				rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH,
-						ndm->ndm_state);
+						ndm->ndm_state, portid);
 			ndm->ndm_flags &= ~NTF_SELF;
 		}
 	}
-- 
2.56.1
Thread (25 messages) 25 messages, 3 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help