On 11/30/26 2:03 PM, Petr Machata wrote:
> Every netlink message carries a port ID in the nlmsg_pid header field. The
> port ID identifies a netlink socket. In a request it is the port ID of the
> socket that sent it. When a change that results from a request is
> announced to the multicast listeners, the kernel puts the port ID of the
> requester in nlmsg_pid of the notification. For changes that the kernel
> initiates by itself, such as aging, nlmsg_pid is zero.
>
> This is used by applications that both configure the kernel and listen to
> notifications from it. By comparing nlmsg_pid to the port ID of their own
> socket, they can tell their own changes apart from those made by someone
> else, and ignore the former. Commit 7b8f7a402d4c ("neighbour: fix nlmsg_pid
> in notifications") fixed this for IP neighbours, citing quagga as one such
> application. Routes and nexthops report the port ID as well.
>
> For FDB entries, the notifications (RTM_NEWNEIGH and RTM_DELNEIGH with the
> AF_BRIDGE family) always carry zero, whoever caused them, so applications
> that manage FDB cannot do this sort of filtering. Hence this patchset.
>
> The patchset goes through the following steps:
>
> - FDB notifications are generated in two places. The bridge and VXLAN
> drivers send their own from ndo_fdb_add, _del and _del_bulk, but these
> NDOs are not given the port ID of the requester. For other drivers that
> implement ndo_fdb_add / _del, the rtnetlink core sends a default
> notification on their behalf. It has the port ID at hand, but does not
> pass it on.
>
> The obvious way to get the port ID to the bridge and VXLAN is to add it
> to the NDO prototypes. But ndo_fdb_add and _del already carry many
> arguments, and one more would further complicate the already unwieldy
> prototypes, as well as require adjustments in every driver. Instead, in
> patch #1, convert the prototypes of ndo_fdb_add, _del and _get to take a
> new struct ndo_fdb_parms. ndo_fdb_get already has the port ID, but it
> shares most of its arguments with the other two, so it makes sense to
> treat them alike.
[..]
> drivers/net/ethernet/intel/i40e/i40e_main.c | 29 +-
> drivers/net/ethernet/intel/ice/ice_main.c | 43 ++-
> drivers/net/ethernet/intel/igb/igb_main.c | 14 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 +-
Acked-by: Przemek Kitszel <prze…@intel.com>