linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] net: vrf: Fix ping failed when vrf mtu is set to 0
@ 2019-04-08  2:04 linmiaohe
  2019-04-08  3:51 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: linmiaohe @ 2019-04-08  2:04 UTC (permalink / raw)
  To: David Ahern, shrijeet, davem, netdev, linux-kernel; +Cc: Mingfangsen

From: Miaohe Lin <linmiaohe@huawei.com>

When the mtu of a vrf device is set to 0, it would cause ping
failed. So I think we should limit vrf mtu in a reasonable range
to solve this problem. I set dev->min_mtu to IPV6_MIN_MTU, so it
will works for both ipv4 and ipv6. And if dev->max_mtu still be 0
can be confusing, so I set dev->max_mtu to ETH_MAX_MTU.

Here is the reproduce step:

1.Config vrf interface and set mtu to 0:
3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel
master vrf1 state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:9e:dd:c1 brd ff:ff:ff:ff:ff:ff

2.Ping peer:
3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel
master vrf1 state UP group default qlen 1000
    link/ether 52:54:00:9e:dd:c1 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/16 scope global enp4s0
       valid_lft forever preferred_lft forever
connect: Network is unreachable

3.Set mtu to default value, ping works:
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=1.88 ms

Fixes: ad49bc6361ca2 ("net: vrf: remove MTU limits for vrf device")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
V2->V3:
- delete VRF specific mtu macros
- set mtu range directly and add a comment

 drivers/net/vrf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 6d1a1abbed27..cd15c32b2e43 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1275,8 +1275,12 @@ static void vrf_setup(struct net_device *dev)
 	dev->priv_flags |= IFF_NO_QUEUE;
 	dev->priv_flags |= IFF_NO_RX_HANDLER;

-	dev->min_mtu = 0;
-	dev->max_mtu = 0;
+	/* VRF devices do not care about MTU, but if the MTU is set
+	 * too low then the ipv4 and ipv6 protocols are disabled
+	 * which breaks networking.
+	 */
+	dev->min_mtu = IPV6_MIN_MTU;
+	dev->max_mtu = ETH_MAX_MTU;
 }

 static int vrf_validate(struct nlattr *tb[], struct nlattr *data[],
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] net: vrf: Fix ping failed when vrf mtu is set to 0
  2019-04-08  2:04 [PATCH net v3] net: vrf: Fix ping failed when vrf mtu is set to 0 linmiaohe
@ 2019-04-08  3:51 ` David Ahern
  2019-04-08  5:49   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2019-04-08  3:51 UTC (permalink / raw)
  To: linmiaohe, shrijeet, davem, netdev, linux-kernel; +Cc: Mingfangsen

On 4/7/19 7:04 PM, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> When the mtu of a vrf device is set to 0, it would cause ping
> failed. So I think we should limit vrf mtu in a reasonable range
> to solve this problem. I set dev->min_mtu to IPV6_MIN_MTU, so it
> will works for both ipv4 and ipv6. And if dev->max_mtu still be 0
> can be confusing, so I set dev->max_mtu to ETH_MAX_MTU.
> 
> Here is the reproduce step:
> 
> 1.Config vrf interface and set mtu to 0:
> 3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel
> master vrf1 state UP mode DEFAULT group default qlen 1000
>     link/ether 52:54:00:9e:dd:c1 brd ff:ff:ff:ff:ff:ff
> 
> 2.Ping peer:
> 3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel
> master vrf1 state UP group default qlen 1000
>     link/ether 52:54:00:9e:dd:c1 brd ff:ff:ff:ff:ff:ff
>     inet 10.0.0.1/16 scope global enp4s0
>        valid_lft forever preferred_lft forever
> connect: Network is unreachable
> 
> 3.Set mtu to default value, ping works:
> PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
> 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=1.88 ms
> 
> Fixes: ad49bc6361ca2 ("net: vrf: remove MTU limits for vrf device")
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---

Reviewed-by: David Ahern <dsahern@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] net: vrf: Fix ping failed when vrf mtu is set to 0
  2019-04-08  3:51 ` David Ahern
@ 2019-04-08  5:49   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2019-04-08  5:49 UTC (permalink / raw)
  To: dsa; +Cc: linmiaohe, shrijeet, netdev, linux-kernel, mingfangsen

From: David Ahern <dsa@cumulusnetworks.com>
Date: Sun, 7 Apr 2019 20:51:05 -0700

> On 4/7/19 7:04 PM, linmiaohe wrote:
>> From: Miaohe Lin <linmiaohe@huawei.com>
>> 
>> When the mtu of a vrf device is set to 0, it would cause ping
>> failed. So I think we should limit vrf mtu in a reasonable range
>> to solve this problem. I set dev->min_mtu to IPV6_MIN_MTU, so it
>> will works for both ipv4 and ipv6. And if dev->max_mtu still be 0
>> can be confusing, so I set dev->max_mtu to ETH_MAX_MTU.
>> 
>> Here is the reproduce step:
 ...
>> Fixes: ad49bc6361ca2 ("net: vrf: remove MTU limits for vrf device")
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
> 
> Reviewed-by: David Ahern <dsahern@gmail.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-08  5:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08  2:04 [PATCH net v3] net: vrf: Fix ping failed when vrf mtu is set to 0 linmiaohe
2019-04-08  3:51 ` David Ahern
2019-04-08  5:49   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).