From patchwork Tue Apr 7 03:15:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wlswo X-Patchwork-Id: 2220431 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=naver.com header.i=@naver.com header.a=rsa-sha256 header.s=s20171208 header.b=hVN5b0Jw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4fqg9c35hFz1xtJ for ; Tue, 07 Apr 2026 18:59:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1C874810EF; Tue, 7 Apr 2026 08:59:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 4ULMGDAYdltk; Tue, 7 Apr 2026 08:59:12 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C4B9D80FA9 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=naver.com header.i=@naver.com header.a=rsa-sha256 header.s=s20171208 header.b=hVN5b0Jw Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id C4B9D80FA9; Tue, 7 Apr 2026 08:59:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 765BFC0902; Tue, 7 Apr 2026 08:59:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id C17A5C04FA for ; Tue, 7 Apr 2026 03:25:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B9F7E4081A for ; Tue, 7 Apr 2026 03:25:51 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id lzRhhCt3ec_K for ; Tue, 7 Apr 2026 03:25:50 +0000 (UTC) X-Greylist: delayed 603 seconds by postgrey-1.37 at util1.osuosl.org; Tue, 07 Apr 2026 03:25:50 UTC DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 4394940817 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=naver.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4394940817 Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=naver.com header.i=@naver.com header.a=rsa-sha256 header.s=s20171208 header.b=hVN5b0Jw Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=114.111.35.232; helo=cvsmtppost12.nm.naver.com; envelope-from=byunjin11@naver.com; receiver= Received: from cvsmtppost12.nm.naver.com (cvsmtppost12.nm.naver.com [114.111.35.232]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4394940817 for ; Tue, 7 Apr 2026 03:25:49 +0000 (UTC) X-Originating-IP: 14.35.255.226 Received: from cvsendbo035.nm ([10.112.22.38]) by cvsmtppost12.nm.naver.com with ESMTP id -ofF+ba1RrembvdaeaLtuQ for ; Tue, 07 Apr 2026 03:15:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=naver.com; s=s20171208; t=1775531745; bh=113CrO6qDBsyllKWABGp49y5kogTRLe654sX1UxsgfU=; h=From:To:Subject:Date:Message-Id:From:Subject:Feedback-ID: X-Works-Security; b=hVN5b0JwLl02c2q4Dnio6hdD2uBHIy+FKQ9hHVT/2y39x48cC3yLHcAaJXWWgjDYV tiGzdoaTj2dHujX0U1D+q0F0/ixEwvvo6INUdnikKZNnTnXHJ9X1HfeKtadjv7Rp7i A7fECU1uvsJmuzhKlZiSJwFtjeclP7t+j9nE6RLAs0179JyCUj2CRDnoD785ihvVPK 8XdESjnftA5fmaTKwdSVbKcgApMvhCz2pd3sehTzmx1E7NliMLD6g3wWaEXYZVjwgG uXRIElFYXddQW3hNfLgcgtiBSfqnfBoVHjfSoKrBkIIhIm28fXfj0bdvabVZc1wURE Fcy45z8pTB3pA== X-Session-ID: iSOcNqHdQw+qdbHRE41MMA X-Originating-IP: 14.35.255.226 X-Works-Send-Opt: LebwjAJYjHmwFoEqFoJYaAbXaBwkx0eFjAJYKg== X-Works-Smtp-Source: IdKlFAEXFqJZ+HmdFAKl+6E= Received: from localhost.localdomain ([14.35.255.226]) by cvnsmtp011.nm.naver.com with ESMTP id iSOcNqHdQw+qdbHRE41MMA for (version=TLSv1.3 cipher=TLS_CHACHA20_POLY1305_SHA256); Tue, 07 Apr 2026 03:15:44 -0000 From: wlswo To: dev@openvswitch.org Cc: wlswo Date: Tue, 7 Apr 2026 12:15:32 +0900 Message-Id: <20260407031532.36157-1-byunjin11@naver.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 07 Apr 2026 08:59:09 +0000 Subject: [ovs-dev] [PATCH] python/socket_util: Add system resolver fallback. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When the python unbound library is not installed, dns_resolve.resolve() returns None for hostnames, causing all hostname-based TCP connections to silently fail. This affects services like neutron-ovn-metadata-agent that use hostname-based connection strings (e.g. tcp:hostname:6642). Add a fallback to socket.getaddrinfo() which uses the system resolver (/etc/hosts, nsswitch.conf, system DNS) when unbound is unavailable or fails to resolve. Signed-off-by: wlswo Signed-off-by: wlswo --- python/ovs/socket_util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py index a26298b75..93764568b 100644 --- a/python/ovs/socket_util.py +++ b/python/ovs/socket_util.py @@ -235,6 +235,17 @@ def _inet_parse_active(target, default_port): host_name = str(ipaddress.ip_address(host_name)) except ValueError: host_name = dns_resolve.resolve(host_name) + if not host_name: + # Fallback to the system resolver (e.g. /etc/hosts, system DNS) + # when the unbound library is not available. + try: + result = socket.getaddrinfo( + ":".join(address[0:-1]).lstrip('[').rstrip(']'), + None, 0, socket.SOCK_STREAM) + if result: + host_name = result[0][4][0] + except socket.gaierror: + pass if not host_name: raise ValueError("%s: bad peer name format" % target) return (host_name, port)