]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Changed DHCPv4 Authentication (90) to struct and added test (#4425)
authorJames Jones <jejones3141@gmail.com>
Mon, 21 Mar 2022 21:09:01 +0000 (16:09 -0500)
committerGitHub <noreply@github.com>
Mon, 21 Mar 2022 21:09:01 +0000 (17:09 -0400)
Co-authored-by: Alan DeKok <aland@freeradius.org>
share/dictionary/dhcpv4/dictionary
share/dictionary/dhcpv4/dictionary.rfc2131
share/dictionary/dhcpv4/dictionary.rfc3118 [new file with mode: 0644]
src/tests/unit/protocols/dhcpv4/rfc3118.txt [new file with mode: 0644]

index 494370a5d4d5adea9a38e31494be52bf4928b9f5..d6b112f454aa1d86c06841a89c071f11fa61502f 100644 (file)
@@ -26,6 +26,7 @@ $INCLUDE dictionary.rfc2131
 $INCLUDE dictionary.rfc2241
 $INCLUDE dictionary.rfc2610
 $INCLUDE dictionary.rfc3004
+$INCLUDE dictionary.rfc3118
 $INCLUDE dictionary.rfc3397
 $INCLUDE dictionary.rfc3442
 $INCLUDE dictionary.rfc4280
index a3a7e0f89a46ef6c15d49922be1fba0bbc7bbda2..94839a6cb8d5ef72be8ba8261291a493fc9bcdd5 100644 (file)
@@ -170,9 +170,6 @@ ATTRIBUTE   Server-Identifier-Override              82.11   ipaddr
 # Internet Storage Name Service
 ATTRIBUTE      iSNS                                    83      octets
 
-# Authentication
-ATTRIBUTE      Authentication                          90      octets
-
 ATTRIBUTE      Client-Last-Transaction-Time            91      uint32 # seconds on the past
 
 ATTRIBUTE      associated-ip                           92      ipaddr array
diff --git a/share/dictionary/dhcpv4/dictionary.rfc3118 b/share/dictionary/dhcpv4/dictionary.rfc3118
new file mode 100644 (file)
index 0000000..254dcce
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- text -*-
+# Copyright (C) 2022 The FreeRADIUS Server project and contributors
+# This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0
+# Version $Id$
+##############################################################################
+#
+#  RFC3118 - Authentication for DHCP Messages
+#
+#  $Id$
+#
+##############################################################################
+
+# Authentication
+ATTRIBUTE       Authentication                          90      struct
+MEMBER          Protocol                        uint8
+MEMBER          Algorithm                       uint8
+MEMBER          RDM                             uint8
+MEMBER          Replay-Detection                uint64
+MEMBER          Authentication-Information      octets
diff --git a/src/tests/unit/protocols/dhcpv4/rfc3118.txt b/src/tests/unit/protocols/dhcpv4/rfc3118.txt
new file mode 100644 (file)
index 0000000..a87ddd6
--- /dev/null
@@ -0,0 +1,18 @@
+#
+#  Test vectors for DHCP attributes
+#
+proto dhcpv4
+proto-dictionary dhcpv4
+fuzzer-out dhcpv4
+
+#
+# Authentication
+#
+encode-pair Authentication = { Protocol = 1, Algorithm = 2, RDM = 32, Replay-Detection = 0, Authentication-Information = "123456789a123456789a123456789a"  }
+match 5a 29 01 02 20 00 00 00 00 00 00 00 00 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61
+
+decode-pair -
+match Authentication = { Protocol = 1, Algorithm = 2, RDM = 32, Replay-Detection = 0, Authentication-Information = 0x313233343536373839613132333435363738396131323334353637383961 }
+
+count
+match 7