From 9a175cc2cea75b98fc3c20381f58dcabf24ef529 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 29 Sep 2021 16:11:06 +0200 Subject: 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 [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 --- passt.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'passt.h') diff --git a/passt.h b/passt.h index 895dd91..aef483a 100644 --- a/passt.h +++ b/passt.h @@ -85,13 +85,15 @@ enum passt_modes { /** * struct ctx - Execution context * @mode: Operation mode, qemu/UNIX domain socket or namespace/tap - * @pasta_pid: Target PID of namespace for pasta mode * @debug: Enable debug mode * @quiet: Don't print informational messages * @foreground: Run in foreground, don't log to stderr by default * @stderr: Force logging to stderr * @sock_path: Path for UNIX domain socket * @pcap: Path for packet capture file + * @pasta_netns_fd: File descriptor for network namespace in pasta mode + * @pasta_userns_fd: File descriptor for user namespace in pasta mode + * @netns_only: In pasta mode, don't join or create a user namespace * @epollfd: File descriptor for epoll instance * @fd_tap_listen: File descriptor for listening AF_UNIX socket, if any * @fd_tap: File descriptor for AF_UNIX socket or tuntap device @@ -131,7 +133,6 @@ enum passt_modes { */ struct ctx { enum passt_modes mode; - int pasta_pid; int debug; int quiet; int foreground; @@ -139,6 +140,10 @@ struct ctx { char sock_path[UNIX_PATH_MAX]; char pcap[PATH_MAX]; + int pasta_netns_fd; + int pasta_userns_fd; + int netns_only; + int epollfd; int fd_tap_listen; int fd_tap; -- cgit v1.2.3