diff options
author | Christopher Koch <chrisko@google.com> | 2019-01-10 16:19:02 -0800 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-01-14 23:19:04 +0000 |
commit | 81af01ddbffafdc6904a8092cba3adf92008c715 (patch) | |
tree | 0bccb58f602c9289cdf4893297d579119591f98f /dhcpv4/option_relay_agent_information_test.go | |
parent | 833f274e1aca3b23320f6d31c246c73eefd38974 (diff) |
dhcpv4: change OptionCode to an interface for humanization.
Interface'd OptionCodes can print the correct human string.
It sucks because option codes are just a byte, but depending on where
you use them, they are interpreted differently. BSDP option codes !=
DHCP option codes.
Diffstat (limited to 'dhcpv4/option_relay_agent_information_test.go')
-rw-r--r-- | dhcpv4/option_relay_agent_information_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/dhcpv4/option_relay_agent_information_test.go b/dhcpv4/option_relay_agent_information_test.go index d1aeee2..bb5fae0 100644 --- a/dhcpv4/option_relay_agent_information_test.go +++ b/dhcpv4/option_relay_agent_information_test.go @@ -23,9 +23,9 @@ func TestParseOptRelayAgentInformation(t *testing.T) { opt, err = ParseOptRelayAgentInformation(data) require.NoError(t, err) require.Equal(t, len(opt.Options), 2) - circuit := opt.Options.GetOne(1).(*OptionGeneric) + circuit := opt.Options.GetOne(optionCode(1)).(*OptionGeneric) require.NoError(t, err) - remote := opt.Options.GetOne(2).(*OptionGeneric) + remote := opt.Options.GetOne(optionCode(2)).(*OptionGeneric) require.NoError(t, err) require.Equal(t, circuit.Data, []byte("linux")) require.Equal(t, remote.Data, []byte("boot")) @@ -34,8 +34,8 @@ func TestParseOptRelayAgentInformation(t *testing.T) { func TestParseOptRelayAgentInformationToBytes(t *testing.T) { opt := OptRelayAgentInformation{ Options: Options{ - &OptionGeneric{OptionCode: 1, Data: []byte("linux")}, - &OptionGeneric{OptionCode: 2, Data: []byte("boot")}, + &OptionGeneric{OptionCode: optionCode(1), Data: []byte("linux")}, + &OptionGeneric{OptionCode: optionCode(2), Data: []byte("boot")}, }, } data := opt.ToBytes() |