[ovs-dev] [PATCH 1/3] datapath: Checks the MTU for netdev-internal ports.

nickcooper-zhangtonghao nic at opencloud.tech
Mon Dec 12 04:48:55 UTC 2016


We should check the MTU before changing it.

Signed-off-by: nickcooper-zhangtonghao <nic at opencloud.tech>
---
 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






More information about the dev mailing list