]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.13.6/ip6_tunnel-update-mtu-properly-for-arphrd_ether-tunnel-device-in-tx-path.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.13.6 / ip6_tunnel-update-mtu-properly-for-arphrd_ether-tunnel-device-in-tx-path.patch
CommitLineData
014275a0
GKH
1From foo@baz Mon Oct 9 09:32:35 CEST 2017
2From: Xin Long <lucien.xin@gmail.com>
3Date: Thu, 28 Sep 2017 13:24:07 +0800
4Subject: ip6_tunnel: update mtu properly for ARPHRD_ETHER tunnel device in tx path
5
6From: Xin Long <lucien.xin@gmail.com>
7
8
9[ Upstream commit d41bb33ba33b8f8debe54ed36be6925eb496e354 ]
10
11Now when updating mtu in tx path, it doesn't consider ARPHRD_ETHER tunnel
12device, like ip6gre_tap tunnel, for which it should also subtract ether
13header to get the correct mtu.
14
15Signed-off-by: Xin Long <lucien.xin@gmail.com>
16Signed-off-by: David S. Miller <davem@davemloft.net>
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18---
19 net/ipv6/ip6_tunnel.c | 5 +++--
20 1 file changed, 3 insertions(+), 2 deletions(-)
21
22--- a/net/ipv6/ip6_tunnel.c
23+++ b/net/ipv6/ip6_tunnel.c
24@@ -1043,6 +1043,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, st
25 struct dst_entry *dst = NULL, *ndst = NULL;
26 struct net_device *tdev;
27 int mtu;
28+ unsigned int eth_hlen = t->dev->type == ARPHRD_ETHER ? ETH_HLEN : 0;
29 unsigned int psh_hlen = sizeof(struct ipv6hdr) + t->encap_hlen;
30 unsigned int max_headroom = psh_hlen;
31 bool use_cache = false;
32@@ -1124,7 +1125,7 @@ route_lookup:
33 t->parms.name);
34 goto tx_err_dst_release;
35 }
36- mtu = dst_mtu(dst) - psh_hlen - t->tun_hlen;
37+ mtu = dst_mtu(dst) - eth_hlen - psh_hlen - t->tun_hlen;
38 if (encap_limit >= 0) {
39 max_headroom += 8;
40 mtu -= 8;
41@@ -1133,7 +1134,7 @@ route_lookup:
42 mtu = IPV6_MIN_MTU;
43 if (skb_dst(skb) && !t->parms.collect_md)
44 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);
45- if (skb->len - t->tun_hlen > mtu && !skb_is_gso(skb)) {
46+ if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) {
47 *pmtu = mtu;
48 err = -EMSGSIZE;
49 goto tx_err_dst_release;