From patchwork Wed Nov 4 12:47:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5593 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:30a9:b0:118:2077:975e with SMTP id f41csp314841laa; Wed, 4 Nov 2026 04:48:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AKwUvBxb0Q8Hu/Bz2q/22nfsKsn/3mSsjWJ0e9/IWxUSXd48Vmt6DY3ona4Fi5zKwjdcG2p6Nk4ulIn1qGE=@openvpn.net X-Received: by 2002:a05:7022:120c:b0:15a:4155:3d9a with SMTP id a92af1059eb24-1ac609808c6mr21726228c88.47.1793796497852; Wed, 04 Nov 2026 04:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793796497; cv=none; d=google.com; s=arc-20260327; b=iNbIdaVe5A/ZAPIV2dcjN0MjdqKpXcymz9Pf8fzN5P5fE5dcPw9oMvbflruaBrqilO c7LZgzu4OpZdtzTMxVhqqsgoCBVeSlFq8VpUey7xIJIEItIC3GdUq3VUN8XiEyetNCJm iCmv9dzitay6HDeKIjzpi1fEyP/zhAcOFDsBqjT72gTVqxmrutiDVjYNq91OaRB9EgU2 c4NwE7kZJbt9Lnz//sp+gGBKibloSgrN5fC6nbY+VmqVQ/YmJ0AFd029qV6T1Glo+Nz3 4hhI4JGPpMtn+2JmgiLEkpg4t6oYSGz2+kAf0ABkkynQUcfplzZ3h7UePFWyvHAvlqlQ 164A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; 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=0jeFP3Z1d32mMat8Fx5ghbvfljmaB6JIb4oRzmpINMU=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=AZPs8OEXSTx+kKs+U79OjZH1intNH9As7znHMxfYQtpBsHSGSL4lCte4pO5I5LnXc7 oxcu+7a8hf982Tdcdxy9tHpiN4D+BbwOwyTQIWOOz5d9pyEkw1CR8BHQjsJgLtln2wS2 YnuJd3Nc5/j+debZtKJDvUP27FBZ1hFWMkpkk8lFwmnzQQZkSn7YU7o11nbThVXMFEVn gfk48kbdzqC43b8eBZTdJGJCIfLG/nS3yClIl+s8SKGE/SdfnZ/wKbOkJgbZ2xIWs43L JOzxtdARslGL8JKunTjMJPYmkk/2Y+cy9NbY0duQKA0Icit732YKpBN45LxcV/hInz/l GZbg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=lI9Zx2tt; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=iyHiJ7CX; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=bOe6+WQk; 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 a92af1059eb24-1b245b96a67si6401317c88.6.2026.11.04.04.48.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Nov 2026 04:48:17 -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=pass header.i=@lists.sourceforge.net header.s=beta header.b=lI9Zx2tt; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=iyHiJ7CX; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=bOe6+WQk; 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-Unsubscribe-Post: List-Owner; bh=0jeFP3Z1d32mMat8Fx5ghbvfljmaB6JIb4oRzmpINMU=; b=lI9Zx2ttd4RqiC cTomzoM/WQXG8eexpaotrJFxXl+O6iICQqdgDtNx5VoVxM7YsCVxdCq2mB40rvp8XLnq3wA+8AE/L EyczVtiDrhwOFzF8SVN6Goftl4pqjdHBPMekdiJKBHtUdZDLJSGVig7g36rYZBE3mehugp5xWhP4n q8A=; 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.100.1) (envelope-from ) id 1xOaPY-000000003s6-0Vri; Wed, 04 Nov 2026 12:48:16 +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.100.1) (envelope-from ) id 1xOaPW-000000003rn-1BEC for openvpn-devel@lists.sourceforge.net; Wed, 04 Nov 2026 12:48:14 +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-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cHF0iWO/knf94mUBcLlI4OYX2YltYjrs+mjDAcbfzcQ=; b=iyHiJ7CXspyMkPqKp5PsROC5IU UrmK6dpsVCRr+NJDY0vviYIyT995yVDNxKg/N5DHnJGTZ6ZMjaN85TSg25unySOvc0nBOa5HXKatc Clc7XUpNydGG9Eca9euOffR83y3ayLCgWICu1VUaQthFpyouFIcoQ8saXpExG4roM1Kk=; 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-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cHF0iWO/knf94mUBcLlI4OYX2YltYjrs+mjDAcbfzcQ=; b=bOe6+WQkXOJGAD/JplWbIsKokJ vlBx6s/7IjkOb9NkUPHyP4M+i6d02A3xAaqIQsk+CuWDiM4N14e36g2UJafqbbEhVCo9JSoilxV2t lQW2CIwmg+VpOte3KU2zinq/6ku1dRTMIKOUCyXMg2NzUUkp72me0N9he46w26fe8fsU=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xOaPF-000000000QR-0aO6 for openvpn-devel@lists.sourceforge.net; Wed, 04 Nov 2026 12:48:00 +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 6A4CloTN018314 for ; Wed, 4 Nov 2026 13:47:50 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6A4CloJm018313 for openvpn-devel@lists.sourceforge.net; Wed, 4 Nov 2026 13:47:50 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 4 Nov 2026 13:47:45 +0100 Message-ID: <20261104124750.18302-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 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: Razvan Cojocaru setenv_route() and setenv_route_ipv6() built the route_metric_N and route_ipv6_*_N names by hand. Use the env_set helpers instead. The resulting variable names are unchanged. 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: 1xOaPF-000000000QR-0aO6 Subject: [Openvpn-devel] [PATCH v1] route: use setenv_int_i()/setenv_str_i() for indexed route env variables 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: 1880931956317067124 X-GMAIL-MSGID: 1880931956317067124 From: Razvan Cojocaru setenv_route() and setenv_route_ipv6() built the route_metric_N and route_ipv6_*_N names by hand. Use the env_set helpers instead. The resulting variable names are unchanged. Change-Id: If903dc58238580ec0680f2d4c908b1f949a27469 Signed-off-by: Razvan Cojocaru Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2131 --- 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/+/2131 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 53550c4..6386960 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1317,7 +1317,6 @@ static void setenv_route(struct env_set *es, const struct route_ipv4 *r, int i) { - struct gc_arena gc = gc_new(); if (r->flags & RT_DEFINED) { setenv_route_addr(es, "network", r->network, i); @@ -1326,12 +1325,9 @@ if (r->flags & RT_METRIC_DEFINED) { - struct buffer name = alloc_buf_gc(256, &gc); - buf_printf(&name, "route_metric_%d", i); - setenv_int(es, BSTR(&name), r->metric); + setenv_int_i(es, "route_metric", r->metric, i); } } - gc_free(&gc); } void @@ -1351,22 +1347,15 @@ struct gc_arena gc = gc_new(); if (r6->flags & RT_DEFINED) { - struct buffer name1 = alloc_buf_gc(256, &gc); struct buffer val = alloc_buf_gc(256, &gc); - struct buffer name2 = alloc_buf_gc(256, &gc); - buf_printf(&name1, "route_ipv6_network_%d", i); buf_printf(&val, "%s/%u", print_in6_addr(r6->network, 0, &gc), r6->netbits); - setenv_str(es, BSTR(&name1), BSTR(&val)); - - buf_printf(&name2, "route_ipv6_gateway_%d", i); - setenv_str(es, BSTR(&name2), print_in6_addr(r6->gateway, 0, &gc)); + setenv_str_i(es, "route_ipv6_network", BSTR(&val), i); + setenv_str_i(es, "route_ipv6_gateway", print_in6_addr(r6->gateway, 0, &gc), i); if (r6->flags & RT_METRIC_DEFINED) { - struct buffer name3 = alloc_buf_gc(256, &gc); - buf_printf(&name3, "route_ipv6_metric_%d", i); - setenv_int(es, BSTR(&name3), r6->metric); + setenv_int_i(es, "route_ipv6_metric", r6->metric, i); } } gc_free(&gc);