From patchwork Tue Mar 25 10:54:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4194 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:81e:b0:60a:d70a:d3c7 with SMTP id jj30csp2432548mab; Tue, 25 Mar 2025 03:55:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUEHt0sHmF50nRUTs/fIVPhyDeTJIckULdXeeng149pmJsKvuDoMMQUAvfzKxIc8GEKU76TwXSZKSE=@openvpn.net X-Google-Smtp-Source: AGHT+IF+xLjT3VNJLyi+uY3KfQKciBvqHO9KQJoUCtQwJjMH+xHosqXczCdl56QreQnFSJUoWZWB X-Received: by 2002:a05:6830:3814:b0:72b:9965:d997 with SMTP id 46e09a7af769-72c0aefa731mr9697495a34.18.1742900118175; Tue, 25 Mar 2025 03:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742900118; cv=none; d=google.com; s=arc-20240605; b=H0ty3k745ed9mFZGCgoedXfwkZLU2lCRMze3rhsZfgspllUS6xdAmtS7FRgijW1G45 Yz/ePQaoszqZceYUjVDv054TnBYVYya2sMjQepHEfpzPsHMmKLIwp/E/Grg9kkALM+nS 5GRRmlVzKp3Nr1UW0ccBp5FTv/0Kf3IVFbNt+ua3vOF+6C2ydp/J4hcRAPeTsjgj2zXQ ncp8zUX+B1obYGSELP+IAhU4w/edqKhA0q5DOKW25aAJknuIjPbfq4aPvgEpGFOx0CVm CivdwjRSnubHtiJ59Em7xDMrdVVx2lcR0wt+iWrkw1mxoNPv2axC4xKtGmoMW3dfoO4O oA8g== 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=nPQpXF4c/g8dDR1K2hiQeMGElBiMEr6MzawihwEEltI=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=DDaW3Ypgxj3t8SqyBviVxnUv5Fauijtwi2b7Cd/q2MrnYuCBNqR34K6Fw6HU7rubKe 0pGjCK4lm55c5NPkg09CCchwfvm/veHr9gHVbSQRV3FjlGS+iDsy9V8mAJxFdDEHKdbC mjPOZXXlq90TQUx8BkHLd4khJ+qUgOf0BKTGrdy3+2BvdN2AceTbeFC/w4Uqixo3Sm/9 U9kFo9HhLsaZudu7f+n+in8D0tVEN0/sdwr+YWhvBmohx+zSY7x4h3W7bwGoUbIXMROP O+y2RIf/mXo/QD8agtGf5VU5nKyRi4YwoSOr/NaoVwsfPiEWNe2itNlvWN1OtP/t4dLo h3kg==; 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=Sh5wSN2L; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dWd8qFIc; 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 46e09a7af769-72c0ac68bbbsi8418361a34.140.2025.03.25.03.55.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2025 03:55:18 -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=Sh5wSN2L; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dWd8qFIc; 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 1tx1wB-0008L4-80; Tue, 25 Mar 2025 10:55:14 +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 1tx1wA-0008Ky-FM for openvpn-devel@lists.sourceforge.net; Tue, 25 Mar 2025 10:55:13 +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=CaqrBTCRLS4l3NMcBAM9KbIri3hPjf4bhiUuKkELSgo=; b=Sh5wSN2L2gmyr5KK2TSV94SkeL d3cY/0ujscQqjpdl0+p08k0ZK6TaBGjxBBWruqVqcbcp5aeUkxQq2Ja86ONR7A5CqS4WKasuTWdyC BCBWSHZoL/HrhZ673hLi6fnwIPMb0EDI+91GHD7F0SlFauR036HWd6SAErqbBT5kBzRU=; 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=CaqrBTCRLS4l3NMcBAM9KbIri3hPjf4bhiUuKkELSgo=; b=dWd8qFIcLg4+086F8MfaKbPSt+ mtfonbtH9aoopodn52ASXhIR+MHC6rurQixijXOrgYGdp24rHpCjjuvLckVOiDH9fVR54VNni0Qlg VZK2jWmie2o6I7IuvNI65DqZlUHa5IpTH9YrZXCy9FbjRWXkgXBgeNI0DIF1zriIb9xQ=; 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 1tx1vv-0008RI-Tw for openvpn-devel@lists.sourceforge.net; Tue, 25 Mar 2025 10:55:13 +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 52PAsm5c032241 for ; Tue, 25 Mar 2025 11:54:48 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 52PAsmoq032240 for openvpn-devel@lists.sourceforge.net; Tue, 25 Mar 2025 11:54:48 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 25 Mar 2025 11:54:40 +0100 Message-ID: <20250325105447.32164-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.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: Arne Schwabe With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and [...] Content analysis details: (0.0 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. [193.149.48.174 listed in sa-trusted.bondedsender.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. [193.149.48.174 listed in bl.score.senderscore.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Headers-End: 1tx1vv-0008RI-Tw Subject: [Openvpn-devel] [PATCH v3] Mention address if not unspecific on DNS failure 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?1827563234500950572?= X-GMAIL-MSGID: =?utf-8?q?1827563234500950572?= From: Arne Schwabe With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier. Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5 Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- 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/+/909 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 6b32e30..bea5393 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -445,6 +445,22 @@ throw_signal_soft(SIGHUP, "Preresolving failed"); } +/** + * Small helper function for openvpn_getaddrinfo to print the address + * family when resolving fails + */ +static const char * +getaddrinfo_addr_family_name(int af) +{ + switch (af) + { + case AF_INET: return "[AF_INET]"; + + case AF_INET6: return "[AF_INET6]"; + } + return ""; +} + /* * Translate IPv4/IPv6 addr or hostname into struct addrinfo * If resolve error, try again for resolve_retry_seconds seconds. @@ -545,11 +561,11 @@ print_hostname = "undefined"; } - fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)"; + fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)"; if ((flags & GETADDR_MENTION_RESOLVE_RETRY) && !resolve_retry_seconds) { - fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) " + fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s) %s" "(I would have retried this name query if you had " "specified the --resolv-retry option.)"; } @@ -639,6 +655,7 @@ fmt, print_hostname, print_servname, + getaddrinfo_addr_family_name(ai_family), gai_strerror(status)); if (--resolve_retries <= 0)