diff mbox series

[ovs-dev,v5,1/4] netdev-linux: Skip vport nsid lookup for user dpif.

Message ID 20260318110442.102318-2-matteo.perin@canonical.com
State New
Delegated to: Ilya Maximets
Headers show
Series netdev-linux: Add peer_ifindex in interface status for veth. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Matteo Perin March 18, 2026, 11:04 a.m. UTC
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).

Signed-off-by: Matteo Perin <matteo.perin@canonical.com>
---
 lib/netdev-linux.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 47faea8c6..c694dc1c5 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);