From 526df7d8543f7f651059338e42f409f04bb9970b Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Fri, 6 Feb 2015 21:10:45 +0100 Subject: [PATCH] tunnel: Provide framework for tunnel extensions for VXLAN-GBP and others Supports a new "exts" field in the tunnel configuration which takes a comma separated list of enabled extensions. The only extension supported so far is GBP but this can be used to enable RCO and possibly others as soon as the OVS datapath supports them. Signed-off-by: Thomas Graf Acked-by: Ben Pfaff --- lib/dpif-netlink.c | 20 +++++++++++++++++--- lib/netdev-vport.c | 18 ++++++++++++++++++ lib/netdev.h | 2 ++ vswitchd/vswitch.xml | 20 ++++++++++++++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index 1d8abdf67..337ebd6d0 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -849,10 +849,24 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif, struct netdev *netdev, } tnl_cfg = netdev_get_tunnel_config(netdev); - if (tnl_cfg && tnl_cfg->dst_port != 0) { + if (tnl_cfg && (tnl_cfg->dst_port != 0 || tnl_cfg->exts)) { ofpbuf_use_stack(&options, options_stub, sizeof options_stub); - nl_msg_put_u16(&options, OVS_TUNNEL_ATTR_DST_PORT, - ntohs(tnl_cfg->dst_port)); + if (tnl_cfg->dst_port) { + nl_msg_put_u16(&options, OVS_TUNNEL_ATTR_DST_PORT, + ntohs(tnl_cfg->dst_port)); + } + if (tnl_cfg->exts) { + size_t ext_ofs; + int i; + + ext_ofs = nl_msg_start_nested(&options, OVS_TUNNEL_ATTR_EXTENSION); + for (i = 0; i < 32; i++) { + if (tnl_cfg->exts & (1 << i)) { + nl_msg_put_flag(&options, i); + } + } + nl_msg_end_nested(&options, ext_ofs); + } request.options = ofpbuf_data(&options); request.options_len = ofpbuf_size(&options); } diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 91acabb4e..9d02f2f68 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -532,6 +532,24 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args) !strcmp(node->key, "in_key") || !strcmp(node->key, "out_key")) { /* Handled separately below. */ + } else if (!strcmp(node->key, "exts")) { + char *str = xstrdup(node->value); + char *ext, *save_ptr = NULL; + + tnl_cfg.exts = 0; + + ext = strtok_r(str, ",", &save_ptr); + while (ext) { + if (!strcmp(type, "vxlan") && !strcmp(ext, "gbp")) { + tnl_cfg.exts |= (1 << OVS_VXLAN_EXT_GBP); + } else { + VLOG_WARN("%s: unknown extension '%s'", name, ext); + } + + ext = strtok_r(NULL, ",", &save_ptr); + } + + free(str); } else { VLOG_WARN("%s: unknown %s argument '%s'", name, type, node->key); } diff --git a/lib/netdev.h b/lib/netdev.h index c5aa17d49..33f301ac0 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -120,6 +120,8 @@ struct netdev_tunnel_config { ovs_be32 ip_src; ovs_be32 ip_dst; + uint32_t exts; + uint8_t ttl; bool ttl_inherit; diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index d0bd4462b..932e4b287 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1904,6 +1904,26 @@ to false to disable. + + + +

Optional. Comma separated list of optional VXLAN extensions to + enable. The following extensions are supported:

+ +
    +
  • + gbp: VXLAN-GBP allows to transport the group policy + context of a packet across the VXLAN tunnel to other network + peers. See the field description of tun_gbp_id and + tun_gbp_flags in ovs-ofctl(8) for additional + information. + (https://tools.ietf.org/html/draft-smith-vxlan-group-policy) +
  • +
+
+ +
+

Only gre and ipsec_gre interfaces support -- 2.20.1