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]
Message-ID: <5527D837.9030506@6wind.com>
Date:	Fri, 10 Apr 2015 16:03:35 +0200
From:	Nicolas Dichtel <nicolas.dichtel@...nd.com>
To:	Vadim Kochan <vadim4j@...il.com>
CC:	shemminger@...tta.com, netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next 2/2] netns: allow to dump and monitor nsid

Le 09/04/2015 10:36, Vadim Kochan a écrit :
> On Thu, Apr 09, 2015 at 10:30:14AM +0200, Nicolas Dichtel wrote:
[snip]
>> +	dir = opendir(NETNS_RUN_DIR);
>> +	if (!dir)
>> +		return;
>> +
>> +	while ((entry = readdir(dir)) != NULL) {
>> +		if (strcmp(entry->d_name, ".") == 0)
>> +			continue;
>> +		if (strcmp(entry->d_name, "..") == 0)
>> +			continue;
>> +		nsid = get_netnsid_from_name(entry->d_name);
>> +
>> +		if (nsid >= 0)
>> +			netns_map_add(nsid, entry->d_name);
>> +	}
>
> May be lib/namespace.c -> netns_foreach will be useful here  ?
I'm not fully convinced, because to use netns_foreach I need to have
another intermediate function.

[snip]
>> +	dir = opendir(NETNS_RUN_DIR);
>> +	if (!dir)
>> +		return -ENOENT;
>> +
>> +	while ((entry = readdir(dir)) != NULL) {
>> +		if (strcmp(entry->d_name, ".") == 0)
>> +			continue;
>> +		if (strcmp(entry->d_name, "..") == 0)
>> +			continue;
>> +		id = get_netnsid_from_name(entry->d_name);
>> +
>> +		if (nsid == id) {
>> +			strcpy(name, entry->d_name);
>> +			closedir(dir);
>> +			return 0;
>> +		}
>> +	}
>
> And may be here too ?
Same here. And this implies to also define a new structure to pass 'name' and
'nsid' to this new intermediate function. This will make the code more complex
to read.


Regards,
Nicolas
--
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