Skip to content

Commit

Permalink
Merge pull request #4738 from mikma/dhcpv6-prefix-len
Browse files Browse the repository at this point in the history
networks: Support stateful DHCPv6 with prefixes longer than /64
  • Loading branch information
stgraber committed Jul 5, 2018
2 parents 8f35d81 + 0bcc715 commit ca8a3be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lxd/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)}...)
Expand Down

0 comments on commit ca8a3be

Please sign in to comment.