diff options
Diffstat (limited to 'dhcpv6')
-rw-r--r-- | dhcpv6/dhcpv6.go | 10 | ||||
-rw-r--r-- | dhcpv6/dhcpv6_test.go | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/dhcpv6/dhcpv6.go b/dhcpv6/dhcpv6.go index d82ed4a..9382334 100644 --- a/dhcpv6/dhcpv6.go +++ b/dhcpv6/dhcpv6.go @@ -5,6 +5,8 @@ import ( "fmt" "net" "strings" + + "github.com/insomniacslk/dhcp/iana" ) type DHCPv6 interface { @@ -222,9 +224,11 @@ func IsUsingUEFI(msg DHCPv6) bool { // 9 EFI x86-64 if opt := msg.GetOneOption(OptionClientArchType); opt != nil { optat := opt.(*OptClientArchType) - // TODO investigate if other types are appropriate - if optat.ArchType == EFI_BC || optat.ArchType == EFI_X86_64 { - return true + for _, at := range optat.ArchTypes { + // TODO investigate if other types are appropriate + if at == iana.EFI_BC || at == iana.EFI_X86_64 { + return true + } } } if opt := msg.GetOneOption(OptionUserClass); opt != nil { diff --git a/dhcpv6/dhcpv6_test.go b/dhcpv6/dhcpv6_test.go index 812d284..6840252 100644 --- a/dhcpv6/dhcpv6_test.go +++ b/dhcpv6/dhcpv6_test.go @@ -218,14 +218,14 @@ func TestNewMessageTypeSolicitWithCID(t *testing.T) { func TestIsUsingUEFIArchTypeTrue(t *testing.T) { msg := DHCPv6Message{} - opt := OptClientArchType{ArchType: EFI_BC} + opt := OptClientArchType{ArchTypes: []iana.ArchType{iana.EFI_BC}} msg.AddOption(&opt) require.True(t, IsUsingUEFI(&msg)) } func TestIsUsingUEFIArchTypeFalse(t *testing.T) { msg := DHCPv6Message{} - opt := OptClientArchType{ArchType: INTEL_X86PC} + opt := OptClientArchType{ArchTypes: []iana.ArchType{iana.INTEL_X86PC}} msg.AddOption(&opt) require.False(t, IsUsingUEFI(&msg)) } |