From nobody Tue May 13 11:50:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1539845865422875.9965439627541; Wed, 17 Oct 2018 23:57:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C7BC30833AF; Thu, 18 Oct 2018 06:57:43 +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 180AF2E057; Thu, 18 Oct 2018 06:57:43 +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 B766A4BB74; Thu, 18 Oct 2018 06:57:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9I6o55j008959 for ; Thu, 18 Oct 2018 02:50:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id C01E65D756; Thu, 18 Oct 2018 06:50:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59ED75B6AD; Thu, 18 Oct 2018 06:50:02 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBC29308FB94; Thu, 18 Oct 2018 06:49:59 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1gD285-0007CF-M0; Thu, 18 Oct 2018 09:49:57 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 18 Oct 2018 09:49:33 +0300 Message-Id: <1539845374-898024-4-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1539845374-898024-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1539845374-898024-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 18 Oct 2018 06:50:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 18 Oct 2018 06:50:01 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] nwfilter: force filters reinstantiation on firewalld reload 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 18 Oct 2018 06:57:44 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We need reinstantiation because reload will flush rules installed by libvirtd. Signed-off-by: Nikolay Shirokovskiy --- src/nwfilter/nwfilter_driver.c | 6 +++--- src/nwfilter/nwfilter_gentech_driver.c | 13 +++++++++---- src/nwfilter/nwfilter_gentech_driver.h | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 5d25d65..db04868 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -168,7 +168,7 @@ virNWFilterTriggerRebuildImpl(void *opaque) { virNWFilterDriverStatePtr nwdriver =3D opaque; =20 - return virNWFilterBuildAll(nwdriver, true); + return virNWFilterBuildAll(nwdriver, true, false); } =20 =20 @@ -264,7 +264,7 @@ nwfilterStateInitialize(bool privileged, if (virNWFilterBindingObjListLoadAllConfigs(driver->bindings, driver->= bindingDir) < 0) goto error; =20 - if (virNWFilterBuildAll(driver, false) < 0) + if (virNWFilterBuildAll(driver, false, false) < 0) goto error; =20 nwfilterDriverUnlock(); @@ -319,7 +319,7 @@ nwfilterStateReload(void) =20 virNWFilterUnlockFilterUpdates(); =20 - virNWFilterBuildAll(driver, false); + virNWFilterBuildAll(driver, false, true); =20 nwfilterDriverUnlock(); =20 diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index 46b1144..a5b3e1a 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -984,7 +984,8 @@ static int virNWFilterBuildOne(virNWFilterDriverStatePtr driver, virNWFilterBindingObjPtr bindingobj, virHashTablePtr skipInterfaces, - int step) + int step, + bool force) { virNWFilterBindingDefPtr binding =3D virNWFilterBindingObjGetDef(bindi= ngobj); virNWFilterObjPtr filter; @@ -1020,7 +1021,8 @@ virNWFilterBuildOne(virNWFilterDriverStatePtr driver, break; =20 case STEP_APPLY_CURRENT: - if ((filter =3D virNWFilterObjListFindByName(driver->nwfilters, + if (!force && + (filter =3D virNWFilterObjListFindByName(driver->nwfilters, binding->filter))) { char *filterhash =3D virNWFilterObjGetHash(filter); char *bindinghash =3D virNWFilterBindingObjGetFilterhash(bindi= ngobj); @@ -1055,6 +1057,7 @@ struct virNWFilterBuildData { virNWFilterDriverStatePtr driver; virHashTablePtr skipInterfaces; int step; + bool force; }; =20 static int @@ -1063,15 +1066,17 @@ virNWFilterBuildIter(virNWFilterBindingObjPtr bindi= ng, void *opaque) struct virNWFilterBuildData *data =3D opaque; =20 return virNWFilterBuildOne(data->driver, binding, - data->skipInterfaces, data->step); + data->skipInterfaces, data->step, data->for= ce); } =20 int virNWFilterBuildAll(virNWFilterDriverStatePtr driver, - bool newFilters) + bool newFilters, + bool force) { struct virNWFilterBuildData data =3D { .driver =3D driver, + .force =3D force, }; int ret =3D 0; =20 diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter= _gentech_driver.h index 3c96c34..bdf3daa 100644 --- a/src/nwfilter/nwfilter_gentech_driver.h +++ b/src/nwfilter/nwfilter_gentech_driver.h @@ -55,7 +55,8 @@ virHashTablePtr virNWFilterCreateVarHashmap(const char *m= acaddr, const virNWFilterVarValue *val= ue); =20 int virNWFilterBuildAll(virNWFilterDriverStatePtr driver, - bool newFilters); + bool newFilters, + bool force); =20 void virNWFilterBindingUpdateHash(virNWFilterObjListPtr nwfilters, virNWFilterBindingObjPtr binding); --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list