Skip to content

Commit ce3b535

Browse files
tomratbertdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: Tom Herbert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ffaa31d commit ce3b535

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

net/core/flow_dissector.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -308,30 +308,30 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
308308
* Only look inside GRE if version zero and no
309309
* routing
310310
*/
311-
if (!(hdr->flags & (GRE_VERSION|GRE_ROUTING))) {
312-
proto = hdr->proto;
311+
if (hdr->flags & (GRE_VERSION | GRE_ROUTING))
312+
break;
313+
314+
proto = hdr->proto;
315+
nhoff += 4;
316+
if (hdr->flags & GRE_CSUM)
313317
nhoff += 4;
314-
if (hdr->flags & GRE_CSUM)
315-
nhoff += 4;
316-
if (hdr->flags & GRE_KEY)
317-
nhoff += 4;
318-
if (hdr->flags & GRE_SEQ)
319-
nhoff += 4;
320-
if (proto == htons(ETH_P_TEB)) {
321-
const struct ethhdr *eth;
322-
struct ethhdr _eth;
323-
324-
eth = __skb_header_pointer(skb, nhoff,
325-
sizeof(_eth),
326-
data, hlen, &_eth);
327-
if (!eth)
328-
return false;
329-
proto = eth->h_proto;
330-
nhoff += sizeof(*eth);
331-
}
332-
goto again;
318+
if (hdr->flags & GRE_KEY)
319+
nhoff += 4;
320+
if (hdr->flags & GRE_SEQ)
321+
nhoff += 4;
322+
if (proto == htons(ETH_P_TEB)) {
323+
const struct ethhdr *eth;
324+
struct ethhdr _eth;
325+
326+
eth = __skb_header_pointer(skb, nhoff,
327+
sizeof(_eth),
328+
data, hlen, &_eth);
329+
if (!eth)
330+
return false;
331+
proto = eth->h_proto;
332+
nhoff += sizeof(*eth);
333333
}
334-
break;
334+
goto again;
335335
}
336336
case IPPROTO_IPIP:
337337
proto = htons(ETH_P_IP);

0 commit comments

Comments
 (0)