aboutgitcodebugslistschat
path: root/pasta.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-10-14 15:25:37 +1100
committerStefano Brivio <sbrivio@redhat.com>2022-10-15 02:10:36 +0200
commit40abd447c80a01fbbfa5de70ad3c33bdc1380c06 (patch)
tree6be6065984058e49ebd0ca89f801ad5a12950e0d /pasta.c
parenteb3d03a588e8a246a30017add08c79527fa9a6a3 (diff)
downloadpasst-40abd447c80a01fbbfa5de70ad3c33bdc1380c06.tar
passt-40abd447c80a01fbbfa5de70ad3c33bdc1380c06.tar.gz
passt-40abd447c80a01fbbfa5de70ad3c33bdc1380c06.tar.bz2
passt-40abd447c80a01fbbfa5de70ad3c33bdc1380c06.tar.lz
passt-40abd447c80a01fbbfa5de70ad3c33bdc1380c06.tar.xz
passt-40abd447c80a01fbbfa5de70ad3c33bdc1380c06.tar.zst
passt-40abd447c80a01fbbfa5de70ad3c33bdc1380c06.zip
Rename pasta_setup_ns() to pasta_spawn_cmd()
pasta_setup_ns() no longer has much to do with setting up a namespace. Instead it's really about starting the shell or other command we want to run with pasta connectivity. Rename it and its argument structure to be less misleading. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'pasta.c')
-rw-r--r--pasta.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/pasta.c b/pasta.c
index 1824c6e..ae695e2 100644
--- a/pasta.c
+++ b/pasta.c
@@ -148,29 +148,29 @@ void pasta_open_ns(struct ctx *c, const char *netns)
}
/**
- * struct pasta_setup_ns_arg - Argument for pasta_setup_ns()
+ * struct pasta_spawn_cmd_arg - Argument for pasta_spawn_cmd()
* @exe: Executable to run
* @argv: Command and arguments to run
*/
-struct pasta_setup_ns_arg {
+struct pasta_spawn_cmd_arg {
const char *exe;
char *const *argv;
};
/**
- * pasta_setup_ns() - Map credentials, enable access to ping sockets, run shell
- * @arg: See @pasta_setup_ns_arg
+ * pasta_spawn_cmd() - Prepare new netns, start command or shell
+ * @arg: See @pasta_spawn_cmd_arg
*
* Return: this function never returns
*/
-static int pasta_setup_ns(void *arg)
+static int pasta_spawn_cmd(void *arg)
{
- const struct pasta_setup_ns_arg *a;
+ const struct pasta_spawn_cmd_arg *a;
if (write_file("/proc/sys/net/ipv4/ping_group_range", "0 0"))
warn("Cannot set ping_group_range, ICMP requests might fail");
- a = (const struct pasta_setup_ns_arg *)arg;
+ a = (const struct pasta_spawn_cmd_arg *)arg;
execvp(a->exe, a->argv);
perror("execvp");
@@ -188,7 +188,7 @@ static int pasta_setup_ns(void *arg)
void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid,
int argc, char *argv[])
{
- struct pasta_setup_ns_arg arg = {
+ struct pasta_spawn_cmd_arg arg = {
.exe = argv[0],
.argv = argv,
};
@@ -226,7 +226,7 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid,
arg.argv = sh_argv;
}
- pasta_child_pid = clone(pasta_setup_ns,
+ pasta_child_pid = clone(pasta_spawn_cmd,
ns_fn_stack + sizeof(ns_fn_stack) / 2,
CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET |
CLONE_NEWUTS,