aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/wg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/wg.c')
-rw-r--r--src/tools/wg.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tools/wg.c b/src/tools/wg.c
index f70b5c5..1fd8157 100644
--- a/src/tools/wg.c
+++ b/src/tools/wg.c
@@ -11,6 +11,7 @@
#include "subcommands.h"
#include "containers.h"
+#include "netns.h"
const char *PROG_NAME;
@@ -47,20 +48,27 @@ static bool parse_options(int argc, char *argv[], struct wgoptions *options)
.val = 'h',
},
{
+ .name = "netns",
+ .has_arg = 1,
+ .val = 'n',
+ },
+ {
0
}
};
- (void)options;
setenv("POSIXLY_CORRECT", "", 0);
- while ((ch = getopt_long(argc, argv, "h", opts, NULL)) != -1) {
+ while ((ch = getopt_long(argc, argv, "hn:", opts, NULL)) != -1) {
switch (ch) {
case '?':
return false;
case 'h':
show_usage(stdout);
exit(0);
+ case 'n':
+ netns_parse(&options->dev_netns, optarg);
+ break;
}
}
@@ -69,7 +77,7 @@ static bool parse_options(int argc, char *argv[], struct wgoptions *options)
int main(int argc, char *argv[])
{
- struct wgoptions options = { };
+ struct wgoptions options = { 0 };
PROG_NAME = argv[0];