From patchwork Tue Feb 25 09:49:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "d12fk (Code Review)" X-Patchwork-Id: 4158 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:a117:b0:5e7:b9eb:58e8 with SMTP id cp23csp71730mab; Tue, 25 Feb 2025 01:50:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWwt0bdBmpwI4vAfJajT7tqygg6WgmHXdVoCP0Jl5N/x6Sn4LgOs1tmI0qev58Spd7sOG/VPwesStM=@openvpn.net X-Google-Smtp-Source: AGHT+IGQoVRsA68974JPNBC7jdI4LUgxafjjcCdGkuO2Bd/vNPddUUHcWl8COWeMgH59odAjFC1d X-Received: by 2002:a05:6e02:170e:b0:3d0:255e:fdc with SMTP id e9e14a558f8ab-3d2cb514580mr148088375ab.15.1740477009434; Tue, 25 Feb 2025 01:50:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1740477009; cv=none; d=google.com; s=arc-20240605; b=IVE7wGAZRBwWr00PzGCA58xmGXk2CYNSjq4v89BSOD3x2x6OZaEdY/I9dXXsrs5prz 9pgLrL7ffHz7VGKzP53PzcUctvBsNQkycBAhdHExGz0II8igiiQmQnqkFVgi2oW+4/Z0 FDn9DnoejncUhafGQWgTy4oPz1HySasaYijQK43+egvsGHQDE2mB8mhf5i7rSzi/9IZW HfKQyMKslYFtKhWTqxclilN8L7bjnQKgsmOor20ZxedbXHM29o7vpuRWACcvn4KxSyRO 6n/vQwiZJZfOpkvcIgfeyMPTaiawNjF8UKDG/AwsHsVKE+M5/+0SnYUuRanvIVFGmcbJ mIyQ== 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=Cw5N2fz+cwWa5zEJozZuQhfQwbbX3jahV91gXq/gd34=; fh=U7wEyxtwz2o5+UdevFSA47vNeG9knhWH0KV//QhD5a0=; b=j5D6csx/eDwB5skI3fW26DUEBLki0K8pH57HTCw/D5ZKfXjwAW7PSJSl+xyZx+kHQc nckF5FZBjL2QS3nXhMX2YDoiyeMAbbZRDd1WI3EG4lEK07uA0tW3Dzc5eDUzcoJcfoML HYeyLLcGYXyXOJvKEE0e9iTqk05tMwrEmI+W7hHRMDWvMH8rQDpz9Npc9zrlaoV5BJ68 +MsUBVQ+yI/PO/rhg04JxZSI6o8QIbkKBPsOINfHAK2c0avAg7bMp9woZ+5JFsPps0uf QqlwmM8rnvqK8J7JItKlR5JvlJm5DZHBtWsrhtkbfCUcd4ISvxju+ZdFntCMtBlzLV5P iN6Q==; 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=h5KQ+hRA; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=EqYYI6JN; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=S0kZBqRR; 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 8926c6da1cb9f-4f047455a9esi1335892173.3.2025.02.25.01.50.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Feb 2025 01:50:09 -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=h5KQ+hRA; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=EqYYI6JN; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=S0kZBqRR; 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-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tmrZk-0008TX-Ma; Tue, 25 Feb 2025 09:50:05 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tmrZj-0008TQ-8r for openvpn-devel@lists.sourceforge.net; Tue, 25 Feb 2025 09:50:03 +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=nLJXPh6IIHnQ9ai+ZQ6GHENChpGlnczKZ7bTQPXYugA=; b=h5KQ+hRA5yg0KfyYg3dx2/RfXd kVrZNSjCiC26eqTpa2mEOqVALGhvEZnw/O2yNAF4QMPuH4l81WdXseIyoeEtXkm0qMu2cJdAWX2RP HPYljopOdiOka4g341zDeKQv4ZZmYvWhpp7pZx2VMvJ9x1D6XT1oTPVONCCxSZT/+GV4=; 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=nLJXPh6IIHnQ9ai+ZQ6GHENChpGlnczKZ7bTQPXYugA=; b=E qYYI6JNFmLW+YKyzW+h1Io7rG0Sd0lm+UipUTEXdJjIOmup49Rjf+EF/ODczaAx9gJSRNTa6oGS+T xZoZqKIyjvILvUuRsXWqKz3SzfuxpH9eBpP6IUykE/DRWpB7emArOIFL9NDkjo2+u3B3sCAvUXEt2 NRvjvc5GKwggQLa4=; Received: from mail-wr1-f52.google.com ([209.85.221.52]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1tmrZi-0008IQ-GQ for openvpn-devel@lists.sourceforge.net; Tue, 25 Feb 2025 09:50:03 +0000 Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-38f2b7ce2e5so3129225f8f.2 for ; Tue, 25 Feb 2025 01:50:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1740476991; x=1741081791; 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=nLJXPh6IIHnQ9ai+ZQ6GHENChpGlnczKZ7bTQPXYugA=; b=S0kZBqRRJntYkuXIl33xV/iW+bHwpSXBoC3Y1Kb68lQe01cynQYkv9bVqveRe1+WYn qewM1LPR0RuE7HPOOjJ6jmzlSRv6IjU78F37HJ0BuNF+W+dY749GcGx7FAx/I4/RkgP/ /uee31bziqWO0I+U3yPAPdqOLhppS++v6KJISwQYc71fT5r5r5nAjcA0G3CAZYC5XGFj FM5yyyTaqCsXTWdO/n+VE7L0XM5mi1bDTpDGV7V1DTdCqVa66W8+MbbA/X0BEWljVvhC w2s5M1Np8aUn4FcmfxuWKqFOuRIayvcoFq+1epoY5EPNmGXpGsDxMsvS90NHf4FS03Qc Fp/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476991; x=1741081791; 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=nLJXPh6IIHnQ9ai+ZQ6GHENChpGlnczKZ7bTQPXYugA=; b=DWbbCEgfBSIBZodxieZ0s83wheSYjCMv8nf9DrcMoEZ0HFixFyasYK+yZnTgfpy4Jm wv5U0phWIxk4/wdyeixk4/gVcdRMtg5QX4mf3sBaqN/gMxoCOQyqDg8raNGzLk8N/1gc o9z/kNOZUpASxjLAQFT/AnOUjGQBnbfB8yQITaMvzx+RMqksQjQTYU0WA9E/uIBVt/SS d11C84r3JuKQQQtDRHVT1ASYtjxQjoWn9srYvStcGnwwmPx2Rzu+QNaoK8F8RqDZMDt9 +B7a5qo3MWQ+SaW/9on5nyDlnDZcs0xG5+4pyOzmfrYyh0ekahTxiRma58SNml3ssd2g t5mw== X-Gm-Message-State: AOJu0YyjGY9cT+LKUb6vRF44P9r1SmfTFRjTNVLOBfxn3JX6mrWGb/ny CFDKamDMepI6jb3GcogCE8UwpnmxEUsRBujQrI8dJcoJN9MqAEFPqqlUKl8htFn1Mbu/KYQ3Pwx t X-Gm-Gg: ASbGncvZGsMQwMtP4atuh/D665p3ygA6R7rUGVafm9NQxxKJ00/A3A4EI7t7+jeew0o 9ZX/Jiqbwcr86rJA24Qo+SaHtVNQSjwebJlEoVmOiSuyJkRXvIZdoBQZuKyV09xNNHPdF3Ahch0 PxlxlLiYyB0sZRVWRkO6cPc5pHEC3f0t8/yMBsvYKejHn2bUfPEQdTYHN8pBxlJ34cqioVwqzz9 HLspUoThsl9hw6erpD9gGS5V3n6fvqtHyj306j1PtT2ZaBbBJeism7m9jEd/zXB29LDfuNZGyH3 S1oYmCPpy6Wi93qYcQQbwKM1aGNXblP9XS3OVZnMmyI0qAyZlCw5lnwjLY5nWbeYGCdHSx+4Ncz Sqdq991/Ed8jYJoK1wA== X-Received: by 2002:a5d:5f8e:0:b0:38d:eb33:7f7e with SMTP id ffacd0b85a97d-390cc631dd6mr1642799f8f.36.1740476990849; Tue, 25 Feb 2025 01:49:50 -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 ffacd0b85a97d-390cd883934sm1722283f8f.59.2025.02.25.01.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:49:50 -0800 (PST) From: "mrbff (Code Review)" X-Google-Original-From: "mrbff (Code Review)" X-Gerrit-PatchSet: 1 Date: Tue, 25 Feb 2025 09:49:49 +0000 To: plaisthos , flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: Ifc54be34101c0eb0f3dc479a9480d7219628cc76 X-Gerrit-Change-Number: 902 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: ed3c2c4e739273c834406dad2e4f7d3782947f5a References: Message-ID: 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_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.221.52 listed in sa-accredit.habeas.com] 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.221.52 listed in bl.score.senderscore.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_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.52 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.52 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 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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: 1tmrZi-0008IQ-GQ Subject: [Openvpn-devel] [S] Change in openvpn[master]: route: handle default gateway (net_gateway) and nexthop towards VPN s... 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: marco@mandelbit.com, 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?1825022420967302834?= X-GMAIL-MSGID: =?utf-8?q?1825022420967302834?= 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/+/902?usp=email to review the following change. Change subject: route: handle default gateway (net_gateway) and nexthop towards VPN server separately ...................................................................... route: handle default gateway (net_gateway) and nexthop towards VPN server separately Right now there is the assumption that the gateway used for net_gateway is the same used to reach the VPN server. However, these two gateways may be different (i.e. when there is a specific hostroute for the VPN server using a different nexthop). For this reason we must adapt init_route_list() to fetch the two gateways separately. Change-Id: Ifc54be34101c0eb0f3dc479a9480d7219628cc76 --- M src/openvpn/route.c 1 file changed, 14 insertions(+), 6 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/902/1 diff --git a/src/openvpn/route.c b/src/openvpn/route.c index bc41492..3ddc333 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -655,10 +655,12 @@ rl->spec.flags |= RTSA_DEFAULT_METRIC; } - get_default_gateway(&rl->rgi, remote_host != IPV4_INVALID_ADDR ? remote_host : INADDR_ANY, ctx); - if (rl->rgi.flags & RGI_ADDR_DEFINED) + struct route_gateway_info ngi; + + get_default_gateway(&ngi, INADDR_ANY, ctx); + if (ngi.flags & RGI_ADDR_DEFINED) { - setenv_route_addr(es, "net_gateway", rl->rgi.gateway.addr, -1); + setenv_route_addr(es, "net_gateway", ngi.gateway.addr, -1); #if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL) print_default_gateway(D_ROUTE, &rl->rgi, NULL); #endif @@ -668,6 +670,8 @@ dmsg(D_ROUTE, "ROUTE: default_gateway=UNDEF"); } + get_default_gateway(&rl->rgi, remote_host != IPV4_INVALID_ADDR ? remote_host : INADDR_ANY, ctx); + if (rl->spec.flags & RTSA_REMOTE_HOST) { rl->spec.remote_host_local = test_local_addr(remote_host, &rl->rgi); @@ -818,10 +822,12 @@ msg(D_ROUTE, "GDG6: remote_host_ipv6=%s", remote_host_ipv6 ? print_in6_addr(*remote_host_ipv6, 0, &gc) : "n/a" ); - get_default_gateway_ipv6(&rl6->rgi6, remote_host_ipv6, ctx); - if (rl6->rgi6.flags & RGI_ADDR_DEFINED) + struct route_ipv6_gateway_info ngi6; + + get_default_gateway_ipv6(&ngi6, NULL, ctx); + if (ngi6.flags & RGI_ADDR_DEFINED) { - setenv_str(es, "net_gateway_ipv6", print_in6_addr(rl6->rgi6.gateway.addr_ipv6, 0, &gc)); + setenv_str(es, "net_gateway_ipv6", print_in6_addr(ngi6.gateway.addr_ipv6, 0, &gc)); #if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL) print_default_gateway(D_ROUTE, NULL, &rl6->rgi6); #endif @@ -831,6 +837,8 @@ dmsg(D_ROUTE, "ROUTE6: default_gateway=UNDEF"); } + get_default_gateway_ipv6(&rl6->rgi6, remote_host_ipv6, ctx); + if (is_route_parm_defined( remote_endpoint )) { if (inet_pton( AF_INET6, remote_endpoint,