From: Tom Herbert <therbert@google•com>
To: davem@davemloft•net, netdev@vger•kernel.org
Subject: [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset
Date: Sun, 7 Sep 2014 22:26:25 -0700 [thread overview]
Message-ID: <1410153989-23837-2-git-send-email-therbert@google.com> (raw)
In-Reply-To: <1410153989-23837-1-git-send-email-therbert@google.com>
GRE assumes that the GRE header is at skb_network_header +
ip_hrdlen(skb). It is more general to use skb_transport_header
and this allows the possbility of inserting additional header
between IP and GRE (which is what we will done in Generic UDP
Encapsulation for GRE).
Signed-off-by: Tom Herbert <therbert@google•com>
---
net/ipv4/gre_demux.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 7e0756d..4a7b5b2 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -98,7 +98,6 @@ EXPORT_SYMBOL_GPL(gre_build_header);
static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
bool *csum_err)
{
- unsigned int ip_hlen = ip_hdrlen(skb);
const struct gre_base_hdr *greh;
__be32 *options;
int hdr_len;
@@ -106,7 +105,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
if (unlikely(!pskb_may_pull(skb, sizeof(struct gre_base_hdr))))
return -EINVAL;
- greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen);
+ greh = (struct gre_base_hdr *)skb_transport_header(skb);
if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING)))
return -EINVAL;
@@ -116,7 +115,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
if (!pskb_may_pull(skb, hdr_len))
return -EINVAL;
- greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen);
+ greh = (struct gre_base_hdr *)skb_transport_header(skb);
tpi->proto = greh->protocol;
options = (__be32 *)(greh + 1);
--
2.1.0.rc2.206.gedb03e5
next prev parent reply other threads:[~2014-09-08 5:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-08 5:26 [PATCH net-next 0/5] net: Changes to GRO for encapsulation Tom Herbert
2014-09-08 5:26 ` Tom Herbert [this message]
2014-09-08 10:37 ` [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset Eric Dumazet
2014-09-08 5:26 ` [PATCH net-next 2/5] ipip: Add gro callbacks to ipip offload Tom Herbert
2014-09-08 5:26 ` [PATCH net-next 3/5] sit: Add gro callbacks to sit offload Tom Herbert
2014-09-08 11:55 ` Eric Dumazet
2014-09-08 5:26 ` [PATCH net-next 4/5] udp: Add try convert checksum is case of skb_steal_sock Tom Herbert
2014-09-08 5:26 ` [PATCH net-next 5/5] net: Export inet_offloads and inet6_offloads Tom Herbert
2014-09-08 10:42 ` Eric Dumazet
2014-09-09 19:18 ` [PATCH net-next 0/5] net: Changes to GRO for encapsulation David Miller
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=1410153989-23837-2-git-send-email-therbert@google.com \
--to=therbert@google$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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