diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-09-29 16:11:06 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-10-07 04:05:15 +0200 |
commit | 9a175cc2cea75b98fc3c20381f58dcabf24ef529 (patch) | |
tree | 44e40e4dff717ec2e4d12402a47bcf33a6f4f92b /tcp.c | |
parent | ab3283802206d19ea8509f5471b5c0928ca5835f (diff) | |
download | passt-9a175cc2cea75b98fc3c20381f58dcabf24ef529.tar passt-9a175cc2cea75b98fc3c20381f58dcabf24ef529.tar.gz passt-9a175cc2cea75b98fc3c20381f58dcabf24ef529.tar.bz2 passt-9a175cc2cea75b98fc3c20381f58dcabf24ef529.tar.lz passt-9a175cc2cea75b98fc3c20381f58dcabf24ef529.tar.xz passt-9a175cc2cea75b98fc3c20381f58dcabf24ef529.tar.zst passt-9a175cc2cea75b98fc3c20381f58dcabf24ef529.zip |
pasta: Allow specifying paths and names of namespaces
Based on a patch from Giuseppe Scrivano, this adds the ability to:
- specify paths and names of target namespaces to join, instead of
a PID, also for user namespaces, with --userns
- request to join or create a network namespace only, without
entering or creating a user namespace, with --netns-only
- specify the base directory for netns mountpoints, with --nsrun-dir
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
[sbrivio: reworked logic to actually join the given namespaces when
they're not created, implemented --netns-only and --nsrun-dir,
updated pasta demo script and man page]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r-- | tcp.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -2828,7 +2828,7 @@ static int tcp_splice_connect_ns(void *arg) struct tcp_splice_connect_ns_arg *a; a = (struct tcp_splice_connect_ns_arg *)arg; - ns_enter(a->c->pasta_pid); + ns_enter(a->c); a->ret = tcp_splice_connect(a->c, a->conn, -1, a->v6, a->port); return 0; } @@ -3431,7 +3431,7 @@ static int tcp_sock_init_ns(void *arg) struct ctx *c = (struct ctx *)arg; in_port_t port; - ns_enter(c->pasta_pid); + ns_enter(c); for (port = 0; port < USHRT_MAX; port++) { if (!bitmap_isset(c->tcp.port_to_init, port)) @@ -3491,7 +3491,7 @@ static int tcp_sock_refill(void *arg) int i, *p4, *p6; if (a->ns) { - if (ns_enter(a->c->pasta_pid)) + if (ns_enter(a->c)) return 0; p4 = ns_sock_pool4; p6 = ns_sock_pool6; @@ -3676,7 +3676,7 @@ static int tcp_port_detect(void *arg) struct tcp_port_detect_arg *a = (struct tcp_port_detect_arg *)arg; if (a->detect_in_ns) { - ns_enter(a->c->pasta_pid); + ns_enter(a->c); get_bound_ports(a->c, 1, IPPROTO_TCP); } else { @@ -3708,7 +3708,7 @@ static int tcp_port_rebind(void *arg) in_port_t port; if (a->bind_in_ns) { - ns_enter(a->c->pasta_pid); + ns_enter(a->c); for (port = 0; port < USHRT_MAX; port++) { if (!bitmap_isset(a->c->tcp.port_to_init, port)) { |