From: Alan T. DeKok Date: Tue, 29 Oct 2019 01:44:15 +0000 (-0400) Subject: move tests around and add some more tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b9554103f9d9b515c2d3e1aeacfa7b9f33a8a7a;p=thirdparty%2Ffreeradius-server.git move tests around and add some more tests --- diff --git a/src/tests/unit/dhcpv6.txt b/src/tests/unit/dhcpv6.txt index f399bcc1f07..86c53027c6a 100644 --- a/src/tests/unit/dhcpv6.txt +++ b/src/tests/unit/dhcpv6.txt @@ -179,18 +179,6 @@ match 00 21 00 22 03 77 77 77 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 03 66 74 70 encode-pair BCMCS-Server-Domain-Name-List = "www.example.com", BCMCS-Server-Domain-Name-List = "ftp.example.com", BCMCS-Server-Domain-Name-List = "ns.example.com" match 00 21 00 32 03 77 77 77 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 03 66 74 70 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 02 6e 73 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 -encode-pair Client-ID-DUID = Client-ID-DUID-UUID, Client-ID-DUID-UUID-Value = 0x000102030405060708090a0b0c0d0e0f -match 00 01 00 12 00 04 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f - -# -# UUID-Value field is 16 octets. So we truncate if if it's too long, and pad it with zeros if it's too short. -# -encode-pair Client-ID-DUID = Client-ID-DUID-UUID, Client-ID-DUID-UUID-Value = 0x000102030405060708090a0b0c0d0e0f1112 -match 00 01 00 12 00 04 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f - -encode-pair Client-ID-DUID = Client-ID-DUID-UUID, Client-ID-DUID-UUID-Value = 0x000102030405060708090a0b0c0d -match 00 01 00 12 00 04 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 00 00 - # # Microsoft VSAs. We have no idea what the contents are, and the documentation doesn't say. # @@ -200,4 +188,4 @@ encode-pair Microsoft-Rogue-Detection-Request = 0x00 match 00 11 00 09 00 00 01 37 00 5e 00 01 00 count -match 88 +match 82 diff --git a/src/tests/unit/dhcpv6_rfc3315.txt b/src/tests/unit/dhcpv6_rfc3315.txt index 6ae82b34a1d..be66c785483 100644 --- a/src/tests/unit/dhcpv6_rfc3315.txt +++ b/src/tests/unit/dhcpv6_rfc3315.txt @@ -14,32 +14,7 @@ dictionary-load dhcpv6 # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # -# -# @rfc6355 -# -# 4. DUID-UUID Format -# -# The DUID-UUID is carried within Client Identifier or Server -# Identifier options. It has the following format: -# -# 0 1 2 3 -# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -# | DUID-Type (4) | UUID (128 bits) | -# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | -# | | -# | | -# | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -# | | -# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- -# -# Figure 1: DUID-UUID Format -# -# DUID-Type - DUID-UUID (4) - (16 bits) -# UUID - An [RFC4122] UUID (128 bits) - -# -# @rfc3315 +# From RFC 3315 # # 9.2. DUID Based on Link-layer Address Plus Time [DUID-LLT] # @@ -153,3 +128,6 @@ match 00 02 00 0a 00 03 00 02 d3 4d 00 c0 ff ee decode-pair - match Server-ID-DUID = Server-ID-DUID-LL, Server-ID-DUID-LL-Hardware-Type = 2, Server-ID-DUID-LL-Address = 0xd34d00c0ffee + +count +match 26 diff --git a/src/tests/unit/dhcpv6_rfc6355.txt b/src/tests/unit/dhcpv6_rfc6355.txt index 05705498048..017ac2ac683 100644 --- a/src/tests/unit/dhcpv6_rfc6355.txt +++ b/src/tests/unit/dhcpv6_rfc6355.txt @@ -47,3 +47,26 @@ match 00 01 00 02 00 04 decode-pair - match Client-ID-DUID = Client-ID-DUID-UUID + +# Encode a 16-octet UUID +encode-pair Client-ID-DUID = Client-ID-DUID-UUID, Client-ID-DUID-UUID-Value = 0x000102030405060708090a0b0c0d0e0f +match 00 01 00 12 00 04 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f + +# UUID-Value field is 16 octets. So we truncate if if it's too long, and pad it with zeros if it's too short. +encode-pair Client-ID-DUID = Client-ID-DUID-UUID, Client-ID-DUID-UUID-Value = 0x000102030405060708090a0b0c0d0e0f1112 +match 00 01 00 12 00 04 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f + +# But if we decode something that's too long, we ignore the extra data +decode-pair - +match Client-ID-DUID = Client-ID-DUID-UUID, Client-ID-DUID-UUID-Value = 0x000102030405060708090a0b0c0d0e0f + +# Or we pad the UUID to 16 octets if it's too short +encode-pair Client-ID-DUID = Client-ID-DUID-UUID, Client-ID-DUID-UUID-Value = 0x000102030405060708090a0b0c0d +match 00 01 00 12 00 04 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 00 00 + +# And if we see something that's too short, we get a bad attribute. +decode-pair 00 01 00 10 00 04 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d +match Client-ID-DUID = Client-ID-DUID-UUID, Attr-1.1.4 = 0x000102030405060708090a0b0c0d + +count +match 16