* [Patch net-next 1/2] net: fix comments for __skb_flow_get_ports() @ 2014-08-26 0:03 Cong Wang 2014-08-26 0:03 ` [Patch net-next 2/2] net: make skb an optional parameter for__skb_flow_dissect() Cong Wang 2014-08-26 0:21 ` [Patch net-next 1/2] net: fix comments for __skb_flow_get_ports() David Miller 0 siblings, 2 replies; 4+ messages in thread From: Cong Wang @ 2014-08-26 0:03 UTC (permalink / raw) To: netdev; +Cc: Cong Wang, David S. Miller 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> --- net/core/flow_dissector.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 8ffcc97..ae8f0db 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -26,10 +26,12 @@ static void iph_to_flow_copy_addrs(struct flow_keys *flow, const struct iphdr *i } /** - * skb_flow_get_ports - extract the upper layer ports and return them - * @skb: buffer to extract the ports from + * __skb_flow_get_ports - extract the upper layer ports and return them + * @skb: sk_buff to extract the ports from * @thoff: transport header offset * @ip_proto: protocol for which to get port offset + * @data: raw buffer pointer to the packet, if NULL use skb->data + * @hlen: packet header length, if @data is NULL use skb_headlen(skb) * * The function will try to retrieve the ports at offset thoff + poff where poff * is the protocol port offset returned from proto_ports_offset -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Patch net-next 2/2] net: make skb an optional parameter for__skb_flow_dissect() 2014-08-26 0:03 [Patch net-next 1/2] net: fix comments for __skb_flow_get_ports() Cong Wang @ 2014-08-26 0:03 ` Cong Wang 2014-08-26 0:22 ` David Miller 2014-08-26 0:21 ` [Patch net-next 1/2] net: fix comments for __skb_flow_get_ports() David Miller 1 sibling, 1 reply; 4+ messages in thread From: Cong Wang @ 2014-08-26 0:03 UTC (permalink / raw) To: netdev; +Cc: Cong Wang, David S. Miller 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> --- include/net/flow_keys.h | 4 ++-- net/core/flow_dissector.c | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h index 4040f63..9a03f73 100644 --- a/include/net/flow_keys.h +++ b/include/net/flow_keys.h @@ -28,10 +28,10 @@ struct flow_keys { }; bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow, - void *data, int hlen); + void *data, __be16 proto, int nhoff, int hlen); static inline bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow) { - return __skb_flow_dissect(skb, flow, NULL, 0); + return __skb_flow_dissect(skb, flow, NULL, 0, 0, 0); } __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto, void *data, int hlen_proto); 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); } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch net-next 2/2] net: make skb an optional parameter for__skb_flow_dissect() 2014-08-26 0:03 ` [Patch net-next 2/2] net: make skb an optional parameter for__skb_flow_dissect() Cong Wang @ 2014-08-26 0:22 ` David Miller 0 siblings, 0 replies; 4+ messages in thread From: David Miller @ 2014-08-26 0:22 UTC (permalink / raw) To: xiyou.wangcong; +Cc: netdev From: Cong Wang <xiyou.wangcong@gmail.com> Date: Mon, 25 Aug 2014 17:03:47 -0700 > 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> Applied. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch net-next 1/2] net: fix comments for __skb_flow_get_ports() 2014-08-26 0:03 [Patch net-next 1/2] net: fix comments for __skb_flow_get_ports() Cong Wang 2014-08-26 0:03 ` [Patch net-next 2/2] net: make skb an optional parameter for__skb_flow_dissect() Cong Wang @ 2014-08-26 0:21 ` David Miller 1 sibling, 0 replies; 4+ messages in thread From: David Miller @ 2014-08-26 0:21 UTC (permalink / raw) To: xiyou.wangcong; +Cc: netdev From: Cong Wang <xiyou.wangcong@gmail.com> Date: Mon, 25 Aug 2014 17:03:46 -0700 > 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> Applied. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-26 0:22 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-08-26 0:03 [Patch net-next 1/2] net: fix comments for __skb_flow_get_ports() Cong Wang 2014-08-26 0:03 ` [Patch net-next 2/2] net: make skb an optional parameter for__skb_flow_dissect() Cong Wang 2014-08-26 0:22 ` David Miller 2014-08-26 0:21 ` [Patch net-next 1/2] net: fix comments for __skb_flow_get_ports() David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).