From: Jorge Pereira Date: Tue, 29 Oct 2019 00:49:42 +0000 (-0300) Subject: Add tests for DHCPv6 / rfc3315 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3926072b0b41a70cebfa5bc9cb370fd55735371e;p=thirdparty%2Ffreeradius-server.git Add tests for DHCPv6 / rfc3315 --- diff --git a/src/tests/unit/all.mk b/src/tests/unit/all.mk index 9420023b2f0..5a58b930e4a 100644 --- a/src/tests/unit/all.mk +++ b/src/tests/unit/all.mk @@ -30,8 +30,9 @@ FILES := \ eap_sim_error.txt \ dhcpv4.txt \ dhcpv6.txt \ - dhcpv6_rfc3646.txt \ + dhcpv6_rfc3315.txt \ dhcpv6_rfc3319.txt \ + dhcpv6_rfc3646.txt \ regex.txt \ escape.txt \ condition.txt \ diff --git a/src/tests/unit/dhcpv6_rfc3315.txt b/src/tests/unit/dhcpv6_rfc3315.txt new file mode 100644 index 00000000000..6ae82b34a1d --- /dev/null +++ b/src/tests/unit/dhcpv6_rfc3315.txt @@ -0,0 +1,155 @@ +# +# Test vectors for DHCPv6 protocol +# +load dhcpv6 +dictionary-load dhcpv6 + +# +# Encoding an option header: +# +# 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 +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# | OPTION_CLIENTID | option-len | +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# + +# +# @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 +# +# 9.2. DUID Based on Link-layer Address Plus Time [DUID-LLT] +# +# The following diagram illustrates the format of a DUID-LLT: +# +# 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 +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# | 1 | hardware type (16 bits) | +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# | time (32 bits) | +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# . . +# . link-layer address (variable length) . +# . . +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# + +# +# Client Identifier +# + +# Define the DUID-LLT + DUID +encode-pair Client-ID-DUID = Client-ID-DUID-LLT, Client-ID-DUID-LLT-Hardware-Type = 1, Client-ID-DUID-LLT-Time = "Jan 1 1970 12:00:00 UTC", Client-ID-DUID-LLT-Ethernet-Address = aa:bb:cc:dd:ee:ff +match 00 01 00 0e 00 01 00 01 00 00 a8 c0 aa bb cc dd ee ff + +decode-pair - +match Client-ID-DUID = Client-ID-DUID-LLT, Client-ID-DUID-LLT-Hardware-Type = Client-ID-DUID-LLT-Ethernet, Client-ID-DUID-LLT-Time = "Jan 1 1970 12:00:00 UTC", Client-ID-DUID-LLT-Ethernet-Address = aa:bb:cc:dd:ee:ff + +# +# Server Identifier +# + +# Define the DUID-LLT + DUID +encode-pair Server-ID-DUID = Server-ID-DUID-LLT, Server-ID-DUID-LLT-Hardware-Type = 3, Server-ID-DUID-LLT-Time = "Jan 1 1970 12:00:00 UTC", Server-ID-DUID-LLT-Link-Layer-Address = 0xc0ffeec0ffee +match 00 02 00 0e 00 01 00 03 00 00 a8 c0 c0 ff ee c0 ff ee + +decode-pair - +match Server-ID-DUID = Server-ID-DUID-LLT, Server-ID-DUID-LLT-Hardware-Type = 3, Server-ID-DUID-LLT-Time = "Jan 1 1970 12:00:00 UTC", Server-ID-DUID-LLT-Link-Layer-Address = 0xc0ffeec0ffee + +# +# 9.3. DUID Assigned by Vendor Based on Enterprise Number [DUID-EN] +# +# 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 +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# | 2 | enterprise-number | +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# | enterprise-number (contd) | | +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | +# . identifier . +# . (variable length) . +# . . +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# + +# +# Client Identifier +# + +# Define the DUID-EN + DUID +encode-pair Client-ID-DUID = Client-ID-DUID-EN, Client-ID-DUID-EN-Enterprise-Number = 11344, Client-ID-DUID-EN-Identifier = 0xaabbccddeeff +match 00 01 00 0c 00 02 00 00 2c 50 aa bb cc dd ee ff + +decode-pair - +match Client-ID-DUID = Client-ID-DUID-EN, Client-ID-DUID-EN-Enterprise-Number = 11344, Client-ID-DUID-EN-Identifier = 0xaabbccddeeff + +# +# Server Identifier +# + +# Define the DUID-EN + DUID +encode-pair Server-ID-DUID = Server-ID-DUID-EN, Server-ID-DUID-EN-Enterprise-Number = 11344, Server-ID-DUID-EN-Identifier = 0xc0ffeec0ffee +match 00 02 00 0c 00 02 00 00 2c 50 c0 ff ee c0 ff ee + +decode-pair - +match Server-ID-DUID = Server-ID-DUID-EN, Server-ID-DUID-EN-Enterprise-Number = 11344, Server-ID-DUID-EN-Identifier = 0xc0ffeec0ffee + +# +# 9.4. DUID Based on Link-layer Address [DUID-LL] +# +# 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 +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# | 3 | hardware type (16 bits) | +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# . . +# . link-layer address (variable length) . +# . . +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +# + +# +# Client Identifier +# + +# Define the DUID-LL + DUID +encode-pair Client-ID-DUID = Client-ID-DUID-LL, Client-ID-DUID-LL-Hardware-Type = 2, Client-ID-DUID-LL-Address = 0xaabbccddeeff +match 00 01 00 0a 00 03 00 02 aa bb cc dd ee ff + +decode-pair - +match Client-ID-DUID = Client-ID-DUID-LL, Client-ID-DUID-LL-Hardware-Type = 2, Client-ID-DUID-LL-Address = 0xaabbccddeeff + +# +# Server Identifier +# + +# Define the DUID-LL + DUID +encode-pair Server-ID-DUID = Server-ID-DUID-LL, Server-ID-DUID-LL-Hardware-Type = 2, Server-ID-DUID-LL-Address = 0xd34d00c0ffee +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