#  -*- 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: ede549ef2a7be2e8fa1bb6b559a63afcffdfc665 $
#
#  Test vectors for RADIUS protocol
#
#  Based on https://github.com/the-tcpdump-group/tcpdump/blob/master/tests/RADIUS-RFC3162.pcap
#

proto radius
proto-dictionary radius
fuzzer-out radius

#
#  one byte is too short for reserved + prefix
#
decode-pair 61 03 00
match raw.Framed-IPv6-Prefix = 0x00

#
#  This is 0/0
#
decode-pair 61 04 00 00
match Framed-IPv6-Prefix = ::/0

#
#  Omitting bytes outside of the prefix length
#
decode-pair 61 0c 00 40 20 01 0d b8 0a 0b 12 f0
match Framed-IPv6-Prefix = 2001:db8:a0b:12f0::/64

#
#  Same as above, but the trailing bytes are zero.
#
decode-pair 61 14 00 40 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 00
match Framed-IPv6-Prefix = 2001:db8:a0b:12f0::/64

#
#  trailing bytes outside of the prefix exist, but are not zero
#
decode-pair 61 14 00 40 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 01
match raw.Framed-IPv6-Prefix = 0x004020010db80a0b12f00000000000000001

#
#  1.
#
# [ RADIUS ]
#   code      = Access-Request
#   id        = 240
#   len       = 141
#   authenticator= 2afdb090418ac6365298fbbb15e0fd2e
#   \attributes\
#    |[ Radius Attribute ]
#    |  type      = User-Name
#    |  len       = 5
#    |  value     = 'bob'
#    |[ Radius Attribute ]
#    |  type      = User-Password
#    |  len       = 18
#    |  value     = 'E\xe8\xd5\xda\xea\xd8~@\x15\xe0\xfc\xc0\xec\x0f\x08\xa1'
#    |[ Radius Attribute ]
#    |  type      = NAS-IPv6-Address
#    |  len       = 18
#    |  value     = ' \x01\r\xb8\n\x0b\x12\xf0\x00\x00\x00\x00\x00\x00\x00\x01'
#    |[ Radius Attribute ]
#    |  type      = Framed-IPv6-Prefix
#    |  len       = 20
#    |  value     = '\x00@ \x01\r\xb8\n\x0b\x12\xf0\x00\x00\x00\x00\x00\x00\x00\x00'
#    |[ Radius Attribute ]
#    |  type      = Framed-IPv6-Prefix
#    |  len       = 12
#    |  value     = '\x00@ \x01\r\xb8\n\x0b\x12\xf0'
#    |[ Radius Attribute ]
#    |  type      = Framed-IPv6-Prefix
#    |  len       = 4
#    |  value     = '\x00\x00'
#    |[ Radius Attribute ]
#    |  type      = Framed-IPv6-Prefix
#    |  len       = 3
#    |  value     = '\x00'
#    |[ Radius Attribute ]
#    |  type      = Framed-IPv6-Prefix
#    |  len       = 21
#    |  value     = '\x00@ \x01\r\xb8\n\x0b\x12\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00'
#    |[ Radius Attribute ]
#    |  type      = Framed-IPv6-Prefix
#    |  len       = 20
#    |  value     = '\x00\x81 \x01\r\xb8\n\x0b\x12\xf0\x00\x00\x00\x00\x00\x00\x00\x01'
#
decode-proto 01 f0 00 8d 2a fd b0 90 41 8a c6 36 52 98 fb bb 15 e0 fd 2e 01 05 62 6f 62 02 12 45 e8 d5 da ea d8 7e 40 15 e0 fc c0 ec 0f 08 a1 5f 12 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 01 61 14 00 40 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 00 61 0c 00 40 20 01 0d b8 0a 0b 12 f0 61 04 00 00 61 03 00 61 15 00 40 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 00 00 61 14 00 81 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 01
match Packet-Type = ::Access-Request, Packet-Authentication-Vector = 0x2afdb090418ac6365298fbbb15e0fd2e, User-Name = "bob", User-Password = "\323\006\334\020\236\%\004Z\005\246\373\344\354\033\212*", NAS-IPv6-Address = 2001:db8:a0b:12f0::1, Framed-IPv6-Prefix = 2001:db8:a0b:12f0::/64, Framed-IPv6-Prefix = 2001:db8:a0b:12f0::/64, Framed-IPv6-Prefix = ::/0, raw.Framed-IPv6-Prefix = 0x00, raw.Framed-IPv6-Prefix = 0x004020010db80a0b12f0000000000000000000, raw.Framed-IPv6-Prefix = 0x008120010db80a0b12f00000000000000001
encode-proto -
match 01 00 00 85 2a fd b0 90 41 8a c6 36 52 98 fb bb 15 e0 fd 2e 01 05 62 6f 62 02 12 fe 8b 65 a6 1b fd 7a 1a 10 46 07 24 00 14 82 8b 5f 12 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 01 61 0c 00 40 20 01 0d b8 0a 0b 12 f0 61 0c 00 40 20 01 0d b8 0a 0b 12 f0 61 04 00 00 61 03 00 61 15 00 40 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 00 00 61 14 00 81 20 01 0d b8 0a 0b 12 f0 00 00 00 00 00 00 00 01

decode-proto -
match Packet-Type = ::Access-Request, Packet-Authentication-Vector = 0x2afdb090418ac6365298fbbb15e0fd2e, User-Name = "bob", User-Password = "hello", NAS-IPv6-Address = 2001:db8:a0b:12f0::1, Framed-IPv6-Prefix = 2001:db8:a0b:12f0::/64, Framed-IPv6-Prefix = 2001:db8:a0b:12f0::/64, Framed-IPv6-Prefix = ::/0, raw.Framed-IPv6-Prefix = 0x00, raw.Framed-IPv6-Prefix = 0x004020010db80a0b12f0000000000000000000, raw.Framed-IPv6-Prefix = 0x008120010db80a0b12f00000000000000001

count
match 19
