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:   Fri, 31 May 2019 03:07:32 +0000
From:   Parav Pandit <parav@...lanox.com>
To:     David Ahern <dsahern@...il.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        "stephen@...workplumber.org" <stephen@...workplumber.org>,
        Leon Romanovsky <leonro@...lanox.com>
Subject: RE: [PATCH iproute2-next 1/4] rdma: Add an option to query,set net
 namespace sharing sys parameter

Hi David,

> -----Original Message-----
> From: David Ahern <dsahern@...il.com>
> Sent: Wednesday, May 29, 2019 9:43 PM
> To: Parav Pandit <parav@...lanox.com>
> Cc: netdev@...r.kernel.org; linux-rdma@...r.kernel.org;
> stephen@...workplumber.org; Leon Romanovsky <leonro@...lanox.com>
> Subject: Re: [PATCH iproute2-next 1/4] rdma: Add an option to query,set net
> namespace sharing sys parameter
> 
> On 5/21/19 8:22 AM, Parav Pandit wrote:
> > diff --git a/rdma/sys.c b/rdma/sys.c
> > new file mode 100644
> > index 00000000..78e5198f
> > --- /dev/null
> > +++ b/rdma/sys.c
> > @@ -0,0 +1,143 @@
> > +/*
> > + * sys.c	RDMA tool
> > + *
> > + *              This program is free software; you can redistribute it and/or
> > + *              modify it under the terms of the GNU General Public License
> > + *              as published by the Free Software Foundation; either version
> > + *              2 of the License, or (at your option) any later version.
> > + */
> 
> Please use the SPDX line like the other rdma files.
> 
Sure. Yes.

> > +
> > +#include "rdma.h"
> > +
> > +static int sys_help(struct rd *rd)
> > +{
> > +	pr_out("Usage: %s system show [ netns ]\n", rd->filename);
> > +	pr_out("       %s system set netns { shared | exclusive }\n", rd-
> >filename);
> > +	return 0;
> > +}
> > +
> > +static const char *netns_modes_str[] = {
> > +	"exclusive",
> > +	"shared",
> > +};
> > +
> > +static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data)
> > +{
> > +	struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {};
> > +	struct rd *rd = data;
> > +
> > +	mnl_attr_parse(nlh, 0, rd_attr_cb, tb);
> > +
> > +	if (tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE]) {
> > +		const char *mode_str;
> > +		uint8_t netns_mode;
> > +
> > +		netns_mode =
> > +
> 	mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE]);
> > +
> > +		if (netns_mode <= ARRAY_SIZE(netns_modes_str))
> > +			mode_str = netns_modes_str[netns_mode];
> > +		else
> > +			mode_str = "unknown";
> > +
> > +		if (rd->json_output)
> > +			jsonw_string_field(rd->jw, "netns", mode_str);
> > +		else
> > +			pr_out("netns %s\n", mode_str);
> > +	}
> > +	return MNL_CB_OK;
> > +}
> > +
> > +static int sys_show_no_args(struct rd *rd) {
> > +	uint32_t seq;
> > +	int ret;
> > +
> > +	rd_prepare_msg(rd, RDMA_NLDEV_CMD_SYS_GET,
> > +		       &seq, (NLM_F_REQUEST | NLM_F_ACK));
> > +	ret = rd_send_msg(rd);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = rd_recv_msg(rd, sys_show_parse_cb, rd, seq);
> > +	return ret;
> 
> since you are fixing the header, why not just
> 	return rd_recv_msg(rd, sys_show_parse_cb, rd, seq);
> 
> like the other functions?

Yep. Changed.
Sending v1.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ