[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 2/6] nwfilter: Remove unnecessary UUID comparison bypass



Commit id '46a811db07' added code to check if the filter by Name
already existed with a different UUID, to go along with the existing
found filter by UUID and compare the Names match thus making it
impossible to reach this find by Name condition without both the
Name and UUID already matching, so remove the need to "filter"
out the UUID for the virNWFilterDefEqual.

Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/conf/virnwfilterobj.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index ecc7653..1e8fd36 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -329,18 +329,11 @@ virNWFilterObjTestUnassignDef(virNWFilterObjPtr obj)
 
 static bool
 virNWFilterDefEqual(const virNWFilterDef *def1,
-                    virNWFilterDefPtr def2,
-                    bool cmpUUIDs)
+                    virNWFilterDefPtr def2)
 {
     bool ret = false;
-    unsigned char rem_uuid[VIR_UUID_BUFLEN];
-    char *xml1, *xml2 = NULL;
-
-    if (!cmpUUIDs) {
-        /* make sure the UUIDs are equal */
-        memcpy(rem_uuid, def2->uuid, sizeof(rem_uuid));
-        memcpy(def2->uuid, def1->uuid, sizeof(def2->uuid));
-    }
+    char *xml1 = NULL;
+    char *xml2 = NULL;
 
     if (!(xml1 = virNWFilterDefFormat(def1)) ||
         !(xml2 = virNWFilterDefFormat(def2)))
@@ -349,9 +342,6 @@ virNWFilterDefEqual(const virNWFilterDef *def1,
     ret = STREQ(xml1, xml2);
 
  cleanup:
-    if (!cmpUUIDs)
-        memcpy(def2->uuid, rem_uuid, sizeof(rem_uuid));
-
     VIR_FREE(xml1);
     VIR_FREE(xml2);
 
@@ -401,7 +391,7 @@ virNWFilterObjListAssignDef(virNWFilterObjListPtr nwfilters,
     if ((obj = virNWFilterObjListFindByName(nwfilters, def->name))) {
 
         objdef = obj->def;
-        if (virNWFilterDefEqual(def, objdef, false)) {
+        if (virNWFilterDefEqual(def, objdef)) {
             virNWFilterDefFree(objdef);
             obj->def = def;
             return obj;
-- 
2.9.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]