* [PATCH] ipv6: Initialize ip6_tnl.hlen in gre tunnel even if no route is found
@ 2013-10-10 17:50 Oussama Ghorbel
2013-10-11 15:02 ` Hannes Frederic Sowa
0 siblings, 1 reply; 3+ messages in thread
From: Oussama Ghorbel @ 2013-10-10 17:50 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
Cc: netdev, linux-kernel, Hannes Frederic Sowa, Oussama Ghorbel
The ip6_tnl.hlen (gre and ipv6 headers length) is independent from the
outgoing interface, so it would be better to initialize it even when no
route is found, otherwise its value will be zero.
While I'm not sure if this could happen in real life, but doing that
will avoid to call the skb_push function with a zero in ip6gre_header
function.
Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Oussama Ghorbel <ou.ghorbel@gmail.com>
---
net/ipv6/ip6_gre.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 90747f1..8e4d42e 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -978,6 +978,7 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu)
if (t->parms.o_flags&GRE_SEQ)
addend += 4;
}
+ t->hlen = addend;
if (p->flags & IP6_TNL_F_CAP_XMIT) {
int strict = (ipv6_addr_type(&p->raddr) &
@@ -1004,8 +1005,6 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu)
}
ip6_rt_put(rt);
}
-
- t->hlen = addend;
}
static int ip6gre_tnl_change(struct ip6_tnl *t,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: Initialize ip6_tnl.hlen in gre tunnel even if no route is found
2013-10-10 17:50 [PATCH] ipv6: Initialize ip6_tnl.hlen in gre tunnel even if no route is found Oussama Ghorbel
@ 2013-10-11 15:02 ` Hannes Frederic Sowa
2013-10-11 21:55 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Hannes Frederic Sowa @ 2013-10-11 15:02 UTC (permalink / raw)
To: Oussama Ghorbel
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, netdev, linux-kernel
On Thu, Oct 10, 2013 at 06:50:27PM +0100, Oussama Ghorbel wrote:
> The ip6_tnl.hlen (gre and ipv6 headers length) is independent from the
> outgoing interface, so it would be better to initialize it even when no
> route is found, otherwise its value will be zero.
> While I'm not sure if this could happen in real life, but doing that
> will avoid to call the skb_push function with a zero in ip6gre_header
> function.
>
> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Oussama Ghorbel <ou.ghorbel@gmail.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Thanks,
Hannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: Initialize ip6_tnl.hlen in gre tunnel even if no route is found
2013-10-11 15:02 ` Hannes Frederic Sowa
@ 2013-10-11 21:55 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-10-11 21:55 UTC (permalink / raw)
To: hannes; +Cc: ou.ghorbel, kuznet, jmorris, yoshfuji, kaber, netdev,
linux-kernel
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Fri, 11 Oct 2013 17:02:17 +0200
> On Thu, Oct 10, 2013 at 06:50:27PM +0100, Oussama Ghorbel wrote:
>> The ip6_tnl.hlen (gre and ipv6 headers length) is independent from the
>> outgoing interface, so it would be better to initialize it even when no
>> route is found, otherwise its value will be zero.
>> While I'm not sure if this could happen in real life, but doing that
>> will avoid to call the skb_push function with a zero in ip6gre_header
>> function.
>>
>> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
>> Signed-off-by: Oussama Ghorbel <ou.ghorbel@gmail.com>
>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-11 21:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-10 17:50 [PATCH] ipv6: Initialize ip6_tnl.hlen in gre tunnel even if no route is found Oussama Ghorbel
2013-10-11 15:02 ` Hannes Frederic Sowa
2013-10-11 21:55 ` David Miller
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).