summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWilson Peng <pweisong@vmware.com>2022-11-09 11:31:46 +0800
committerAlin Gabriel Serdean <aserdean@ovn.org>2023-03-06 12:37:53 +0100
commite3c821f8ca866508b8aba70b08ed016898a06625 (patch)
treea151bbe8d8f2054b14761333f819460cb7079101 /lib
parentbfc0d5da350775f9872b57817169eaf146fb5461 (diff)
downloadopenvswitch-e3c821f8ca866508b8aba70b08ed016898a06625.tar.gz
netdev-windows: Add checking when creating netdev with system type on Windows
In the recent Antrea project testing, some port could not be created on Windows. When doing debug, our team found there is one case happening when multiple ports are waiting for be created with correct port number. Some system type port will be created netdev successfully and it will cause conflict as in the dpif side it will be internal type. So finally the port will be created failed and it could not be easily recovered. With the patch, on Windows the netdev creating will be blocked for system type when the ovs_tyep got on dpif is internal. More detailed case description is in the reported issue No.262 with link below. Reported-at:https://github.com/openvswitch/ovs-issues/issues/262 Signed-off-by: Wilson Peng <pweisong@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/netdev-windows.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c
index 4ad45ffa1..3fad501e3 100644
--- a/lib/netdev-windows.c
+++ b/lib/netdev-windows.c
@@ -156,6 +156,7 @@ netdev_windows_system_construct(struct netdev *netdev_)
struct netdev_windows_netdev_info info;
struct ofpbuf *buf;
int ret;
+ const char *type = NULL;
/* Query the attributes and runtime status of the netdev. */
ret = query_netdev(netdev_get_name(&netdev->up), &info, &buf);
@@ -167,6 +168,16 @@ netdev_windows_system_construct(struct netdev *netdev_)
}
ofpbuf_delete(buf);
+ /* Don't create netdev if ovs-type is "internal"
+ * but the type of netdev->up is "system". */
+ type = netdev_get_type(&netdev->up);
+ if (type && !strcmp(type, "system") &&
+ (info.ovs_type == OVS_VPORT_TYPE_INTERNAL)) {
+ VLOG_DBG("construct device %s, ovs_type: %u failed",
+ netdev_get_name(&netdev->up), info.ovs_type);
+ return 1;
+ }
+
netdev->change_seq = 1;
netdev->dev_type = info.ovs_type;
netdev->port_no = info.port_no;