summaryrefslogtreecommitdiffhomepage
path: root/netboot/netconf.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2019-12-28 07:12:19 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2020-03-05 15:51:55 +0000
commit26ec6ccc1813d21a91bc0227ce36dee3531c5c96 (patch)
tree0697fef1a7ee2b32b7a4a602a4904cb0e18e72c8 /netboot/netconf.go
parent69252213a65449f6984b24e912979876723ce066 (diff)
v6: add DNS getter (and rename DNSRecursiveNameServer to DNS)
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'netboot/netconf.go')
-rw-r--r--netboot/netconf.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/netboot/netconf.go b/netboot/netconf.go
index ea82e05..6f05e93 100644
--- a/netboot/netconf.go
+++ b/netboot/netconf.go
@@ -60,15 +60,13 @@ func GetNetConfFromPacketv6(d *dhcpv6.Message) (*NetConf, error) {
})
}
// get DNS configuration
- opt = d.GetOneOption(dhcpv6.OptionDNSRecursiveNameServer)
- if opt == nil {
- return nil, errors.New("No option DNS Recursive Name Servers found ")
+ dns := d.Options.DNS()
+ if len(dns) == 0 {
+ return nil, errors.New("no option DNS Recursive Name Servers found")
}
- odnsserv := opt.(*dhcpv6.OptDNSRecursiveNameServer)
- // TODO should this be copied?
- netconf.DNSServers = odnsserv.NameServers
+ netconf.DNSServers = dns
- opt = d.GetOneOption(dhcpv6.OptionDomainSearchList)
+ opt := d.GetOneOption(dhcpv6.OptionDomainSearchList)
if opt != nil {
odomains := opt.(*dhcpv6.OptDomainSearchList)
// TODO should this be copied?