[ovs-dev] [PATCH v2 16/17] userspace: enable layer3 option for vxlan-gpe
Yi Yang
yi.y.yang at intel.com
Wed Dec 28 12:26:29 UTC 2016
Signed-off-by: Yi Yang <yi.y.yang at intel.com>
---
lib/netdev-vport.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 9dd38fc..7f52afc 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -410,6 +410,7 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args)
uint16_t dst_proto = 0, src_proto = 0;
struct netdev_tunnel_config tnl_cfg;
struct smap_node *node;
+ bool is_layer3 = false;
has_csum = strstr(type, "gre") || strstr(type, "geneve") ||
strstr(type, "stt") || strstr(type, "vxlan");
@@ -505,6 +506,7 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args)
tnl_cfg.exts |= (1 << OVS_VXLAN_EXT_GBP);
} else if (!strcmp(type, "vxlan") && !strcmp(ext, "gpe")) {
tnl_cfg.exts |= (1 << OVS_VXLAN_EXT_GPE);
+ optional_layer3 = true;
} else {
VLOG_WARN("%s: unknown extension '%s'", name, ext);
}
@@ -513,15 +515,21 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args)
}
free(str);
- } else if (!strcmp(node->key, "layer3") && optional_layer3) {
+ } else if (!strcmp(node->key, "layer3")) {
if (!strcmp(node->value, "true")) {
- tnl_cfg.is_layer3 = true;
+ is_layer3 = true;
}
} else {
VLOG_WARN("%s: unknown %s argument '%s'", name, type, node->key);
}
}
+ if (optional_layer3 && is_layer3) {
+ tnl_cfg.is_layer3 = is_layer3;
+ } else if (!optional_layer3 && is_layer3) {
+ VLOG_WARN("%s: unknown %s argument '%s'", name, type, "layer3");
+ }
+
if (!ipv6_addr_is_set(&tnl_cfg.ipv6_dst) && !tnl_cfg.ip_dst_flow) {
VLOG_ERR("%s: %s type requires valid 'remote_ip' argument",
name, type);
@@ -631,7 +639,8 @@ get_tunnel_config(const struct netdev *dev, struct smap *args)
smap_add(args, "csum", "true");
}
- if (tnl_cfg.is_layer3 && !strcmp("gre", type)) {
+ if (tnl_cfg.is_layer3 && (!strcmp("gre", type) ||
+ !strcmp("vxlan", type))) {
smap_add(args, "layer3", "true");
}
--
2.1.0
More information about the dev
mailing list