Use the new network instead of doing this logic in the CLI

This commit is contained in:
Gregory Kurtzer
2020-12-19 21:03:44 -08:00
parent 5e8ef337d0
commit 5ec1988029

View File

@@ -2,13 +2,11 @@ package dhcp
import (
"fmt"
"github.com/brotherpowers/ipsubnet"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"net"
"os"
"path"
"strings"
@@ -99,14 +97,9 @@ func Configure(show bool) error {
os.Exit(1)
}
mask := net.IPMask(net.ParseIP(controller.Netmask).To4())
size, _ := mask.Size()
sub := ipsubnet.SubnetCalculator(controller.Ipaddr, size)
d.Ipaddr = controller.Ipaddr
d.Network = sub.GetNetworkPortion()
d.Netmask = sub.GetSubnetMask()
d.Network = controller.Network
d.Netmask = controller.Netmask
d.RangeStart = controller.Dhcp.RangeStart
d.RangeEnd = controller.Dhcp.RangeEnd