Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jordan Rife <jrife@google.com>
Cc: Jason@zx2c4.com, davem@davemloft.net, edumazet@google.com,
	linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com, shuah@kernel.org, wireguard@lists.zx2c4.com
Subject: Re: [PATCH v2 net-next] wireguard: allowedips: Add WGALLOWEDIP_F_REMOVE_ME flag
Date: Sat, 30 Nov 2024 09:56:24 -0800	[thread overview]
Message-ID: <20241130095624.1c34a12c@kernel.org> (raw)
In-Reply-To: <20241127232133.3928793-1-jrife@google.com>

On Wed, 27 Nov 2024 23:21:33 +0000 Jordan Rife wrote:
> The second command fails with "Invalid argument" (EINVAL) on the
> unpatched kernel. This simplifies things, as there's no need for
> clients to explicitly probe to see if this attribute is supported. I
> will do the following:
> 
> 1. Revert WG_GENL_VERSION back to 1.
> 2. Add a check for new flags similar to the one you mentioned for
>    WGPEER_A_FLAGS.
> 
>         if (attrs[WGPEER_A_FLAGS])
>                 flags = nla_get_u32(attrs[WGPEER_A_FLAGS]);
>         ret = -EOPNOTSUPP;
>         if (flags & ~__WGPEER_F_ALL)
>                 goto out;
> 
> This should be sufficient. We might want to consider how best to bubble
> this error up to users. In the case of wg, "Invalid argument" may not be
> very helpful in determining where you went wrong. We could always detect
> when EINVAL is returned in response to an operation that sets
> WGALLOWEDIP_A_FLAGS and print something more helpful like "Operation not
> supported on this kernel". However, these are details that can be worked
> out.

Better still use NLA_POLICY_MASK() so that nla_parse_nested() can
perform the validation and attach a machine readable info about
the failure.

  reply	other threads:[~2024-11-30 17:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 20:05 [PATCH v2 net-next] wireguard: allowedips: Add WGALLOWEDIP_F_REMOVE_ME flag Jordan Rife
2024-10-01 16:26 ` Jordan Rife
2024-11-17 20:50 ` Jason A. Donenfeld
2024-11-17 21:46 ` Jason A. Donenfeld
2024-11-18 20:44   ` Jordan Rife
2024-11-27 23:21     ` Jordan Rife
2024-11-30 17:56       ` Jakub Kicinski [this message]
2024-12-04  1:23         ` Jordan Rife

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=20241130095624.1c34a12c@kernel.org \
    --to=kuba@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jrife@google.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=wireguard@lists.zx2c4.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