From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BBAA1ABDC for ; Wed, 28 Jun 2023 11:40:07 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 94D1120A18 for ; Wed, 28 Jun 2023 11:39:37 +0200 (CEST) Received: from bastionodiso.odiso.net (bastionodiso.odiso.net [IPv6:2a0a:1580:2000::2d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 28 Jun 2023 11:39:36 +0200 (CEST) Received: from kvmformation3.odiso.net (formationkvm3.odiso.net [10.3.94.12]) by bastionodiso.odiso.net (Postfix) with ESMTP id 01DFF7FC0; Wed, 28 Jun 2023 11:39:28 +0200 (CEST) Received: by kvmformation3.odiso.net (Postfix, from userid 0) id E60F1246C8F; Wed, 28 Jun 2023 11:39:28 +0200 (CEST) From: Alexandre Derumier To: pve-devel@lists.proxmox.com Date: Wed, 28 Jun 2023 11:39:27 +0200 Message-Id: <20230628093927.988114-1-aderumier@odiso.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy HEADER_FROM_DIFFERENT_DOMAINS 0.25 From and EnvelopeFrom 2nd level mail domains are different KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: [pve-devel] [PATCH pve-cluster] pmxcfs: lookup_node_ip : skip local ips X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2023 09:40:08 -0000 stock debian or some hosting company like ovh through cloudinit at each boot, add 127.0.1.1 in /etc/hosts. fix: https://forum.proxmox.com/threads/proxmox-7-to-8-upgrade-problem-ovh.129678/ https://forum.proxmox.com/threads/update-7-to-8-issue-with-cloud-init.129669/#post-568172 https://forum.proxmox.com/threads/bookworm-installation-fails-with-pve-manager-dependency-error.129398/#post-568290 Signed-off-by: Alexandre Derumier --- src/pmxcfs/pmxcfs.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/pmxcfs/pmxcfs.c b/src/pmxcfs/pmxcfs.c index d78a248..e0f5f27 100644 --- a/src/pmxcfs/pmxcfs.c +++ b/src/pmxcfs/pmxcfs.c @@ -726,26 +726,34 @@ static char * lookup_node_ip(const char *nodename) { char buf[INET6_ADDRSTRLEN]; - struct addrinfo *ainfo; + struct addrinfo *ainfo, *rp; struct addrinfo ahints; char *res = NULL; memset(&ahints, 0, sizeof(ahints)); + ahints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ + ahints.ai_socktype = SOCK_STREAM; /* Datagram socket */ + ahints.ai_flags = AI_V4MAPPED | AI_ALL; if (getaddrinfo(nodename, NULL, &ahints, &ainfo)) return NULL; - if (ainfo->ai_family == AF_INET) { - struct sockaddr_in *sa = (struct sockaddr_in *)ainfo->ai_addr; - inet_ntop(ainfo->ai_family, &sa->sin_addr, buf, sizeof(buf)); + for (rp = ainfo; rp != NULL; rp = rp->ai_next) { + + if (ainfo->ai_family == AF_INET) { + struct sockaddr_in *sa = (struct sockaddr_in *)rp->ai_addr; + inet_ntop(rp->ai_family, &sa->sin_addr, buf, sizeof(buf)); if (strncmp(buf, "127.", 4) != 0) { res = g_strdup(buf); + break; } - } else if (ainfo->ai_family == AF_INET6) { - struct sockaddr_in6 *sa = (struct sockaddr_in6 *)ainfo->ai_addr; - inet_ntop(ainfo->ai_family, &sa->sin6_addr, buf, sizeof(buf)); + } else if (ainfo->ai_family == AF_INET6) { + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)rp->ai_addr; + inet_ntop(rp->ai_family, &sa->sin6_addr, buf, sizeof(buf)); if (strcmp(buf, "::1") != 0) { res = g_strdup(buf); + break; } + } } freeaddrinfo(ainfo); -- 2.39.2