aboutgitcodebugslistschat
path: root/passt.h
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-09-29 16:11:06 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-07 04:05:15 +0200
commit9a175cc2cea75b98fc3c20381f58dcabf24ef529 (patch)
tree44e40e4dff717ec2e4d12402a47bcf33a6f4f92b /passt.h
parentab3283802206d19ea8509f5471b5c0928ca5835f (diff)
downloadpasst-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 'passt.h')
-rw-r--r--passt.h9
1 files changed, 7 insertions, 2 deletions
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;