aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/flow_keys.h4
-rw-r--r--net/core/flow_dissector.c18
2 files changed, 17 insertions, 5 deletions
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index 4040f63932c5..9a03f73c4974 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -28,10 +28,10 @@ struct flow_keys {
28}; 28};
29 29
30bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow, 30bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow,
31 void *data, int hlen); 31 void *data, __be16 proto, int nhoff, int hlen);
32static inline bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow) 32static inline bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow)
33{ 33{
34 return __skb_flow_dissect(skb, flow, NULL, 0); 34 return __skb_flow_dissect(skb, flow, NULL, 0, 0, 0);
35} 35}
36__be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto, 36__be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
37 void *data, int hlen_proto); 37 void *data, int hlen_proto);
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index ae8f0db67aed..12f48ca7a0b0 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -59,14 +59,26 @@ __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
59} 59}
60EXPORT_SYMBOL(__skb_flow_get_ports); 60EXPORT_SYMBOL(__skb_flow_get_ports);
61 61
62bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow, void *data, int hlen) 62/**
63 * __skb_flow_dissect - extract the flow_keys struct and return it
64 * @skb: sk_buff to extract the flow from, can be NULL if the rest are specified
65 * @data: raw buffer pointer to the packet, if NULL use skb->data
66 * @proto: protocol for which to get the flow, if @data is NULL use skb->protocol
67 * @nhoff: network header offset, if @data is NULL use skb_network_offset(skb)
68 * @hlen: packet header length, if @data is NULL use skb_headlen(skb)
69 *
70 * The function will try to retrieve the struct flow_keys from either the skbuff
71 * or a raw buffer specified by the rest parameters
72 */
73bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow,
74 void *data, __be16 proto, int nhoff, int hlen)
63{ 75{
64 int nhoff = skb_network_offset(skb);
65 u8 ip_proto; 76 u8 ip_proto;
66 __be16 proto = skb->protocol;
67 77
68 if (!data) { 78 if (!data) {
69 data = skb->data; 79 data = skb->data;
80 proto = skb->protocol;
81 nhoff = skb_network_offset(skb);
70 hlen = skb_headlen(skb); 82 hlen = skb_headlen(skb);
71 } 83 }
72 84