| Message ID | 20240917091433.24092-1-gert@greenie.muc.de |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:7000:6794:b0:5b9:581e:f939 with SMTP id c20csp65018mao;
Tue, 17 Sep 2024 02:14:50 -0700 (PDT)
X-Forwarded-Encrypted: i=2;
AJvYcCVU1tcnqznQUmvboiWmAQiok/Oo7/ROmj3Wpb1RGDVW/8faB1urYAGv9ILmL3C+ck/dfRL5cj3KCU0=@openvpn.net
X-Google-Smtp-Source:
AGHT+IHh/BxiUXzyo15YjxI0kP4W32Nf02/ub8fy6GiQd4jL/TBis+/9EcTINQkWE36hxj0bKd3K
X-Received: by 2002:a05:6830:6c0a:b0:710:f287:717e with SMTP id
46e09a7af769-7110945bf53mr10797236a34.7.1726564489920;
Tue, 17 Sep 2024 02:14:49 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1726564489; cv=none;
d=google.com; s=arc-20240605;
b=GmZGIqmfdK2lXvMJTM8nfT6ZJ4UcDjD7bGVVN3cRysRfymK2nbrDk8dtwlRwF6bK3S
wM7bhOsLwbDn2N05aoizblqnBnCCiwfd1rItIL1Q/Y/UBrsjju00sopP0ubNOOnc4UEj
dfBGpoyni4MRmk+cdn3j9yhf1Efib0vNxZgglLak6w9PZ+krTX5hGl3d2iuUahAbRYIg
MMpf5sJ7yruOoenVdAcfAf2epja1kvwec0tDGUIiIC5Y9Xc3j1G29xyFGREvyNixO9ON
mtcmUQlz/aGOQKhTSbuKGyMPpH5di0OmJEcftzdao9ElrjJQk9/uD91l7ILHGB/XZm63
rgXw==
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;
bh=DYR+pNdrsc0gnl0YoNiLHNMLoZ3FWVpFQBNEZC+/B9M=;
fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=;
b=McJZHcEtsesapNog9jzCJaec6CSSpAcebBNquScwJ+Mqv6bYFWgzJcDas1ilLQK7ma
cBk2Ayxme/bMzfknJ60fPqTzAdZ93HR0XPMP+8aJvAOzyFTLjpggbb2wvBtInHbkAvdS
8diikukOZ/GISBiVAT9nS9ILh51cdmaOauZ01ffejRjx/GNfvTuUm7gXVwVnBKFQO8zg
wTcdhEItgEy3SnoCl8EpMgt91yPX+420EpQD2JEQi4d44LVWldmrydprRBQwez7UqRkM
T6baH6Ex5R9gHnIp0rk6J9kVZqbV3xzkjasj/uNZmZI4O76LruBEmvOLHn4PUnTFeODL
NAOQ==;
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="bg/MNeyK";
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=Xbr+alGA;
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
006d021491bc7-5e3b0db780bsi2890782eaf.40.2024.09.17.02.14.49
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Tue, 17 Sep 2024 02:14:49 -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=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b="bg/MNeyK";
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=Xbr+alGA;
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 [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 <openvpn-devel-bounces@lists.sourceforge.net>)
id 1sqUIG-0006VR-GG;
Tue, 17 Sep 2024 09:14:43 +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 <gert@blue.greenie.muc.de>) id 1sqUIE-0006VL-Nq
for openvpn-devel@lists.sourceforge.net;
Tue, 17 Sep 2024 09:14:42 +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=rPWtgz8gIKAFwDJO9o+w6KPWNJq18O5lTs0Dovp15y4=; b=bg/MNeyKNvRF55aNKNNkpxrbuF
rZSWdGSP1gSBfpbbnLtxjnB9T3gIzN78yZKKZEGV5RHDDrCSaQy9sczFxyfrxnO06BZBbgRZtjobY
Bj7Zup+twkrgho4YLpEjdBJU9DiVAcXyI7hVmWezqw1iNwpGW9PvDGZ5G5O9bK4atOvs=;
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=rPWtgz8gIKAFwDJO9o+w6KPWNJq18O5lTs0Dovp15y4=; b=Xbr+alGAM7A/4Q0xX2q2BZvRo+
+8M9WfYjTlHuLg/4zUeTuMtJFVER0MVqch8bqCMcxOFuc72QUMWfPXvaGP5jyRUzLv1mwfS0J3TcX
CpcNhsOhkIJuXXY/zvjwxkh8HZ7qHerWzPvfAG5niX8TwRiQ8yBg6OL7WH0yND7a2rZY=;
Received: from dhcp-174.greenie.muc.de ([193.149.48.174]
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 1sqUIC-0002KS-Sq for openvpn-devel@lists.sourceforge.net;
Tue, 17 Sep 2024 09:14:42 +0000
Received: from blue.greenie.muc.de (localhost [127.0.0.1])
by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 48H9EYpO024106
for <openvpn-devel@lists.sourceforge.net>; Tue, 17 Sep 2024 11:14:34 +0200
Received: (from gert@localhost)
by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 48H9EYkm024105
for openvpn-devel@lists.sourceforge.net; Tue, 17 Sep 2024 11:14:34 +0200
From: Gert Doering <gert@greenie.muc.de>
To: openvpn-devel@lists.sourceforge.net
Date: Tue, 17 Sep 2024 11:14:33 +0200
Message-ID: <20240917091433.24092-1-gert@greenie.muc.de>
X-Mailer: git-send-email 2.44.2
In-Reply-To:
<gerrit.1725890088000.I5adbe0a79f078221c4bb5f3d39391a81b4d8adce@gerrit.openvpn.net>
References:
<gerrit.1725890088000.I5adbe0a79f078221c4bb5f3d39391a81b4d8adce@gerrit.openvpn.net>
MIME-Version: 1.0
X-Spam-Score: -0.0 (/)
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: From: Ralf Lici <ralf@mandelbit.com> In init_tun() make sure
to pass the --local and --remote addresses in the host order so that they
can be compared to the --ifconfig addresses. Change-Id:
I5adbe0a79f078221c4bb5f3d39391a81b4d8adce
Signed-off-by: Ralf Lici <ralf@mandelbit.com> Acked-by: Frank Lichtenheld
<frank@lichtenheld.com> ---
Content analysis details: (-0.0 points, 6.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
-0.0 SPF_PASS SPF: sender matches SPF record
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
X-Headers-End: 1sqUIC-0002KS-Sq
Subject: [Openvpn-devel] [PATCH v1] Fix check_addr_clash argument order
X-BeenThere: openvpn-devel@lists.sourceforge.net
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: <openvpn-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive:
<http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel>
List-Post: <mailto:openvpn-devel@lists.sourceforge.net>
List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: openvpn-devel-bounces@lists.sourceforge.net
X-getmail-retrieved-from-mailbox: Inbox
X-GMAIL-THRID: =?utf-8?q?1810434086534857536?=
X-GMAIL-MSGID: =?utf-8?q?1810434086534857536?=
|
| Series |
[Openvpn-devel,v1] Fix check_addr_clash argument order
|
|
Commit Message
Gert Doering
Sept. 17, 2024, 9:14 a.m. UTC
From: Ralf Lici <ralf@mandelbit.com> In init_tun() make sure to pass the --local and --remote addresses in the host order so that they can be compared to the --ifconfig addresses. Change-Id: I5adbe0a79f078221c4bb5f3d39391a81b4d8adce Signed-off-by: Ralf Lici <ralf@mandelbit.com> Acked-by: Frank Lichtenheld <frank@lichtenheld.com> --- 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/+/737 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld <frank@lichtenheld.com>
Comments
Good find.
I tested this as instructed in gerrit, also enabling the #if 0 debug code -
this is a p2p setup with --topology subnet, to actually have a subnet to
check against.
Test 1, "--local" in the "--ifconfig" subnet:
2024-09-17 11:25:45 CHECK_ADDR_CLASH type=2 public=10.204.8.7 local=10.204.8.2, remote_netmask=255.255.255.0
2024-09-17 11:25:45 WARNING: potential conflict between --local address [10.204.8.7] and --ifconfig address pair [10.204.8.2, 255.255.255.0] -- this is a warning only that is triggered when local/remote addresses exist within the same /24 subnet as --ifconfig endpoints. (silence this warning with --ifconfig-nowarn)
"works".
Test 2, "--remote" in the "--ifconfig" subnet:
2024-09-17 11:27:03 CHECK_ADDR_CLASH type=2 public=10.204.8.8 local=10.204.8.2, remote_netmask=255.255.255.0
2024-09-17 11:27:03 WARNING: potential conflict between --remote address [10.204.8.8] and --ifconfig address pair [10.204.8.2, 255.255.255.0] -- this is a warning only that is triggered when local/remote addresses exist within the same /24 subnet as --ifconfig endpoints. (silence this warning with --ifconfig-nowarn)
Test 3, no "--topology subnet":
2024-09-17 11:36:28 CHECK_ADDR_CLASH type=2 public=10.204.8.250 local=10.204.8.2, remote_netmask=10.204.8.1
2024-09-17 11:36:28 WARNING: potential conflict between --local address [10.204.8.250] and --ifconfig address pair [10.204.8.2, 10.204.8.1] -- this is a warning only that is triggered when local/remote addresses exist within the same /24 subnet as --ifconfig endpoints. (silence this warning with --ifconfig-nowarn)
2024-09-17 11:36:28 CHECK_ADDR_CLASH type=2 public=10.204.8.220 local=10.204.8.2, remote_netmask=10.204.8.1
2024-09-17 11:36:28 WARNING: potential conflict between --remote address [10.204.8.220] and --ifconfig address pair [10.204.8.2, 10.204.8.1] -- this is a warning only that is triggered when local/remote addresses exist within the same /24 subnet as --ifconfig endpoints. (silence this warning with --ifconfig-nowarn)
.. it "works as designed", but does raise questions... see below.
So, while this patch is actually fixing the first problem with this
code, I have some ideas how to improve things further ;-)
- the line wrapping "one function argument per line" is not how we do
things today, so a future (master-only) patch could improve that
- the check as implemented today checks "within the same /24", so if
I do "--ifconfig 10.204.8.2 255.255.255.128 --remote 10.204.8.220"
(which is perfectly sane) I get
2024-09-17 11:30:44 CHECK_ADDR_CLASH type=2 public=10.204.8.220 local=10.204.8.2, remote_netmask=255.255.255.128
2024-09-17 11:30:44 WARNING: potential conflict between --remote address [10.204.8.220] and --ifconfig address pair [10.204.8.2, 255.255.255.128] -- this is a warning only that is triggered when local/remote addresses exist within the same /24 subnet as --ifconfig endpoints. (silence this warning with --ifconfig-nowarn)
... which is not making any sense. Computers can do math, AND the
code actually knows the netmask there, but uses /24 always
(the TAP check code actually uses the netmask...).
So I think this code needs to be taught about "--topology subnet",
and only does the /24 heuristic for p2p/net30 (if at all).
Your patch has been applied to the master and release/26 branch
(bugfix).
commit 7d345b19e20f30cb2ecbea71682b5a41e6cff454 (master)
commit 7e6723aa7096bee80eb42a473fbfde7de4362b0f (release/2.6)
Author: Ralf Lici
Date: Tue Sep 17 11:14:33 2024 +0200
Fix check_addr_clash argument order
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20240917091433.24092-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29261.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 739e008..1cd6ad2 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -877,9 +877,10 @@ { if (curele->ai_family == AF_INET) { + const in_addr_t local = ntohl(((struct sockaddr_in *)curele->ai_addr)->sin_addr.s_addr); check_addr_clash("local", tt->type, - ((struct sockaddr_in *)curele->ai_addr)->sin_addr.s_addr, + local, tt->local, tt->remote_netmask); } @@ -889,9 +890,10 @@ { if (curele->ai_family == AF_INET) { + const in_addr_t remote = ntohl(((struct sockaddr_in *)curele->ai_addr)->sin_addr.s_addr); check_addr_clash("remote", tt->type, - ((struct sockaddr_in *)curele->ai_addr)->sin_addr.s_addr, + remote, tt->local, tt->remote_netmask); }