Commit 468763f7 authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by Luis Henriques

ip6_gre: fix endianness errors in ip6gre_err

commit d1e158e2 upstream.

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: c12b395a ("gre: Support GRE over IPv6")
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 167fa487
...@@ -414,7 +414,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -414,7 +414,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
if (code == ICMPV6_HDR_FIELD) if (code == ICMPV6_HDR_FIELD)
teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data); 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]; tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
if (tel->encap_limit == 0) { if (tel->encap_limit == 0) {
net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n", net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n",
...@@ -426,7 +426,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -426,7 +426,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
} }
break; break;
case ICMPV6_PKT_TOOBIG: case ICMPV6_PKT_TOOBIG:
mtu = info - offset; mtu = be32_to_cpu(info) - offset;
if (mtu < IPV6_MIN_MTU) if (mtu < IPV6_MIN_MTU)
mtu = IPV6_MIN_MTU; mtu = IPV6_MIN_MTU;
t->dev->mtu = mtu; t->dev->mtu = mtu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment