lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 10 Jul 2017 10:10:56 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Stephen Hemminger' <stephen@...workplumber.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     "lorenzo@...gle.com" <lorenzo@...gle.com>
Subject: RE: [PATCH iproute2] ip: change flag names to an array

From:  Stephen Hemminger
> Sent: 07 July 2017 16:40
> For the most of the address flags, use a table of bit values rather
> than open coding every value.  This allows for easier inevitable
> expansion of flags.
> 
> This also fixes the missing stable-privacy flag.
> 
> Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
> ---
>  ip/ipaddress.c | 152 ++++++++++++++++++++++++---------------------------------
>  1 file changed, 65 insertions(+), 87 deletions(-)
> 
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index f06f5829fb61..b4efb9fedcd2 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -1013,14 +1013,67 @@ static unsigned int get_ifa_flags(struct ifaddrmsg *ifa,
>  				ifa->ifa_flags;
>  }
> 
> +
> +static const char *ifa_flag_names[] = {
> +	"secondary",
> +	"nodad",
> +	"optimistic",
> +	"dadfailed",
> +	"home",
> +	"deprecated",
> +	"tentative",
> +	"permanent",
> +	"mngtmpaddr",
> +	"noprefixroute",
> +	"autojoin",
> +	"stable-privacy",
> +};

It would be safer to set up a table of the constant - string pairs
instead of relying on the table being in the right order.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ