# -*- 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: 85dba0de86ec88d5a8e4558be4decb31cd1bbd9f $
#
#  Test vectors for DHCPv6 protocol
#
proto dhcpv6
proto-dictionary dhcpv6
fuzzer-out dhcpv6

#
#   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 = OPTION_IP4RD_MAP_RULE  |         option-length         |
#   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#  |  prefix4-len  |  prefix6-len  |    ea-len     |W|   Reserved  |
#  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#  |                    rule-ipv4-prefix                           |
#  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#  |                                                               |
#  +                                                               +
#  |                        rule-ipv6-prefix                       |
#  +                                                               +
#  |                                                               |
#  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
#  Figure 8: Encapsulated Option for Mapping-Rule Parameters
#
#  o  option code: 98, encapsulated OPTION_IP4RD_MAP_RULE option (see Section 6)
#  o  option-length: 20
#  o  prefix4-len: number of bits of the Rule IPv4 prefix
#  o  prefix6-len: number of bits of the Rule IPv6 prefix
#  o  ea-len: EA-bits length
#  o  W: WKP authorized, = 1 if set
#  o  rule-ipv4-prefix: Rule IPv4 prefix, left-aligned
#  o  rule-ipv6-prefix: Rule IPv6 prefix, left-aligned
#
encode-pair IP4RD = { IP4RD-Map-Rule.IPv4-Prefix-Len = 16, IP4RD-Map-Rule.IPv6-Prefix-Len = 128, IP4RD-Map-Rule.EA-Len = 4, IP4RD-Map-Rule.WPK-Authorized = 1, IP4RD-Map-Rule.IPv4-Prefix = 0x01020304 }
match 00 61 00 18 00 62 00 14 10 80 04 01 01 02 03 04 00 00 00 00 00 00 00 00 00 00 00 00

#
#  The same as the input, with an added IP4RD-Map-Rule.IPv6-Prefix = 0x00..
#
decode-pair -
match IP4RD = { IP4RD-Map-Rule = { IPv4-Prefix-Len = 16, IPv6-Prefix-Len = 128, EA-Len = 4, WPK-Authorized = 1, IPv4-Prefix = 0x01020304, IPv6-Prefix = 0x000000000000000000000000 } }

#
#  Multiple rules
#
encode-pair IP4RD = { IP4RD-Map-Rule.IPv4-Prefix-Len = 16, IP4RD-Map-Rule.IPv6-Prefix-Len = 128, IP4RD-Map-Rule.EA-Len = 4, IP4RD-Map-Rule.WPK-Authorized = 1, IP4RD-Map-Rule.IPv4-Prefix = 0x01020304, IP4RD-Map-Rule.IPv4-Prefix-Len = 8, IP4RD-Map-Rule.IPv6-Prefix-Len = 0, IP4RD-Map-Rule.EA-Len = 4, IP4RD-Map-Rule.WPK-Authorized = 1, IP4RD-Map-Rule.IPv4-Prefix = 0x7f000001 }
match 00 61 00 30 00 62 00 14 10 80 04 01 01 02 03 04 00 00 00 00 00 00 00 00 00 00 00 00 00 62 00 14 08 00 04 01 7f 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00

decode-pair -
match IP4RD = { IP4RD-Map-Rule = { IPv4-Prefix-Len = 16, IPv6-Prefix-Len = 128, EA-Len = 4, WPK-Authorized = 1, IPv4-Prefix = 0x01020304, IPv6-Prefix = 0x000000000000000000000000 }, IP4RD-Map-Rule = { IPv4-Prefix-Len = 8, IPv6-Prefix-Len = 0, EA-Len = 4, WPK-Authorized = 1, IPv4-Prefix = 0x7f000001, IPv6-Prefix = 0x000000000000000000000000 } }

#
#   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 =OPTION_IP4RD_NON_MAP_RULE|         option-length         |
#  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#  |H|      0    |T| traffic-class |         domain-pmtu           |
#  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
#  Figure 9: Encapsulated Option for Non-Mapping-Rule Parameters of 4rd Domains
#
#  o  option code: 99, encapsulated OPTION_IP4RD_NON_MAP_RULE option (see Section 6)
#  o  option-length: 4
#  o  H: Hub-and-spoke topology (= 1 if Yes)
#  o  T: Traffic Class flag (= 1 if a Tunnel Traffic Class is provided)
#  o  traffic-class: Tunnel Traffic Class
#  o  domain-pmtu: Domain PMTU (at least 1280 octets)
#
#  Means other than DHCPv6 that may prove useful to provide 4rd
#  parameters to CEs are off-scope for this document.  The same or
#  similar parameter formats would, however, be recommended to
#  facilitate training and operation.
#
encode-pair IP4RD-Non-Map-Rule.Traffic-Class-Provided = yes, IP4RD-Non-Map-Rule.Hub-And-Spoke = yes, IP4RD-Non-Map-Rule.Domain-PMTU = 31
match 00 63 00 02 81 1f

decode-pair -
match IP4RD-Non-Map-Rule = { Traffic-Class-Provided = yes, Reserved = 0, Hub-And-Spoke = yes, Domain-PMTU = 31 }

count
match 15
