net: use core MTU range checking in core net infra
geneve: - Merge __geneve_change_mtu back into geneve_change_mtu, set max_mtu - This one isn't quite as straight-forward as others, could use some closer inspection and testing macvlan: - set min/max_mtu tun: - set min/max_mtu, remove tun_net_change_mtu vxlan: - Merge __vxlan_change_mtu back into vxlan_change_mtu - Set max_mtu to IP_MAX_MTU and retain dynamic MTU range checks in change_mtu function - This one is also not as straight-forward and could use closer inspection and testing from vxlan folks bridge: - set max_mtu of IP_MAX_MTU and retain dynamic MTU range checks in change_mtu function openvswitch: - set min/max_mtu, remove internal_dev_change_mtu - note: max_mtu wasn't checked previously, it's been set to 65535, which is the largest possible size supported sch_teql: - set min/max_mtu (note: max_mtu previously unchecked, used max of 65535) macsec: - min_mtu = 0, max_mtu = 65535 macvlan: - min_mtu = 0, max_mtu = 65535 ntb_netdev: - min_mtu = 0, max_mtu = 65535 veth: - min_mtu = 68, max_mtu = 65535 8021q: - min_mtu = 0, max_mtu = 65535 CC: netdev@vger.kernel.org CC: Nicolas Dichtel <nicolas.dichtel@6wind.com> CC: Hannes Frederic Sowa <hannes@stressinduktion.org> CC: Tom Herbert <tom@herbertland.com> CC: Daniel Borkmann <daniel@iogearbox.net> CC: Alexander Duyck <alexander.h.duyck@intel.com> CC: Paolo Abeni <pabeni@redhat.com> CC: Jiri Benc <jbenc@redhat.com> CC: WANG Cong <xiyou.wangcong@gmail.com> CC: Roopa Prabhu <roopa@cumulusnetworks.com> CC: Pravin B Shelar <pshelar@ovn.org> CC: Sabrina Dubroca <sd@queasysnail.net> CC: Patrick McHardy <kaber@trash.net> CC: Stephen Hemminger <stephen@networkplumber.org> CC: Pravin Shelar <pshelar@nicira.com> CC: Maxim Krasnyansky <maxk@qti.qualcomm.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Cette révision appartient à :

révisé par
David S. Miller

Parent
8b6b4135e4
révision
91572088e3
@@ -826,5 +826,8 @@ void vlan_setup(struct net_device *dev)
|
||||
dev->destructor = vlan_dev_free;
|
||||
dev->ethtool_ops = &vlan_ethtool_ops;
|
||||
|
||||
dev->min_mtu = 0;
|
||||
dev->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
eth_zero_addr(dev->broadcast);
|
||||
}
|
||||
|
@@ -185,7 +185,7 @@ static struct rtnl_link_stats64 *br_get_stats64(struct net_device *dev,
|
||||
static int br_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct net_bridge *br = netdev_priv(dev);
|
||||
if (new_mtu < 68 || new_mtu > br_min_mtu(br))
|
||||
if (new_mtu > br_min_mtu(br))
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
@@ -410,6 +410,7 @@ void br_dev_setup(struct net_device *dev)
|
||||
br->bridge_hello_time = br->hello_time = 2 * HZ;
|
||||
br->bridge_forward_delay = br->forward_delay = 15 * HZ;
|
||||
br->ageing_time = BR_DEFAULT_AGEING_TIME;
|
||||
dev->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
br_netfilter_rtable_init(br);
|
||||
br_stp_timer_init(br);
|
||||
|
@@ -89,15 +89,6 @@ static const struct ethtool_ops internal_dev_ethtool_ops = {
|
||||
.get_link = ethtool_op_get_link,
|
||||
};
|
||||
|
||||
static int internal_dev_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
{
|
||||
if (new_mtu < 68)
|
||||
return -EINVAL;
|
||||
|
||||
netdev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void internal_dev_destructor(struct net_device *dev)
|
||||
{
|
||||
struct vport *vport = ovs_internal_dev_get_vport(dev);
|
||||
@@ -148,7 +139,6 @@ static const struct net_device_ops internal_dev_netdev_ops = {
|
||||
.ndo_stop = internal_dev_stop,
|
||||
.ndo_start_xmit = internal_dev_xmit,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_change_mtu = internal_dev_change_mtu,
|
||||
.ndo_get_stats64 = internal_get_stats,
|
||||
.ndo_set_rx_headroom = internal_set_rx_headroom,
|
||||
};
|
||||
|
@@ -418,9 +418,6 @@ static int teql_master_mtu(struct net_device *dev, int new_mtu)
|
||||
struct teql_master *m = netdev_priv(dev);
|
||||
struct Qdisc *q;
|
||||
|
||||
if (new_mtu < 68)
|
||||
return -EINVAL;
|
||||
|
||||
q = m->slaves;
|
||||
if (q) {
|
||||
do {
|
||||
@@ -460,6 +457,8 @@ static __init void teql_master_setup(struct net_device *dev)
|
||||
dev->netdev_ops = &teql_netdev_ops;
|
||||
dev->type = ARPHRD_VOID;
|
||||
dev->mtu = 1500;
|
||||
dev->min_mtu = 68;
|
||||
dev->max_mtu = 65535;
|
||||
dev->tx_queue_len = 100;
|
||||
dev->flags = IFF_NOARP;
|
||||
dev->hard_header_len = LL_MAX_HEADER;
|
||||
|
Référencer dans un nouveau ticket
Bloquer un utilisateur