We should check the MTU before changing it.

Signed-off-by: nickcooper-zhangtonghao <[email protected]>
---
 datapath/vport-internal_dev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index 482af37..515fca0 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -89,9 +89,12 @@ static const struct ethtool_ops internal_dev_ethtool_ops = {
        .get_link       = ethtool_op_get_link,
 };
 
+#define INTERNAL_MIN_MTU 68    /* Min L3 MTU. */
+#define INTERNAL_MAX_MTU 65535 /* Max L3 MTU (arbitrary). */
+
 static int internal_dev_change_mtu(struct net_device *netdev, int new_mtu)
 {
-       if (new_mtu < 68)
+       if (new_mtu < INTERNAL_MIN_MTU || new_mtu > INTERNAL_MAX_MTU)
                return -EINVAL;
 
        netdev->mtu = new_mtu;
-- 
1.8.3.1




_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to