[PATCH net] ip6_gre: fix endianness errors in ip6gre_err

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE4278d

5 messages, 3 authors, 2015-02-05 · open the first message on its own page

[PATCH net] ip6_gre: fix endianness errors in ip6gre_err

From: Sabrina Dubroca <sd@queasysnail.net>
Date: 2015-02-04 14:25:53

info is in network byte order, change it back to host byte order
before use. In particular, the current code sets the MTU of the tunnel
to a wrong (too big) value.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
 net/ipv6/ip6_gre.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 13cda4c6313b..01ccc28a686f 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -417,7 +417,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		if (code == ICMPV6_HDR_FIELD)
 			teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data);
 
-		if (teli && teli == info - 2) {
+		if (teli && teli == be32_to_cpu(info) - 2) {
 			tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
 			if (tel->encap_limit == 0) {
 				net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n",
@@ -429,7 +429,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		}
 		break;
 	case ICMPV6_PKT_TOOBIG:
-		mtu = info - offset;
+		mtu = be32_to_cpu(info) - offset;
 		if (mtu < IPV6_MIN_MTU)
 			mtu = IPV6_MIN_MTU;
 		t->dev->mtu = mtu;
-- 
2.2.2

Re: [PATCH net] ip6_gre: fix endianness errors in ip6gre_err

From: Eric Dumazet <hidden>
Date: 2015-02-04 15:44:41

On Wed, 2015-02-04 at 15:25 +0100, Sabrina Dubroca wrote:
info is in network byte order, change it back to host byte order
before use. In particular, the current code sets the MTU of the tunnel
to a wrong (too big) value.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
Acked-by: Eric Dumazet <redacted>

Re: [PATCH net] ip6_gre: fix endianness errors in ip6gre_err

From: Eric Dumazet <hidden>
Date: 2015-02-04 15:50:17

On Wed, 2015-02-04 at 07:44 -0800, Eric Dumazet wrote:
On Wed, 2015-02-04 at 15:25 +0100, Sabrina Dubroca wrote:
quoted
info is in network byte order, change it back to host byte order
before use. In particular, the current code sets the MTU of the tunnel
to a wrong (too big) value.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
Acked-by: Eric Dumazet <redacted>

BTW, "fl6.flowi6_proto = skb->protocol; " in ip6gre_xmit_other()
looks suspicious...

Re: [PATCH net] ip6_gre: fix endianness errors in ip6gre_err

From: Sabrina Dubroca <sd@queasysnail.net>
Date: 2015-02-04 23:38:32

2015-02-04, 07:50:12 -0800, Eric Dumazet wrote:
On Wed, 2015-02-04 at 07:44 -0800, Eric Dumazet wrote:
quoted
On Wed, 2015-02-04 at 15:25 +0100, Sabrina Dubroca wrote:
quoted
info is in network byte order, change it back to host byte order
before use. In particular, the current code sets the MTU of the tunnel
to a wrong (too big) value.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
Acked-by: Eric Dumazet <redacted>

BTW, "fl6.flowi6_proto = skb->protocol; " in ip6gre_xmit_other()
looks suspicious...
Yes, I know that sparse complains about it.  I don't know how to
handle that for now.  ntohs would silence the sparse warning, but we
would still have u8 vs u16.  I'll need to have a closer look.

-- 
Sabrina

Re: [PATCH net] ip6_gre: fix endianness errors in ip6gre_err

From: David Miller <davem@davemloft.net>
Date: 2015-02-05 08:34:10

From: Sabrina Dubroca <sd@queasysnail.net>
Date: Wed,  4 Feb 2015 15:25:09 +0100
info is in network byte order, change it back to host byte order
before use. In particular, the current code sets the MTU of the tunnel
to a wrong (too big) value.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help