summaryrefslogtreecommitdiffhomepage
path: root/netboot/netconf.go
diff options
context:
space:
mode:
authorAndrea Barberio <insomniac@slackware.it>2018-11-13 11:53:08 +0000
committerinsomniac <insomniacslk@users.noreply.github.com>2018-11-13 14:43:39 +0000
commitefa803b562a7fd3d31715e0ce92e3045d9d29817 (patch)
tree175c63f7dabd1884ef6c24d2980869fe4a360a40 /netboot/netconf.go
parent81701eacf8671ec9f6e1993c1384e42cebbc866c (diff)
netboot: domain search list not mandatory
Diffstat (limited to 'netboot/netconf.go')
-rw-r--r--netboot/netconf.go23
1 files changed, 10 insertions, 13 deletions
diff --git a/netboot/netconf.go b/netboot/netconf.go
index 50e339c..bf0274e 100644
--- a/netboot/netconf.go
+++ b/netboot/netconf.go
@@ -66,12 +66,11 @@ func GetNetConfFromPacketv6(d *dhcpv6.DHCPv6Message) (*NetConf, error) {
netconf.DNSServers = odnsserv.NameServers
opt = d.GetOneOption(dhcpv6.OptionDomainSearchList)
- if opt == nil {
- return nil, errors.New("No option DNS Domain Search List found")
+ if opt != nil {
+ odomains := opt.(*dhcpv6.OptDomainSearchList)
+ // TODO should this be copied?
+ netconf.DNSSearchList = odomains.DomainSearchList
}
- odomains := opt.(*dhcpv6.OptDomainSearchList)
- // TODO should this be copied?
- netconf.DNSSearchList = odomains.DomainSearchList
return &netconf, nil
}
@@ -133,15 +132,13 @@ func GetNetConfFromPacketv4(d *dhcpv4.DHCPv4) (*NetConf, error) {
// get domain search list
dnsDomainSearchListOption := d.GetOneOption(dhcpv4.OptionDNSDomainSearchList)
- if dnsDomainSearchListOption == nil {
- return nil, errors.New("no domain search list option in response packet")
-
- }
- dnsSearchList := dnsDomainSearchListOption.(*dhcpv4.OptDomainSearch).DomainSearch
- if len(dnsSearchList) == 0 {
- return nil, errors.New("dns search list is empty")
+ if dnsDomainSearchListOption != nil {
+ dnsSearchList := dnsDomainSearchListOption.(*dhcpv4.OptDomainSearch).DomainSearch
+ if len(dnsSearchList) == 0 {
+ return nil, errors.New("dns search list is empty")
+ }
+ netconf.DNSSearchList = dnsSearchList
}
- netconf.DNSSearchList = dnsSearchList
// get default gateway
routerOption := d.GetOneOption(dhcpv4.OptionRouter)