From: Michael Kerrisk <mtk.manpages@googlemail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Pavel Emelyanov <xemul@openvz.org>,
David Miller <davem@davemloft.net>,
"Eric W. Biederman" <ebiederm@xmission.com>,
lkml <linux-kernel@vger.kernel.org>,
linux-man@vger.kernel.org,
Subrata Modak <subrata@linux.vnet.ibm.com>,
Stephen Hemminger <shemminger@linux-foundation.org>,
adobriyan@gmail.com, Patrick McHardy <kaber@trash.net>,
den@openvz.org, Daniel Lezcano <dlezcano@fr.ibm.com>,
linux-net@vger.kernel.org
Subject: CLONE_NEWNET documentation
Date: Thu, 20 Nov 2008 13:20:06 -0500 [thread overview]
Message-ID: <4925AA56.9030409@gmail.com> (raw)
In-Reply-To: <492489D1.5080502@gmail.com>
Based on my reading of some of the kernel source, various
documentation that I've now read, and comments I received
from people to my earlier mail ("Current state of Network
Namespaces (NETNS, CLONE_NEWNET)?"), I've written the patch
below to document the CLONE_NEWNET clone(2) flag.
Fixes and suggestions for improvements welcome.
Cheers,
Michael
CLONE_NEWNET (since Linux 2.6.24)
(The implementation of this flag is not yet com-
plete, but probably will be mostly complete by
about Linux 2.6.28.)
If CLONE_NEWNET is set, then create the process in
a new network namespace. If this flag is not set,
then (as with fork(2)), the process is created in
the same network namespace as the calling process.
This flag is intended for the implementation of
containers.
A network namespace provides an isolated view of
the networking stack (network device interfaces,
IPv4 and IPv6 protocol stacks, IP routing tables,
firewall rules, the /proc/net and /sys/class/net
directory trees, sockets, etc.). A physical net-
work device can live in exactly one network names-
pace. A virtual network device ("veth") pair pro-
vides a pipe-like abstraction that can be used to
create tunnels between network namespaces, and can
be used to create a bridge to a physical network
device in another namespace.
Use of this flag requires: a kernel configured
with the CONFIG_NET_NS option and that the process
be privileged (CAP_SYS_ADMIN).
--- a/man2/clone.2
+++ b/man2/clone.2
@@ -286,10 +285,41 @@ and
configuration options and that the process be privileged
.RB ( CAP_SYS_ADMIN ).
This flag can't be specified in conjunction with
.BR CLONE_SYSVSEM .
.TP
+.BR CLONE_NEWNET " (since Linux 2.6.24)"
+(The implementation of this flag is not yet complete,
+but probably will be mostly complete by about Linux 2.6.28.)
+
+If
+.B CLONE_NEWNET
+is set, then create the process in a new network namespace.
+If this flag is not set, then (as with
+.BR fork (2)),
+the process is created in the same network namespace as
+the calling process.
+This flag is intended for the implementation of containers.
+
+A network namespace provides an isolated view of the networking stack
+(network device interfaces, IPv4 and IPv6 protocol stacks,
+IP routing tables, firewall rules, the
+.I /proc/net
+and
+.I /sys/class/net
+directory trees, sockets, etc.).
+A physical network device can live in exactly one
+network namespace.
+A virtual network device ("veth") pair provides a pipe-like abstraction
+that can be used to create tunnels between network namespaces,
+and can be used to create a bridge to a physical network device
+in another namespace.
+
+Use of this flag requires: a kernel configured with the
+.B CONFIG_NET_NS
+option and that the process be privileged
+.RB ( CAP_SYS_ADMIN ).
+.TP
.BR CLONE_NEWNS " (since Linux 2.4.19)"
Start the child in a new mount namespace.
Every process lives in a mount namespace.
The
@@ -822,10 +852,18 @@ but the kernel was not configured with the
and
.BR CONFIG_IPC_NS
options.
.TP
.B EINVAL
+.BR CLONE_NEWNET
+was specified in
+.IR flags ,
+but the kernel was not configured with the
+.B CONFIG_NET_NS
+option.
+.TP
+.B EINVAL
.BR CLONE_NEWPID
was specified in
.IR flags ,
but the kernel was not configured with the
.B CONFIG_PID_NS
@@ -844,10 +882,11 @@ Cannot allocate sufficient memory to allocate a task structure for the
child, or to copy those parts of the caller's context that need to be
copied.
.TP
.B EPERM
.BR CLONE_NEWIPC ,
+.BR CLONE_NEWNET ,
.BR CLONE_NEWNS ,
.BR CLONE_NEWPID ,
or
.BR CLONE_NEWUTS
was specified by a non-root process (process without \fBCAP_SYS_ADMIN\fP).
prev parent reply other threads:[~2008-11-20 18:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-19 21:49 Current state of Network Namespaces (NETNS, CLONE_NEWNET)? Michael Kerrisk
2008-11-20 1:37 ` Eric W. Biederman
2008-11-20 2:50 ` Alexey Dobriyan
2008-11-20 7:54 ` Daniel Lezcano
2008-11-20 8:04 ` Subrata Modak
2008-11-20 18:20 ` Michael Kerrisk [this message]
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=4925AA56.9030409@gmail.com \
--to=mtk.manpages@googlemail.com \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=den@openvz.org \
--cc=dlezcano@fr.ibm.com \
--cc=ebiederm@xmission.com \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=linux-net@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
--cc=subrata@linux.vnet.ibm.com \
--cc=xemul@openvz.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox