summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_iaprefix_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/option_iaprefix_test.go')
-rw-r--r--dhcpv6/option_iaprefix_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/dhcpv6/option_iaprefix_test.go b/dhcpv6/option_iaprefix_test.go
index caabc75..0f37214 100644
--- a/dhcpv6/option_iaprefix_test.go
+++ b/dhcpv6/option_iaprefix_test.go
@@ -50,3 +50,15 @@ func TestOptIAPrefixToBytes(t *testing.T) {
t.Fatalf("Invalid ToBytes result. Expected %v, got %v", expected, toBytes)
}
}
+
+func TestOptIAPrefixParseInvalidTooShort(t *testing.T) {
+ buf := []byte{
+ 0xaa, 0xbb, 0xcc, 0xdd, // preferredLifetime
+ 0xee, 0xff, 0x00, 0x11, // validLifetime
+ 36, // prefixLength
+ 0, 0, 0, 0, 0, 0, 0, // truncated ipv6Prefix
+ }
+ if opt, err := ParseOptIAPrefix(buf); err == nil {
+ t.Fatalf("ParseOptIAPrefix: Expected error on truncated option, got %v", opt)
+ }
+}