[libvirt PATCH v4 6/8] virNetworkForwardNatDefParseXML: Use virXMLProp*

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/network_conf.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 4cf4aa4840..19b84cbdd1 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1321,7 +1321,6 @@ virNetworkForwardNatDefParseXML(const char *networkName,
     g_autofree xmlNodePtr *natPortNodes = NULL;
     g_autofree char *addrStart = NULL;
     g_autofree char *addrEnd = NULL;
-    g_autofree char *ipv6 = NULL;
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
 
     ctxt->node = node;
@@ -1333,18 +1332,9 @@ virNetworkForwardNatDefParseXML(const char *networkName,
         return -1;
     }
 
-    ipv6 = virXMLPropString(node, "ipv6");
-    if (ipv6) {
-        int natIPv6;
-        if ((natIPv6 = virTristateBoolTypeFromString(ipv6)) <= 0) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           _("Invalid ipv6 setting '%s' "
-                             "in network '%s' NAT"),
-                           ipv6, networkName);
-            return -1;
-        }
-        def->natIPv6 = natIPv6;
-    }
+    if (virXMLPropTristateBool(node, "ipv6", VIR_XML_PROP_OPTIONAL,
+                               &def->natIPv6) < 0)
+        return -1;
 
     /* addresses for SNAT */
     nNatAddrs = virXPathNodeSet("./address", ctxt, &natAddrNodes);
-- 
2.26.2




[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]

  Powered by Linux