geneve: check MTU for a minimum in geneve_change_mtu()

geneve_change_mtu() will be used not only as ndo_change_mtu() callback,
but also to verify a user specified MTU on a new link creation in the
next patch.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Alexey Kodanev 2018-04-19 15:42:31 +03:00 committed by David S. Miller
parent 5edbea6987
commit 321acc1c68
1 changed files with 2 additions and 3 deletions

View File

@ -942,11 +942,10 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)
static int geneve_change_mtu(struct net_device *dev, int new_mtu)
{
/* Only possible if called internally, ndo_change_mtu path's new_mtu
* is guaranteed to be between dev->min_mtu and dev->max_mtu.
*/
if (new_mtu > dev->max_mtu)
new_mtu = dev->max_mtu;
else if (new_mtu < dev->min_mtu)
new_mtu = dev->min_mtu;
dev->mtu = new_mtu;
return 0;