[libvirt] [PATCH] Maintain value of ctxt->node in virInterfaceDefParseDhcp.

Laine Stump laine at laine.org
Mon Sep 28 22:54:19 UTC 2009


This was causing subsequent calls to virXPathxxx() to fail, since
ctxt->node was left pointing at the dhcp node, rather than the
protocol node. Previously this had gone unnoticed, as the dhcp node
was the only thing parsed under ip, if it was there.
---
 src/conf/interface_conf.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 632f28f..818cff2 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -229,10 +229,12 @@ virInterfaceDefParseBondArpValid(virConnectPtr conn, xmlXPathContextPtr ctxt) {
 static int
 virInterfaceDefParseDhcp(virConnectPtr conn, virInterfaceDefPtr def,
                          xmlNodePtr dhcp, xmlXPathContextPtr ctxt) {
+    xmlNodePtr save;
     char *tmp;
     int ret = 0;
 
     def->proto.dhcp = 1;
+    save = ctxt->node;
     ctxt->node = dhcp;
     /* Not much to do in the current version */
     tmp = virXPathString(conn, "string(./@peerdns)", ctxt);
@@ -250,6 +252,7 @@ virInterfaceDefParseDhcp(virConnectPtr conn, virInterfaceDefPtr def,
     } else
         def->proto.peerdns = -1;
 
+    ctxt->node = save;
     return(ret);
 }
 
-- 
1.6.2.5




More information about the libvir-list mailing list