]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add DHCPv6 test server
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 20 Jan 2021 18:31:00 +0000 (18:31 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 20 Jan 2021 18:35:23 +0000 (18:35 +0000)
src/tests/keywords/dhcpv6.conf [new file with mode: 0644]

diff --git a/src/tests/keywords/dhcpv6.conf b/src/tests/keywords/dhcpv6.conf
new file mode 100644 (file)
index 0000000..07a12bc
--- /dev/null
@@ -0,0 +1,117 @@
+
+modules {
+       $INCLUDE ${raddb}/mods-enabled/always
+
+       $INCLUDE ${raddb}/mods-enabled/expr
+
+       $INCLUDE ${raddb}/mods-enabled/escape
+
+       delay reschedule {
+               force_reschedule = yes
+       }
+
+       delay delay_10s {
+               delay = 10
+       }
+
+       unpack {
+
+       }
+
+}
+
+policy {
+       #
+       #  Outputs the contents of the control list in debugging (-X) mode
+       #
+       debug_control {
+               if("%{debug_attr:control[*]}" == '') {
+                       noop
+               }
+       }
+
+       #
+       #  Outputs the contents of the request list in debugging (-X) mode
+       #
+       debug_request {
+               if("%{debug_attr:request[*]}" == '') {
+                       noop
+               }
+       }
+
+       #
+       #  Outputs the contents of the reply list in debugging (-X) mode
+       #
+       debug_reply {
+               if("%{debug_attr:reply[*]}" == '') {
+                       noop
+               }
+       }
+
+       #
+       #  Outputs the contents of the main lists in debugging (-X) mode
+       #
+       debug_all {
+               debug_control
+               debug_request
+               debug_reply
+       }
+
+       #
+       #  Set the test to successful, but only if there are no failures.
+       #
+       success {
+               if (!&reply.Result-Status) {
+                       update reply {
+                               &Result-Status := "success"
+                       }
+               }
+
+               if (&parent.request.User-Name && !&parent.reply.Result-Status) {
+                       update parent.reply {
+                               &Result-Status := "success"
+                       }
+               }
+       }
+
+       test_fail {
+               update reply {
+                       &Result-Status += "Failure in test at line %{interpreter:...line}"
+               }
+
+               if (&parent.request.User-Name) {
+                       update parent.reply {
+                               &Result-Status += "Failure in test at line %{interpreter:...line}"
+                       }
+               }
+       }
+}
+
+instantiate {
+       #
+       #  Just check that this can be referred to as "virtual_instantiate.post-auth"
+       #
+       load-balance virtual_instantiate {
+               ok
+               ok
+       }
+}
+
+#
+#  Virtual server for the DHCPv6 protocol.
+#
+server default {
+       namespace = dhcpv6
+
+       listen {
+               type = Solicit
+       }
+
+       recv Solicit {
+               #
+               # Include the test file specified by the
+               # KEYWORD environment variable.
+               #
+               $INCLUDE ${keyword}/$ENV{KEYWORD}
+       }
+}