The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4738

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Include prefix-len, which defaults to 64, in the --dhcp-range
option to dnsmasq.

Signed-off-by: Mikael Magnusson <[email protected]>
From 0bcc715939dfd864a010f28c255c3c033f25e921 Mon Sep 17 00:00:00 2001
From: Mikael Magnusson <[email protected]>
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 <[email protected]>
---
 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)}...)
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to