summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dhcpv6/option_nontemporaryaddress.go6
-rw-r--r--netboot/netconf.go13
2 files changed, 5 insertions, 14 deletions
diff --git a/dhcpv6/option_nontemporaryaddress.go b/dhcpv6/option_nontemporaryaddress.go
index 01971f8..0b6012e 100644
--- a/dhcpv6/option_nontemporaryaddress.go
+++ b/dhcpv6/option_nontemporaryaddress.go
@@ -32,8 +32,8 @@ type IdentityOptions struct {
Options
}
-// Address returns the addresses assigned to the identity.
-func (io IdentityOptions) Address() []*OptIAAddress {
+// Addresses returns the addresses assigned to the identity.
+func (io IdentityOptions) Addresses() []*OptIAAddress {
opts := io.Options.Get(OptionIAAddr)
var iaAddrs []*OptIAAddress
for _, o := range opts {
@@ -44,7 +44,7 @@ func (io IdentityOptions) Address() []*OptIAAddress {
// OneAddress returns one address (of potentially many) assigned to the identity.
func (io IdentityOptions) OneAddress() *OptIAAddress {
- a := io.Address()
+ a := io.Addresses()
if len(a) == 0 {
return nil
}
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
}