<source network='default'/>
<target dev='vnet0'/>
<b><ip address='192.168.122.5' prefix='24'/></b>
+ <b><ip address='192.168.122.5' prefix='24' peer='10.0.0.10'/></b>
<b><route family='ipv4' address='192.168.122.0' prefix='24' gateway='192.168.122.1'/></b>
<b><route family='ipv4' address='192.168.122.8' gateway='192.168.122.1'/></b>
</interface>
to define the network routes to use for the network device. The attributes
of this element are described in the documentation for the <code>route</code>
element in <a href="formatnetwork.html#elementsStaticroute">network definitions</a>.
- This is only used by the LXC driver.
+ This is used by the LXC driver and <span class="since">Since 1.3.3</span> by the QEMU
+ driver.
+ </p>
+
+ <p>
+ <span class="since">Since 1.3.3</span> ip elements can hold peer attribute to assign
+ a point-to-point address for the network device. The attributes of this element
+ are described in the documentation for the <code>ip</code> element in
+ <a href="formatnetwork.html#elementsAddress">network definitions</a>.
+ This is only used by the LXC and QEMU drivers.
</p>
<h5><a name="elementVhostuser">vhost-user interface</a></h5>
<ref name="ipPrefix"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="peer">
+ <ref name="ipAddr"/>
+ </attribute>
+ </optional>
<empty/>
</element>
</zeroOrMore>
unsigned int prefixValue = 0;
char *familyStr = NULL;
int family = AF_UNSPEC;
- char *address = NULL;
+ char *address = NULL, *peer = NULL;
if (!(prefixStr = virXMLPropString(node, "prefix")) ||
(virStrToLong_ui(prefixStr, NULL, 10, &prefixValue) < 0)) {
goto cleanup;
}
+ if ((peer = virXMLPropString(node, "peer")) == NULL)
+ VIR_DEBUG("Peer is empty");
+
familyStr = virXMLPropString(node, "family");
if (familyStr && STREQ(familyStr, "ipv4"))
family = AF_INET;
address);
goto cleanup;
}
+
+ if ((peer != NULL) && (virSocketAddrParse(&ip->peer, peer, family) < 0)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Failed to parse IP address: '%s'"),
+ peer);
+ goto cleanup;
+ }
+
ip->prefix = prefixValue;
ret = ip;
VIR_FREE(prefixStr);
VIR_FREE(familyStr);
VIR_FREE(address);
+ VIR_FREE(peer);
VIR_FREE(ip);
return ret;
}
typedef virDomainNetIpDef *virDomainNetIpDefPtr;
struct _virDomainNetIpDef {
virSocketAddr address; /* ipv4 or ipv6 address */
+ virSocketAddr peer; /* ipv4 or ipv6 address of peer */
unsigned int prefix; /* number of 1 bits in the net mask */
};