diff options
author | Sean Karlage <skarlage@fb.com> | 2018-08-11 14:30:48 -0700 |
---|---|---|
committer | Sean Karlage <skarlage@fb.com> | 2018-08-11 14:32:26 -0700 |
commit | 8ea2525c898436a2a935580de67727bbe7035c85 (patch) | |
tree | 69d35d17c238feabb07ef07a907aae5520104911 /netboot | |
parent | 2b05c7d03724d31529886d98f738499ac06ead7e (diff) | |
parent | a6212f1f72e94821a29894fb66656a981bd035d0 (diff) |
Merge branch 'master' into dhcpv4-moar-tests
Diffstat (limited to 'netboot')
-rw-r--r-- | netboot/netboot.go | 8 | ||||
-rw-r--r-- | netboot/netconf.go | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/netboot/netboot.go b/netboot/netboot.go index 97a3240..81ba144 100644 --- a/netboot/netboot.go +++ b/netboot/netboot.go @@ -50,7 +50,7 @@ func ConversationToNetconf(conversation []dhcpv6.DHCPv6) (*NetConf, string, erro var reply dhcpv6.DHCPv6 for _, m := range conversation { // look for a REPLY - if m.Type() == dhcpv6.REPLY { + if m.Type() == dhcpv6.MessageTypeReply { reply = m break } @@ -67,14 +67,14 @@ func ConversationToNetconf(conversation []dhcpv6.DHCPv6) (*NetConf, string, erro opt dhcpv6.Option bootfile string ) - opt = reply.GetOneOption(dhcpv6.OPT_BOOTFILE_URL) + opt = reply.GetOneOption(dhcpv6.OptionBootfileURL) if opt == nil { log.Printf("no bootfile URL option found in REPLY, looking for it in ADVERTISE") // as a fallback, look for bootfile URL in the advertise var advertise dhcpv6.DHCPv6 for _, m := range conversation { // look for an ADVERTISE - if m.Type() == dhcpv6.ADVERTISE { + if m.Type() == dhcpv6.MessageTypeAdvertise { advertise = m break } @@ -82,7 +82,7 @@ func ConversationToNetconf(conversation []dhcpv6.DHCPv6) (*NetConf, string, erro if advertise == nil { return nil, "", errors.New("no ADVERTISE found") } - opt = advertise.GetOneOption(dhcpv6.OPT_BOOTFILE_URL) + opt = advertise.GetOneOption(dhcpv6.OptionBootfileURL) if opt == nil { return nil, "", errors.New("no bootfile URL option found in ADVERTISE") } diff --git a/netboot/netconf.go b/netboot/netconf.go index f7a117c..84fb263 100644 --- a/netboot/netconf.go +++ b/netboot/netconf.go @@ -30,7 +30,7 @@ type NetConf struct { // GetNetConfFromPacketv6 extracts network configuration information from a DHCPv6 // Reply packet and returns a populated NetConf structure func GetNetConfFromPacketv6(d *dhcpv6.DHCPv6Message) (*NetConf, error) { - opt := d.GetOneOption(dhcpv6.OPTION_IA_NA) + opt := d.GetOneOption(dhcpv6.OptionIANA) if opt == nil { return nil, errors.New("No option IA NA found") } @@ -39,7 +39,7 @@ func GetNetConfFromPacketv6(d *dhcpv6.DHCPv6Message) (*NetConf, error) { oiana := opt.(*dhcpv6.OptIANA) iaaddrs := make([]*dhcpv6.OptIAAddress, 0) for _, o := range oiana.Options { - if o.Code() == dhcpv6.OPTION_IAADDR { + if o.Code() == dhcpv6.OptionIAAddr { iaaddrs = append(iaaddrs, o.(*dhcpv6.OptIAAddress)) } } @@ -55,7 +55,7 @@ func GetNetConfFromPacketv6(d *dhcpv6.DHCPv6Message) (*NetConf, error) { }) } // get DNS configuration - opt = d.GetOneOption(dhcpv6.DNS_RECURSIVE_NAME_SERVER) + opt = d.GetOneOption(dhcpv6.OptionDNSRecursiveNameServer) if opt == nil { return nil, errors.New("No option DNS Recursive Name Servers found ") } @@ -63,7 +63,7 @@ func GetNetConfFromPacketv6(d *dhcpv6.DHCPv6Message) (*NetConf, error) { // TODO should this be copied? netconf.DNSServers = odnsserv.NameServers - opt = d.GetOneOption(dhcpv6.DOMAIN_SEARCH_LIST) + opt = d.GetOneOption(dhcpv6.OptionDomainSearchList) if opt == nil { return nil, errors.New("No option DNS Domain Search List found") } |