From patchwork Fri Dec 13 16:45:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3996 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:1f13:b0:5e7:b9eb:58e8 with SMTP id hs19csp536429mab; Fri, 13 Dec 2024 09:02:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXEJP5xYCYwIhQwCFuqPyarqF9tuHjPRpujXlcpmvBTC6aMarLxgbPGhZyoTWyjeMfI2anE3hmPjiE=@openvpn.net X-Google-Smtp-Source: AGHT+IFALnFD9eKIw2lRr0HTBjgEyQqoTbIWwM9HlREhScDGMz5yNmK6J3rupcx5Or34TlgOUkPo X-Received: by 2002:a05:6808:14c5:b0:3ea:6174:ac24 with SMTP id 5614622812f47-3eba67feba4mr2138527b6e.1.1734109327686; Fri, 13 Dec 2024 09:02:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734109327; cv=none; d=google.com; s=arc-20240605; b=GdSZFBsK4SXgcId1stsGqmxGHLL3TOMsGE+6boDww0rJRJgvL0B7rLK8WFB4zxcw6X cXaFXHSCA/TvEZypoG/x8F34HoEizeUrgqIQ++6vb82eg1WNLX9NqvjITn9pfftBYRyr iYJUqgyDaaACjnbsOUYr+VJsZUsOpuLZ2Vkww4Xodf3R+7p2UnkaL1QMTsBtFDKm7NYB YUY3R7bbD1H8WPT0GRFonG2j4Boodxxp7uPJvZq8hM+bisasEHWN0fJGjRCt4l/yhtea gIRwvWHuefC+/g14aEp8kEPW5COSpGVD8oGzReGpcCz4jOJNdiQn+wpQEbkIdAzblIcr dXXw== 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=uK/1J0ZE4QS/XiFWtY9MOY2AabaROzQLMCt7HN1FQDU=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=RHm2IV0qxZJhQMYsojw8bTvdSOyigF8DA6Szdjyf0UnQ4guqESRG9hgz5/F8dK5IjF 8XPFhRt/0/6Kj6R21ojBrhiVjQzRqg5jGpdvlnhVq1HTADXlV56NC6JPsvVIlHuBHKDg Q3PBPcv2J8UlLn8TTGPnr8124VxtaJhp3tQ8AqFkxzD7yPzJ8QJ6y9noWRd3uEp+XoVm cPVLfZJM0E6YX/yvhEavdQiGbs6l5jEXrfff5wULgUO9UbkXdx+um6NPLX+DvOjJSVvK xxPVotYrTdQVfDFkzAkQAbasYDuZHBczxo8up2O/oRWfsMjrzkIkiNiMmn9d0J0fuDmQ PLIg==; 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=XZDwzqiy; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=VjzuUc4L; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=gf6imhpX; 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-71e2dd9de6fsi2421377a34.5.2024.12.13.09.02.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Dec 2024 09:02:07 -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=XZDwzqiy; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=VjzuUc4L; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=gf6imhpX; 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-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tM93C-0002XH-Hy; Fri, 13 Dec 2024 17:02:02 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tM93A-0002Wy-0a for openvpn-devel@lists.sourceforge.net; Fri, 13 Dec 2024 17:02:00 +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=6pF/Hxpj/IQBXwHS6MV9GrHVXH7yjFutUA6k3YYcOzo=; b=XZDwzqiyRwVO54T41eHW8hLym4 3BtBt/v/JguFCUmd4Z7aY+ort6r2Gx0Mx+aMIL34OKz7wfHbdOTlNbAQ8jmIZHxJAyTjccRA/OBaV FwbbsebA2P01qt6Y/kAdt6F0rgw75lqKw1TwVun0voR37kHXrFxg0i1FwkeFVutMHCCg=; 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=6pF/Hxpj/IQBXwHS6MV9GrHVXH7yjFutUA6k3YYcOzo=; b=VjzuUc4LB6R+D1fWVHPlOlmh4a zMMd8nYsEVlIa1WqAbBqaiavnAynu0vn4ZbPLDn+xk9cbQFKEOZJGkA9SoM121BMWhoXzQTdJRqBs lqkb5x8R9JiLyFsubdzJgFxX/4IrcS/E4Po2ByBGVx7OnuxJQMf1TNdXVRuh8lVSK8i0=; Received: from mout-p-102.mailbox.org ([80.241.56.152]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tM937-00064n-UF for openvpn-devel@lists.sourceforge.net; Fri, 13 Dec 2024 17:01:59 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (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-102.mailbox.org (Postfix) with ESMTPS id 4Y8wFY5v4hz9shj; Fri, 13 Dec 2024 17:45:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1734108353; 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=6pF/Hxpj/IQBXwHS6MV9GrHVXH7yjFutUA6k3YYcOzo=; b=gf6imhpXPOvVmVg2QdupOJRzSu+lXsahZOGpooiuLFu7NR+A121UDj0f71HOfip6Izi8T+ cPkpDEwHyR5dFtbSZEdTWjRtHzfaEgr3A5PnrWumPSJ8enUqf6c+eucUpoHJ8Qm0IbRllB MrE1DnjwyQCaOxI/sT2hjWS15tZp2bv/zdcvjz7sAbkkAaS5wbDFeNIaUANnsOA4fm8oVV Ukbw/oKFBmmQ6zvIDLes2529W2mDlxjGxk3ZDcBCt4DKQcXloh0Qg7hr0mOPOeDL9TCr1z TuCupQF23IQIQbgNY0fCBrI+6FNCRQc7DJQqwbfhsXoeW8IkuuBdSW98C5j0dg== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Fri, 13 Dec 2024 17:45:52 +0100 Message-Id: <20241213164552.265863-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.9 (/) 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: Heiko Hund This is done so that inet_ntop(3) can be used with IPv4 name server addresses. It expects the binary address in network byte order. If they are not that way the address octets are reversed. Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 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.152 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. [80.241.56.152 listed in sa-accredit.habeas.com] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.152 listed in list.dnswl.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 Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1tM937-00064n-UF Subject: [Openvpn-devel] [PATCH v1] dns: store IPv4 addresses in network byte 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?1818345422169010042?= X-GMAIL-MSGID: =?utf-8?q?1818345422169010042?= From: Heiko Hund This is done so that inet_ntop(3) can be used with IPv4 name server addresses. It expects the binary address in network byte order. If they are not that way the address octets are reversed. Change-Id: I81d4bb0abdd421f5ba260c10c610918652334a4d 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/+/834 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 0539ca5..15e7322 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -121,7 +121,7 @@ if (ai->ai_family == AF_INET) { struct sockaddr_in *sin = (struct sockaddr_in *)ai->ai_addr; - server->addr[server->addr_count].in.a4.s_addr = ntohl(sin->sin_addr.s_addr); + server->addr[server->addr_count].in.a4.s_addr = sin->sin_addr.s_addr; } else { @@ -384,7 +384,7 @@ if (s->addr[j].family == AF_INET) { setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, - print_in_addr_t(s->addr[j].in.a4.s_addr, 0, &gc)); + print_in_addr_t(s->addr[j].in.a4.s_addr, IA_NET_ORDER, &gc)); } else { @@ -443,7 +443,7 @@ const char *fmt_port; if (server->addr[j].family == AF_INET) { - addr = print_in_addr_t(server->addr[j].in.a4.s_addr, 0, &gc); + addr = print_in_addr_t(server->addr[j].in.a4.s_addr, IA_NET_ORDER, &gc); fmt_port = " address = %s:%s"; } else