lkml.org 
[lkml]   [2019]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net v2] net: vrf: Fix ping failed when vrf mtu is set to 0
From
Date
On 4/6/19 11:46 PM, linmiaohe wrote:
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index 7c1430ed0244..4d35d37f225a 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -43,6 +43,12 @@
>
> #define FIB_RULE_PREF 1000 /* default preference for FIB rules */
>
> +/* The MTU is really irrelevant for VRF except for odd cases, so limit it
> + * to a reasonable range which both works for IPV4 and IPV6.
> + */
> +#define VRF_MIN_MTU 1280 /* same as IPV6_MIN_MTU */
> +#define VRF_MAX_MTU 0xFFFFU /* same as IP_MAX_MTU */

Since VRF does not care about MTU, there is no reason for VRF specific
macros.

> +
> static unsigned int vrf_net_id;
>
> struct net_vrf {
> @@ -1274,8 +1280,8 @@ static void vrf_setup(struct net_device *dev)
> /* default to no qdisc; user can add if desired */
> dev->priv_flags |= IFF_NO_QUEUE;
>
> - dev->min_mtu = 0;
> - dev->max_mtu = 0;
> + dev->min_mtu = VRF_MIN_MTU;
> + dev->max_mtu = VRF_MAX_MTU;

Set these to IPV6_MIN_MTU and ETH_MAX_MTU and add a comment that 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.

\
 
 \ /
  Last update: 2019-04-07 16:31    [W:0.077 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site