From patchwork Thu Dec 12 07:47:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "ralf_lici (Code Review)" X-Patchwork-Id: 3987 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:750c:b0:5e7:b9eb:58e8 with SMTP id r12csp1399761mai; Wed, 11 Dec 2024 23:47:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWi/oN14/J/b74ho0Gs0fh1epl8OkGEr6oRHzqYj5x8cNoUm8V96Q6I8Ca5ZIX5zm//lm6EU0bnyi8=@openvpn.net X-Google-Smtp-Source: AGHT+IF0HbmGgXI4J3BoxxvCItyTlNRsOVrkXcWYqlyfkM0V9I4XvGrqaqWXIcgWlt/m79QE9+CQ X-Received: by 2002:a05:6830:4513:b0:71e:1c5:4f77 with SMTP id 46e09a7af769-71e29c6d41amr1711186a34.20.1733989679726; Wed, 11 Dec 2024 23:47:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733989679; cv=none; d=google.com; s=arc-20240605; b=R/s/DeVuVWP14Suxl4tYkisE3dEohoLUQQHIPzr+wTBsuZLcQA3hofjN7VY1jBk1c6 UjVBia5t21Wjfr4SMyz/6famDsbIfiJ1rCm6zIN9llDR9Pmh5WJHRScQ341j13Zewc2+ awQLl3GhzwkA83hpk72SWMWTtbszZqLH5U6u6QaBFduivVKIjIRTz+1Szvmyq1ayI11a Kk8oz0cMPnsM1Us+RXmGLrrjk63e+q4LraS5pSDJdtsLXG2jmd+siktBFFKUo/3ZZMWC QeXISw00ZJTf10k1PvVGK6t3XmqvbMByGc6f1roZwPXkvydE6IAvNDsXwnnVhIdmNc+n 8H/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=IXjtQHSLb9V+fYJ3P96gwRF4YOawXf8Pscdvzb/AQw4=; fh=U7wEyxtwz2o5+UdevFSA47vNeG9knhWH0KV//QhD5a0=; b=V5kSAdk/QXbKpZMVPBBNgtWNLA9z0p2CNZ700tSjDMd0InJzlBp3p3+SMg2RJo+avk Q/OxlI8M+QJFYkY53MIQU3/jganym8eNqyAc3cosojf8F9Fh1RxteGFsF1/j4MzmLdqW WDJKolHagt5hT960FWIQVeeocYzLASgyfjina16dX89OnbZYV+eoE/l1spKv6sKJd0+r rz3aQwOKznGD1lT/SDk1KWvZ7I7sq3wDp/Hb1o/QJeDPb3iv+cmIZaBeE48KGXQzTUqq tI5XmcDEjgxv5hsbiKnfejNgVb2sOF+oarMvktvJFY1ZDHcRfKAGhXX5cNVYIoxmBm3F 3JBg==; 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="OUFT/Bwq"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=TaRETuxB; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=PZUV8xhM; 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=openvpn.net; dara=fail header.i=@openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-71e00580228si3600114a34.296.2024.12.11.23.47.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2024 23:47:59 -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="OUFT/Bwq"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=TaRETuxB; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=PZUV8xhM; 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=openvpn.net; dara=fail header.i=@openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tLdvR-0000eq-9M; Thu, 12 Dec 2024 07:47:56 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tLdvP-0000ei-Si for openvpn-devel@lists.sourceforge.net; Thu, 12 Dec 2024 07:47:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xxlyJcd1oUf1x1guyTPvzAAj/smZ0fT5sTA0nFvwmUw=; b=OUFT/BwqOrtlZ5xfoxULroX92s gVtX0uG9i2mNzKcn6B2ILBSHMS6ltxIsTVciDdXsTs4flYiCXjn+BGYzsnjECJQsuHntF4sKLkpGm GpJL710XNtI2Vwzu74Ki2sVdaxqLyddDfptlh4/1XuC4p6s620lIz8FCx25ofMIEO5Dc=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=xxlyJcd1oUf1x1guyTPvzAAj/smZ0fT5sTA0nFvwmUw=; b=T aRETuxBNcaEus+lToAoSdKNDvLnBzIMInh5sECE6CfPypmBQ96kiE+N3GbHNyfu6KOPd7BzcG92f3 T+b0lVeQWbURyK4UB4OUrzhzD1KuHxchKvm/nixTs/J4MXw4faj3L4ecfvOLDS/FRlP5yW4NH2riL SCJwWWyKXA2awoFw=; Received: from mail-wm1-f54.google.com ([209.85.128.54]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1tLdvO-00064G-9v for openvpn-devel@lists.sourceforge.net; Thu, 12 Dec 2024 07:47:55 +0000 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-434a2033562so1617705e9.1 for ; Wed, 11 Dec 2024 23:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1733989663; x=1734594463; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=xxlyJcd1oUf1x1guyTPvzAAj/smZ0fT5sTA0nFvwmUw=; b=PZUV8xhMZqhUKh5mceqKKj4DlAluO0uKUveDZbaNlRULLaNe4Qr7X6Fr0oiEppONhm qtCc0HTduHeASyhyIIaJMZaC+hkshM6KPB4gzb14e8TNemKS46FssXlsGjv+ndiZmWwV YZtBkvYzsjQ6RqCAJxUo8mxCRw37T16mmTWB9a81tmwhb6diAk4umVxMKCoHa63zYYSJ wizIfTE2G57ZRZdS58lBc+Coi+ylaFwBlaNs1SZtoEMJkZkMjC56Mmr8qtIWLfSPFI3c 33PzsiMmbuQnMaUhexi6JGBrqD5ePbDN0k/E582JCBVDX4QT0WGIzNwB1lvoDFl7tC2T OxyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733989663; x=1734594463; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xxlyJcd1oUf1x1guyTPvzAAj/smZ0fT5sTA0nFvwmUw=; b=C6LSCTUneqaP0qH92vGbDsD6P/G1y+xAzQZcP4g+9Lin5OT0asIAVaJh31yUpPEJ25 LEBTISuoUmGlrmqdZazfYc5X+lL2XtCbUBlN8Xbj1EMd4LMeVdMOKi1NrIJzPqizRB8M YRTvkba8Od1D126xmcO3aK74YPCmwXAuuW8nw7DWsmOzUFIR6OleA0+pPIm/h2UycA80 62CI70A5on8vLdTgUJ+NooykkMCwIkRfWJ9ZalbuAFb7R6F6pDme1HwAa54y9gMTxfrn uhfbhTkO35qvMLC24SV+O/IQaInTEcD2sq45ocLca4uIQ770e2OhxBFXmF+y4FJe6xbM F8sA== X-Gm-Message-State: AOJu0YzYbt4oZF/GR5ZKWzzD4UVfBewqv2oq947vvO6OOmuAvM1vcOOR 93ZVgsajG+YZAQVOktmsgQkc0xqhQkG64e9jdtbRX4bHIFvtBqnXJshNN0CsIngJYQddaPg7fL9 M X-Gm-Gg: ASbGncv82O4jfGXcO6k23+ShSzkfY4LhMnW/81b4TPsv9qpXM5cLb35Go8J8CdnWQ8Z x5DjMU/KdNV1TIbjPwR/8rCih7A7EUocQzYZ4S9o38gdna/IdZO5jYs6JTG59nk1pWm7ySKg3t/ WE/Mf/5Xfn5Z/HEZlZFghLj9LNqBL5XmclVWo588zUxukOpG+loMqxFmuu02+mbuk4U7Ynk0hq6 KJ23o3Qgezc1GavgXZX3d8moFH1/V4hd6zaLfq9Ugbuc+X9QVBALmcAQ02Q5krw4cbBVayKww0P U97nkvALn2HLEPa2q3bPlmoNeIf0yZIVHQy57TUC2+hTST8R X-Received: by 2002:a05:600c:3b88:b0:434:a5bc:70fc with SMTP id 5b1f17b1804b1-4362282a958mr18099685e9.8.1733989662717; Wed, 11 Dec 2024 23:47:42 -0800 (PST) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436256b42a3sm8234265e9.28.2024.12.11.23.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:47:42 -0800 (PST) From: "d12fk (Code Review)" X-Google-Original-From: "d12fk (Code Review)" X-Gerrit-PatchSet: 1 Date: Thu, 12 Dec 2024 07:47:41 +0000 To: plaisthos , flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I12b8bb26c0cb70e50b2d42b1c69018894e9f080c X-Gerrit-Change-Number: 835 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: bdc96b02192bd8104a4b33c658861dad1cd0412d References: Message-ID: <3475f095bce1e8bb3549a7f35f6c4a45712b9ce6-HTML@gerrit.openvpn.net> MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.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: Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.54 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. [209.85.128.54 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [209.85.128.54 listed in sa-accredit.habeas.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.54 listed in wl.mailspike.net] 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1tLdvO-00064G-9v Subject: [Openvpn-devel] [S] Change in openvpn[master]: 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: , Reply-To: heiko@openvpn.net, arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1818219962722376965?= X-GMAIL-MSGID: =?utf-8?q?1818219962722376965?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/835?usp=email to review the following change. Change subject: dns: clone options via pointer instead of copy ...................................................................... dns: clone options via pointer instead of copy Change-Id: I12b8bb26c0cb70e50b2d42b1c69018894e9f080c Signed-off-by: Heiko Hund --- M src/openvpn/dns.c M src/openvpn/dns.h M src/openvpn/options.c 3 files changed, 10 insertions(+), 7 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/35/835/1 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)