summaryrefslogtreecommitdiffhomepage
path: root/netboot/netconf.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2019-12-28 01:35:02 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2020-03-09 11:20:54 +0000
commit9f507afe0e85d11469f610304e001eb825c1c61e (patch)
tree2c046a7a4e852dbfaced220b3184bfb8495e0063 /netboot/netconf.go
parenta3ce4ba6230eaf0fceb9c67321bd1a3aa6d2e983 (diff)
netconf: use new IANA and IAAddress getters
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'netboot/netconf.go')
-rw-r--r--netboot/netconf.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/netboot/netconf.go b/netboot/netconf.go
index 78ddff8..60468a7 100644
--- a/netboot/netconf.go
+++ b/netboot/netconf.go
@@ -41,19 +41,11 @@ func GetNetConfFromPacketv6(d *dhcpv6.Message) (*NetConf, error) {
}
netconf := NetConf{}
- // get IP configuration
- iaaddrs := make([]*dhcpv6.OptIAAddress, 0)
- for _, o := range iana.Options {
- if o.Code() == dhcpv6.OptionIAAddr {
- iaaddrs = append(iaaddrs, o.(*dhcpv6.OptIAAddress))
- }
- }
- netmask := net.IPMask(net.ParseIP("ffff:ffff:ffff:ffff::"))
- for _, iaaddr := range iaaddrs {
+ for _, iaaddr := range iana.Options.Addresses() {
netconf.Addresses = append(netconf.Addresses, AddrConf{
IPNet: net.IPNet{
IP: iaaddr.IPv6Addr,
- Mask: netmask,
+ Mask: net.CIDRMask(64, 128),
},
PreferredLifetime: iaaddr.PreferredLifetime,
ValidLifetime: iaaddr.ValidLifetime,
@@ -70,7 +62,6 @@ func GetNetConfFromPacketv6(d *dhcpv6.Message) (*NetConf, error) {
if domains != nil {
netconf.DNSSearchList = domains.Labels
}
-
return &netconf, nil
}