From nobody Wed May 1 14:08:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1594995477; cv=none; d=zohomail.com; s=zohoarc; b=FhmNbhTGkpA7/nfLveeCCAF1FsK4y+3M4yOctPBCVnK3IoafoJQAAPUJcCXGwaTh3lXsxIp4hYuzScp6q5ddzbavpaArAbM2shssbHa2+uoG6BG+SwadjV0+qSyf/8yGRRTKEUALx6IbPqqZkGtgMydhhxr3bqLoeyWm1Cl8eiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594995477; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=IBQjg57SLq2Cx9uaZzDJk08Ovp58dUnqMSUoCPpWZMs=; b=aMY4sSuYfwXPs0AstIWfnJFRVXKuLn0JE0bWD++E6CXWASgJqoagnArlZJMjS9WbWWx8dPNB1vf+lizUT+W02JSS3QjbtS/GtsIwIR+4HmErBjePs4/2RPzDVclptjqG8uDDr71sHpsnY3/XZgU4vCyWqF4QrOjstxwINjc7z8w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594995477603612.3108171452418; Fri, 17 Jul 2020 07:17:57 -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-323-qkDnLaLmNRq45W7aplv9RA-1; Fri, 17 Jul 2020 10:17:53 -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 EE0B58005B0; Fri, 17 Jul 2020 14:17:47 +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 4FECE6FDD1; Fri, 17 Jul 2020 14:17:47 +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 8169F96239; Fri, 17 Jul 2020 14:17:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06HEHh5Z001773 for ; Fri, 17 Jul 2020 10:17:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id C4E11397; Fri, 17 Jul 2020 14:17:43 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4310119C58 for ; Fri, 17 Jul 2020 14:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594995476; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IBQjg57SLq2Cx9uaZzDJk08Ovp58dUnqMSUoCPpWZMs=; b=AUcOB00NH9lhaIJ4RRqe0QqZL9hSPZiShhKR0ONDrGc74nmVrCCLWIvM21DY9vjkjXo2OC k8FuQzUkCSnAiAyDa1xv/v2YVvyfbyh+1FAsC/tOffPFMoMCZoLFk2ZYeEiTLkRBT5ShNZ bFopIixKZIKtMGicS3ijee3wgOmFN90= X-MC-Unique: qkDnLaLmNRq45W7aplv9RA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virNetSocketCheckProtocols: Actually check bool value Date: Fri, 17 Jul 2020 16:17:38 +0200 Message-Id: <0dcf9562e23edaab7451ec6af7e1c2a4f9800ac8.1594995431.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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" In 9536379da4c8ed61 and 8b0cb0e666f I've tried to call virNetSocketCheckProtocolByLookup() only if we are suspecting the host is IPv4 or IPv6 capable (because we've found an interface with such address). However, the code was missing dereference of the boolean variables and thus was comparing pointers against NULL. Signed-off-by: Michal Privoznik --- Pushed under trivial rule. src/rpc/virnetsocket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 45dcf48206..5a7f501923 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -205,11 +205,11 @@ int virNetSocketCheckProtocols(bool *hasIPv4, =20 freeifaddrs(ifaddr); =20 - if (hasIPv4 && + if (*hasIPv4 && virNetSocketCheckProtocolByLookup("127.0.0.1", AF_INET, hasIPv4) <= 0) return -1; =20 - if (hasIPv6 && + if (*hasIPv6 && virNetSocketCheckProtocolByLookup("::1", AF_INET6, hasIPv6) < 0) return -1; =20 --=20 2.26.2