summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorTom Herbert <tom@herbertland.com>2015-06-04 18:16:45 +0200
committerDavid S. Miller <davem@davemloft.net>2015-06-05 00:44:31 +0200
commit1fdd512c92003cf2d671ba22753d13302bf8cd1d (patch)
tree43fc39f0d9f7429c5a0394200b9185765747ec27 /net/core
parentnet: Add IPv6 flow label to flow_keys (diff)
downloadlinux-1fdd512c92003cf2d671ba22753d13302bf8cd1d.tar.xz
linux-1fdd512c92003cf2d671ba22753d13302bf8cd1d.zip
net: Add GRE keyid in flow_keys
In flow dissector if a GRE header contains a keyid this is saved in the new keyid field of flow_keys. The GRE keyid is then represented in the flow hash function input. Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/flow_dissector.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 70f0567b6be9..7ddc0a7b3da5 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -127,6 +127,7 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
struct flow_dissector_key_addrs *key_addrs;
struct flow_dissector_key_ports *key_ports;
struct flow_dissector_key_tags *key_tags;
+ struct flow_dissector_key_keyid *key_keyid;
u8 ip_proto;
if (!data) {
@@ -315,8 +316,25 @@ ipv6:
nhoff += 4;
if (hdr->flags & GRE_CSUM)
nhoff += 4;
- if (hdr->flags & GRE_KEY)
+ if (hdr->flags & GRE_KEY) {
+ const __be32 *keyid;
+ __be32 _keyid;
+
+ keyid = __skb_header_pointer(skb, nhoff, sizeof(_keyid),
+ data, hlen, &_keyid);
+
+ if (!keyid)
+ return false;
+
+ if (skb_flow_dissector_uses_key(flow_dissector,
+ FLOW_DISSECTOR_KEY_GRE_KEYID)) {
+ key_keyid = skb_flow_dissector_target(flow_dissector,
+ FLOW_DISSECTOR_KEY_GRE_KEYID,
+ target_container);
+ key_keyid->keyid = *keyid;
+ }
nhoff += 4;
+ }
if (hdr->flags & GRE_SEQ)
nhoff += 4;
if (proto == htons(ETH_P_TEB)) {
@@ -650,6 +668,10 @@ static const struct flow_dissector_key flow_keys_dissector_keys[] = {
.key_id = FLOW_DISSECTOR_KEY_FLOW_LABEL,
.offset = offsetof(struct flow_keys, tags),
},
+ {
+ .key_id = FLOW_DISSECTOR_KEY_GRE_KEYID,
+ .offset = offsetof(struct flow_keys, keyid),
+ },
};
static const struct flow_dissector_key flow_keys_buf_dissector_keys[] = {