netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Antonio Quartulli <antonio@openvpn.net>
Cc: netdev@vger.kernel.org,  kuba@kernel.org,  pabeni@redhat.com,
	ryazanov.s.a@gmail.com,  edumazet@google.com,  andrew@lunn.ch,
	sd@queasysnail.net
Subject: Re: [PATCH net-next v7 04/25] ovpn: add basic netlink support
Date: Wed, 18 Sep 2024 11:07:09 +0100	[thread overview]
Message-ID: <m2o74lb7hu.fsf@gmail.com> (raw)
In-Reply-To: <99028055-f440-45e8-8fb1-ec4e19e0cafa@openvpn.net> (Antonio Quartulli's message of "Tue, 17 Sep 2024 23:28:41 +0200")

Antonio Quartulli <antonio@openvpn.net> writes:
>>> +      -
>>> +        name: local-ip
>>> +        type: binary
>>> +        doc: The local IP to be used to send packets to the peer (UDP only)
>>> +        checks:
>>> +          max-len: 16
>> It might be better to have separate attrs fopr local-ipv4 and
>> local-ipv6, to be consistent with vpn-ipv4 / vpn-ipv6
>
> while it is possible for a peer to be dual stack and have both an IPv4 and IPv6 address assigned
> to the VPN tunnel, the local transport endpoint can only be one (either v4 or v6).
> This is why we have only one local_ip.
> Does it make sense?

I was thinking that the two attributes would be mutually exclusive. You
could accept local-ipv4 OR local-ipv6. If both are provided then you can
report an extack error.

>>
>>> +      -
>>> +        name: keyconf
>>> +        type: nest
>>> +        doc: Peer specific cipher configuration
>>> +        nested-attributes: keyconf
>> Perhaps keyconf should just be used as a top-level attribute-set. The
>> only attr you'd need to duplicate would be peer-id? There are separate
>> ops for setting peers and for key configuration, right?
>
> This is indeed a good point.
> Yes, SET_PEER and SET_KEY are separate ops.
>
> I could go with SET_PEER only, and let the user specify a keyconf within a peer (like now).
>
> Or I could keep to SET_KEY, but then do as you suggest and move KEYCONF to the root level.
>
> Is there any preferred approach?

I liked the separate ops for key management because the sematics are
explicit and it is very obvious that there is no op for reading keys. If
you also keep keyconf attrs separate from the peer attrs then it would be
obvious that the peer ops would never expose any keyconf attrs.

>>
>>> +    -
>>> +      name: del-peer
>>> +      attribute-set: ovpn
>>> +      flags: [ admin-perm ]
>>> +      doc: Delete existing remote peer
>>> +      do:
>>> +        pre: ovpn-nl-pre-doit
>>> +        post: ovpn-nl-post-doit
>>> +        request:
>>> +          attributes:
>>> +            - ifindex
>>> +            - peer
>> I think you need to add an op for 'del-peer-notify' to specify the
>> notification, not reuse the 'del-peer' command.
>
> my idea was to use CMD_DEL_PEER and then send back a very very short PEER object.
> I took inspiration from nl80211 that sends CMD_NEW_STATION and CMD_DEL_STATION when a wifi host
> connects or disconnect. In that case the full STATION object is also delivered (maybe I should
> do the same?)
>
> Or is there some other technical reason for not reusing CMD_DEL_PEER?

nl80211 is maybe not a good example to follow because it predates the
ynl specs and code generation. The netdev.yaml spec is a good example of
a modern genetlink spec. It specifies ops for 'dev-add-ntf' and
'dev-del-ntf' that both reuse the definition from 'dev-get' with the
'notify: dev-get' attribute:

    -
      name: dev-get
      doc: Get / dump information about a netdev.
      attribute-set: dev
      do:
        request:
          attributes:
            - ifindex
        reply: &dev-all
          attributes:
            - ifindex
            - xdp-features
            - xdp-zc-max-segs
            - xdp-rx-metadata-features
            - xsk-features
      dump:
        reply: *dev-all
    -
      name: dev-add-ntf
      doc: Notification about device appearing.
      notify: dev-get
      mcgrp: mgmt
    -
      name: dev-del-ntf
      doc: Notification about device disappearing.
      notify: dev-get
      mcgrp: mgmt

The notify ops get distinct ids so they should never be confused with
normal command responses.

>> 
>>> +    -
>>> +      name: set-key
>>> +      attribute-set: ovpn
>>> +      flags: [ admin-perm ]
>>> +      doc: Add or modify a cipher key for a specific peer
>>> +      do:
>>> +        pre: ovpn-nl-pre-doit
>>> +        post: ovpn-nl-post-doit
>>> +        request:
>>> +          attributes:
>>> +            - ifindex
>>> +            - peer
>>> +    -
>>> +      name: swap-keys
>>> +      attribute-set: ovpn
>>> +      flags: [ admin-perm ]
>>> +      doc: Swap primary and secondary session keys for a specific peer
>>> +      do:
>>> +        pre: ovpn-nl-pre-doit
>>> +        post: ovpn-nl-post-doit
>>> +        request:
>>> +          attributes:
>>> +            - ifindex
>>> +            - peer
>> Same for swap-keys notifications.
>
> Yeah, here I can understand. My rationale was: tell userspace that now we truly need a
> SWAP_KEYS. Do you think this can create problems/confusion?

Right, so this is a notification to user space that it is time to swap
keys, not that a swap-keys operation has happened? If the payload is
unique to this notification then you should probably use the 'event' op
format. For example:

    -
      name: swap-keys-ntf
      doc: Notify user space that a swap-keys op is due.
      attribute-set: ovpn
      event:
        attributes:
          - ifindex
          - peer
      mcgrp: peers

>> 
>>> +    -
>>> +      name: del-key
>>> +      attribute-set: ovpn
>>> +      flags: [ admin-perm ]
>>> +      doc: Delete cipher key for a specific peer
>>> +      do:
>>> +        pre: ovpn-nl-pre-doit
>>> +        post: ovpn-nl-post-doit
>>> +        request:
>>> +          attributes:
>>> +            - ifindex
>>> +            - peer
>>> +
>>> +mcast-groups:
>>> +  list:
>>> +    -
>>> +      name: peers
>
> Thanks a lot for your comments, Donald!
>
> Regards,

  reply	other threads:[~2024-09-18 10:07 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
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 [this message]
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=m2o74lb7hu.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=antonio@openvpn.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=sd@queasysnail.net \
    /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).