wireguard-setup/mount-daemon/wireguard-mount.c

21 lines
424 B
C
Raw Normal View History

2021-02-24 08:13:25 +00:00
#include <sys/mount.h>
#include <unistd.h>
#include <stdio.h>
2021-02-24 10:07:32 +00:00
#include <systemd/sd-daemon.h>
2021-02-24 08:13:25 +00:00
int main() {
char mount_path[32] = {0};
snprintf(mount_path, sizeof(mount_path), "/proc/%d/ns", getpid());
int err = mount(mount_path, "/run/vpn", NULL, MS_BIND, NULL);
if(err) {
perror("Error");
return 1;
}
2021-02-24 10:07:32 +00:00
sd_notify(0, "READY=1");
2021-02-24 08:13:25 +00:00
while(1) {
sleep(10);
}
return 1;
}