All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH 0/6] netns: add linux-vrf features via network namespaces
Date: Fri, 31 Oct 2008 16:10:00 -0700	[thread overview]
Message-ID: <m1bpx0pdiv.fsf@frodo.ebiederm.org> (raw)
In-Reply-To: <490B6F19.4060206-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org> (Daniel Lezcano's message of "Fri, 31 Oct 2008 21:48:25 +0100")

Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org> writes:

> Eric W. Biederman wrote:
>> Thinking it over a little more I have the following thought.
>>
>> For binding a socket to a namespace let's use the a fd arg.
>> That way we can either supply another existing network socket
>> or the result of an open call.  Simple, and faster if you
>> are creating more than one socket in the other network namespace.
>>
>> I really don't like the idea of binding a socket into a namespace.
>> Especially after looking at the arguments to socket(2).
>> The network namespace may be incomplete and you may create a socket
>> in a network namespace that way that we could not exist normally.
>> That plus it puts lots of races in code that finds the namespace of
>> a socket.
>>
>>
>> So in some form let's implement socketat. int socketat(int ns, int domain, int
>> type, int protocol, int flags);
>
> Is the 'ns' arg a fd from a socket just after the unshare ?

Yes.   Any socket in the target namespace will do.

>> We need the flags field so we can accomodate the O_CLOEXEC flag.
>>
>>
>> That should be very straight forward.  Implementable now, without
>> a magic filesystem.   And then the filesystem would just provide
>> the global naming and process independence.
>
> Assuming the ns arg is a fd from a socket created in a specific network
> namespace, I agree this is quite easy to implement and consistent with the
> refcounting of the netns. Furthermore that follows the logic of the network
> devices, one can be created in another netns using the pid as identifier.

Yes.  Your assumption is right.

Using a fd as the descriptor we need to touch both socket creation and network
device movement, but that should be sufficient.

Eric

  parent reply	other threads:[~2008-10-31 23:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30 13:05 [PATCH 0/6] netns: add linux-vrf features via network namespaces Vivien Chappelier
     [not found] ` <4909B10A.8090403-L+G57L1VLRbR7s880joybQ@public.gmane.org>
2008-10-30 14:38   ` Andreas B Aaen
     [not found]     ` <200810301538.08032.andreas.aaen-546VmZ+UeKYX2WXlbB3fKg@public.gmane.org>
2008-10-30 15:03       ` Serge E. Hallyn
2008-10-30 16:20       ` Vivien Chappelier
     [not found]         ` <4909DEC8.9090102-L+G57L1VLRbR7s880joybQ@public.gmane.org>
2008-10-30 23:07           ` Eric W. Biederman
     [not found]             ` <m14p2tznoz.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-10-31  9:46               ` Andreas B Aaen
     [not found]                 ` <200810311046.17506.andreas.aaen-546VmZ+UeKYX2WXlbB3fKg@public.gmane.org>
2008-10-31 14:17                   ` Daniel Lezcano
     [not found]                     ` <490B1384.7030001-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2008-10-31 18:59                       ` Eric W. Biederman
     [not found]                         ` <m1zlkksi91.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-10-31 19:32                           ` Eric W. Biederman
     [not found]                             ` <m13aicsgr2.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-10-31 20:48                               ` Daniel Lezcano
     [not found]                                 ` <490B6F19.4060206-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2008-10-31 23:10                                   ` Eric W. Biederman [this message]
2008-10-31 18:43                   ` Eric W. Biederman
2009-03-25 18:21   ` Bruce Jones
  -- strict thread matches above, loose matches on Subject: below --
2009-04-15  3:14 Krishna Vamsi-B22174

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1bpx0pdiv.fsf@frodo.ebiederm.org \
    --to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.