netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ip6_gre: fix endianness errors in ip6gre_err
@ 2015-02-04 14:25 Sabrina Dubroca
  2015-02-04 15:44 ` Eric Dumazet
  2015-02-05  8:34 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Sabrina Dubroca @ 2015-02-04 14:25 UTC (permalink / raw)
  To: davem; +Cc: netdev, Sabrina Dubroca

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-05  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04 14:25 [PATCH net] ip6_gre: fix endianness errors in ip6gre_err Sabrina Dubroca
2015-02-04 15:44 ` Eric Dumazet
2015-02-04 15:50   ` Eric Dumazet
2015-02-04 23:38     ` Sabrina Dubroca
2015-02-05  8:34 ` 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).