* [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset
@ 2014-09-08 15:29 Tom Herbert
2014-09-08 15:50 ` Eric Dumazet
2014-09-08 22:23 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Tom Herbert @ 2014-09-08 15:29 UTC (permalink / raw)
To: davem, netdev
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset
2014-09-08 15:29 [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset Tom Herbert
@ 2014-09-08 15:50 ` Eric Dumazet
2014-09-08 17:10 ` Tom Herbert
2014-09-08 22:23 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2014-09-08 15:50 UTC (permalink / raw)
To: Tom Herbert; +Cc: davem, netdev
On Mon, 2014-09-08 at 08:29 -0700, Tom Herbert wrote:
> 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(-)
I am always confused why you do not include prior Acked-by when you
repost same patch.
This forces me to add it again.
Note this should be a net-next patch, right ?
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset
2014-09-08 15:50 ` Eric Dumazet
@ 2014-09-08 17:10 ` Tom Herbert
0 siblings, 0 replies; 4+ messages in thread
From: Tom Herbert @ 2014-09-08 17:10 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, Linux Netdev List
On Mon, Sep 8, 2014 at 8:50 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Mon, 2014-09-08 at 08:29 -0700, Tom Herbert wrote:
>> 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(-)
>
> I am always confused why you do not include prior Acked-by when you
> repost same patch.
>
Sorry, I'll do that next time.
> This forces me to add it again.
>
> Note this should be a net-next patch, right ?
>
Yes.
> Acked-by: Eric Dumazet <edumazet@google.com>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset
2014-09-08 15:29 [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset Tom Herbert
2014-09-08 15:50 ` Eric Dumazet
@ 2014-09-08 22:23 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-09-08 22:23 UTC (permalink / raw)
To: therbert; +Cc: netdev
From: Tom Herbert <therbert@google.com>
Date: Mon, 8 Sep 2014 08:29:12 -0700
> 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>
Applied, thanks Tom.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-08 22:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08 15:29 [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset Tom Herbert
2014-09-08 15:50 ` Eric Dumazet
2014-09-08 17:10 ` Tom Herbert
2014-09-08 22:23 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.