From: Stefan Berger Date: Thu, 14 Oct 2010 15:53:08 +0000 (-0400) Subject: nwfilter: prevent filters with different name but same UUID X-Git-Tag: v0.8.5~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cfcde2d835ebf1c5a71bcb2f720cc763d6b441d;p=thirdparty%2Flibvirt.git nwfilter: prevent filters with different name but same UUID Patch to prevent multiple nwfilters with different name but same UUID. --- diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 682ba74567..a553b51648 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -2399,6 +2399,20 @@ virNWFilterPoolObjAssignDef(virConnectPtr conn, { virNWFilterPoolObjPtr pool; + pool = virNWFilterPoolObjFindByUUID(pools, def->uuid); + + if (pool) { + if (!STREQ(def->name, pool->def->name)) { + virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, + _("filter with same UUID but different name " + "('%s') already exists"), + pool->def->name); + virNWFilterPoolObjUnlock(pool); + return NULL; + } + virNWFilterPoolObjUnlock(pool); + } + if (virNWFilterDefLoopDetect(conn, pools, def)) { virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s", _("filter would introduce a loop"));