From nobody Mon Feb 9 16:34:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594813752; cv=none; d=zohomail.com; s=zohoarc; b=dfyR479LFpHaoS/Iy0hotX5ijHSrUPnZphFrIf1UqrgrYkj94NBZ+2Y2L/Xd+Q3CSoG4PDZ6yIFq5EJA1qOEtK+J/Nhaugv9MP85QcxlP5sOsgoDsWAZVLCQ8pLUye4wMP6reuP2H43mqeIAu9cPaXEM8o1Vxb4iP6z5lUJX+vU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594813752; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RZdG0cghEGnXWLx9GWDaPoKs5wHWoOpRHjOu1rPx7zE=; b=jkAvwe2AWCwQy6SQsh2oUf8eY5Ls9lH5s5zJorr2YPky8pg1zm8ZcvYeyovzijfNmFURmLT4rqCDDL2Lev1UdAXY9pvc8jNhpB1TZVxSUpE7SbwNIsG4P+mE74HDvqBAUWlFnF8erTEXEeK2/U+iOy3nILTiI9eyF+VP/GNk69I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594813752764352.69534169027975; Wed, 15 Jul 2020 04:49:12 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-205-LaNWLgUfMk-WDC1c-RHYLQ-1; Wed, 15 Jul 2020 07:49:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59FF9100CCC6; Wed, 15 Jul 2020 11:49:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A52A79D02; Wed, 15 Jul 2020 11:49:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 096149622F; Wed, 15 Jul 2020 11:49:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06FBmtV3023068 for ; Wed, 15 Jul 2020 07:48:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 243BE5D9CA; Wed, 15 Jul 2020 11:48:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A2EF5D9C5 for ; Wed, 15 Jul 2020 11:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594813751; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RZdG0cghEGnXWLx9GWDaPoKs5wHWoOpRHjOu1rPx7zE=; b=IOvFHKCSRFgg53csBYCUFY9V4BT4Ct/fm1MWHeMDYr3TV1YyNIDYEkpqiA2jFfm37ZaGJ5 J18LaneOYvnepc3nWWhavjgubYNyjsnnp0uwtEe2C65UPYd7n14xMlNJSZRDl3GA3bK4OH UynmQpBn7lJukW+QquYAm7w1/G/SKOE= X-MC-Unique: LaNWLgUfMk-WDC1c-RHYLQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] virNetSocketCheckProtocols: Confirm IPv4 by lookup too Date: Wed, 15 Jul 2020 13:48:46 +0200 Message-Id: <9ebc3658c325457edb79e5766bd783a78743c726.1594813563.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Historically, if we found an interface with an IPv6 address we did not blindly trust that host is IPv6 capable (as in we can successfully translate IPv4 addresses) but used getaddrinfo() to confirm it. Turns out, we have use the same argument for IPv4. For instance, in an namespace created by the following steps, getaddrinfo("127.0.0.1", ...) fails (demonstrating by "Socket TCP/IPv4 Accept" test case failing in virnetsockettest): unshare -n ip link set lo up ip link add dummy0 type dummy ip link set dummy0 up Signed-off-by: Michal Privoznik --- src/rpc/virnetsocket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index b0d63f0f2c..c62c2fb3fc 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -204,6 +204,9 @@ int virNetSocketCheckProtocols(bool *hasIPv4, =20 freeifaddrs(ifaddr); =20 + if (hasIPv4 && + virNetSocketCheckProtocolByLookup("127.0.0.1", AF_INET, hasIPv4) <= 0) + return -1; =20 if (hasIPv6 && virNetSocketCheckProtocolByLookup("::1", AF_INET6, hasIPv6) < 0) --=20 2.26.2