diff options
author | Dongsu Park <dongsu@kinvolk.io> | 2017-11-24 18:22:17 +0100 |
---|---|---|
committer | Iago López Galeiras <iago@kinvolk.io> | 2017-12-13 10:21:06 +0000 |
commit | d7bea6b6299677fe0b5ddc73ff313f93c3d453c7 (patch) | |
tree | 2756c012eaa6a89d5e13669b2f754f49d3a924c5 /src/basic/stat-util.h | |
parent | cb9eeb062c323391fcd98da0c30e844fa5162e90 (diff) | |
download | systemd-d7bea6b6299677fe0b5ddc73ff313f93c3d453c7.tar.gz |
nspawn: introduce an option for specifying network namespace path
Add a new option `--network-namespace-path` to systemd-nspawn to allow
users to specify an arbitrary network namespace, e.g. `/run/netns/foo`.
Then systemd-nspawn will open the netns file, pass the fd to
outer_child, and enter the namespace represented by the fd before
running inner_child.
```
$ sudo ip netns add foo
$ mount | grep /run/netns/foo
nsfs on /run/netns/foo type nsfs (rw)
...
$ sudo systemd-nspawn -D /srv/fc27 --network-namespace-path=/run/netns/foo \
/bin/readlink -f /proc/self/ns/net
/proc/1/ns/net:[4026532009]
```
Note that the option `--network-namespace-path=` cannot be used together
with other network-related options such as `--private-network` so that
the options do not conflict with each other.
Fixes https://github.com/systemd/systemd/issues/7361
Diffstat (limited to 'src/basic/stat-util.h')
-rw-r--r-- | src/basic/stat-util.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h index 8b8d128121..d8d3c20496 100644 --- a/src/basic/stat-util.h +++ b/src/basic/stat-util.h @@ -62,6 +62,7 @@ int path_is_fs_type(const char *path, statfs_f_type_t magic_value); bool is_temporary_fs(const struct statfs *s) _pure_; int fd_is_temporary_fs(int fd); +int fd_is_network_ns(int fd); int path_is_temporary_fs(const char *path); /* Because statfs.t_type can be int on some architectures, we have to cast |