mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
lib/dpif-netlink: Fix miscompare of gre ports
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user