From: Stephen Hemminger <stephen@networkplumber.org>
To: Hongren Zheng <i@zenithal.me>
Cc: Daniel Borkmann <daniel@iogearbox.net>, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] iptoken: Add doc on the conditions of iptoken
Date: Wed, 31 Mar 2021 15:26:02 -0700 [thread overview]
Message-ID: <20210331152602.50cc4a79@hermes.local> (raw)
In-Reply-To: <YF80x4bBaXpS4s/W@Sun>
On Sat, 27 Mar 2021 21:36:07 +0800
Hongren Zheng <i@zenithal.me> wrote:
> `ip token set suffix dev interface' may be unsuccessful
> with only the error 'RTNETLINK answers: Invalid argument'
> prompted. For users this is mysterious and hard to debug.
> Hence a more user-friendly prompt is added.
>
> This commit adds doc for conditions for setting the token and
> making the token take effect. For the former one, conditions
> in the function 'inet6_set_iftoken' of 'net/ipv6/addrconf.c'
> of the Linux kernel code is documented.
>
> For the latter one, conditions in the function 'addrconf_prefix_rcv'
> of 'net/ipv6/addrconf.c' of the Linux kernel code is docuemnted.
>
> Signed-off-by: Hongren Zheng <i@zenithal.me>
> ---
> ip/iptoken.c | 4 +++-
> man/man8/ip-token.8 | 24 ++++++++++++++++++++++++
> 2 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/ip/iptoken.c b/ip/iptoken.c
> index 9f356890..d56fd68d 100644
> --- a/ip/iptoken.c
> +++ b/ip/iptoken.c
> @@ -177,8 +177,10 @@ static int iptoken_set(int argc, char **argv, bool delete)
> addattr_nest_end(&req.n, afs6);
> addattr_nest_end(&req.n, afs);
>
> - if (rtnl_talk(&rth, &req.n, NULL) < 0)
> + if (rtnl_talk(&rth, &req.n, NULL) < 0) {
> + fprintf(stderr, "Conditions not met: 'man ip-token' for more info\n");
> return -2;
> + }
>
> return 0;
> }
> diff --git a/man/man8/ip-token.8 b/man/man8/ip-token.8
> index 6505b8c5..ac64eb66 100644
> --- a/man/man8/ip-token.8
> +++ b/man/man8/ip-token.8
> @@ -67,6 +67,30 @@ must be left out.
> list all tokenized interface identifiers for the networking interfaces from
> the kernel.
>
> +.SH "NOTES"
> +Several conditions should be met before setting the token for an interface.
> +.RS
> +.IP A
> +\- The interface is not a loopback device.
> +.IP B
> +\- The interface does not have NOARP flag.
> +.IP C
> +\- The interface accepts router advertisement (RA). To be more specific,
> +net.ipv6.conf.interface.accept_ra=1,
> +and when net.ipv6.conf.interface.forwarding=1,
> +net.ipv6.conf.interface.accept_ra=2.
> +.RE
> +
> +For the token to take effect, several conditions should be met.
> +.RS
> +.IP A
> +\- The interface has autoconf flag turned on. To be more specific, net.ipv6.conf.interface.autoconf=1
> +.IP B
> +\- The router advertisement (RA) has autonomous address-configuration flag turned on.
> +.IP C
> +\- The length of the prefix in the router advertisement (RA) is 64.
> +.RE
> +
> .SH SEE ALSO
> .br
> .BR ip (8)
It would be better if kernel provided the error messages through external ack
of the netlink message, rather than providing potentially out of date
recommendations on the man page.
next prev parent reply other threads:[~2021-03-31 22:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-27 13:36 [PATCH iproute2] iptoken: Add doc on the conditions of iptoken Hongren Zheng
2021-03-31 22:26 ` Stephen Hemminger [this message]
2021-04-01 10:41 ` Hongren Zheng
2021-04-01 3:49 ` [RFC] add extack errors for iptoken Stephen Hemminger
2021-04-01 10:21 ` Hongren Zheng
2021-04-01 14:31 ` David Ahern
2021-04-01 15:06 ` Stephen Hemminger
2021-04-28 12:55 ` Hongren Zheng
2021-04-28 15:32 ` David Ahern
2021-05-29 6:31 ` Hongren Zheng
2021-05-31 2:42 ` Stephen Hemminger
2021-05-31 5:26 ` Hongren Zheng
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=20210331152602.50cc4a79@hermes.local \
--to=stephen@networkplumber.org \
--cc=daniel@iogearbox.net \
--cc=i@zenithal.me \
--cc=netdev@vger.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).