Re: [PATCH] conf: log error when encountering multiple filterrefs in interface

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

 



On 2012年08月14日 23:06, Laine Stump wrote:
Each interface has a single pointer to a filterref object. That
filterref can itself point to multiple other filterrefs, but at the
toplevel there is only one.

The parser had previously just silently overwritten earlier filterrefs
when a new one was encountered, so the interface was left with
whichever was the last filterref in the xml, ignoring all the
others. This patch logs an error when it sees more than one filterref.
---
  src/conf/domain_conf.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ae95d81..58c424f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4627,6 +4627,12 @@ virDomainNetDefParseXML(virCapsPtr caps,
                  ioeventfd = virXMLPropString(cur, "ioeventfd");
                  event_idx = virXMLPropString(cur, "event_idx");
              } else if (xmlStrEqual (cur->name, BAD_CAST "filterref")) {
+                if (filter) {
+                    virReportError(VIR_ERR_XML_ERROR, "%s",
+                                   _("Invalid specification of multiple<filterref>s "
+                                     "in a single<interface>"));
+                    goto error;
+                }
                  filter = virXMLPropString(cur, "filter");
                  virNWFilterHashTableFree(filterparams);
                  filterparams = virNWFilterParseParamAttributes(cur);

ACK

Regards,
Osier

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]