diff mbox series

[ovs-dev] 回复: [PATCH v3] netdev-vport : Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs.

Message ID MEYP282MB3302D9C98D037B8E561A10B2CD6B9@MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM
State Not Applicable
Headers show
Series [ovs-dev] 回复: [PATCH v3] netdev-vport : Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs. | expand

Checks

Context Check Description
ovsrobot/apply-robot fail apply and check: fail

Commit Message

lin huang Dec. 4, 2021, 8:52 a.m. UTC
hi all,

pls review my code.

Regards,
Lin Huang
diff mbox series

Patch

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 499c029..f0ff02b 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -1151,8 +1151,10 @@  netdev_vport_get_ifindex(const struct netdev *netdev_)
 {
     char buf[NETDEV_VPORT_NAME_BUFSIZE];
     const char *name = netdev_vport_get_dpif_port(netdev_, buf, sizeof(buf));
+    const char *dpif_type = netdev_get_dpif_type(netdev_);

-    return linux_get_ifindex(name);
+    return (dpif_type && !strcmp(dpif_type, "system")
+            ? linux_get_ifindex(name) : -ENODEV);
 }

 #define NETDEV_VPORT_GET_IFINDEX netdev_vport_get_ifindex
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 5223aa8..513ef7e 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2052,6 +2052,8 @@  iface_do_create(const struct bridge *br,
         goto error;
     }

+    netdev_set_dpif_type(netdev, br->ofproto->type);
+
     error = iface_set_netdev_config(iface_cfg, netdev, errp);
     if (error) {
         goto error;