diff options
author | Matt Dunwoodie <ncon@mail.noconroy.net> | 2019-07-21 22:49:43 +1000 |
---|---|---|
committer | Matt Dunwoodie <ncon@mail.noconroy.net> | 2019-07-21 22:49:43 +1000 |
commit | 703bc7fdc2095be2a8825e5ad3b602cf367a9c66 (patch) | |
tree | cbe26a8e8a2e334d7358679fd0029e304a61d763 /src/tools/ipc.c | |
parent | Add support for OpenBSD keepalive (diff) | |
download | wireguard-monolithic-historical-703bc7fdc2095be2a8825e5ad3b602cf367a9c66.tar.xz wireguard-monolithic-historical-703bc7fdc2095be2a8825e5ad3b602cf367a9c66.zip |
Actually call SIOCSWGPEERAIP in wg(8)
The set AIP ioctl was actually not called in openbsd_set_device. Also,
specify ipv4 and ipv6 when copying the addresses.
Diffstat (limited to '')
-rw-r--r-- | src/tools/ipc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tools/ipc.c b/src/tools/ipc.c index 099dfd1..64ea9e5 100644 --- a/src/tools/ipc.c +++ b/src/tools/ipc.c @@ -1079,10 +1079,10 @@ static int openbsd_get_device(struct wgdevice **device, const char *interface) aip->family = ip[j].c_af; if (ip[j].c_af == AF_INET) { - memcpy(&aip->ip4, &ip[j].c_ip, sizeof(aip->ip4)); + memcpy(&aip->ip4, &ip[j].c_ip.ipv4, sizeof(aip->ip4)); aip->cidr = ip[j].c_mask; } else if (ip[j].c_af == AF_INET6) { - memcpy(&aip->ip6, &ip[j].c_ip, sizeof(aip->ip6)); + memcpy(&aip->ip6, &ip[j].c_ip.ipv6, sizeof(aip->ip6)); aip->cidr = ip[j].c_mask; } } @@ -1169,6 +1169,9 @@ static int openbsd_set_device(struct wgdevice *dev) } else { return -1; } + + if (ioctl(s, SIOCSWGPEERAIP, (caddr_t)&wsp) == -1) + return -1; } } return 0; |