</p>
<pre>
- <network>
+ <network ipv6='yes'>
<name>default</name>
<uuid>3e3fce45-4f53-4fa7-bb32-11f34168b82b</uuid>
...</pre>
The format must be RFC 4122 compliant, eg <code>3e3fce45-4f53-4fa7-bb32-11f34168b82b</code>.
If omitted when defining/creating a new network, a random
UUID is generated. <span class="since">Since 0.3.0</span></dd>
+ <dt><code>ipv6='yes'</code></dt>
+ <dd>The new, optional parameter <code>ipv6='yes'</code> enables
+ a network definition with no IPv6 gateway addresses specified
+ to have guest-to-guest communications. For further information,
+ see the example below for the example with no gateway addresses.
+ <span class="since">Since 1.0.1</span></dd>
</dl>
<h3><a name="elementsConnect">Connectivity</a></h3>
</forward>
</network></pre>
+ <h3><a name="examplesNoGateway">Network config with no gateway addresses</a></h3>
+
+ <p>
+ A valid network definition can contain no IPv4 or IPv6 addresses. Such a definition
+ can be used for a "very private" or "very isolated" network since it will not be
+ possible to communicate with the virtualization host via this network. However,
+ this virtual network interface can be used for communication between virtual guest
+ systems. This works for IPv4 and <span class="since">(Since 1.0.1)</span> IPv6.
+ However, the new ipv6='yes' must be added for guest-to-guest IPv6
+ communication.
+ </p>
+
+ <pre>
+ <network ipv6='yes'>
+ <name>nogw</name>
+ <uuid>7a3b7497-1ec7-8aef-6d5c-38dff9109e93</uuid>
+ <bridge name="virbr2" stp="on" delay="0" />
+ <mac address='00:16:3E:5D:C7:9E'/>
+ </network></pre>
+
</body>
</html>
<data type="unsignedInt"/>
</attribute>
</optional>
+ <!-- Enables IPv6 guest-to-guest communications on a network
+ with no gateways addresses specified -->
+ <optional>
+ <attribute name="ipv6">
+ <choice>
+ <value>yes</value>
+ <value>no</value>
+ </choice>
+ </attribute>
+ </optional>
<interleave>
<!-- The name of the network, used to refer to it through the API
xmlNodePtr virtPortNode = NULL;
xmlNodePtr forwardNode = NULL;
int nIps, nPortGroups, nForwardIfs, nForwardPfs, nForwardAddrs;
+ char *ipv6nogwStr = NULL;
char *forwardDev = NULL;
char *forwardManaged = NULL;
char *type = NULL;
def->uuid_specified = true;
}
+ /* check if definitions with no IPv6 gateway addresses is to
+ * allow guest-to-guest communications.
+ */
+ ipv6nogwStr = virXPathString("string(./@ipv6)", ctxt);
+ if (ipv6nogwStr) {
+ if (STREQ(ipv6nogwStr, "yes")) {
+ def->ipv6nogw = true;
+ } else if (STRNEQ(ipv6nogwStr, "no")) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid ipv6 setting '%s' in network '%s'"),
+ ipv6nogwStr, def->name);
+ goto error;
+ }
+ VIR_FREE(ipv6nogwStr);
+ }
+
/* Parse network domain information */
def->domain = virXPathString("string(./domain[1]/@name)", ctxt);
VIR_FREE(portGroupNodes);
VIR_FREE(forwardIfNodes);
VIR_FREE(forwardPfNodes);
+ VIR_FREE(ipv6nogwStr);
VIR_FREE(forwardDev);
ctxt->node = save;
return NULL;
if (!(flags & VIR_NETWORK_XML_INACTIVE) && (def->connections > 0)) {
virBufferAsprintf(&buf, " connections='%d'", def->connections);
}
+ if (def->ipv6nogw)
+ virBufferAddLit(&buf, " ipv6='yes'");
virBufferAddLit(&buf, ">\n");
virBufferAdjustIndent(&buf, 2);
virBufferEscapeString(&buf, "<name>%s</name>\n", def->name);
virMacAddr mac; /* mac address of bridge device */
bool mac_specified;
+ /* specified if ip6tables rules added
+ * when no ipv6 gateway addresses specified.
+ */
+ bool ipv6nogw;
+
int forwardType; /* One of virNetworkForwardType constants */
int managed; /* managed attribute for hostdev mode */
}
}
-/* Add all once/network rules required for IPv6 (if any IPv6 addresses are defined) */
+/* Add all once/network rules required for IPv6.
+
+ * If no IPv6 addresses are defined and <network ipv6='yes'> is
+ * specified, then allow IPv6 commuinications between guests connected
+ * to this network. If any IPv6 addresses are defined, then add all
+ * rules for regular operation (including inter-guest communication).
+ */
static int
networkAddGeneralIp6tablesRules(struct network_driver *driver,
virNetworkObjPtr network)
{
- if (!virNetworkDefGetIpByIndex(network->def, AF_INET6, 0))
+ if (!virNetworkDefGetIpByIndex(network->def, AF_INET6, 0) &&
+ !network->def->ipv6nogw) {
return 0;
+ }
/* Catch all rules to block forwarding to/from bridges */
goto err3;
}
+ /* if no IPv6 addresses are defined, we are done. */
+ if (!virNetworkDefGetIpByIndex(network->def, AF_INET6, 0))
+ return 0;
+
/* allow DNS over IPv6 */
if (iptablesAddTcpInput(driver->iptables, AF_INET6,
network->def->bridge, 53) < 0) {
networkRemoveGeneralIp6tablesRules(struct network_driver *driver,
virNetworkObjPtr network)
{
- if (!virNetworkDefGetIpByIndex(network->def, AF_INET6, 0))
+ if (!virNetworkDefGetIpByIndex(network->def, AF_INET6, 0) &&
+ !network->def->ipv6nogw)
return;
+ if (virNetworkDefGetIpByIndex(network->def, AF_INET6, 0)) {
+ iptablesRemoveUdpInput(driver->iptables, AF_INET6, network->def->bridge, 53);
+ iptablesRemoveTcpInput(driver->iptables, AF_INET6, network->def->bridge, 53);
+ }
- iptablesRemoveUdpInput(driver->iptables, AF_INET6, network->def->bridge, 53);
- iptablesRemoveTcpInput(driver->iptables, AF_INET6, network->def->bridge, 53);
+ /* the following rules are there if no IPv6 address has been defined
+ * but network->def->ipv6nogw == true
+ */
iptablesRemoveForwardAllowCross(driver->iptables, AF_INET6, network->def->bridge);
iptablesRemoveForwardRejectIn(driver->iptables, AF_INET6, network->def->bridge);
iptablesRemoveForwardRejectOut(driver->iptables, AF_INET6, network->def->bridge);
--- /dev/null
+<network ipv6='yes'>
+ <name>empty</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
+ <bridge name='virbr7' />
+ <mac address='52:54:00:17:3F:47'/>
+</network>
-<network>
+<network ipv6='no'>
<name>private</name>
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
<bridge name="virbr2" />
--- /dev/null
+<network ipv6='yes'>
+ <name>empty</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
+ <bridge name='virbr7' stp='on' delay='0' />
+ <mac address='52:54:00:17:3F:47'/>
+</network>
} while (0)
#define DO_TEST(name) DO_TEST_FULL(name, 0)
+ DO_TEST("empty-allow-ipv6");
DO_TEST("isolated-network");
DO_TEST("routed-network");
DO_TEST("nat-network");