Commit ce3b5355 authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

net: Simplify GRE case in flow_dissector

Do break when we see routing flag or a non-zero version number in GRE
header.
Acked-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ffaa31d7
...@@ -308,30 +308,30 @@ bool __skb_flow_dissect(const struct sk_buff *skb, ...@@ -308,30 +308,30 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
* Only look inside GRE if version zero and no * Only look inside GRE if version zero and no
* routing * routing
*/ */
if (!(hdr->flags & (GRE_VERSION|GRE_ROUTING))) { if (hdr->flags & (GRE_VERSION | GRE_ROUTING))
proto = hdr->proto; break;
proto = hdr->proto;
nhoff += 4;
if (hdr->flags & GRE_CSUM)
nhoff += 4; nhoff += 4;
if (hdr->flags & GRE_CSUM) if (hdr->flags & GRE_KEY)
nhoff += 4; nhoff += 4;
if (hdr->flags & GRE_KEY) if (hdr->flags & GRE_SEQ)
nhoff += 4; nhoff += 4;
if (hdr->flags & GRE_SEQ) if (proto == htons(ETH_P_TEB)) {
nhoff += 4; const struct ethhdr *eth;
if (proto == htons(ETH_P_TEB)) { struct ethhdr _eth;
const struct ethhdr *eth;
struct ethhdr _eth; eth = __skb_header_pointer(skb, nhoff,
sizeof(_eth),
eth = __skb_header_pointer(skb, nhoff, data, hlen, &_eth);
sizeof(_eth), if (!eth)
data, hlen, &_eth); return false;
if (!eth) proto = eth->h_proto;
return false; nhoff += sizeof(*eth);
proto = eth->h_proto;
nhoff += sizeof(*eth);
}
goto again;
} }
break; goto again;
} }
case IPPROTO_IPIP: case IPPROTO_IPIP:
proto = htons(ETH_P_IP); proto = htons(ETH_P_IP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment