diff options
author | 2025-05-20 22:12:39 +0200 | |
---|---|---|
committer | 2025-05-20 22:12:39 +0200 | |
commit | dce8ac6e2fa30f8b07e84859f244f81b3c6b2353 (patch) | |
tree | 75bd5c981f2d8f8a5c68638acba3a69edee72398 | |
parent | ipc: linux: support incremental allowed ips updates (diff) | |
download | wireguard-tools-dce8ac6e2fa30f8b07e84859f244f81b3c6b2353.tar.xz wireguard-tools-dce8ac6e2fa30f8b07e84859f244f81b3c6b2353.zip |
ipc: add stub for allowedips flags on other platforms
On UAPI, just pass along the -. On other platforms, return an error and
add a TODO comment.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/ipc-freebsd.h | 5 | ||||
-rw-r--r-- | src/ipc-openbsd.h | 5 | ||||
-rw-r--r-- | src/ipc-uapi.h | 2 | ||||
-rw-r--r-- | src/ipc-windows.h | 6 |
4 files changed, 17 insertions, 1 deletions
diff --git a/src/ipc-freebsd.h b/src/ipc-freebsd.h index 446f13c..58e5e71 100644 --- a/src/ipc-freebsd.h +++ b/src/ipc-freebsd.h @@ -307,6 +307,11 @@ static int kernel_set_device(struct wgdevice *dev) nvl_aips[j] = nvlist_create(0); if (!nvl_aips[j]) goto err_peer; + if (aip->flags) { + //TODO: implement me + ret = -EOPNOTSUPP; + goto err_peer; + } nvlist_add_number(nvl_aips[j], "cidr", aip->cidr); if (aip->family == AF_INET) nvlist_add_binary(nvl_aips[j], "ipv4", &aip->ip4, sizeof(aip->ip4)); diff --git a/src/ipc-openbsd.h b/src/ipc-openbsd.h index 03fbdb5..6bb231e 100644 --- a/src/ipc-openbsd.h +++ b/src/ipc-openbsd.h @@ -252,6 +252,11 @@ static int kernel_set_device(struct wgdevice *dev) aip_count = 0; wg_aip = &wg_peer->p_aips[0]; for_each_wgallowedip(peer, aip) { + if (aip->flags) { + //TODO: implement me + errno = EOPNOTSUPP; + goto out; + } wg_aip->a_af = aip->family; wg_aip->a_cidr = aip->cidr; diff --git a/src/ipc-uapi.h b/src/ipc-uapi.h index f582916..1d8a271 100644 --- a/src/ipc-uapi.h +++ b/src/ipc-uapi.h @@ -89,7 +89,7 @@ static int userspace_set_device(struct wgdevice *dev) continue; } else continue; - fprintf(f, "allowed_ip=%s/%d\n", ip, allowedip->cidr); + fprintf(f, "allowed_ip=%s%s/%d\n", (allowedip->flags & WGALLOWEDIP_REMOVE_ME) ? "-" : "", ip, allowedip->cidr); } } fprintf(f, "\n"); diff --git a/src/ipc-windows.h b/src/ipc-windows.h index d237fc9..a71911e 100644 --- a/src/ipc-windows.h +++ b/src/ipc-windows.h @@ -418,6 +418,12 @@ static int kernel_set_device(struct wgdevice *dev) aip_count = 0; wg_aip = (void *)wg_peer + sizeof(WG_IOCTL_PEER); for_each_wgallowedip(peer, aip) { + if (aip->flags) { + //TODO: implement me + errno = EOPNOTSUPP; + goto out; + } + wg_aip->AddressFamily = aip->family; wg_aip->Cidr = aip->cidr; |