diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-08-25 17:03:47 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-25 17:21:26 -0700 |
commit | 453a940ea725d692282f9e66475cec0d1b1e12f2 (patch) | |
tree | b7c1aa76d72315c12b159d3f6253499b56b6779e /net | |
parent | 6451b3f59ab39162d1fbb5a5d0c8f46c0d9e1231 (diff) | |
download | op-kernel-dev-453a940ea725d692282f9e66475cec0d1b1e12f2.zip op-kernel-dev-453a940ea725d692282f9e66475cec0d1b1e12f2.tar.gz |
net: make skb an optional parameter for__skb_flow_dissect()
Fixes: commit 690e36e726d00d2 (net: Allow raw buffers to be passed into the flow dissector)
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/flow_dissector.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index ae8f0db..12f48ca 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, } EXPORT_SYMBOL(__skb_flow_get_ports); -bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow, void *data, int hlen) +/** + * __skb_flow_dissect - extract the flow_keys struct and return it + * @skb: sk_buff to extract the flow from, can be NULL if the rest are specified + * @data: raw buffer pointer to the packet, if NULL use skb->data + * @proto: protocol for which to get the flow, if @data is NULL use skb->protocol + * @nhoff: network header offset, if @data is NULL use skb_network_offset(skb) + * @hlen: packet header length, if @data is NULL use skb_headlen(skb) + * + * The function will try to retrieve the struct flow_keys from either the skbuff + * or a raw buffer specified by the rest parameters + */ +bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow, + void *data, __be16 proto, int nhoff, int hlen) { - int nhoff = skb_network_offset(skb); u8 ip_proto; - __be16 proto = skb->protocol; if (!data) { data = skb->data; + proto = skb->protocol; + nhoff = skb_network_offset(skb); hlen = skb_headlen(skb); } |