ipdef = ipv4def ? ipv4def : ipv6def;
while (ipdef) {
+ int prefix;
+
+ prefix = virNetworkIpDefPrefix(ipdef);
+ if (prefix < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("bridge '%s' has an invalid prefix"),
+ network->def->bridge);
+ goto cleanup;
+ }
for (r = 0; r < ipdef->nranges; r++) {
int thisRange;
!(eaddr = virSocketAddrFormat(&ipdef->ranges[r].end)))
goto cleanup;
- virBufferAsprintf(&configbuf, "dhcp-range=%s,%s\n",
+ virBufferAsprintf(&configbuf, "dhcp-range=%s,%s",
saddr, eaddr);
+ if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET6))
+ virBufferAsprintf(&configbuf, ",%d", prefix);
+ virBufferAddLit(&configbuf, "\n");
+
VIR_FREE(saddr);
VIR_FREE(eaddr);
thisRange = virSocketAddrGetRange(&ipdef->ranges[r].start,
char *bridgeaddr = virSocketAddrFormat(&ipdef->address);
if (!bridgeaddr)
goto cleanup;
- virBufferAsprintf(&configbuf, "dhcp-range=%s,static\n", bridgeaddr);
+ virBufferAsprintf(&configbuf, "dhcp-range=%s,static",
+ bridgeaddr);
+ if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET6))
+ virBufferAsprintf(&configbuf, ",%d", prefix);
+ virBufferAddLit(&configbuf, "\n");
VIR_FREE(bridgeaddr);
}
interface=virbr0
dhcp-range=192.168.122.2,192.168.122.254
dhcp-no-override
-dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff
+dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64
dhcp-lease-max=493
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
except-interface=lo
bind-dynamic
interface=virbr0
-dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff
+dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64
dhcp-lease-max=240
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
interface=virbr1
dhcp-range=192.168.122.1,static
dhcp-no-override
-dhcp-range=2001:db8:ac10:fd01::1,static
+dhcp-range=2001:db8:ac10:fd01::1,static,64
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/local.hostsfile
addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts
enable-ra