From nobody Sun Nov 10 18:35:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1683104473; cv=none; d=zohomail.com; s=zohoarc; b=niHFXVQvkv20qvZJ1ZG8rv2rpvrXDIf0/H9Gmq7Ktx/aMonFOrRQgEJ6AzL4Pl8ovCRDETLdh9smCRHizwwC5Bxp4o2dKiP6IrwxMMVpg9G4KxlJ7PAX8dKxJbUMv52sE4Xc4sW+1y6rxf4r0NmHVgHc5KlCQVgRGxiCOjM5UZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683104473; 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=oZmqQyKtPLUzRMZSP78X4cO3J20vtjMNLfPL8pByVrg=; b=VaQgua0VXrf3bHXFF2x1wdifp1bt0oNWO/KVdGtuuLrSYsoEpnHBGxKUkPLEVVI9fKEihWk9bDXhl1JSLeZd4+vrgQ3NkhrguTCTVZ585Jn9ug0zm9d+zvS5/oLO0KdBGP7f00RUdZD4ZKZU7+BOPzdAV9LVkU31yfITmKAt/Z8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1683104473512115.62609633240731; Wed, 3 May 2023 02:01:13 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-360-K-KfKn_XNY-A5qtRiuY8ng-1; Wed, 03 May 2023 05:01:10 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 732F185A588; Wed, 3 May 2023 09:01:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60189406AA66; Wed, 3 May 2023 09:01:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E68681946A4B; Wed, 3 May 2023 09:00:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AF95419465BB for ; Wed, 3 May 2023 09:00:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9636B407D451; Wed, 3 May 2023 09:00:57 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D9E6407D450 for ; Wed, 3 May 2023 09:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683104472; 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=oZmqQyKtPLUzRMZSP78X4cO3J20vtjMNLfPL8pByVrg=; b=PJExputBAWtCmu1GGM3vzWOnoxf9LpkjKUsLcPpoolshk9bUO3n/UqoY0SxvZSlvWnrDJG Mbmg690k6PGMR2HU/C1MCbj967giN8SxP5yaW76pwPItNG+Y6+B3DPq8mxu2hZHcPWAo21 wAWhUo6qVJli3MFtugwFwQ4zyNrloUs= X-MC-Unique: K-KfKn_XNY-A5qtRiuY8ng-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] util: include virfirewall.h in virfirewalld.h Date: Wed, 3 May 2023 11:00:54 +0200 Message-Id: <9cb2051f60a9bb67f69b22942c00cd5af937253c.1683104398.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683104475082100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The virfirewalld.h file provides a declaration for virFirewallDApplyRule() which accepts an argument of type virFirewallLayer. But the typedef lives in virfirewall.h and thus including just virfirewalld.h is not sufficient. Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova Reviewed-by: Martin Kletzander --- src/util/virfirewalld.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/virfirewalld.h b/src/util/virfirewalld.h index 004d10ec29..0e94d3507b 100644 --- a/src/util/virfirewalld.h +++ b/src/util/virfirewalld.h @@ -20,6 +20,8 @@ =20 #pragma once =20 +#include "virfirewall.h" + #define VIR_FIREWALL_FIREWALLD_SERVICE "org.fedoraproject.FirewallD1" =20 typedef enum { --=20 2.39.2 From nobody Sun Nov 10 18:35:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1683104523; cv=none; d=zohomail.com; s=zohoarc; b=ZHTrmRWFf6yNusEKRZvmz2po3Bak8I7KJehnIR1ktOupHzDaMwqr+vZub3bNnrKiZTlpmvMMQD835Lf8PebLXd7xDq/6Jxbvl4qWexz+G0lpAR9ywUZtwyeu5T0ClXOlv6WQUTJA/DzX0GmrrciDuKa6ydwwW0MSkDTDPx3xoAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683104523; 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=1/ksN22Tm8racQ+l0sioZ7IYeNtAGBggiJajvJcf0pg=; b=Ei5UvX2VveircJruKKIBQGoHpMyPc6UvM1nGg9IRRlZo7yMqiqL8b6Kow+bfJks2iolsK31z3Kh2yCDyeVLUhf+204qqZKatdVLwUXKzFgKlihlEhmenW0ug9iWgLdmNsBwnUhCtB9zi0kcfmPZ1PXC/GOfx2OMjdmc7c/YY1bA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1683104523871463.57184594450473; Wed, 3 May 2023 02:02:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-14-tUYyrUpGPeeK4fy4mquRmA-1; Wed, 03 May 2023 05:01:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C6BD3C11783; Wed, 3 May 2023 09:01:14 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36718407D451; Wed, 3 May 2023 09:01:14 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9B32F1946A41; Wed, 3 May 2023 09:01:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 506A619465BB for ; Wed, 3 May 2023 09:00:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 345B1407D451; Wed, 3 May 2023 09:00:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEEF9407D450 for ; Wed, 3 May 2023 09:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683104522; 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=1/ksN22Tm8racQ+l0sioZ7IYeNtAGBggiJajvJcf0pg=; b=Pyq8cVpfd18PfT6cHwteQiDpOLWUCVTvrQL0YVp/hIhjf3p0eeMeb0lHrgR5+8yCpKwWzo FXGFUwbI0J4Z0XoGNvtAHotZGpfAGABwNzFJB3vqiIuJ0lAa4aj7G0nIYBXrsXyBe+mTmZ HOt19Kvjqt98087LdCwRz0jLmP5L9Mg= X-MC-Unique: tUYyrUpGPeeK4fy4mquRmA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] virfirewallmock: Replace virFindFileInPath() with virFirewallDIsRegistered() Date: Wed, 3 May 2023 11:00:55 +0200 Message-Id: <32a7244b2aff8fa3c498719704201ef2152acc68.1683104398.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683104525523100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Neither of tests that use virfirewallmock.c (networkxml2firewalltest, nwfilterebiptablestest, nwfilterxml2firewalltest, virfirewalltest) really call virFindFileInPath(). But at least networkxml2firewalltest calls virFirewallDIsRegistered(), under the hood. Now, the actual implementation connects to dbus and something, which is definitely not what we want in our test suite. Therefore, drop virFindFileInPath() implementation and provide implementation for virFirewallDIsRegistered() which just returns -2 to signal that firewalld is not registered. Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova Reviewed-by: Martin Kletzander --- tests/virfirewallmock.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/virfirewallmock.c b/tests/virfirewallmock.c index 6b096701c9..793b954d87 100644 --- a/tests/virfirewallmock.c +++ b/tests/virfirewallmock.c @@ -17,18 +17,10 @@ #include =20 #include "internal.h" -#include "virfile.h" +#include "virfirewalld.h" =20 -char * -virFindFileInPath(const char *file) +int +virFirewallDIsRegistered(void) { - if (file && - (g_strrstr(file, "ebtables") || - g_strrstr(file, "iptables") || - g_strrstr(file, "ip6tables"))) { - return g_strdup(file); - } - - /* We should not need any other binaries so return NULL. */ - return NULL; + return -2; } --=20 2.39.2