#  -*- text -*-
#  Copyright (C) 2019 Network RADIUS SARL (legal@networkradius.com)
#  This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0
#
#  Version $Id: e2ef332aa2352a0ca9c78642c3f4bbb8fda6118c $
#
#  Test vectors for DHCPv6 protocol
#
#  Based on https://github.com/the-tcpdump-group/tcpdump/blob/master/tests/dhcpv6-ia-ta.pcap
#

proto dhcpv6
proto-dictionary dhcpv6
fuzzer-out dhcpv6

#
#  1.
#
# [ DHCPv6 Solicit Message ]
#   msgtype   = SOLICIT
#   trid      = 0x28b040
# [ DHCP6 Client Identifier Option ]
#    optcode   = CLIENTID
#    optlen    = 10
#    \duid      \
#     |[ DUID - Based on Link-layer Address ]
#     |  type      = Link-layer Address
#     |  hwtype    = Ethernet (10Mb)
#     |  lladdr    = 00:01:02:03:04:05
# [ DHCP6 Option Request Option ]
#     optcode   = ORO
#     optlen    = 4
#     reqopts   = [DNS Recursive Name Server Option, Domain Search List option]
# [ DHCP6 Elapsed Time Option ]
#      optcode   = ELAPSED_TIME
#      optlen    = 2
#      elapsedtime= 0.00 sec
# [ DHCP6 Identity Association for Temporary Addresses Option ]
#       optcode   = IA_TA
#       optlen    = 4
#       iaid      = 0x2030405
#       \iataopts  \
#
decode-proto 01 28 b0 40 00 01 00 0a 00 03 00 01 00 01 02 03 04 05 00 06 00 04 00 17 00 18 00 08 00 02 00 00 00 04 00 04 02 03 04 05
match Packet-Type = ::Solicit, Transaction-ID = 0x28b040, Client-ID = { DUID = ::LL, DUID.LL = { Hardware-Type = ::Ethernet, Hardware-Type.Ethernet = { Address = 00:01:02:03:04:05 } } }, Option-Request = ::DNS-Servers, Option-Request = ::Domain-List, Elapsed-Time = 0, IA-TA = { IAID = 33752069 }

encode-proto -
match 01 28 b0 40 00 01 00 0a 00 03 00 01 00 01 02 03 04 05 00 06 00 04 00 17 00 18 00 08 00 02 00 00 00 04 00 04 02 03 04 05

#
#  2.
#
# [ DHCPv6 Advertise Message ]
#   msgtype   = ADVERTISE
#   trid      = 0x28b040
# [ DHCP6 Identity Association for Temporary Addresses Option ]
#    optcode   = IA_TA
#    optlen    = 32
#    iaid      = 0x2030405
#    \iataopts  \
#     |[ DHCP6 IA Address Option (IA_TA or IA_NA suboption) ]
#     |  optcode   = IAADDR
#     |  optlen    = 24
#     |  addr      = 2a00:1:1:200:5da2:f920:84c4:88cc
#     |  preflft   = 4500
#     |  validlft  = 7200
#     |  iaaddropts= ''
# [ DHCP6 Client Identifier Option ]
#     optcode   = CLIENTID
#     optlen    = 10
#     \duid      \
#      |[ DUID - Based on Link-layer Address ]
#      |  type      = Link-layer Address
#      |  hwtype    = Ethernet (10Mb)
#      |  lladdr    = 00:01:02:03:04:05
# [ DHCP6 Server Identifier Option ]
#      optcode   = SERVERID
#      optlen    = 14
#      \duid      \
#       |[ DUID - Link-layer address plus time ]
#       |  type      = Link-layer address plus time
#       |  hwtype    = Ethernet (10Mb)
#       |  timeval   = Mon, 26 Nov 2012 15:32:00 -0300 (1353943920)
#       |  lladdr    = 00:11:22:33:44:55
#
decode-proto 02 28 b0 40 00 04 00 20 02 03 04 05 00 05 00 18 2a 00 00 01 00 01 02 00 5d a2 f9 20 84 c4 88 cc 00 00 11 94 00 00 1c 20 00 01 00 0a 00 03 00 01 00 01 02 03 04 05 00 02 00 0e 00 01 00 01 18 46 47 f0 00 11 22 33 44 55
match Packet-Type = ::Advertise, Transaction-ID = 0x28b040, IA-TA = { IAID = 33752069, Options = { IA-Addr = { IPv6-Address = 2a00:1:1:200:5da2:f920:84c4:88cc, Preferred-Lifetime = 4500, Valid-Lifetime = 7200 } } }, Client-ID = { DUID = ::LL, DUID.LL = { Hardware-Type = ::Ethernet, Hardware-Type.Ethernet = { Address = 00:01:02:03:04:05 } } }, Server-ID = { DUID = ::LLT, DUID.LLT = { Hardware-Type = ::Ethernet, Time = "2012-11-26T15:32:00Z", Hardware-Type.Ethernet = { Address = 00:11:22:33:44:55 } } }

encode-proto -
match 02 28 b0 40 00 04 00 20 02 03 04 05 00 05 00 18 2a 00 00 01 00 01 02 00 5d a2 f9 20 84 c4 88 cc 00 00 11 94 00 00 1c 20 00 01 00 0a 00 03 00 01 00 01 02 03 04 05 00 02 00 0e 00 01 00 01 18 46 47 f0 00 11 22 33 44 55

#
#  3.
#
# [ DHCPv6 Request Message ]
#   msgtype   = REQUEST
#   trid      = 0x2b0e45
# [ DHCP6 Client Identifier Option ]
#    optcode   = CLIENTID
#    optlen    = 10
#    \duid      \
#     |[ DUID - Based on Link-layer Address ]
#     |  type      = Link-layer Address
#     |  hwtype    = Ethernet (10Mb)
#     |  lladdr    = 00:01:02:03:04:05
# [ DHCP6 Server Identifier Option ]
#     optcode   = SERVERID
#     optlen    = 14
#     \duid      \
#      |[ DUID - Link-layer address plus time ]
#      |  type      = Link-layer address plus time
#      |  hwtype    = Ethernet (10Mb)
#      |  timeval   = Mon, 26 Nov 2012 15:32:00 -0300 (1353943920)
#      |  lladdr    = 00:11:22:33:44:55
# [ DHCP6 Option Request Option ]
#      optcode   = ORO
#      optlen    = 4
#      reqopts   = [DNS Recursive Name Server Option, Domain Search List option]
# [ DHCP6 Elapsed Time Option ]
#       optcode   = ELAPSED_TIME
#       optlen    = 2
#       elapsedtime= 0.00 sec
# [ DHCP6 Identity Association for Temporary Addresses Option ]
#        optcode   = IA_TA
#        optlen    = 32
#        iaid      = 0x2030405
#        \iataopts  \
#         |[ DHCP6 IA Address Option (IA_TA or IA_NA suboption) ]
#         |  optcode   = IAADDR
#         |  optlen    = 24
#         |  addr      = 2a00:1:1:200:5da2:f920:84c4:88cc
#         |  preflft   = 7200
#         |  validlft  = 7500
#         |  iaaddropts= ''
#
decode-proto 03 2b 0e 45 00 01 00 0a 00 03 00 01 00 01 02 03 04 05 00 02 00 0e 00 01 00 01 18 46 47 f0 00 11 22 33 44 55 00 06 00 04 00 17 00 18 00 08 00 02 00 00 00 04 00 20 02 03 04 05 00 05 00 18 2a 00 00 01 00 01 02 00 5d a2 f9 20 84 c4 88 cc 00 00 1c 20 00 00 1d 4c
match Packet-Type = ::Request, Transaction-ID = 0x2b0e45, Client-ID = { DUID = ::LL, DUID.LL = { Hardware-Type = ::Ethernet, Hardware-Type.Ethernet = { Address = 00:01:02:03:04:05 } } }, Server-ID = { DUID = ::LLT, DUID.LLT = { Hardware-Type = ::Ethernet, Time = "2012-11-26T15:32:00Z", Hardware-Type.Ethernet = { Address = 00:11:22:33:44:55 } } }, Option-Request = ::DNS-Servers, Option-Request = ::Domain-List, Elapsed-Time = 0, IA-TA = { IAID = 33752069, Options = { IA-Addr = { IPv6-Address = 2a00:1:1:200:5da2:f920:84c4:88cc, Preferred-Lifetime = 7200, Valid-Lifetime = 7500 } } }

encode-proto -
match 03 2b 0e 45 00 01 00 0a 00 03 00 01 00 01 02 03 04 05 00 02 00 0e 00 01 00 01 18 46 47 f0 00 11 22 33 44 55 00 06 00 04 00 17 00 18 00 08 00 02 00 00 00 04 00 20 02 03 04 05 00 05 00 18 2a 00 00 01 00 01 02 00 5d a2 f9 20 84 c4 88 cc 00 00 1c 20 00 00 1d 4c

#
#  4.
#
# [ DHCPv6 Reply Message ]
#   msgtype   = REPLY
#   trid      = 0x2b0e45
# [ DHCP6 Identity Association for Temporary Addresses Option ]
#    optcode   = IA_TA
#    optlen    = 32
#    iaid      = 0x2030405
#    \iataopts  \
#     |[ DHCP6 IA Address Option (IA_TA or IA_NA suboption) ]
#     |  optcode   = IAADDR
#     |  optlen    = 24
#     |  addr      = 2a00:1:1:200:5da2:f920:84c4:88cc
#     |  preflft   = 4500
#     |  validlft  = 7200
#     |  iaaddropts= ''
# [ DHCP6 Client Identifier Option ]
#     optcode   = CLIENTID
#     optlen    = 10
#     \duid      \
#      |[ DUID - Based on Link-layer Address ]
#      |  type      = Link-layer Address
#      |  hwtype    = Ethernet (10Mb)
#      |  lladdr    = 00:01:02:03:04:05
# [ DHCP6 Server Identifier Option ]
#      optcode   = SERVERID
#      optlen    = 14
#      \duid      \
#       |[ DUID - Link-layer address plus time ]
#       |  type      = Link-layer address plus time
#       |  hwtype    = Ethernet (10Mb)
#       |  timeval   = Mon, 26 Nov 2012 15:32:00 -0300 (1353943920)
#       |  lladdr    = 00:11:22:33:44:55
#
decode-proto 07 2b 0e 45 00 04 00 20 02 03 04 05 00 05 00 18 2a 00 00 01 00 01 02 00 5d a2 f9 20 84 c4 88 cc 00 00 11 94 00 00 1c 20 00 01 00 0a 00 03 00 01 00 01 02 03 04 05 00 02 00 0e 00 01 00 01 18 46 47 f0 00 11 22 33 44 55
match Packet-Type = ::Reply, Transaction-ID = 0x2b0e45, IA-TA = { IAID = 33752069, Options = { IA-Addr = { IPv6-Address = 2a00:1:1:200:5da2:f920:84c4:88cc, Preferred-Lifetime = 4500, Valid-Lifetime = 7200 } } }, Client-ID = { DUID = ::LL, DUID.LL = { Hardware-Type = ::Ethernet, Hardware-Type.Ethernet = { Address = 00:01:02:03:04:05 } } }, Server-ID = { DUID = ::LLT, DUID.LLT = { Hardware-Type = ::Ethernet, Time = "2012-11-26T15:32:00Z", Hardware-Type.Ethernet = { Address = 00:11:22:33:44:55 } } }

encode-proto -
match 07 2b 0e 45 00 04 00 20 02 03 04 05 00 05 00 18 2a 00 00 01 00 01 02 00 5d a2 f9 20 84 c4 88 cc 00 00 11 94 00 00 1c 20 00 01 00 0a 00 03 00 01 00 01 02 03 04 05 00 02 00 0e 00 01 00 01 18 46 47 f0 00 11 22 33 44 55

count
match 19
