From patchwork Fri Dec 13 16:46:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3997 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:1f13:b0:5e7:b9eb:58e8 with SMTP id hs19csp538287mab; Fri, 13 Dec 2024 09:03:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWxPa4QUa02NER1jFvjhr2Ij0ZbSaiduUoOH55SJA6Hj6rF/y+1QgQeijqkPM91sCgvLcFVqMPKD/k=@openvpn.net X-Google-Smtp-Source: AGHT+IG2q1aoh/q7/Hvt5xF8AH9KgZNMbfynKYlI6sjzHkmULgiIknwIKjbH/WSYP2EzvSWWRleu X-Received: by 2002:a05:6830:4123:b0:710:ea11:3d35 with SMTP id 46e09a7af769-71e3b88caf6mr2293442a34.15.1734109435865; Fri, 13 Dec 2024 09:03:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734109435; cv=none; d=google.com; s=arc-20240605; b=Y/+6SQ/L299UQ6zpiNPEDAW5+7ROjbjMkNk4f47XyJkB5LErkJ/JOkmMH8Nz7sbwG8 07idv7IutMF5pQDHLm42erGGhgx0wPymNUu+dzoHs3xOHm5ZDV6OwjuuP3KD/iJs2kpL NeRGMGGylHTvIWPihEGc+3GjcFQrFuD9eqLQVrbiSBbA09ExQJ8ovWHbErXifYKqoJcK 5Y+QxfnBfqK/ITtXSQY14NgTJjHoa9oAiSeYu8YaPJB7DXzfYfgEDd9n63czEVQ/r78Q Bdiqoyrwj2g56Bc1OIg+9NFcJW+jDcxYpv/8Adm1MmOGDbZdtDFjL7THtxb7XS/5C4hc J2pQ== 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=jhAbdD3LfWn9Ha3gNcjsqb6ThFud+cnhZ4WEz9KUdKI=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=DHrWl+pagPE9Sd1OQyy0JjL0wbXnhK8ISKW+TxAv+axzF6PNbLNH5eWJf0OSl98CGO euxjrYBKwlIbYFfJUK/LEik1dVFHp3esVQsDnNIvUtM9kJKdlq5k/0h6rVDhrvFTSluf aNwU28l97J0XP1xu3V173Jt05W2f7IscPQpK6Uati6ppvtOkAZgd5vYhxbSwqf2Fa/Vj JDHIFu4NL3D67lhXZJCKZHhbDredVuNiCDH3Ym1KgA1IL+e+olrSYrpcvGGLm/XNGDzv iDLBLwrNO7cwJZn97l4HybWVbO1qdM+4O9ujJGhYu0MkEIo6EO5nbNVQPrKjLPJuiCKm KcTQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=YYm8ktk8; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=M+MYs6+L; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=KuTZAIHR; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-71e2241fef8si3149524a34.233.2024.12.13.09.03.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Dec 2024 09:03:55 -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=YYm8ktk8; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=M+MYs6+L; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=KuTZAIHR; 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 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 1tM94x-00086A-N5; Fri, 13 Dec 2024 17:03:51 +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 1tM94w-00085s-9U for openvpn-devel@lists.sourceforge.net; Fri, 13 Dec 2024 17:03:50 +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:Cc:To:From:Sender:Reply-To: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=JF83upM/Ar3e5UMMCqI8GxYqF1du0kGT8mtyQXbCzjw=; b=YYm8ktk82HuTBmugiwWjDd/w/3 qhEoYbHhawQOnFmEp/6INqWv/K1QaJ9ZyTDQkt4voxCYNzQPFAABCUlQ3EHJmDS97eVtVzCEy1DOs AxX9Sb7EBtifpojKWjf6IbbTsnbPgTQ1Vk+TsRSWCeNOiCSeJImENmfJIn4XKuSM3New=; 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:Cc:To:From:Sender:Reply-To: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=JF83upM/Ar3e5UMMCqI8GxYqF1du0kGT8mtyQXbCzjw=; b=M+MYs6+LPnroU2YgIWNZ9cHV7Q toNhBTP92HnsPf9oV617rSWxrhwLjlJqK8dB4nFQnCyUvkmLb/CW4kaCZxFJBORGIjSRYnApN/w/y CD4AAID6r7DtIjL8OaKfqFwD4kzGgi02MNBu06wRzQ6KjTqVnGeBqJ6GLMvKGM3C0kuY=; Received: from mout-p-202.mailbox.org ([80.241.56.172]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tM94v-0006Bz-Aw for openvpn-devel@lists.sourceforge.net; Fri, 13 Dec 2024 17:03:50 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Y8wGH0rtFz9spc; Fri, 13 Dec 2024 17:46:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1734108391; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JF83upM/Ar3e5UMMCqI8GxYqF1du0kGT8mtyQXbCzjw=; b=KuTZAIHRWHvaVBm8arOAzN+ONyQGJRrTWRFGbFmpsoJit2/x3vM5mZv+zd81PRbkBGwxD/ HRbdInKx4IBk/ehEKOSDtRoosZmJPCxXglo/VIcC37A08OPL68ZvZnu5mb0/N3Ek1okJkP IunyXP7O/C4OKJe3ilxx23miBlTJpqYecHQ23BUJrt5CTRYMSD8S+jSgIz4x+pouuYPWlm +jVqVLiw7MbDrNgU2ivks8Bi/w7+NJngSfQWvhPpiRVqwIO4OsRIe9i6/npuhwZ7ZRnXA0 AgC1zpLAD6dbKumOiBZEXaf0g53YVw7NfJ2ASIbkgh19V1pWWj79542QLkJJ2g== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Fri, 13 Dec 2024 17:46:30 +0100 Message-Id: <20241213164630.266045-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4Y8wGH0rtFz9spc X-Spam-Score: -0.9 (/) 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: Heiko Hund Change-Id: I12b8bb26c0cb70e50b2d42b1c69018894e9f080c Signed-off-by: Heiko Hund Acked-by: Frank Lichtenheld --- Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.172 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [80.241.56.172 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [80.241.56.172 listed in sa-trusted.bondedsender.org] 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1tM94v-0006Bz-Aw Subject: [Openvpn-devel] [PATCH v1] dns: clone options via pointer instead of copy 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?1818345535525617361?= X-GMAIL-MSGID: =?utf-8?q?1818345535525617361?= From: Heiko Hund Change-Id: I12b8bb26c0cb70e50b2d42b1c69018894e9f080c Signed-off-by: Heiko Hund Acked-by: Frank Lichtenheld --- 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/+/835 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c index 15e7322..e22ea00 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -248,13 +248,15 @@ } struct dns_options -clone_dns_options(const struct dns_options o, struct gc_arena *gc) +clone_dns_options(const struct dns_options *o, struct gc_arena *gc) { struct dns_options clone; + memset(&clone, 0, sizeof(clone)); - clone.search_domains = clone_dns_domains(o.search_domains, gc); - clone.servers = clone_dns_servers(o.servers, gc); - clone.servers_prepull = clone_dns_servers(o.servers_prepull, gc); + clone.search_domains = clone_dns_domains(o->search_domains, gc); + clone.servers = clone_dns_servers(o->servers, gc); + clone.servers_prepull = clone_dns_servers(o->servers_prepull, gc); + return clone; } diff --git a/src/openvpn/dns.h b/src/openvpn/dns.h index a4ccb95..838ebe1 100644 --- a/src/openvpn/dns.h +++ b/src/openvpn/dns.h @@ -129,7 +129,8 @@ * @param gc Pointer to the gc_arena to use for the clone * @return The dns_options clone */ -struct dns_options clone_dns_options(const struct dns_options o, struct gc_arena *gc); +struct dns_options clone_dns_options(const struct dns_options *o, + struct gc_arena *gc); /** * Saves and resets the server options, so that pulled ones don't mix in. diff --git a/src/openvpn/options.c b/src/openvpn/options.c index fa22eca..cc723ca 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3311,7 +3311,7 @@ o->pre_connect->route_default_gateway = o->route_default_gateway; o->pre_connect->route_ipv6_default_gateway = o->route_ipv6_default_gateway; - o->pre_connect->dns_options = clone_dns_options(o->dns_options, &o->gc); + o->pre_connect->dns_options = clone_dns_options(&o->dns_options, &o->gc); /* NCP related options that can be overwritten by a push */ o->pre_connect->ciphername = o->ciphername; @@ -3364,7 +3364,7 @@ /* Free DNS options and reset them to pre-pull state */ gc_free(&o->dns_options.gc); struct gc_arena dns_gc = gc_new(); - o->dns_options = clone_dns_options(pp->dns_options, &dns_gc); + o->dns_options = clone_dns_options(&pp->dns_options, &dns_gc); o->dns_options.gc = dns_gc; if (pp->client_nat_defined)