diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-09-28 01:24:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-30 22:46:42 -0400 |
commit | d41bb33ba33b8f8debe54ed36be6925eb496e354 (patch) | |
tree | 06150d05fc49d87760ec7d558c33b4d1675f0c1b | |
parent | 2d40557cc702ed8e5edd9bd422233f86652d932e (diff) |
ip6_tunnel: update mtu properly for ARPHRD_ETHER tunnel device in tx path
Now when updating mtu in tx path, it doesn't consider ARPHRD_ETHER tunnel
device, like ip6gre_tap tunnel, for which it should also subtract ether
header to get the correct mtu.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index f2f21c24915f..a1c24443cd9e 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1043,6 +1043,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield, | |||
1043 | struct dst_entry *dst = NULL, *ndst = NULL; | 1043 | struct dst_entry *dst = NULL, *ndst = NULL; |
1044 | struct net_device *tdev; | 1044 | struct net_device *tdev; |
1045 | int mtu; | 1045 | int mtu; |
1046 | unsigned int eth_hlen = t->dev->type == ARPHRD_ETHER ? ETH_HLEN : 0; | ||
1046 | unsigned int psh_hlen = sizeof(struct ipv6hdr) + t->encap_hlen; | 1047 | unsigned int psh_hlen = sizeof(struct ipv6hdr) + t->encap_hlen; |
1047 | unsigned int max_headroom = psh_hlen; | 1048 | unsigned int max_headroom = psh_hlen; |
1048 | bool use_cache = false; | 1049 | bool use_cache = false; |
@@ -1124,7 +1125,7 @@ route_lookup: | |||
1124 | t->parms.name); | 1125 | t->parms.name); |
1125 | goto tx_err_dst_release; | 1126 | goto tx_err_dst_release; |
1126 | } | 1127 | } |
1127 | mtu = dst_mtu(dst) - psh_hlen - t->tun_hlen; | 1128 | mtu = dst_mtu(dst) - eth_hlen - psh_hlen - t->tun_hlen; |
1128 | if (encap_limit >= 0) { | 1129 | if (encap_limit >= 0) { |
1129 | max_headroom += 8; | 1130 | max_headroom += 8; |
1130 | mtu -= 8; | 1131 | mtu -= 8; |
@@ -1133,7 +1134,7 @@ route_lookup: | |||
1133 | mtu = IPV6_MIN_MTU; | 1134 | mtu = IPV6_MIN_MTU; |
1134 | if (skb_dst(skb) && !t->parms.collect_md) | 1135 | if (skb_dst(skb) && !t->parms.collect_md) |
1135 | skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); | 1136 | skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); |
1136 | if (skb->len - t->tun_hlen > mtu && !skb_is_gso(skb)) { | 1137 | if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) { |
1137 | *pmtu = mtu; | 1138 | *pmtu = mtu; |
1138 | err = -EMSGSIZE; | 1139 | err = -EMSGSIZE; |
1139 | goto tx_err_dst_release; | 1140 | goto tx_err_dst_release; |