Not sure why the list was not included in my previous reply, adding it back.

On 3/13/26 9:49 AM, Adrián Moreno wrote:
> On Wed, Mar 11, 2026 at 01:54:13PM +0100, Ilya Maximets wrote:
>> On 3/5/26 6:27 PM, Matteo Perin via dev wrote:
>>> For ports on non-system (i.e. userspace) datapaths, the 
>>> dpif_netlink_vport_get()
>>> call in netdev_linux_netnsid_update() is meaningless, these ports are not
>>> kernel vports.
>>>
>>> Generalize the tap class check in netdev_linux_netnsid_update() with a
>>> dpif_type check: when dpif_type is set and is not "system", assume the
>>> device is local without attempting the vport lookup.  This change will
>>> cover all device types on userspace datapaths (e.g. veth pairs).
>>>
>>> Additionally, bypass the nsid equality check in netdev_linux_update()
>>> for non-system datapaths.  When NETLINK_LISTEN_ALL_NSID is enabled,
>>> local RTM events carry the kernel-assigned namespace ID rather than
>>> NETNSID_LOCAL, causing a mismatch with the locally-assumed nsid.  For
>>> non-system datapaths, process all RTM events unconditionally (the
>>> interface name lookup already ensures only OVS-managed devices are
>>> affected).
>>
>> Hmm.  I don't think this is right.  The name is not unique across namespaces,
>> it can be a completely different device in a different namespace.  We can't
>> rely on just a name.
> 
> I think you're right. This can be problematic.
> 
>>
>> This all-nsids listening functionality is as annoying as it is useless... :)
>>
> 
> Should we go ahead with the attempts to deprecate it?

Let's see what comes from your question that nsid should not be present in the
local notifications.  But if it is present, then I don't think there is an
actual way for us to know what's local and what isn't, unless we check the 
actual
ID of the datapath interface and compare to that.  But it sounds like more and
more hacks for questionably useful functionality.  So, in this case it might be
better to just deprecate it.

> 
>> The unique identifier here is the name plus nsid.  Other unique identifier is
>> ifindex.  But if we want to use ifindex as identifier then we must never 
>> cache
>> ifindex from notifications, only from our own requests.
>>
>> Adrian, maybe you also have some thoughts on this one?
>>
> 
> The ifindex not globally unique either, it's only unique per-namespace so we
> have the same problem.
> 
> E.g:
> 
> $ ip  -j link | jq '.[] | select(.ifindex==2).ifname'
> "wlp0s20f3"
> $ ip -n ns1 -j link | jq '.[] | select(.ifindex==2).ifname'
> "ip6tnl0"


Yeah, OK.  That's unfortunate.

> 
> Thanks.
> Adrián
> 
>>>
>>> Together, these changes ensure RTM events (including RTM_DELLINK on
>>> device removal) are properly processed for system devices on userspace
>>> datapaths, enabling cache invalidation and stale value detection.
>>>
>>> Signed-off-by: Matteo Perin <[email protected]>
>>> ---
>>>  lib/netdev-linux.c | 17 +++++++++++++++--
>>>  1 file changed, 15 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
>>> index 47faea8c6..c6ea21d35 100644
>>> --- a/lib/netdev-linux.c
>>> +++ b/lib/netdev-linux.c
>>> @@ -614,7 +614,12 @@ static int
>>>  netdev_linux_netnsid_update(struct netdev_linux *netdev)
>>>  {
>>>      if (netnsid_is_unset(netdev->netnsid)) {
>>> -        if (netdev_get_class(&netdev->up) == &netdev_tap_class) {
>>> +        const char *dpif_type = netdev_get_dpif_type(&netdev->up);
>>> +
>>> +        if (netdev_get_class(&netdev->up) == &netdev_tap_class
>>> +            || (dpif_type && strcmp(dpif_type, "system"))) {
>>> +            /* vport netlink lookup makes no sense for
>>> +             * non-system dpif types, set nsid to local. */
>>>              netnsid_set_local(&netdev->netnsid);
>>>          } else {
>>>              return netdev_linux_netnsid_update__(netdev);
>>> @@ -931,7 +936,15 @@ netdev_linux_update(struct netdev_linux *dev, int nsid,
>>>                      const struct rtnetlink_change *change)
>>>      OVS_REQUIRES(dev->mutex)
>>>  {
>>> -    if (netdev_linux_netnsid_is_eq(dev, nsid)) {
>>> +    const char *dpif_type = netdev_get_dpif_type(&dev->up);
>>> +
>>> +    /* With NETLINK_LISTEN_ALL_NSID, local RTM events carry the 
>>> kernel-assigned
>>> +     * nsid, not NETNSID_LOCAL.  In netdev_linux_netnsid_update() 
>>> non-system
>>> +     * devices have their nsid forced to NETNSID_LOCAL (no vport lookup),
>>> +     * so the equality check would always fail and events would be dropped.
>>> +     * The nsid equality check for these devices is, therefore, skipped. */
>>> +    if ((dpif_type && strcmp(dpif_type, "system"))
>>> +        || netdev_linux_netnsid_is_eq(dev, nsid)) {
>>>          netdev_linux_update__(dev, change);
>>>      }
>>>  }
>>
> 

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to