diff options
author | Tom Herbert <tom@herbertland.com> | 2015-06-04 12:16:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-04 18:44:30 -0400 |
commit | ce3b5355477ce99bffa60a6a215f2e11db4b649c (patch) | |
tree | 6093434cce0554125a03988266c3f9a30292180f /net/core/flow_dissector.c | |
parent | ffaa31d7945f14edb04d7b2792a1dbd3a854a2bc (diff) |
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: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/flow_dissector.c')
-rw-r--r-- | net/core/flow_dissector.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 1f2d89300b1a..7f699169dc92 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -308,30 +308,30 @@ flow_label: | |||
308 | * Only look inside GRE if version zero and no | 308 | * Only look inside GRE if version zero and no |
309 | * routing | 309 | * routing |
310 | */ | 310 | */ |
311 | if (!(hdr->flags & (GRE_VERSION|GRE_ROUTING))) { | 311 | if (hdr->flags & (GRE_VERSION | GRE_ROUTING)) |
312 | proto = hdr->proto; | 312 | break; |
313 | |||
314 | proto = hdr->proto; | ||
315 | nhoff += 4; | ||
316 | if (hdr->flags & GRE_CSUM) | ||
313 | nhoff += 4; | 317 | nhoff += 4; |
314 | if (hdr->flags & GRE_CSUM) | 318 | if (hdr->flags & GRE_KEY) |
315 | nhoff += 4; | 319 | nhoff += 4; |
316 | if (hdr->flags & GRE_KEY) | 320 | if (hdr->flags & GRE_SEQ) |
317 | nhoff += 4; | 321 | nhoff += 4; |
318 | if (hdr->flags & GRE_SEQ) | 322 | if (proto == htons(ETH_P_TEB)) { |
319 | nhoff += 4; | 323 | const struct ethhdr *eth; |
320 | if (proto == htons(ETH_P_TEB)) { | 324 | struct ethhdr _eth; |
321 | const struct ethhdr *eth; | 325 | |
322 | struct ethhdr _eth; | 326 | eth = __skb_header_pointer(skb, nhoff, |
323 | 327 | sizeof(_eth), | |
324 | eth = __skb_header_pointer(skb, nhoff, | 328 | data, hlen, &_eth); |
325 | sizeof(_eth), | 329 | if (!eth) |
326 | data, hlen, &_eth); | 330 | return false; |
327 | if (!eth) | 331 | proto = eth->h_proto; |
328 | return false; | 332 | nhoff += sizeof(*eth); |
329 | proto = eth->h_proto; | ||
330 | nhoff += sizeof(*eth); | ||
331 | } | ||
332 | goto again; | ||
333 | } | 333 | } |
334 | break; | 334 | goto again; |
335 | } | 335 | } |
336 | case IPPROTO_IPIP: | 336 | case IPPROTO_IPIP: |
337 | proto = htons(ETH_P_IP); | 337 | proto = htons(ETH_P_IP); |