[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240920093234.15620-1-kuniyu@amazon.com>
Date: Fri, 20 Sep 2024 11:32:34 +0200
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <antonio@...nvpn.net>
CC: <andrew@...n.ch>, <antony.antony@...unet.com>, <edumazet@...gle.com>,
<kuba@...nel.org>, <kuniyu@...zon.com>, <netdev@...r.kernel.org>,
<pabeni@...hat.com>, <ryazanov.s.a@...il.com>, <sd@...asysnail.net>,
<steffen.klassert@...unet.com>
Subject: Re: [PATCH net-next v7 03/25] net: introduce OpenVPN Data Channel Offload (ovpn)
From: Antonio Quartulli <antonio@...nvpn.net>
Date: Thu, 19 Sep 2024 13:57:51 +0200
> Hi Kuniyuki and thank you for chiming in.
>
> On 19/09/2024 07:52, Kuniyuki Iwashima wrote:
> > From: Antonio Quartulli <antonio@...nvpn.net>
> > Date: Tue, 17 Sep 2024 03:07:12 +0200
> >> +/* we register with rtnl to let core know that ovpn is a virtual driver and
> >> + * therefore ifaces should be destroyed when exiting a netns
> >> + */
> >> +static struct rtnl_link_ops ovpn_link_ops = {
> >> +};
> >
> > This looks like abusing rtnl_link_ops.
>
> In some way, the inspiration came from
> 5b9e7e160795 ("openvswitch: introduce rtnl ops stub")
>
> [which just reminded me that I wanted to fill the .kind field, but I
> forgot to do so]
>
> The reason for taking this approach was to avoid handling the iface
> destruction upon netns exit inside the driver, when the core already has
> all the code for taking care of this for us.
>
> Originally I implemented pernet_operations.pre_exit, but Sabrina
> suggested that letting the core handle the destruction was cleaner (and
> I agreed).
>
> However, after I removed the pre_exit implementation, we realized that
> default_device_exit_batch/default_device_exit_net thought that an ovpn
> device is a real NIC and was moving it to the global netns rather than
> killing it.
>
> One way to fix the above was to register rtnl_link_ops with netns_fund =
> false (so the ops object you see in this patch is not truly "empty").
>
> However, I then hit the bug which required patch 2 to get fixed.
>
> Does it make sense to you?
> Or you still think this is an rtnl_link_ops abuse?
The use of .kind makes sense, and the change should be in this patch.
For the patch 2 and dellink(), is the device not expected to be removed
by ip link del ? Setting unregister_netdevice_queue() to dellink() will
support RTM_DELLINK, but otherwise -EOPNOTSUPP is returned.
>
> The alternative was to change
> default_device_exit_batch/default_device_exit_net to read some new
> netdevice flag which would tell if the interface should be killed or
> moved to global upon netns exit.
>
> Regards,
>
Powered by blists - more mailing lists