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] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 19 Oct 2014 11:39:20 +0530
From:	Stephen Hemminger <stephen@...workplumber.org>
To:	Vadim Kochan <vadim4j@...il.com>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH iproute2] ss: Refactor to use macro for define diag nl
 request

On Sun, 19 Oct 2014 02:50:29 +0300
Vadim Kochan <vadim4j@...il.com> wrote:

> Signed-off-by: Vadim Kochan <vadim4j@...il.com>
> ---
>  misc/ss.c | 57 ++++++++++++++++++---------------------------------------
>  1 file changed, 18 insertions(+), 39 deletions(-)
> 
> diff --git a/misc/ss.c b/misc/ss.c
> index 2420b51..261847b 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -41,6 +41,20 @@
>  #include <linux/packet_diag.h>
>  #include <linux/netlink_diag.h>
>  
> +#define DIAG_REQUEST(_req, _r)						    \
> +	struct {							    \
> +		struct nlmsghdr nlh;					    \
> +		_r;							    \
> +	} _req = {							    \
> +		.nlh = {						    \
> +			.nlmsg_type = SOCK_DIAG_BY_FAMILY,		    \
> +			.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST,\
> +			.nlmsg_seq = 123456,				    \
> +			.nlmsg_len = sizeof(_req),			    \
> +			.nlmsg_pid = 0,					    \
> +		},							    \
> +	}

No need to initialize to zero.
Not a big fan of macro's but it does make the code more readable in this case.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ