[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1441124673-3438470-11-git-send-email-tom@herbertland.com>
Date: Tue, 1 Sep 2015 09:24:32 -0700
From: Tom Herbert <tom@...bertland.com>
To: <davem@...emloft.net>, <netdev@...r.kernel.org>
CC: <kernel-team@...com>
Subject: [PATCH net-next 10/11] flow_dissector: Add control/reporting of encapsulation
Add an input flag to flow dissector on rather dissection should stop
when encapsulation is detected (IP/IP or GRE). Also, add a key_control
flag that indicates encapsulation was encountered during the
dissection.
Signed-off-by: Tom Herbert <tom@...bertland.com>
---
include/net/flow_dissector.h | 2 ++
net/core/flow_dissector.c | 15 +++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index 66dbc34..bddd108 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -14,6 +14,7 @@ struct flow_dissector_key_control {
u16 addr_type;
u32 is_fragment:1;
u32 first_frag:1;
+ u32 encapsulation:1;
};
/**
@@ -127,6 +128,7 @@ enum flow_dissector_key_id {
#define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0)
#define FLOW_DISSECTOR_F_STOP_AT_L3 BIT(1)
#define FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL BIT(2)
+#define FLOW_DISSECTOR_F_STOP_AT_ENCAP BIT(3)
struct flow_dissector_key {
enum flow_dissector_key_id key_id;
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 094e343..8d89013 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -397,6 +397,11 @@ ip_proto_again:
proto = eth->h_proto;
nhoff += sizeof(*eth);
}
+
+ key_control->encapsulation = 1;
+ if (flags & FLOW_DISSECTOR_F_STOP_AT_ENCAP)
+ goto out_good;
+
goto again;
}
case NEXTHDR_HOP:
@@ -444,9 +449,19 @@ ip_proto_again:
}
case IPPROTO_IPIP:
proto = htons(ETH_P_IP);
+
+ key_control->encapsulation = 1;
+ if (flags & FLOW_DISSECTOR_F_STOP_AT_ENCAP)
+ goto out_good;
+
goto ip;
case IPPROTO_IPV6:
proto = htons(ETH_P_IPV6);
+
+ key_control->encapsulation = 1;
+ if (flags & FLOW_DISSECTOR_F_STOP_AT_ENCAP)
+ goto out_good;
+
goto ipv6;
case IPPROTO_MPLS:
proto = htons(ETH_P_MPLS_UC);
--
1.8.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists