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, 29 Nov 2015 22:40:44 +0100
From:	Phil Sutter <phil@....cc>
To:	Stephen Hemminger <shemming@...cade.com>
Cc:	netdev@...r.kernel.org
Subject: Re: [iproute PATCH RFC] libnetlink: introduce DECLARE_NLREQ

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, Nov 29, 2015 at 12:07:52PM -0800, Stephen Hemminger wrote:
> On Thu, 26 Nov 2015 14:26:05 +0100
> Phil Sutter <phil@....cc> wrote:
> 
> > This macro aims to simplify most netlink users' pattern to prepare a
> > request, which is to create an unnamed struct and initialize it:
> > 
> > | struct {
> > |	struct nlmsghdr n;
> > |	struct whatever foo;
> > |	char buf[arbitrary number];
> > | } req;
> > |
> > | memset(&req, 0, sizeof(req));
> > | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct whatever));
> > | req.n.nlmsg_flags = NLM_F_REQUEST;
> > 
> > Having this patch applied, the above can be replaced by a static
> > initializer like so:
> > 
> > | DECLARE_NLREQ(req, n, struct whatever foo, arbitrary number);
> > 
> > There is an added benefit, as well: Due to explicit alignment, the
> > requested tailroom is really as big as requested no matter what size
> > struct whatever really is.
> > 
> > Signed-off-by: Phil Sutter <phil@....cc>
> > ---
> > This patch is RFC because I want to wait for peer review and upstream
> > acceptance before sending in the big refactoring patch itself.
> > ---
> >  include/libnetlink.h | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> 
> I am not a fan of complex macros. But netlink seems to get lots of them.
> You need to add more parens round arguments (like name).
> 
> Really longterm would rather iproute2 switched to a cleaner library like libmnl

Ah, indeed! Someone else suggested that once, as well. I'll have a look
into that before continuing this path.

Thanks, Phil
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlZbcNwACgkQnMPprxY1hCeZNwCfazSwuC8W6DU3vnY12TEwX6yp
d6YAn2JjJYPObXxGBOH/8e+GgY2zIeEq
=wbf7
-----END PGP SIGNATURE-----
--
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