Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1326118
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] vsprintf: automatic parameters for %pIS via 'a' |
| Date | 2016-02-04 00:10 +0100 |
| Message-ID | <qYeIG-fd-9@gated-at.bofh.it> (permalink) |
| References | <qYdtg-7qy-17@gated-at.bofh.it> <qYez2-8kz-71@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 2016-02-03 at 23:53 +0100, Jason A. Donenfeld wrote:
> This patch adds a variable 'a' which indicates that the 'p',
> 'f', and 's' options should be toggled on or off depending on
> whether or not those parameters are actually valid inside the
> passed sockaddr.
OK
> This is something that probably most users of
> the %pIS family of functions will prefer to use.
More doubtful.
There isn't a single user of flowinfo or scope today.
These are the current uses of %pIS
8 %pIS
11 %pISc
5 %pIScp
2 %pISp
23 %pISpc
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
[]
> @@ -1169,9 +1169,18 @@ char *ip6_addr_string_sa(char *buf, char *end, const struct sockaddr_in6 *sa,
> case 'c':
> have_c = true;
> break;
> + case 'a':
> + have_a = true;
> + break;
> }
> }
>
> + if (have_a) {
> + have_p = sa->sin6_port != 0;
> + have_s = sa->sin6_scope_id != 0;
> + have_f = sa->sin6_flowinfo != 0;
Doesn't this needs the mask tested?
sa->sin6_flowinfo & IPV6_FLOWINFO_MASK
given the use of bool, the != 0 are unnecessary.
Other than that, looks good to me.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] vsprintf: do not append unset Scope ID to IPv6 "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-03 11:50 +0100
[PATCH] vsprintf: flowinfo in IPv6 is optional too "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-03 13:20 +0100
IRe: [PATCH] vsprintf: flowinfo in IPv6 is optional too Joe Perches <joe@perches.com> - 2016-02-03 19:00 +0100
Re: IRe: [PATCH] vsprintf: flowinfo in IPv6 is optional too "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-03 22:20 +0100
Re: IRe: [PATCH] vsprintf: flowinfo in IPv6 is optional too Daniel Borkmann <daniel@iogearbox.net> - 2016-02-03 22:20 +0100
Re: [PATCH] vsprintf: flowinfo in IPv6 is optional too Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-02-03 22:20 +0100
Re: IRe: [PATCH] vsprintf: flowinfo in IPv6 is optional too "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-03 22:20 +0100
Re: [PATCH] vsprintf: do not append unset Scope ID to IPv6 Daniel Borkmann <daniel@iogearbox.net> - 2016-02-03 22:10 +0100
Re: [PATCH] vsprintf: do not append unset Scope ID to IPv6 "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-03 22:20 +0100
Re: [PATCH] vsprintf: do not append unset Scope ID to IPv6 Joe Perches <joe@perches.com> - 2016-02-03 22:50 +0100
Re: [PATCH] vsprintf: do not append unset Scope ID to IPv6 Daniel Borkmann <daniel@iogearbox.net> - 2016-02-03 23:10 +0100
Re: [PATCH] vsprintf: do not append unset Scope ID to IPv6 "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-03 23:50 +0100
[PATCH] vsprintf: automatic parameters for %pIS via 'a' "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-04 00:00 +0100
Re: [PATCH] vsprintf: automatic parameters for %pIS via 'a' Joe Perches <joe@perches.com> - 2016-02-04 00:10 +0100
Re: [PATCH] vsprintf: automatic parameters for %pIS via 'a' "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-04 00:30 +0100
[PATCH v2] vsprintf: automatic parameters for %pIS via 'a' "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-04 00:30 +0100
Re: [PATCH v2] vsprintf: automatic parameters for %pIS via 'a' Joe Perches <joe@perches.com> - 2016-02-04 00:40 +0100
[PATCH v3] vsprintf: automatic parameters for %pIS via 'a' "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-04 02:00 +0100
Re: [PATCH v2] vsprintf: automatic parameters for %pIS via 'a' Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-05 01:10 +0100
Re: [PATCH v2] vsprintf: automatic parameters for %pIS via 'a' "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-05 14:10 +0100
[PATCH v4] vsprintf: automatic parameters for %pIS via 'a' "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-05 14:40 +0100
[PATCH] vsprintf: automatic parameters for %pIS via 'a' "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-05 14:40 +0100
csiph-web