summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Huang <linhuang@ruijie.com.cn>2021-11-24 13:32:41 +0000
committerIlya Maximets <i.maximets@ovn.org>2021-12-08 18:17:19 +0100
commit4f19a78a61c591d0620574961334aee2cabb4ce7 (patch)
tree51dff3d017561df24f4a10383399b9d3195379d9
parent4a7b58163f08b102fb0e1e07a137d8bdc4648aaa (diff)
downloadopenvswitch-4f19a78a61c591d0620574961334aee2cabb4ce7.tar.gz
netdev-vport: Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs.
Userspace tunnel doesn't have a valid device in the kernel. So get_ifindex() function (ioctl) always get error during adding a port, deleting a port or updating a port status. The info log is "2021-08-29T09:17:39.830Z|00059|netdev_linux|INFO|ioctl(SIOCGIFINDEX) on vxlan_sys_4789 device failed: No such device" If there are a lot of userspace tunnel ports on a bridge, the iface_refresh_netdev_status() function will spend a lot of time. So ignore userspace tunnel port ioctl(SIOCGIFINDEX) operation, just return -ENODEV. Signed-off-by: Lin Huang <linhuang@ruijie.com.cn> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r--lib/netdev-vport.c6
-rw-r--r--vswitchd/bridge.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 499c0291c..64331f74b 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -1151,6 +1151,12 @@ 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_);
+
+ if (dpif_type && strcmp(dpif_type, "system")) {
+ /* Not a system device. */
+ return -ENODEV;
+ }
return linux_get_ifindex(name);
}
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 5223aa897..513ef7ea9 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;