ipv4/6: use core net MTU range checking
ipv4/ip_tunnel: - min_mtu = 68, max_mtu = 0xFFF8 - dev->hard_header_len - t_hlen - preserve all ndo_change_mtu checks for now to prevent regressions ipv6/ip6_tunnel: - min_mtu = 68, max_mtu = 0xFFF8 - dev->hard_header_len - preserve all ndo_change_mtu checks for now to prevent regressions ipv6/ip6_vti: - min_mtu = 1280, max_mtu = 65535 - remove redundant vti6_change_mtu ipv6/sit: - min_mtu = 1280, max_mtu = 0xFFF8 - t_hlen - remove redundant ipip6_tunnel_change_mtu CC: netdev@vger.kernel.org CC: "David S. Miller" <davem@davemloft.net> CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> CC: James Morris <jmorris@namei.org> CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> CC: Patrick McHardy <kaber@trash.net> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
46b3ef4cdf
commit
b96f9afee4
@@ -358,6 +358,7 @@ static struct ip_tunnel *ip_tunnel_create(struct net *net,
|
||||
{
|
||||
struct ip_tunnel *nt;
|
||||
struct net_device *dev;
|
||||
int t_hlen;
|
||||
|
||||
BUG_ON(!itn->fb_tunnel_dev);
|
||||
dev = __ip_tunnel_create(net, itn->fb_tunnel_dev->rtnl_link_ops, parms);
|
||||
@@ -367,6 +368,9 @@ static struct ip_tunnel *ip_tunnel_create(struct net *net,
|
||||
dev->mtu = ip_tunnel_bind_dev(dev);
|
||||
|
||||
nt = netdev_priv(dev);
|
||||
t_hlen = nt->hlen + sizeof(struct iphdr);
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = 0xFFF8 - dev->hard_header_len - t_hlen;
|
||||
ip_tunnel_add(itn, nt);
|
||||
return nt;
|
||||
}
|
||||
@@ -929,7 +933,7 @@ int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict)
|
||||
int t_hlen = tunnel->hlen + sizeof(struct iphdr);
|
||||
int max_mtu = 0xFFF8 - dev->hard_header_len - t_hlen;
|
||||
|
||||
if (new_mtu < 68)
|
||||
if (new_mtu < ETH_MIN_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
if (new_mtu > max_mtu) {
|
||||
|
||||
Reference in New Issue
Block a user