summaryrefslogtreecommitdiff
path: root/datapath/flow.c
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2014-06-05 19:07:32 -0700
committerJesse Gross <jesse@nicira.com>2014-06-20 15:19:35 -0700
commitc1fc1411d204c59608bf9fe36a65bd221b10cbb2 (patch)
treeefafb29b0bf6dbc98dd0e8da168ba1fc78b962cb /datapath/flow.c
parent1d2a1b5f5252e4c6ce8bbf8d91ca27aba52496e6 (diff)
downloadopenvswitch-c1fc1411d204c59608bf9fe36a65bd221b10cbb2.tar.gz
datapath: Add support for Geneve tunneling.
This adds support for Geneve - Generic Network Virtualization Encapsulation. The protocol is documented at http://tools.ietf.org/html/draft-gross-geneve-00 The kernel implementation is completely agnostic to the options that are in use and can handle newly defined options without further work. It does this by simply matching on a byte array of options and allowing userspace to setup flows on this array. Userspace currently implements only support for basic version of Geneve. It can work with the base header (including the VNI) and is capable of parsing options but does not currently support any particular option definitions. Over time, the intention is to allow options to be matched through OpenFlow without requiring explicit support in OVS userspace. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Thomas Graf <tgraf@suug.ch> Acked-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'datapath/flow.c')
-rw-r--r--datapath/flow.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/datapath/flow.c b/datapath/flow.c
index f1bb95d7f..e90f99a3f 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -455,7 +455,17 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key)
struct ovs_tunnel_info *tun_info = OVS_CB(skb)->tun_info;
memcpy(&key->tun_key, &tun_info->tunnel,
sizeof(key->tun_key));
+ if (tun_info->options) {
+ BUILD_BUG_ON((1 << (sizeof(tun_info->options_len) * 8)) - 1
+ > sizeof(key->tun_opts));
+ memcpy(GENEVE_OPTS(key, tun_info->options_len),
+ tun_info->options, tun_info->options_len);
+ key->tun_opts_len = tun_info->options_len;
+ } else {
+ key->tun_opts_len = 0;
+ }
} else {
+ key->tun_opts_len = 0;
memset(&key->tun_key, 0, sizeof(key->tun_key));
}