From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <jiri@resnulli.us>, <netdev@vger.kernel.org>
Subject: [PATCH v4 net-next 01/11] net: Simplify GRE case in flow_dissector
Date: Thu, 21 May 2015 17:11:36 -0700 [thread overview]
Message-ID: <1432253506-3646977-2-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1432253506-3646977-1-git-send-email-tom@herbertland.com>
Do break when we see routing flag or a non-zero version number in GRE
header.
Signed-off-by: Tom Herbert <tom@herbertland.com>
---
net/core/flow_dissector.c | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 703d059..4a2cb93 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -308,30 +308,30 @@ flow_label:
* 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_KEY)
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_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);
--
1.8.1
next prev parent reply other threads:[~2015-05-22 0:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 0:11 [PATCH v4 net-next 00/11] net: Increase inputs to flow_keys hashing Tom Herbert
2015-05-22 0:11 ` Tom Herbert [this message]
2015-05-22 6:36 ` [PATCH v4 net-next 01/11] net: Simplify GRE case in flow_dissector Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 02/11] mpls: Add definition for IPPROTO_MPLS Tom Herbert
2015-05-22 6:37 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 03/11] net: Remove superfluous setting of key_basic Tom Herbert
2015-05-22 6:37 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 04/11] net: Get skb hash over flow_keys structure Tom Herbert
2015-05-22 6:52 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 05/11] net: Add full IPv6 addresses to flow_keys Tom Herbert
2015-05-22 4:16 ` Cong Wang
2015-05-22 7:57 ` Jiri Pirko
2015-05-22 15:08 ` Tom Herbert
2015-05-22 0:11 ` [PATCH v4 net-next 06/11] net: Add keys for TIPC address Tom Herbert
2015-05-22 8:05 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 07/11] net: Get rid of IPv6 hash addresses flow keys Tom Herbert
2015-05-22 8:08 ` Jiri Pirko
2015-05-22 0:11 ` [PATCH v4 net-next 08/11] net: Add VLAN ID to flow_keys Tom Herbert
2015-05-22 0:11 ` [PATCH v4 net-next 09/11] net: Add IPv6 flow label " Tom Herbert
2015-05-22 8:14 ` Jiri Pirko
2015-05-22 15:14 ` Tom Herbert
2015-05-22 15:22 ` Jiri Pirko
2015-05-22 20:12 ` Tom Herbert
2015-05-22 0:11 ` [PATCH v4 net-next 10/11] net: Add GRE keyid in flow_keys Tom Herbert
2015-05-22 0:11 ` [PATCH v4 net-next 11/11] mpls: Add MPLS entropy label " Tom Herbert
2015-05-22 8:19 ` Jiri Pirko
-- strict thread matches above, loose matches on Subject: below --
2015-05-28 18:18 [PATCH v4 net-next 00/11] net: Increase inputs to flow_keys hashing Tom Herbert
2015-05-28 18:18 ` [PATCH v4 net-next 01/11] net: Simplify GRE case in flow_dissector Tom Herbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432253506-3646977-2-git-send-email-tom@herbertland.com \
--to=tom@herbertland.com \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).