summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_iaaddress_test.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2020-03-06 21:58:45 -0800
committerChris Koch <chrisko@google.com>2020-03-06 22:03:11 -0800
commitf22253b4fdf6b07f3ab92d457ac00c330b9f3470 (patch)
tree1dc75955efe4c32d6b70869bf00ed984c47539e6 /dhcpv6/option_iaaddress_test.go
parent99cbb09fb7b9ed72366e4c3e7def412d8e461539 (diff)
dhcpv6: always write 16-byte IPs
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_iaaddress_test.go')
-rw-r--r--dhcpv6/option_iaaddress_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/dhcpv6/option_iaaddress_test.go b/dhcpv6/option_iaaddress_test.go
index 4db999c..0469caf 100644
--- a/dhcpv6/option_iaaddress_test.go
+++ b/dhcpv6/option_iaaddress_test.go
@@ -43,6 +43,16 @@ func TestOptIAAddressParseInvalidBrokenOptions(t *testing.T) {
require.Error(t, err)
}
+func TestOptIAAddressToBytesDefault(t *testing.T) {
+ want := []byte{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // IP
+ 0, 0, 0, 0, // preferred lifetime
+ 0, 0, 0, 0, // valid lifetime
+ }
+ opt := OptIAAddress{}
+ require.Equal(t, opt.ToBytes(), want)
+}
+
func TestOptIAAddressToBytes(t *testing.T) {
ipBytes := []byte{0x24, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
expected := append(ipBytes, []byte{