On Fri, 1 Dec 2017 13:14:07 -0800
Ben Pfaff <b...@ovn.org> wrote:

> On Thu, Nov 09, 2017 at 03:31:00PM -0200, Flavio Leitner wrote:
> > The netlink notification's ancillary data contains the network
> > namespace id (netnsid) needed to identify the device correctly.
> > (ifindex and netnsid).
> > 
> > Signed-off-by: Flavio Leitner <f...@redhat.com>
> > ---
> > 
> > ChangeLog:
> > * V2
> >   - report and close unexpected file descriptors.  
> 
> Thanks for working on improving OVS support for network namespaces.
> This work is long overdue (Jiri talked about it over two years ago at
> ovscon) and I am happy to see progress.
> 
> netns.h uses a struct to represent a network namespace.  I am not sure
> yet whether that is necessary.  It seems like a network namespace is a
> lot like a process ID: I think that only 0...INT_MAX is actually used.
> If so, then I believe that we could use just an "int", with -1 and -2 to

There was no consensus regarding to the network namespace ID range,
unfortunately.  The only thing we have is NETNSA_NSID_NOT_ASSIGNED.

It is only positive numbers if you review the kernel sources today,
but the API is exposing signed 32bit, so not sure what can happen
in the future if the kernel decides to expand the range.

> represent the "local" and "invalid" values.  Then, wouldn't many of the
> operations be simply natural C operators?  I admit that I don't

Yes, if we assume the ID range is positive only. 
Looks like iproute would break in that case, so maybe we can follow it.

> understand the special cases for NETNS_INVALID; maybe the code should
> document the intended semantics for NETNS_INVALID in the comments.

That represents a temporary state where the network namespace information
can't be used because it's out-of-sync. When it's in that state, it will
query the kernel before do anything that would require netnsid.

I will add more details.

> I think that the 'ns' parameter to nl_sock_recv() receives the network
> namespace from which the message was sent.  It might be worth saying
> that in the function comment; just saying "the network namespace
> information" leaves the reader to guess.

That's a good idea.

Thanks!
-- 
Flavio
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to