[ovs-dev] [PATCH] netdev: fix missing shifts of VXLAN_EXT_GPE

Eric Garver e at erig.me
Fri Jun 30 20:27:45 UTC 2017


Contrary to the comment by the enum value, these are actually regular
enum values that need shifted. VXLAN_EXT_GBP for example is used as a
netlink value for vports.

Fixes: 875ab13020b1 ("userspace: Handling of versatile tunnel ports")
Signed-off-by: Eric Garver <e at erig.me>
---
 datapath/linux/compat/include/linux/openvswitch.h | 5 +++--
 lib/netdev-vport.c                                | 7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h
index 91d31401ae71..9d08dacae5cc 100644
--- a/datapath/linux/compat/include/linux/openvswitch.h
+++ b/datapath/linux/compat/include/linux/openvswitch.h
@@ -290,8 +290,9 @@ enum ovs_vport_attr {
 
 enum {
 	OVS_VXLAN_EXT_UNSPEC,
-	OVS_VXLAN_EXT_GBP,      /* Flag or __u32 */
-	OVS_VXLAN_EXT_GPE = 8,  /* Flag or __u32 */
+	OVS_VXLAN_EXT_GBP,
+	/* place new values here to fill gap. */
+	OVS_VXLAN_EXT_GPE = 8,
 	__OVS_VXLAN_EXT_MAX,
 };
 
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 7de58b8a313e..64a3ba3c46ff 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -407,7 +407,8 @@ tunnel_supported_layers(const char *type,
         return TNL_L3;
     } else if (!strcmp(type, "gre")) {
         return TNL_L2 | TNL_L3;
-    } else if (!strcmp(type, "vxlan") && tnl_cfg->exts & OVS_VXLAN_EXT_GPE) {
+    } else if (!strcmp(type, "vxlan")
+               && tnl_cfg->exts & (1 << OVS_VXLAN_EXT_GPE)) {
         return TNL_L2 | TNL_L3;
     } else {
         return TNL_L2;
@@ -545,8 +546,8 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args, char **errp)
 
     enum tunnel_layers layers = tunnel_supported_layers(type, &tnl_cfg);
     const char *full_type = (strcmp(type, "vxlan") ? type
-                             : tnl_cfg.exts & OVS_VXLAN_EXT_GPE ? "VXLAN-GPE"
-                             : "VXLAN (without GPE");
+                             : (tnl_cfg.exts & (1 << OVS_VXLAN_EXT_GPE)
+                                ? "VXLAN-GPE" : "VXLAN (without GPE"));
     const char *packet_type = smap_get(args, "packet_type");
     if (!packet_type) {
         tnl_cfg.pt_mode = default_pt_mode(layers);
-- 
2.12.0



More information about the dev mailing list