netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
To: Jiri Pirko <jiri@resnulli.us>, Antonio Quartulli <antonio@openvpn.net>
Cc: Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Donald Hunter <donald.hunter@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, sd@queasysnail.net
Subject: Re: [PATCH net-next v8 03/24] ovpn: add basic netlink support
Date: Fri, 1 Nov 2024 02:17:25 +0200	[thread overview]
Message-ID: <e05ca0a3-5573-4617-8bb9-f33c062fa519@gmail.com> (raw)
In-Reply-To: <ZwUrAn8xrF2BCrMp@nanopsycho.orion>

Hello Jiri,

Sorry for the late reply. Could you elaborate a bit reasons for the RTNL 
interface implementation? Please find the questions inlined.

On 08.10.2024 15:52, Jiri Pirko wrote:
> Tue, Oct 08, 2024 at 11:16:01AM CEST, antonio@openvpn.net wrote:
>> On 08/10/2024 10:58, Jiri Pirko wrote:
>>> Tue, Oct 08, 2024 at 10:01:40AM CEST, antonio@openvpn.net wrote:
>>>> Hi,
>>>>
>>>> On 07/10/24 17:32, Jiri Pirko wrote:
>>>>> Wed, Oct 02, 2024 at 11:02:17AM CEST, antonio@openvpn.net wrote:
>>>>>
>>>>> [...]
>>>>>
>>>>>
>>>>>> +operations:
>>>>>> +  list:
>>>>>> +    -
>>>>>> +      name: dev-new
>>>>>> +      attribute-set: ovpn
>>>>>> +      flags: [ admin-perm ]
>>>>>> +      doc: Create a new interface of type ovpn
>>>>>> +      do:
>>>>>> +        request:
>>>>>> +          attributes:
>>>>>> +            - ifname
>>>>>> +            - mode
>>>>>> +        reply:
>>>>>> +          attributes:
>>>>>> +            - ifname
>>>>>> +            - ifindex
>>>>>> +    -
>>>>>> +      name: dev-del
>>>>>
>>>>> Why you expose new and del here in ovn specific generic netlink iface?
>>>>> Why can't you use the exising RTNL api which is used for creation and
>>>>> destruction of other types of devices?
>>>>
>>>> That was my original approach in v1, but it was argued that an ovpn interface
>>>> needs a userspace program to be configured and used in a meaningful way,
>>>> therefore it was decided to concentrate all iface mgmt APIs along with the
>>>> others in the netlink family and to not expose any RTNL ops.
>>>
>>> Can you please point me to the message id?
>>
>> <CAHNKnsQnHAdxC-XhC9RP-cFp0d-E4YGb+7ie3WymXVL9N-QS6A@mail.gmail.com> from
>> Sergey and subsequent replies.
>> RTNL vs NL topic starts right after the definition of 'ovpn_link_ops'
> 
> Yeah, does not make sense to me. All devices should implement common
> rtnl ops, the extra-config, if needed, could be on a separate channel.
> I don't find Sergey's argumentation valid.

Do we consider word *should* in terms of RFC 2119:

    SHOULD   This word, or the adjective "RECOMMENDED", mean that there
    may exist valid reasons in particular circumstances to ignore a
    particular item, but the full implications must be understood and
    carefully weighed before choosing a different course.

I am asking because rtnl_link_register() allows ops without .newlink 
implementation. What makes .newlink implementation as least optional and 
gives a freedom in design.

Let me briefly summarize my argumentation from the referenced thread. We 
have two classes of links point-to-point and point-to-multipoint. The 
major class is PtP and RTNL is perfectly suited to manage it. While PtMP 
is a minor class and it is an obstacle for RTNL due to need to manage 
multiple peers. What requires a different interface to manage these 
peers. Lets call it GENL interface. A PtMP-class netdev without any 
configured peer is useless, what makes GENL interface for peers 
management mandatory. Mandatory to implement in both user- and kernel-space.

Link creation can be implemented using any of these (RTNL or GENL) 
interfaces. GENL interface is already mandatory to implement in a 
user-space software, while RTNL can be considered optional to implement. 
So, implementing the link creation using GENL requires only a new 
message support implementation. While implementing the the link creation 
using RTNL requires a whole new interface implementation (socket 
read/write, messages demux, etc.).

My point is, GENL-only management gives us consolidated and clear 
solution, while GENL+RTNL requires code duplication and causes a 
complexity. That's it.


Jiri, do you see big flaws in this reasoning?


>> Recently Kuniyuki commented on this topic as well in:
>> <20240919055259.17622-1-kuniyu@amazon.com>
>> and that is why I added a default dellink implemetation.
> 
> Having dellink without newlink implemented is just wrong.

Could you clarify this statement please? I can not recall any 
documentation or a code block that enforces .newlink implementation in 
case of the .dellink presence.


Generally speaking, I can understand a feel of irregularity when looking 
at code implementing delete operation without a link creation 
counterpart. This confusion can be resolved taking into consideration a 
difference in a nature of these operations. A new link can not be 
created automatically while an existing link can be removed 
automatically without any extra inputs.

.newlink designated only for fulfilling user's requests since it 
requires extra information unavailable inside the kernel. While .dellink 
has two semantics: (a) user's requests fulfilling, (b) automatic cleanup 
of unneeded remainders.

 From that perspective, having an option to implement .dellink without 
.newlink implementation looks reasonable.


>>>> However, recently we decided to add a dellink implementation for better
>>>> integration with network namespaces and to allow the user to wipe a dangling
>>>> interface.
>>>
>>> Hmm, one more argument to have symmetric add/del impletentation in RTNL
>>>
>>>
>>>>
>>>> In the future we are planning to also add the possibility to create a
>>>> "persistent interface", that is an interface created before launching any
>>>> userspace program and that survives when the latter is stopped.
>>>> I can guess this functionality may be better suited for RTNL, but I am not
>>>> sure yet.
>>>
>>> That would be quite confusing to have RTNL and genetlink iface to
>>> add/del device. From what you described above, makes more sent to have
>>> it just in RTNL
>>
>> All in all I tend to agree.
>>
>>>
>>>>
>>>> @Jiri: do you have any particular opinion why we should use RTNL ops and not
>>>> netlink for creating/destroying interfaces? I feel this is mostly a matter of
>>>> taste, but maybe there are technical reasons we should consider.
>>>
>>> Well. technically, you can probabaly do both. But it is quite common
>>> that you can add/delete these kind of devices over RTNL. Lots of
>>> examples. People are used to it, aligns with existing flows.
>>
>> The only counterargument I see is the one brought by Sergey: "the ovpn
>> interface is not usable after creation, if no openvpn process is running".
>>
>> However, allowing to create "persistent interfaces" will define a use-case
>> for having an ovpn device without any userspace process.
>>
>> @Sergey what is your opinion here? I am not sure persistent interfaces were
>> discussed at the time you brought your point about RTNL vs NL.
>>
>>
>> Regards,
>>
>>
>>>
>>>>
>>>> Thanks a lot for your contribution.
>>>>
>>>> Regards,
>>>>
>>>>
>>>>>
>>>>>
>>>>> ip link add [link DEV | parentdev NAME] [ name ] NAME
>>>>> 		    [ txqueuelen PACKETS ]
>>>>> 		    [ address LLADDR ]
>>>>> 		    [ broadcast LLADDR ]
>>>>> 		    [ mtu MTU ] [index IDX ]
>>>>> 		    [ numtxqueues QUEUE_COUNT ]
>>>>> 		    [ numrxqueues QUEUE_COUNT ]
>>>>> 		    [ netns { PID | NETNSNAME | NETNSFILE } ]
>>>>> 		    type TYPE [ ARGS ]
>>>>>
>>>>> ip link delete { DEVICE | dev DEVICE | group DEVGROUP } type TYPE [ ARGS ]
>>>>>
>>>>> Lots of examples of existing types creation is for example here:
>>>>> https://developers.redhat.com/blog/2018/10/22/introduction-to-linux-interfaces-for-virtual-networking
>>>>>
>>>>>
>>>>>
>>>>>> +      attribute-set: ovpn
>>>>>> +      flags: [ admin-perm ]
>>>>>> +      doc: Delete existing interface of type ovpn
>>>>>> +      do:
>>>>>> +        pre: ovpn-nl-pre-doit
>>>>>> +        post: ovpn-nl-post-doit
>>>>>> +        request:
>>>>>> +          attributes:
>>>>>> +            - ifindex

--
Sergey

  parent reply	other threads:[~2024-11-01  0:17 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02  9:02 [PATCH net-next v8 00/24] Introducing OpenVPN Data Channel Offload Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 01/24] netlink: add NLA_POLICY_MAX_LEN macro Antonio Quartulli
2024-10-04 12:58   ` Donald Hunter
2024-10-04 13:38     ` Jakub Kicinski
2024-10-04 14:41       ` Donald Hunter
2024-10-07 10:04       ` Antonio Quartulli
2024-10-07 15:53         ` Jakub Kicinski
2024-10-08  7:51           ` Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 02/24] net: introduce OpenVPN Data Channel Offload (ovpn) Antonio Quartulli
2024-10-02 11:08   ` kernel test robot
2024-10-02  9:02 ` [PATCH net-next v8 03/24] ovpn: add basic netlink support Antonio Quartulli
2024-10-02 14:13   ` kernel test robot
2024-10-04 16:13   ` Donald Hunter
2024-10-07 10:57     ` Antonio Quartulli
2024-10-07 15:32   ` Jiri Pirko
2024-10-08  8:01     ` Antonio Quartulli
2024-10-08  8:58       ` Jiri Pirko
2024-10-08  9:16         ` Antonio Quartulli
2024-10-08 12:52           ` Jiri Pirko
2024-10-08 13:21             ` Antonio Quartulli
2024-11-01  0:17             ` Sergey Ryazanov [this message]
2024-10-02  9:02 ` [PATCH net-next v8 04/24] ovpn: add basic interface creation/destruction/management routines Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 05/24] ovpn: implement interface creation/destruction via netlink Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 06/24] ovpn: keep carrier always on Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 07/24] ovpn: introduce the ovpn_peer object Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 08/24] ovpn: introduce the ovpn_socket object Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 09/24] ovpn: implement basic TX path (UDP) Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 10/24] ovpn: implement basic RX " Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 11/24] ovpn: implement packet processing Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 12/24] ovpn: store tunnel and transport statistics Antonio Quartulli
2024-10-03  9:20   ` kernel test robot
2024-10-02  9:02 ` [PATCH net-next v8 13/24] ovpn: implement TCP transport Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 14/24] ovpn: implement multi-peer support Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 15/24] ovpn: implement peer lookup logic Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 16/24] ovpn: implement keepalive mechanism Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 17/24] ovpn: add support for updating local UDP endpoint Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 18/24] ovpn: add support for peer floating Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 19/24] ovpn: implement peer add/dump/delete via netlink Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 20/24] ovpn: implement key add/del/swap " Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 21/24] ovpn: kill key and notify userspace in case of IV exhaustion Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 22/24] ovpn: notify userspace when a peer is deleted Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 23/24] ovpn: add basic ethtool support Antonio Quartulli
2024-10-02  9:02 ` [PATCH net-next v8 24/24] testing/selftest: add test tool and scripts for ovpn module Antonio Quartulli
2024-10-02 22:35   ` Shuah Khan
2024-10-04  9:50     ` 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=e05ca0a3-5573-4617-8bb9-f33c062fa519@gmail.com \
    --to=ryazanov.s.a@gmail.com \
    --cc=antonio@openvpn.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=shuah@kernel.org \
    /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).