From patchwork Mon Dec 5 16:41:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kristof Provost X-Patchwork-Id: 2884 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:622a:418d:b0:3a5:7962:c21f with SMTP id cd13csp1960068qtb; Mon, 5 Dec 2022 08:47:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf7UxGynTfl+GUamt4Zrrtj0EbjGKWg3q1eH79YKv44+UYS9ybFvi8tQ5RvFsGDLeM5Q/oKv X-Received: by 2002:a17:90a:5b09:b0:218:a0cd:5a99 with SMTP id o9-20020a17090a5b0900b00218a0cd5a99mr79466830pji.76.1670258868936; Mon, 05 Dec 2022 08:47:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670258868; cv=none; d=google.com; s=arc-20160816; b=o328sQ+rtPRX9s8kWGXra1zSUtrTUXYSkYxiLJvR9XcBqtMgrHlJOnruBR6GWdLPP4 ex7vyN4ZjWuvShgMrTEdY48/kbRAuKrErNa7swuAqCqTBT0qXeTKskn47Rwkkz4Dx7Zl W7VFbjqISZr21dekB/SB2OR+kxqEOUSMQKsycLHNlbgE59huCBhX/DSz7joxMOcZIl5u 1i3+zAP56IWmT5CUPhuy6grEPIhWUs+bcraQeIyfRmXuK8+FhgLSxrECC7Vk6R73S1cT OLaG00kLdUH6LvI7GCnZtbyyc2s9IafbJ4Nn7uTyBlzO8By5sM12wXoes+tnViM1Sonk fp9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:reply-to:from:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:dkim-signature:dkim-signature:dkim-signature; bh=ef4yM/JyKATOq6EuelALpZJhZnOrm/RTYqqaS0kaHHk=; b=CKc0v4C6vOtG/aNTe4rMMKHZXVVQ/KGGuvMgX43ZO+Zh+H8cJvjjIkzZmfPwyJLkeN z68awJ/kkU5lq2LvVRW7VQPpJ9UE7/RuxvVTZ98OvFhbT0HL4OeH7D9o6kFRXKBOq+DI bEEjpv3U7tHWdfoddLEktx9taazjUcR8kYkd7dLfDOrOPrbA9pC76G8+bfE2Hffe0W+I CrlMjpqZ273y0paQzP4ZDIVJFdbTB0vOdLwoF4tQ7HcCwS+Gx2OkPpmrAvZlIjADruNh zsOER0UKhmEjfEME6pyQi+KDTRD1H4N9TcV7RjDhvKFo8PpDFcJQpUZq/f6K4il5Q983 EIGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=bNMCXg4c; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=EWaZzSNe; dkim=neutral (body hash did not verify) header.i=@netgate.com header.s=google header.b=VK2PeapD; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id qa8-20020a17090b4fc800b00219ed0bf12esi743511pjb.190.2022.12.05.08.47.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec 2022 08:47:48 -0800 (PST) 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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=bNMCXg4c; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=EWaZzSNe; dkim=neutral (body hash did not verify) header.i=@netgate.com header.s=google header.b=VK2PeapD; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1p2Ece-00047u-EN; Mon, 05 Dec 2022 16:47:16 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p2Ecd-00047o-Te for openvpn-devel@lists.sourceforge.net; Mon, 05 Dec 2022 16:47:15 +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=IMezvPwB+UDH8zLw4w0ahfyCbcDyq2nUvn5R9LJdW3Q=; b=bNMCXg4cyGyyLsu9CKBbYNy/e2 T5RfZogGydEuWWtRfjg4g45IlvUYluefpAFLeTL4FIQH2NulPGYY0l+oMKlythO7FRRWoPGikMalr QrzOpA7bCK3xL5VGQPxpV7NWVO5Mh4BFNhzHjUFyXpNJ7TwUOy3dSf+eDf25h1lNvigM=; 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=IMezvPwB+UDH8zLw4w0ahfyCbcDyq2nUvn5R9LJdW3Q=; b=EWaZzSNeyA9Y3xvIAleR1PCw9p Y8xYOYkh4ZwME0FwghmGj+RfbYUNqDl/+sMxfhF2ThmrvLxLFVb7HZcgLANBn5i6gYjlwVmDZCre5 l+ZyZn4Fz+Sm2d3Psqw4/diXN7l604yF79rVZURZPi1XMmBa9kQ4B4gtyhhmWL+cyNkk=; Received: from mail-ej1-f46.google.com ([209.85.218.46]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1p2Eca-006xNd-Dl for openvpn-devel@lists.sourceforge.net; Mon, 05 Dec 2022 16:47:15 +0000 Received: by mail-ej1-f46.google.com with SMTP id td2so29214971ejc.5 for ; Mon, 05 Dec 2022 08:47:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netgate.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IMezvPwB+UDH8zLw4w0ahfyCbcDyq2nUvn5R9LJdW3Q=; b=VK2PeapDvJkzq6iM0MSgZu+emlZKK2TNUjUmqdCXJkilrZKlDff/mhZuMc055W3qHe clsHXFgbkBuECfGpDqBxNzCkSzKsD/DVtVVEoA7oHCm2yDSzIRC4nrEyiNV6YcrmfXhD 95kAPUqXYsCxnGBHbYKgrMktX07LSZXlPbn14= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IMezvPwB+UDH8zLw4w0ahfyCbcDyq2nUvn5R9LJdW3Q=; b=nyTkFd3mWPRyJ+fl2F6Hhk83yr1bguLLicWfFSEWp+70eHcidyvbgGde7fT57kx0B7 B6VmStgdQqPhHV5qSmDJ2TPhU7/4NN1O5f9KBQ35VHMWwkZmuXqz4sS8NNNHmy5/pbXG jZCvRDU/2fKRjhW4wB7apqbKwLUaobMI/t08sQ9EWtUcCKJq8R4nGsJ6uFZDuKhH4xDK 9h2pNwhljJkTV62Tv5smmRk0cuRUe0pkhZSUuOv1mZwZSHR9NbRnMObk5xnmQdxmy2fm 4DoM0ISsBXMWuUnOFd/CmfCM6Gpi9MimWpA5D4TiwnmXgjEMB+kA1AvGh6UFihQFmoXF vVBg== X-Gm-Message-State: ANoB5pk8jBI04VpAqxoV0dczkNEF4YGQQQIoRPBGxT5jLdmn9aVs6O77 1AppMwM2aqBhg8LPsV83MaGB8/l3juAnlo6g X-Received: by 2002:a50:ed90:0:b0:46a:e6e3:b3cf with SMTP id h16-20020a50ed90000000b0046ae6e3b3cfmr37984547edr.333.1670258468753; Mon, 05 Dec 2022 08:41:08 -0800 (PST) Received: from nut.jupiter.sigsegv.be (ptr-8rfalzsse26o3oo9imw.18120a2.ip6.access.telenet.be. [2a02:1811:2402:bf00:f602:70ff:feae:6e98]) by smtp.googlemail.com with ESMTPSA id 1-20020a170906310100b0073ae9ba9ba8sm6389266ejx.3.2022.12.05.08.41.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 08:41:08 -0800 (PST) To: openvpn-devel Date: Mon, 5 Dec 2022 17:41:03 +0100 Message-Id: <20221205164103.9190-5-kprovost@netgate.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221205164103.9190-1-kprovost@netgate.com> References: <20221205164103.9190-1-kprovost@netgate.com> MIME-Version: 1.0 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", 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 Remove support for reading packets through the control interface. FreeBSD no longer does this, so there's no point in keeping the code for it. While here also check that we know what type of notification we're getting. There's currently only one, but we should check anyway. Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.218.46 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.218.46 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Headers-End: 1p2Eca-006xNd-Dl Subject: [Openvpn-devel] [PATCH 4/4] dco: cleanup FreeBSD dco_do_read() 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: , X-Patchwork-Original-From: Kristof Provost via Openvpn-devel From: Kristof Provost Reply-To: Kristof Provost Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1751393363694534649?= X-GMAIL-MSGID: =?utf-8?q?1751393363694534649?= From: Kristof Provost Remove support for reading packets through the control interface. FreeBSD no longer does this, so there's no point in keeping the code for it. While here also check that we know what type of notification we're getting. There's currently only one, but we should check anyway. Signed-off-by: Kristof Provost Acked-by: Gert Doering --- src/openvpn/dco_freebsd.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index 8d7ceb70..b6d869b0 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -489,8 +489,7 @@ dco_do_read(dco_context_t *dco) struct ifdrv drv; uint8_t buf[4096]; nvlist_t *nvl; - const uint8_t *pkt; - size_t pktlen; + enum ovpn_notif_type type; int ret; /* Flush any pending data from the pipe. */ @@ -518,15 +517,9 @@ dco_do_read(dco_context_t *dco) dco->dco_message_peer_id = nvlist_get_number(nvl, "peerid"); - if (nvlist_exists_binary(nvl, "packet")) - { - pkt = nvlist_get_binary(nvl, "packet", &pktlen); - memcpy(BPTR(&dco->dco_packet_in), pkt, pktlen); - dco->dco_packet_in.len = pktlen; - dco->dco_message_type = OVPN_CMD_PACKET; - } - else - { + type = nvlist_get_number(nvl, "notification"); + switch (type) { + case OVPN_NOTIF_DEL_PEER: dco->dco_del_peer_reason = OVPN_DEL_PEER_REASON_EXPIRED; if (nvlist_exists_number(nvl, "del_reason")) @@ -551,6 +544,10 @@ dco_do_read(dco_context_t *dco) } dco->dco_message_type = OVPN_CMD_DEL_PEER; + break; + default: + msg(M_WARN, "Unknown kernel notification %d", type); + break; } nvlist_destroy(nvl);