Skip to content

Commit

Permalink
flow_dissector: Add flag to stop parsing at L3
Browse files Browse the repository at this point in the history
Add an input flag to flow dissector on rather dissection should be
stopped when an L3 packet is encountered. This would be useful if a
caller just wanted to get IP addresses of the outermost header (e.g.
to do an L3 hash).

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tom Herbert authored and David S. Miller committed Sep 1, 2015
1 parent b840f28 commit 8306b68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/net/flow_dissector.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ enum flow_dissector_key_id {
};

#define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0)
#define FLOW_DISSECTOR_F_STOP_AT_L3 BIT(1)

struct flow_dissector_key {
enum flow_dissector_key_id key_id;
Expand Down
6 changes: 6 additions & 0 deletions net/core/flow_dissector.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
}
}

if (flags & FLOW_DISSECTOR_F_STOP_AT_L3)
goto out_good;

break;
}
case htons(ETH_P_IPV6): {
Expand Down Expand Up @@ -238,6 +241,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
}
}

if (flags & FLOW_DISSECTOR_F_STOP_AT_L3)
goto out_good;

break;
}
case htons(ETH_P_8021AD):
Expand Down

0 comments on commit 8306b68

Please sign in to comment.