Skip to content

Commit

Permalink
eth: Pull header from first fragment via eth_get_headlen
Browse files Browse the repository at this point in the history
We want to try and pull the L4 header in if it is available in the first
fragment.  As such add the flag to indicate we want to pull the headers on
the first fragment in.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexander Duyck authored and David S. Miller committed Feb 24, 2016
1 parent b3c3106 commit d975ddd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ethernet/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ EXPORT_SYMBOL(eth_header);
*/
u32 eth_get_headlen(void *data, unsigned int len)
{
const unsigned int flags = FLOW_DISSECTOR_F_PARSE_1ST_FRAG;
const struct ethhdr *eth = (const struct ethhdr *)data;
struct flow_keys keys;

Expand All @@ -134,7 +135,7 @@ u32 eth_get_headlen(void *data, unsigned int len)

/* parse any remaining L2/L3 headers, check for L4 */
if (!skb_flow_dissect_flow_keys_buf(&keys, data, eth->h_proto,
sizeof(*eth), len, 0))
sizeof(*eth), len, flags))
return max_t(u32, keys.control.thoff, sizeof(*eth));

/* parse for any L4 headers */
Expand Down

0 comments on commit d975ddd

Please sign in to comment.