Skip to content

Commit

Permalink
net: Simplify GRE case in flow_dissector
Browse files Browse the repository at this point in the history
Do break when we see routing flag or a non-zero version number in GRE
header.

Acked-by: Jiri Pirko <jiri@resnulli.us>
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 Jun 4, 2015
1 parent ffaa31d commit ce3b535
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions net/core/flow_dissector.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,30 +308,30 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
* Only look inside GRE if version zero and no
* routing
*/
if (!(hdr->flags & (GRE_VERSION|GRE_ROUTING))) {
proto = hdr->proto;
if (hdr->flags & (GRE_VERSION | GRE_ROUTING))
break;

proto = hdr->proto;
nhoff += 4;
if (hdr->flags & GRE_CSUM)
nhoff += 4;
if (hdr->flags & GRE_CSUM)
nhoff += 4;
if (hdr->flags & GRE_KEY)
nhoff += 4;
if (hdr->flags & GRE_SEQ)
nhoff += 4;
if (proto == htons(ETH_P_TEB)) {
const struct ethhdr *eth;
struct ethhdr _eth;

eth = __skb_header_pointer(skb, nhoff,
sizeof(_eth),
data, hlen, &_eth);
if (!eth)
return false;
proto = eth->h_proto;
nhoff += sizeof(*eth);
}
goto again;
if (hdr->flags & GRE_KEY)
nhoff += 4;
if (hdr->flags & GRE_SEQ)
nhoff += 4;
if (proto == htons(ETH_P_TEB)) {
const struct ethhdr *eth;
struct ethhdr _eth;

eth = __skb_header_pointer(skb, nhoff,
sizeof(_eth),
data, hlen, &_eth);
if (!eth)
return false;
proto = eth->h_proto;
nhoff += sizeof(*eth);
}
break;
goto again;
}
case IPPROTO_IPIP:
proto = htons(ETH_P_IP);
Expand Down

0 comments on commit ce3b535

Please sign in to comment.