summaryrefslogtreecommitdiffhomepage
path: root/netboot
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2019-12-28 09:49:06 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2020-03-05 15:51:55 +0000
commit72e14d6762cd895f00fd5c04fec8a16df521b65f (patch)
treef7238d1821e2c6070ebf5e611808964e1b77c08a /netboot
parentbb0c09a3da430db48a7bd0749b7d5411649e1026 (diff)
v6: add BootFileParam getter
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'netboot')
-rw-r--r--netboot/netboot.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/netboot/netboot.go b/netboot/netboot.go
index 4e1603c..b32f69e 100644
--- a/netboot/netboot.go
+++ b/netboot/netboot.go
@@ -96,7 +96,7 @@ func RequestNetbootv4(ifname string, timeout time.Duration, retries int, modifie
// ConversationToNetconf extracts network configuration and boot file URL from a
// DHCPv6 4-way conversation and returns them, or an error if any.
func ConversationToNetconf(conversation []dhcpv6.DHCPv6) (*BootConf, error) {
- var advertise, reply, optionsSource *dhcpv6.Message
+ var advertise, reply *dhcpv6.Message
for _, m := range conversation {
switch m.Type() {
case dhcpv6.MessageTypeAdvertise:
@@ -118,21 +118,17 @@ func ConversationToNetconf(conversation []dhcpv6.DHCPv6) (*BootConf, error) {
if u := reply.Options.BootFileURL(); len(u) > 0 {
bootconf.BootfileURL = u
- optionsSource = reply
+ bootconf.BootfileParam = reply.Options.BootFileParam()
} else {
log.Printf("no bootfile URL option found in REPLY, fallback to ADVERTISE's value")
if u := advertise.Options.BootFileURL(); len(u) > 0 {
bootconf.BootfileURL = u
- optionsSource = advertise
+ bootconf.BootfileParam = advertise.Options.BootFileParam()
}
}
if len(bootconf.BootfileURL) == 0 {
return nil, errors.New("no bootfile URL option found")
}
-
- if bootfileParamOption := optionsSource.GetOneOption(dhcpv6.OptionBootfileParam); bootfileParamOption != nil {
- bootconf.BootfileParam = bootfileParamOption.(dhcpv6.OptBootFileParam)
- }
return bootconf, nil
}