]> git.proxmox.com Git - mirror_ovs.git/commitdiff
lib/dpif-netlink: Fix miscompare of gre ports
authorGreg Rose <gvrose8192@gmail.com>
Fri, 4 May 2018 23:48:43 +0000 (16:48 -0700)
committerBen Pfaff <blp@ovn.org>
Tue, 22 May 2018 03:33:30 +0000 (20:33 -0700)
In netdev_to_ovs_vport_type() it checks for netdev types matching
"gre" with a strstr().  This makes it match ip6gre as well and return
OVS_VPORT_TYPE_GRE, which is clearly wrong.

Move the usage of strstr() *after* all the exact matches with strcmp()
to avoid the problem permanently because when I added the ip6gre
type I ran into a very difficult to detect bug.

Cc: Ben Pfaff <blp@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
lib/dpif-netlink.c

index 607b497284376a53b4980c297b81f4ee0d3ce56a..41f42dc5e1bd21ce043980c9c950112a2519e851 100644 (file)
@@ -817,8 +817,6 @@ netdev_to_ovs_vport_type(const char *type)
         return OVS_VPORT_TYPE_STT;
     } else if (!strcmp(type, "geneve")) {
         return OVS_VPORT_TYPE_GENEVE;
-    } else if (strstr(type, "gre")) {
-        return OVS_VPORT_TYPE_GRE;
     } else if (!strcmp(type, "vxlan")) {
         return OVS_VPORT_TYPE_VXLAN;
     } else if (!strcmp(type, "lisp")) {
@@ -829,6 +827,8 @@ netdev_to_ovs_vport_type(const char *type)
         return OVS_VPORT_TYPE_IP6ERSPAN;
     } else if (!strcmp(type, "ip6gre")) {
         return OVS_VPORT_TYPE_IP6GRE;
+    } else if (!strcmp(type, "gre")) {
+        return OVS_VPORT_TYPE_GRE;
     } else {
         return OVS_VPORT_TYPE_UNSPEC;
     }