[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 6 Jun 2018 09:11:27 +0200
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2 v2 1/2] ip: display netns name instead of nsid
Le 05/06/2018 à 18:52, Stephen Hemminger a écrit :
> On Tue, 5 Jun 2018 15:08:30 +0200
> Nicolas Dichtel <nicolas.dichtel@...nd.com> wrote:
>
>>
>> +char *get_name_from_nsid(int nsid)
>> +{
>> + struct nsid_cache *c;
>> +
>> + netns_nsid_socket_init();
>> + netns_map_init();
>> +
>> + c = netns_map_get_by_nsid(nsid);
>> + if (c)
>> + return c->name;
>> +
>> + return NULL;
>> +}
>> +
>
> This is better, but now there is a different problem.
> When doing multiple interfaces, won't the initialization code be called twice?
>
No, the init function is propected:
void netns_nsid_socket_init(void)
{
if (rtnsh.fd > -1 || !ipnetns_have_nsid())
return;
...
void netns_map_init(void)
{
...
if (initialized || !ipnetns_have_nsid())
return;
...
Powered by blists - more mailing lists