]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add test of %dhcpv4.decode / %dhcpv4.encode using root ctx
authorNick Porter <nick@portercomputing.co.uk>
Thu, 16 Oct 2025 12:53:04 +0000 (13:53 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 16 Oct 2025 17:27:33 +0000 (18:27 +0100)
src/tests/keywords/xlat-dhcpv4
src/tests/keywords/xlat-dhcpv4.attrs

index 0996f91f95b68e2676a9ba98e3134a1d64aa1c3e..80306305fe0e9eeadef0ecdad4442cab2a010802 100644 (file)
@@ -50,4 +50,33 @@ if (test_octets != 0x7d1900002458140101010204c0a80101050968656c6c6f2e62696e) {
        test_fail
 }
 
+#
+#  Check decoding and encoding with a root context
+#
+if (%dhcpv4.decode(Vendor-Specific-Options, Decoded-Option-43.Broadband-Forum) != 2) {
+       test_fail
+}
+
+if (Decoded-Option-43.Broadband-Forum.ACS-URL != 'https://1.2.3.4:7547/') {
+       test_fail
+}
+if (Decoded-Option-43.Broadband-Forum.Provisioning-Code != 'test') {
+       test_fail
+}
+
+reply.Decoded-Option-43.Broadband-Forum = {
+       ACS-URL = 'https://example.com/',
+       CWMP-Retry-Minimum-Interval = '10 seconds'
+}
+
+debug_reply
+
+test_octets := %dhcpv4.encode(reply.Decoded-Option-43.Broadband-Forum, Decoded-Option-43.Broadband-Forum)
+
+if (test_octets != 0x011468747470733a2f2F6578616d706C652e636f6D2f030a3130207365636F6e6473) {
+       test_fail
+}
+
+reply -= Decoded-Option-43
+
 success
index 80bf169caaf52676e858f74ada2ba39b40565120..765e509137ea2228565cb7add4d250553eeed9be 100644 (file)
@@ -1,4 +1,5 @@
 Packet-Type = Discover
+Vendor-Specific-Options = 0x011568747470733a2f2f312e322e332e343a373534372f020474657374
 
 Result-Status == success
 Packet-Type == Offer