mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
virInterfaceDefParseProtoIPv6: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f4b970dc2a
commit
a2d7bb4062
@ -302,17 +302,14 @@ static int
|
|||||||
virInterfaceDefParseProtoIPv6(virInterfaceProtocolDef *def,
|
virInterfaceDefParseProtoIPv6(virInterfaceProtocolDef *def,
|
||||||
xmlXPathContextPtr ctxt)
|
xmlXPathContextPtr ctxt)
|
||||||
{
|
{
|
||||||
xmlNodePtr dhcp, autoconf;
|
xmlNodePtr dhcp;
|
||||||
g_autofree xmlNodePtr *ipNodes = NULL;
|
g_autofree xmlNodePtr *ipNodes = NULL;
|
||||||
int nipNodes;
|
int nipNodes;
|
||||||
size_t i;
|
size_t i;
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
|
def->gateway = virXPathString("string(./route[1]/@gateway)", ctxt);
|
||||||
def->gateway = tmp;
|
|
||||||
|
|
||||||
autoconf = virXPathNode("./autoconf", ctxt);
|
if (virXPathNode("./autoconf", ctxt) != NULL)
|
||||||
if (autoconf != NULL)
|
|
||||||
def->autoconf = 1;
|
def->autoconf = 1;
|
||||||
|
|
||||||
dhcp = virXPathNode("./dhcp", ctxt);
|
dhcp = virXPathNode("./dhcp", ctxt);
|
||||||
@ -331,10 +328,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDef *def,
|
|||||||
|
|
||||||
def->nips = 0;
|
def->nips = 0;
|
||||||
for (i = 0; i < nipNodes; i++) {
|
for (i = 0; i < nipNodes; i++) {
|
||||||
|
virInterfaceIPDef *ip = g_new0(virInterfaceIPDef, 1);
|
||||||
virInterfaceIPDef *ip;
|
|
||||||
|
|
||||||
ip = g_new0(virInterfaceIPDef, 1);
|
|
||||||
|
|
||||||
if (virInterfaceDefParseIP(ip, ipNodes[i]) < 0) {
|
if (virInterfaceDefParseIP(ip, ipNodes[i]) < 0) {
|
||||||
virInterfaceIPDefFree(ip);
|
virInterfaceIPDefFree(ip);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user