From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
To: Antonio Quartulli <antonio@openvpn.net>,
Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: andrew@lunn.ch, antony.antony@secunet.com, edumazet@google.com,
kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
sd@queasysnail.net, steffen.klassert@secunet.com
Subject: Re: [PATCH net-next v7 03/25] net: introduce OpenVPN Data Channel Offload (ovpn)
Date: Sun, 22 Sep 2024 23:51:48 +0300 [thread overview]
Message-ID: <cbd97c96-4972-4b4d-a5a5-d43968c1a2d0@gmail.com> (raw)
In-Reply-To: <02420241-98a9-47dc-97a7-d3c1fad76573@openvpn.net>
Hello Antonio, Kuniyuki,
On 20.09.2024 12:46, Antonio Quartulli wrote:
> Hi,
>
> On 20/09/2024 11:32, Kuniyuki Iwashima wrote:
>> From: Antonio Quartulli <antonio@openvpn.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@openvpn.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.
>
> Ok, will add it here and I will also add an explicit .netns_fund = false
> to highlight the fact that we need this attribute to avoid moving the
> iface to the global netns.
>
>>
>> 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.
>
> For the time being I decided that it would make sense to add and delete
> ovpn interfaces via netlink API only.
>
> But there are already discussions about implementing the RTNL
> add/dellink() too.
> Therefore I think it makes sense to set dellink to
> unregister_netdevice_queue() in this patch and thus avoid patch 2 at all.
I should make a confession :) It was me who proposed and pushed the idea
of the RTNL ops removing. I was too concerned about uselessness of
addlink operation so I did not clearly mention that dellink is useful
operation. Especially when it comes to namespace destruction. My bad.
So yeah, providing the dellink operation make sense for namespace
destruction handling and for user to manually cleanup reminding network
interfaces after a forceful user application killing or crash.
>>> 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.
--
Sergey
next prev parent reply other threads:[~2024-09-22 20:51 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 1:07 [PATCH net-next v7 00/25] Introducing OpenVPN Data Channel Offload Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 01/25] netlink: add NLA_POLICY_MAX_LEN macro Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 02/25] rtnetlink: don't crash on unregister if no dellink exists Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 03/25] net: introduce OpenVPN Data Channel Offload (ovpn) Antonio Quartulli
2024-09-19 5:52 ` Kuniyuki Iwashima
2024-09-19 11:57 ` Antonio Quartulli
2024-09-20 9:32 ` Kuniyuki Iwashima
2024-09-20 9:46 ` Antonio Quartulli
2024-09-22 20:51 ` Sergey Ryazanov [this message]
2024-09-23 12:51 ` Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 04/25] ovpn: add basic netlink support Antonio Quartulli
2024-09-17 13:23 ` Donald Hunter
2024-09-17 21:28 ` Antonio Quartulli
2024-09-18 10:07 ` Donald Hunter
2024-09-18 11:16 ` Antonio Quartulli
2024-09-22 22:24 ` Sergey Ryazanov
2024-09-25 11:36 ` Antonio Quartulli
2024-09-26 15:06 ` Donald Hunter
2024-09-27 7:52 ` Antonio Quartulli
2024-09-22 23:20 ` Sergey Ryazanov
2024-09-23 12:59 ` Antonio Quartulli
2024-09-24 22:10 ` Sergey Ryazanov
2024-09-25 0:01 ` Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 05/25] ovpn: add basic interface creation/destruction/management routines Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 06/25] ovpn: implement interface creation/destruction via netlink Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 07/25] ovpn: keep carrier always on Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 08/25] ovpn: introduce the ovpn_peer object Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 09/25] ovpn: introduce the ovpn_socket object Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 10/25] ovpn: implement basic TX path (UDP) Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 11/25] ovpn: implement basic RX " Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 12/25] ovpn: implement packet processing Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 13/25] ovpn: store tunnel and transport statistics Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 14/25] ovpn: implement TCP transport Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 15/25] ovpn: implement multi-peer support Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 16/25] ovpn: implement peer lookup logic Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 17/25] ovpn: implement keepalive mechanism Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 18/25] ovpn: add support for updating local UDP endpoint Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 19/25] ovpn: add support for peer floating Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 20/25] ovpn: implement peer add/dump/delete via netlink Antonio Quartulli
2024-09-23 14:36 ` Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 21/25] ovpn: implement key add/del/swap " Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 22/25] ovpn: kill key and notify userspace in case of IV exhaustion Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 23/25] ovpn: notify userspace when a peer is deleted Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 24/25] ovpn: add basic ethtool support Antonio Quartulli
2024-09-17 1:07 ` [PATCH net-next v7 25/25] testing/selftest: add test tool and scripts for ovpn module Antonio Quartulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cbd97c96-4972-4b4d-a5a5-d43968c1a2d0@gmail.com \
--to=ryazanov.s.a@gmail.com \
--cc=andrew@lunn.ch \
--cc=antonio@openvpn.net \
--cc=antony.antony@secunet.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
--cc=steffen.klassert@secunet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).