[lxc-devel] [lxd/master] networks: Support stateful DHCPv6 with prefixes longer than /64
mikma on Github
lxc-bot at linuxcontainers.org
Thu Jul 5 14:08:52 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 447 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180705/d8e5bab3/attachment.bin>
-------------- next part --------------
From 0bcc715939dfd864a010f28c255c3c033f25e921 Mon Sep 17 00:00:00 2001
From: Mikael Magnusson <mikma at users.sourceforge.net>
Date: Thu, 5 Jul 2018 16:01:05 +0200
Subject: [PATCH] networks: Support stateful DHCPv6 with prefixes longer than
/64
Include prefix-len, which defaults to 64, in the --dhcp-range
option to dnsmasq.
Signed-off-by: Mikael Magnusson <mikma at users.sourceforge.net>
---
lxd/networks.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lxd/networks.go b/lxd/networks.go
index 878154809..4bdc0dab1 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -1303,13 +1303,14 @@ func (n *network) Start() error {
}
if shared.IsTrue(n.config["ipv6.dhcp.stateful"]) {
+ subnetSize, _ := subnet.Mask.Size()
if n.config["ipv6.dhcp.ranges"] != "" {
for _, dhcpRange := range strings.Split(n.config["ipv6.dhcp.ranges"], ",") {
dhcpRange = strings.TrimSpace(dhcpRange)
- dnsmasqCmd = append(dnsmasqCmd, []string{"--dhcp-range", fmt.Sprintf("%s,%s", strings.Replace(dhcpRange, "-", ",", -1), expiry)}...)
+ dnsmasqCmd = append(dnsmasqCmd, []string{"--dhcp-range", fmt.Sprintf("%s,%d,%s", strings.Replace(dhcpRange, "-", ",", -1), subnetSize, expiry)}...)
}
} else {
- dnsmasqCmd = append(dnsmasqCmd, []string{"--dhcp-range", fmt.Sprintf("%s,%s,%s", networkGetIP(subnet, 2), networkGetIP(subnet, -1), expiry)}...)
+ dnsmasqCmd = append(dnsmasqCmd, []string{"--dhcp-range", fmt.Sprintf("%s,%s,%d,%s", networkGetIP(subnet, 2), networkGetIP(subnet, -1), subnetSize, expiry)}...)
}
} else {
dnsmasqCmd = append(dnsmasqCmd, []string{"--dhcp-range", fmt.Sprintf("::,constructor:%s,ra-stateless,ra-names", n.name)}...)
More information about the lxc-devel
mailing list