1 // SPDX-License-Identifier: GPL-2.0 OR MIT
3 * Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
10 #include "containers.h"
13 #include "subcommands.h"
15 int set_main(int argc, const char *argv[])
17 struct wgdevice *device = NULL;
21 fprintf(stderr, "Usage: %s %s <interface> [listen-port <port>] [fwmark <mark>] [private-key <file path>] [peer <base64 public key> [remove] [preshared-key <file path>] [endpoint <ip>:<port>] [persistent-keepalive <interval seconds>] [allowed-ips <ip1>/<cidr1>[,<ip2>/<cidr2>]...] ]...\n", PROG_NAME, argv[0]);
25 device = config_read_cmd(argv + 2, argc - 2);
28 strncpy(device->name, argv[1], IFNAMSIZ - 1);
29 device->name[IFNAMSIZ - 1] = '\0';
31 if (ipc_set_device(device) != 0) {
32 perror("Unable to modify interface");
39 free_wgdevice(device);