diff mbox series

xen-netfront, xen-netback: Use correct minimum MTU values

Message ID 1508160032-21689-1-git-send-email-mgamal@redhat.com
State Not Applicable, archived
Delegated to: David Miller
Headers show
Series xen-netfront, xen-netback: Use correct minimum MTU values | expand

Commit Message

Mohammed Gamal Oct. 16, 2017, 1:20 p.m. UTC
RFC791 specifies the minimum MTU to be 68, while xen-net{front|back}
drivers use a minimum value of 0.

When set MTU to 0~67 with xen_net{front|back} driver, the network
will become unreachable immediately, the guest can no longer be pinged.

xen_net{front|back} should not allow the user to set this value which causes
network problems.

Reported-by: Chen Shi <cheshi@redhat.com>
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
---
 drivers/net/xen-netback/interface.c | 2 +-
 drivers/net/xen-netfront.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Eduardo Otubo Oct. 16, 2017, 2:43 p.m. UTC | #1
On Mon, Oct 16, 2017 at 03:20:32PM +0200, Mohammed Gamal wrote:
> RFC791 specifies the minimum MTU to be 68, while xen-net{front|back}
> drivers use a minimum value of 0.
> 
> When set MTU to 0~67 with xen_net{front|back} driver, the network
> will become unreachable immediately, the guest can no longer be pinged.
> 
> xen_net{front|back} should not allow the user to set this value which causes
> network problems.
> 
> Reported-by: Chen Shi <cheshi@redhat.com>
> Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
> ---
>  drivers/net/xen-netback/interface.c | 2 +-
>  drivers/net/xen-netfront.c          | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
> index ee8ed9da..4491ca5 100644
> --- a/drivers/net/xen-netback/interface.c
> +++ b/drivers/net/xen-netback/interface.c
> @@ -486,7 +486,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
>  
>  	dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
>  
> -	dev->min_mtu = 0;
> +	dev->min_mtu = ETH_MIN_MTU;
>  	dev->max_mtu = ETH_MAX_MTU - VLAN_ETH_HLEN;
>  
>  	/*
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index 523387e..8b8689c 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -1316,7 +1316,7 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
>  	netdev->features |= netdev->hw_features;
>  
>  	netdev->ethtool_ops = &xennet_ethtool_ops;
> -	netdev->min_mtu = 0;
> +	netdev->min_mtu = ETH_MIN_MTU;
>  	netdev->max_mtu = XEN_NETIF_MAX_TX_SIZE;
>  	SET_NETDEV_DEV(netdev, &dev->dev);
>  
> -- 
> 1.8.3.1
> 

Acked-by: Eduardo Otubo <otubo@redhat.com>
Wei Liu Oct. 16, 2017, 3:05 p.m. UTC | #2
On Mon, Oct 16, 2017 at 03:20:32PM +0200, Mohammed Gamal wrote:
> RFC791 specifies the minimum MTU to be 68, while xen-net{front|back}
> drivers use a minimum value of 0.
> 
> When set MTU to 0~67 with xen_net{front|back} driver, the network
> will become unreachable immediately, the guest can no longer be pinged.
> 
> xen_net{front|back} should not allow the user to set this value which causes
> network problems.
> 
> Reported-by: Chen Shi <cheshi@redhat.com>
> Signed-off-by: Mohammed Gamal <mgamal@redhat.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

CC netfront maintainers
Boris Ostrovsky Oct. 16, 2017, 8:19 p.m. UTC | #3
On 10/16/2017 11:05 AM, Wei Liu wrote:
> On Mon, Oct 16, 2017 at 03:20:32PM +0200, Mohammed Gamal wrote:
>> RFC791 specifies the minimum MTU to be 68, while xen-net{front|back}
>> drivers use a minimum value of 0.
>>
>> When set MTU to 0~67 with xen_net{front|back} driver, the network
>> will become unreachable immediately, the guest can no longer be pinged.
>>
>> xen_net{front|back} should not allow the user to set this value which causes
>> network problems.
>>
>> Reported-by: Chen Shi <cheshi@redhat.com>
>> Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
>
> CC netfront maintainers


Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

I can take it via Xen tree unless there are objections.

-boris
David Miller Oct. 16, 2017, 8:22 p.m. UTC | #4
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Date: Mon, 16 Oct 2017 16:19:07 -0400

> On 10/16/2017 11:05 AM, Wei Liu wrote:
>> On Mon, Oct 16, 2017 at 03:20:32PM +0200, Mohammed Gamal wrote:
>>> RFC791 specifies the minimum MTU to be 68, while xen-net{front|back}
>>> drivers use a minimum value of 0.
>>>
>>> When set MTU to 0~67 with xen_net{front|back} driver, the network
>>> will become unreachable immediately, the guest can no longer be pinged.
>>>
>>> xen_net{front|back} should not allow the user to set this value which causes
>>> network problems.
>>>
>>> Reported-by: Chen Shi <cheshi@redhat.com>
>>> Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
>> Acked-by: Wei Liu <wei.liu2@citrix.com>
>>
>> CC netfront maintainers
> 
> 
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> 
> I can take it via Xen tree unless there are objections.

No problem on my end.
diff mbox series

Patch

diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index ee8ed9da..4491ca5 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -486,7 +486,7 @@  struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 
 	dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
 
-	dev->min_mtu = 0;
+	dev->min_mtu = ETH_MIN_MTU;
 	dev->max_mtu = ETH_MAX_MTU - VLAN_ETH_HLEN;
 
 	/*
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 523387e..8b8689c 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1316,7 +1316,7 @@  static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netdev->features |= netdev->hw_features;
 
 	netdev->ethtool_ops = &xennet_ethtool_ops;
-	netdev->min_mtu = 0;
+	netdev->min_mtu = ETH_MIN_MTU;
 	netdev->max_mtu = XEN_NETIF_MAX_TX_SIZE;
 	SET_NETDEV_DEV(netdev, &dev->dev);