git: e95cf8b04b47 - stable/14 - wg: ipc: add allowed-ip flags support for FreeBSD

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Mon, 21 Jul 2025 02:13:59 UTC
The branch stable/14 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=e95cf8b04b47ee9abf544bb754452e6f30b2dc18

commit e95cf8b04b47ee9abf544bb754452e6f30b2dc18
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2025-06-26 02:57:03 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2025-07-21 02:13:15 +0000

    wg: ipc: add allowed-ip flags support for FreeBSD
    
    For $reasons, we can't rely on flags in wireguard-tools for the kernel
    side of WireGuard.  Provide a mapping function that uses flags from the
    kernel that we're building against and fail the operation if we made it
    to the end without turning some wg(8) flag off.
    
    Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
    
    Reviewed by:    ivy (previous version), Jason A. Donenfeld, jhb
    
    (cherry picked from commit f6d9e22982a1d0354c0199e94ebdb4474eaa74b9)
---
 contrib/wireguard-tools/ipc-freebsd.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/contrib/wireguard-tools/ipc-freebsd.h b/contrib/wireguard-tools/ipc-freebsd.h
index 58e5e71ce5cb..69077038a15a 100644
--- a/contrib/wireguard-tools/ipc-freebsd.h
+++ b/contrib/wireguard-tools/ipc-freebsd.h
@@ -307,11 +307,8 @@ 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;
-			}
+			if (aip->flags)
+				nvlist_add_number(nvl_aips[j], "flags", aip->flags);
 			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));