From patchwork Mon Sep 8 08:33:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4398 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:b149:b0:671:5a2c:6455 with SMTP id s9csp956301maw; Mon, 8 Sep 2025 01:35:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX862LH3Axlao0zZu2tbQgwYRR82DTCUnBnlCJYeHaYPjx1t4CNIsEv+SH8hV3kUNMRGnt7S9grZNA=@openvpn.net X-Google-Smtp-Source: AGHT+IFGlpvXaAdhqTJ1g9oWLQB99B7WhKEoNRzpBK1q3AINvl9MrXtng9s9d/U1Uxj0koKf83He X-Received: by 2002:a05:6830:2695:b0:745:2585:9c84 with SMTP id 46e09a7af769-74c703b95e4mr2951476a34.9.1757320553182; Mon, 08 Sep 2025 01:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1757320553; cv=none; d=google.com; s=arc-20240605; b=XaFFN9Wq6AlGK3ciKdTLNP5C3Dlw8NqhpZ3MQnAONszDBC3eUbf+ruAOXjWz8WaJ59 wWsUr6s4yTSyQ4Lj65kDCke4Bt2Qgs/ZfKyzfTM5XIrmKLVZCDU2qQo+XiN4EMMbSo9U k8sc0FrmckPTpvf4TzeSGeAgSexA52aPokR5zejSirv7LiHJTlragDLm7+1zZ6mHSoH1 NBgK86A900IEhpp1jniF/SZ6T9jR6p5nLS7d/fp7gHkxJMKXEEbvSGCrIy6xABf88Os+ CcNPBw92yxjc+/LJfc8AhBrb+30Ry/w4cVt5qEMV6iy0dkvKJR4CgK3DAXf9oNA+n/39 oldA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=ECMywRoxpqlJuZH5yZjD7fQaZiYeUcnFD3xTzMqy4x8=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=G19Lq0370f4mODDCZzpJ1UtHwJVysvmAlBndHjPC/iiltozjCUoIEnxtKOpdUVX4E3 A1wltV86U6cXP90HMj4Xw2yBHDhli7N/FXaHMV4t2/vdCLtItbkOpIh6/JTFunNCxRJG HRUKMcTatqP0d/RcoaRyiTiHtl78VbWhCqHuvOF/ZwywR73Uu3ZUIh7LEr9jlRECzPhe mbEaoje/xhzCcvfj/GIOAmZJrR7WSVNt049+k8Iw0cL3EIOWWLblUWn/IjV/fk6pulrO 0RteEn3bKqmtaMUCTodqQdVDRVifpzM7TF31yQwXbtPeakKzdnvIGZ0NkEnxXeWlnaVd b3AA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=k2GBrA62; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=f6wE6oCG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AE+ZQlA8; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-746e9a1d639si2070376a34.146.2025.09.08.01.35.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Sep 2025 01:35:53 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=k2GBrA62; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=f6wE6oCG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AE+ZQlA8; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ECMywRoxpqlJuZH5yZjD7fQaZiYeUcnFD3xTzMqy4x8=; b=k2GBrA627JtrEhxUBe9RwWrXsJ PikwfxOmvGdaGGRGvlcLDX0H8m13Fb1t2CLEWPMjRZ+9bOEKP3bI7LeLcLUEd1SgOWSJAmaLNUsZ0 CA4gI/SiWWfIFYv9U4ZmkB7QtqJHcaD1LjG4zn+A3ZuO4bp/sZ9SVAJa796DdMx9CVG0=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1uvXLp-0008IG-4i; Mon, 08 Sep 2025 08:35:49 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uvXK6-0007cs-Tl for openvpn-devel@lists.sourceforge.net; Mon, 08 Sep 2025 08:34:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=iGpEc2xQqZsenWaKPPKVlFr0E8baam58FM+s4plM2P4=; b=f6wE6oCGpnpQhVvYWaAs0GxcNX /862nnOwK1i3kHvMHohzv0b3H3rIv2dRN2nqxfot/GMW7r9x27KS2H0qR1tZb44uzw8qbTPuG8gBM r7ZjAfofh5kcl0iY8rH/pe671x8gO+wHmKuvT8cqm2KHlpYIieo142s/N/LxJ4U1y4SI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iGpEc2xQqZsenWaKPPKVlFr0E8baam58FM+s4plM2P4=; b=AE+ZQlA8FgiteH5/AkoPqz9pU5 hienUvs9IvSAcLT8LgJMgyJ80KUmlcSIM8f8eK3B0hVN53mr4kqKhd+jP3K0sBOwXSo5+wG/hqSeB En/EYp6RGZL9slIpjPewHQARYW0Lu/VDe1P2w5vcUhi4jwPen6aQS7jzgd62wn3Ie+EY=; Received: from [193.149.48.143] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1uvXK5-000275-RA for openvpn-devel@lists.sourceforge.net; Mon, 08 Sep 2025 08:34:02 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 5888Xtju019824 for ; Mon, 8 Sep 2025 10:33:55 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5888Xt6G019823 for openvpn-devel@lists.sourceforge.net; Mon, 8 Sep 2025 10:33:55 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 8 Sep 2025 10:33:49 +0200 Message-ID: <20250908083354.19811-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Kristof Provost this is a backport of commit b66b80b2ab and 796ad2c559 (squashed, as the second commit undoes quite a bit of #ifdef from the first) Change-Id: I53e6d1b31c4f673cb646716dce774ef3210f36bd Signed-off-by: Kristof Provost Signed-off-by: Gert Doering Acked-by: Ralf Lici (c [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1uvXK5-000275-RA Subject: [Openvpn-devel] [PATCH v1] dco: support float notifications on FreeBSD X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1842684156158277061?= X-GMAIL-MSGID: =?utf-8?q?1842684156158277061?= From: Kristof Provost this is a backport of commit b66b80b2ab and 796ad2c559 (squashed, as the second commit undoes quite a bit of #ifdef from the first) Change-Id: I53e6d1b31c4f673cb646716dce774ef3210f36bd Signed-off-by: Kristof Provost Signed-off-by: Gert Doering Acked-by: Ralf Lici (cherry picked from commit b66b80b2ab73bb422826911b675798e6b789ef03) (cherry picked from commit 796ad2c55951635382e48ea5b71d13bbb83ebfb1) --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to release/2.6. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1170 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Ralf Lici diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index ed7ea92..25532d4 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -72,6 +72,61 @@ return (nvl); } +static bool +nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss) +{ + if (!nvlist_exists_number(nvl, "af")) + { + return (false); + } + if (!nvlist_exists_binary(nvl, "address")) + { + return (false); + } + if (!nvlist_exists_number(nvl, "port")) + { + return (false); + } + + ss->ss_family = nvlist_get_number(nvl, "af"); + + switch (ss->ss_family) + { + case AF_INET: + { + struct sockaddr_in *in = (struct sockaddr_in *)ss; + const void *data; + size_t len; + + in->sin_len = sizeof(*in); + data = nvlist_get_binary(nvl, "address", &len); + assert(len == sizeof(in->sin_addr)); + memcpy(&in->sin_addr, data, sizeof(in->sin_addr)); + in->sin_port = nvlist_get_number(nvl, "port"); + break; + } + + case AF_INET6: + { + struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)ss; + const void *data; + size_t len; + + in6->sin6_len = sizeof(*in6); + data = nvlist_get_binary(nvl, "address", &len); + assert(len == sizeof(in6->sin6_addr)); + memcpy(&in6->sin6_addr, data, sizeof(in6->sin6_addr)); + in6->sin6_port = nvlist_get_number(nvl, "port"); + break; + } + + default: + return (false); + } + + return (true); +} + int dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd, struct sockaddr *localaddr, struct sockaddr *remoteaddr, @@ -571,6 +626,25 @@ dco->dco_message_type = OVPN_CMD_SWAP_KEYS; break; + case OVPN_NOTIF_FLOAT: { + const nvlist_t *address; + + if (!nvlist_exists_nvlist(nvl, "address")) + { + msg(M_WARN, "Float notification without address"); + break; + } + + address = nvlist_get_nvlist(nvl, "address"); + if (!nvlist_to_sockaddr(address, &dco->dco_float_peer_ss)) + { + msg(M_WARN, "Failed to parse float notification"); + break; + } + dco->dco_message_type = OVPN_CMD_FLOAT_PEER; + break; + } + default: msg(M_WARN, "Unknown kernel notification %d", type); break; diff --git a/src/openvpn/dco_freebsd.h b/src/openvpn/dco_freebsd.h index e1a054e..ab5891e 100644 --- a/src/openvpn/dco_freebsd.h +++ b/src/openvpn/dco_freebsd.h @@ -36,6 +36,7 @@ OVPN_CMD_DEL_PEER, OVPN_CMD_PACKET, OVPN_CMD_SWAP_KEYS, + OVPN_CMD_FLOAT_PEER, }; enum ovpn_del_reason_t { @@ -55,6 +56,7 @@ int dco_message_type; int dco_message_peer_id; int dco_del_peer_reason; + struct sockaddr_storage dco_float_peer_ss; uint64_t dco_read_bytes; uint64_t dco_write_bytes; } dco_context_t; diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index eb5f932..310211c 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3313,7 +3313,7 @@ { process_incoming_del_peer(m, mi, dco); } -#if 0 +#if defined(TARGET_FREEBSD) else if (dco->dco_message_type == OVPN_CMD_FLOAT_PEER) { ASSERT(mi->context.c2.link_socket); diff --git a/src/openvpn/ovpn_dco_freebsd.h b/src/openvpn/ovpn_dco_freebsd.h index 53f94df..7eb643b 100644 --- a/src/openvpn/ovpn_dco_freebsd.h +++ b/src/openvpn/ovpn_dco_freebsd.h @@ -37,6 +37,7 @@ enum ovpn_notif_type { OVPN_NOTIF_DEL_PEER, OVPN_NOTIF_ROTATE_KEY, + OVPN_NOTIF_FLOAT, }; enum ovpn_del_reason {