From patchwork Tue Sep 17 09:14:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3839 Return-Path: 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 ) 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 ) 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 ; 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 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: References: 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 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 Acked-by: Frank Lichtenheld --- 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: 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?1810434086534857536?= X-GMAIL-MSGID: =?utf-8?q?1810434086534857536?= From: Ralf Lici 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 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/+/737 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld 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); }