[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKyWWCbAdv8W26HwGpM9q5+6rrk9E-Lbd2aujFkD3GMaQ@mail.gmail.com>
Date: Mon, 21 Feb 2022 07:43:18 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Ziyang Xuan <william.xuanziyang@...wei.com>,
Herbert Xu <herbert@...dor.apana.org.au>
Cc: David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
Vasily Averin <vvs@...tuozzo.com>,
Kees Cook <keescook@...omium.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] net: vlan: allow vlan device MTU change follow real
device from smaller to bigger
CC Herbert Xu, author of blamed commit.
On Mon, Feb 21, 2022 at 4:28 AM Ziyang Xuan
<william.xuanziyang@...wei.com> wrote:
>
> vlan device MTU can only follow real device change from bigger to smaller
> but from smaller to bigger under the premise of vlan device MTU not exceed
> the real device MTU.
>
> This issue can be seen using the following commands:
>
> ip link add link eth1 dev eth1.100 type vlan id 100
> ip link set eth1 mtu 256
> ip link set eth1 mtu 1500
> ip link show
>
> Modify to allow vlan device follow real device MTU change from smaller
> to bigger when user has not configured vlan device MTU which is not
> equal to real device MTU. That also ensure user configuration has higher
> priority.
>
> Fixes: 2e477c9bd2bb ("vlan: Propagate physical MTU changes")
> Signed-off-by: Ziyang Xuan <william.xuanziyang@...wei.com>
> ---
> net/8021q/vlan.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
> index 788076b002b3..7de4f462525a 100644
> --- a/net/8021q/vlan.c
> +++ b/net/8021q/vlan.c
> @@ -361,6 +361,7 @@ static int __vlan_device_event(struct net_device *dev, unsigned long event)
> static int vlan_device_event(struct notifier_block *unused, unsigned long event,
> void *ptr)
> {
> + unsigned int orig_mtu = ((struct netdev_notifier_info_ext *)ptr)->ext.mtu;
> struct netlink_ext_ack *extack = netdev_notifier_info_to_extack(ptr);
> struct net_device *dev = netdev_notifier_info_to_dev(ptr);
> struct vlan_group *grp;
> @@ -419,7 +420,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
>
> case NETDEV_CHANGEMTU:
> vlan_group_for_each_dev(grp, i, vlandev) {
> - if (vlandev->mtu <= dev->mtu)
> + if (vlandev->mtu <= dev->mtu && vlandev->mtu != orig_mtu)
> continue;
>
> dev_set_mtu(vlandev, dev->mtu);
> --
> 2.25.1
>
Herbert, do you recall why only a decrease was taken into consideration ?
Thanks.
Powered by blists - more mailing lists