From patchwork Thu Oct 30 18:29:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4548 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:2f13:b0:72f:f16c:e055 with SMTP id sa19csp1117333mab; Thu, 30 Oct 2025 11:29:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtnAHRGSq6r9vMJCVK3xUhhoQt79HyxYWuxW65Oum5DvL72K9BxYX9icayt4CysGol5qkrPABZB2o=@openvpn.net X-Google-Smtp-Source: AGHT+IGSu0T6cJeTEkzsWIqj3fE60tgdTKxyw/Wlg8yrMSPZWOsPTaGK658qPdLPtTy2EFQegV/F X-Received: by 2002:a05:6e02:168d:b0:431:da5b:9ef3 with SMTP id e9e14a558f8ab-4330d1cf1a5mr12819195ab.27.1761848980255; Thu, 30 Oct 2025 11:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1761848980; cv=none; d=google.com; s=arc-20240605; b=aztemI902rUb5Z7yE2m8T+FNCI6qge/I1TOcNPDI6/IstuI3y+niIz3oxuS/UFxvAl RZd524sFIncf6EFs7LKCruCrf2ETEUKTxFbCaVGy40Bu08hmQ2/DEzi8t12uZP1U0ngR nRPxc3PGcFlDLh63guKKfk2GhHc3ZYQUvhvX8JGQxCFJ/1d96yuw76cVgo+qYIkPYCQm TXHQ/GxqyDT9N+FxlVHhVHOxVfNVfkKubKvxGwScs9Dh/b6/kLPsVOX72f8qELnAVK37 wnk2XOpy+dVbkCYegj3CVKAlZFQS/LgcG3mhY11aBALA6U3eFwXhICbsVEIi/Lyy2zuz KJ7A== 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=qT8h6ZaONy5VLSBOAFZsma0x9WBMicY4mECvUPh9LIM=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=OmP1Dr4wotu7qr24z0O8/smAmbpdT3ewe6TFTCPwuVgQ3jCaflEvaZWFuwDwVPmVS7 3JXnp+JKg1Tm8SA2EPtBonDPQ62w9CqRVXLhnvbdrRAvTkCqNZpNXUOVaVQYcdICisSP PG4a/UAO3Jci6l4bxOCkVosLfqMglS219beXPIhScOlr8z5p9XPysJB3S5A8hm7QP1bb IAK9YQtti+pHnitsqp6xbraKid555e9QfOBZiLJN765TjZfCwaS4YPwEw6Y/5nTMz+O1 bLrKY3uiI8mq8wroxhEptIqBfKBANOG2kFaQb/E3qwG2A8vE6EOqFgo5Jq1ATy+9+9SY LOcw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=jVtKZf8e; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ivWBPfyM; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=l6Go5ZLs; 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 e9e14a558f8ab-431f7e64d8dsi161454985ab.200.2025.10.30.11.29.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Oct 2025 11:29:40 -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=jVtKZf8e; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ivWBPfyM; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=l6Go5ZLs; 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=qT8h6ZaONy5VLSBOAFZsma0x9WBMicY4mECvUPh9LIM=; b=jVtKZf8e4EySSXTUWunaNrzI7t +Du/0xZSU3qf+6+Q+x0KchcE2fiywEqDkuA12FccqHyyEpc1H3Vts31mb7J2ETqe30w4Ptzevfc+N fSjC452dyyIItFMrZKu1TqUV5GsjNWmMh9n0SGryn7RFEyf5CrfUhn7OQZwIKQunC5EY=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vEXOy-0006of-6t; Thu, 30 Oct 2025 18:29:37 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vEXOx-0006oW-2N for openvpn-devel@lists.sourceforge.net; Thu, 30 Oct 2025 18:29:35 +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=gorLnzqcE8E2TQMUuX0T+GVtqA0txFYrQ7cMPTDPc1o=; b=ivWBPfyMcok5opbbBQN6mqiOfg zR/fJtGxiyD7nZ44g+tCYEeNDsvwYX0mRVE5E13+OPvJiRT6liqudXFqi1x3JapSUUaegG3VaFbMa f/ahDeohALrcaBABtdjexIDqRaDfJ+JFBT9LibxWr6dSFx7HghF6XNsv/GciSwgZ5oew=; 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=gorLnzqcE8E2TQMUuX0T+GVtqA0txFYrQ7cMPTDPc1o=; b=l6Go5ZLslAq4haap3rKX68FM9x d/PN/0qsX+8MXlTL9O/ISW1ghplrdccSvs1HPToSGbCkK/KiyVrV11vAb3i1mZebsECBidLHKjhXl TLKCK1S1pstOiLD1FrMniNJtBcLiqrqLz+7gc4/rYkP1nXL6Tmnr7ltnXkqRxcL/Beww=; Received: from [193.149.48.134] (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 1vEXOw-0005qa-SF for openvpn-devel@lists.sourceforge.net; Thu, 30 Oct 2025 18:29:35 +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 59UITNq2026472 for ; Thu, 30 Oct 2025 19:29:23 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 59UITNo0026471 for openvpn-devel@lists.sourceforge.net; Thu, 30 Oct 2025 19:29:23 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 30 Oct 2025 19:29:12 +0100 Message-ID: <20251030182922.26448-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-1.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: Frank Lichtenheld Change-Id: I750a0b8107baa77fb14558d0c8e4ef8020d62efd Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/open [...] 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: 1vEXOw-0005qa-SF Subject: [Openvpn-devel] [PATCH v3] manage: Change kill_by_addr to use better types for port/proto 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?1847432556138378038?= X-GMAIL-MSGID: =?utf-8?q?1847432556138378038?= From: Frank Lichtenheld Change-Id: I750a0b8107baa77fb14558d0c8e4ef8020d62efd Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1310 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1310 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 685b137..e46b5f2 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -608,14 +608,14 @@ if (status) { const int port = atoi(p3); - const int proto = (streq(p1, "tcp")) ? PROTO_TCP_SERVER - : (streq(p1, "udp")) ? PROTO_UDP - : PROTO_NONE; + const uint8_t proto = (streq(p1, "tcp")) ? PROTO_TCP_SERVER + : (streq(p1, "udp")) ? PROTO_UDP + : PROTO_NONE; - if ((port > 0 && port < 65536) && (proto != PROTO_NONE)) + if ((port > 0 && port < UINT16_MAX) && (proto != PROTO_NONE)) { n_killed = (*man->persist.callback.kill_by_addr)(man->persist.callback.arg, - addr, port, proto); + addr, (uint16_t)port, proto); if (n_killed > 0) { msg(M_CLIENT, "SUCCESS: %d client(s) at address %s:%s:%d killed", n_killed, diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index fe460bf..dedcc15 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -178,7 +178,7 @@ void (*status)(void *arg, const int version, struct status_output *so); void (*show_net)(void *arg, const msglvl_t msglevel); int (*kill_by_cn)(void *arg, const char *common_name); - int (*kill_by_addr)(void *arg, const in_addr_t addr, const int port, const int proto); + int (*kill_by_addr)(void *arg, const in_addr_t addr, const uint16_t port, const uint8_t proto); void (*delete_event)(void *arg, event_t event); int (*n_clients)(void *arg); bool (*send_cc_message)(void *arg, const char *message, const char *parameter); diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 285671d..00637b1 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3951,7 +3951,7 @@ } static int -management_callback_kill_by_addr(void *arg, const in_addr_t addr, const int port, const int proto) +management_callback_kill_by_addr(void *arg, const in_addr_t addr, const uint16_t port, const uint8_t proto) { struct multi_context *m = (struct multi_context *)arg; struct hash_iterator hi; diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index e986c9c..832d62e 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -89,7 +89,7 @@ const char *ipchange_command; const struct plugin_list *plugins; bool remote_float; - int proto; /* Protocol (PROTO_x defined below) */ + uint8_t proto; /* Protocol (PROTO_x defined below) */ sa_family_t af; /* Address family like AF_INET, AF_INET6 or AF_UNSPEC*/ bool bind_ipv6_only; int mtu_changed; /* Set to true when mtu value is changed */