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

Jarno Rajahalme jarno at ovn.org
Mon Dec 12 20:58:32 UTC 2016


We should first backport this upstream commit and see if there is anything left to fix. Either way, Linux kernel datapath fixes should be first fixed on the upstream net-next repo:

- 91572088e3 (“net: use core MTU range checking in core net infra”)

  Jarno

> On Dec 11, 2016, at 8:48 PM, nickcooper-zhangtonghao <nic at opencloud.tech> wrote:
> 
> 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
> 
> 
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev



More information about the dev mailing list