]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add foreign encoder to DHCPv6
authorAlan T. DeKok <aland@freeradius.org>
Sun, 28 Jan 2024 17:06:40 +0000 (12:06 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 28 Jan 2024 17:06:40 +0000 (12:06 -0500)
update dictionaries and tests

share/dictionary/dhcpv6/dictionary.rfc7037
src/protocols/dhcpv6/encode.c
src/tests/unit/protocols/radius/foreign.txt

index a040c1c14fb1bac4ba6014041221bece504866f2..9f5d435c2f040e3404b3b3eee2db3a7b1b5ffac9 100644 (file)
@@ -10,4 +10,4 @@
 #
 ##############################################################################
 
-ATTRIBUTE      RADIUS                                  81      octets          # Foreign protocol (RADIUS)
+ATTRIBUTE      RADIUS                                  81      group ref=..RADIUS
index 7472678bf8c7a1d71a136aa09ef64c27a2d26d8d..157cba0cdf86e498c46a9e79b793b03b666d05c9 100644 (file)
@@ -278,6 +278,12 @@ static ssize_t encode_value(fr_dbuff_t *dbuff,
        case FR_TYPE_GROUP:
        {
                fr_dcursor_t child_cursor;
+               fr_dict_attr_t const *ref = fr_dict_attr_ref(vp->da);
+
+               if (ref && (ref->dict != dict_dhcpv6)) {
+                       slen = fr_pair_ref_to_network(&work_dbuff, da_stack, depth, cursor);
+                       break;
+               }
 
                /*
                 *      Encode the child options.
index a8ecc50ad0bd9015f262218c20416f248e055c69..f9286418a45539ca797413511e0744a97ca4fa0d 100644 (file)
@@ -40,6 +40,18 @@ match f5 10 03 00 00 0e 00 00 00 20 00 04 00 00 1a 99
 decode-pair -
 match Extended-Attribute-5 = { DHCPv6-Options = { Rapid-Commit = yes, Information-Refresh-Time = 6809 } }
 
+######################################################################
+#
+#  RADIUS encapsulates DHCPv6, which in turn encapsulates RADIUS
+#
+encode-pair Extended-Attribute-5 = { DHCPv6-Options = { Rapid-Commit = yes, RADIUS = { User-Name = "bob" } } }
+match f5 11 03 00 00 0e 00 00 00 51 00 05 01 05 62 6f 62
+
+#
+#  Not yet
+#
+#decode-pair -
+#match Extended-Attribute-5 = { DHCPv6-Options = { RADIUS = { User-Name = "bob" } } }
 
 ######################################################################
 #
@@ -57,4 +69,4 @@ decode-proto 04ac00edd604040404040404040404040302d700f30303f5040402f50303f504030
 match Packet-Type = Accounting-Request, Packet-Authentication-Vector = 0xd604040404040404040404040302d700, raw.Extended-Attribute-3 = 0x03, raw.Extended-Attribute-5 = 0x0402, raw.Extended-Attribute-5 = 0x03, raw.Extended-Attribute-5 = 0x0303, raw.Extended-Attribute-5 = 0x0402, raw.Extended-Attribute-5 = 0x03, User-Password = "\366\356", raw.Extended-Attribute-3 = 0x03, raw.Extended-Attribute-5 = 0x0402, raw.Extended-Attribute-5 = 0x03, raw.Extended-Attribute-5 = 0x0402, User-Password = "\366\356", raw.Extended-Attribute-3 = 0x03, raw.Extended-Attribute-5 = 0x0402, raw.Extended-Attribute-5 = 0x03, User-Password = "\366\356", raw.Extended-Attribute-3 = 0x03, raw.Extended-Attribute-5 = 0x0402, raw.Extended-Attribute-5 = 0x03, raw.Extended-Attribute-5 = 0x0403, raw.Extended-Attribute-5 = 0x0402, raw.Extended-Attribute-5 = 0x02, raw.214 = 0x0402, User-Password = "\366\356", raw.Extended-Attribute-3 = 0x03, raw.Extended-Attribute-5 = 0x0402, raw.Extended-Attribute-5 = 0x03, User-Password = "\366\356", raw.Extended-Attribute-3 = 0x03, raw.Extended-Attribute-5 = 0x0402, raw.Extended-Attribute-5 = 0x03, Extended-Attribute-5 = { raw.DHCPv4-Options = 0x2a006004040404040404f30303f5040402f50303040202046000f30303f5040402f50303f5040303f5040402f50303040202046000f30303f5040402f50303f5040402020203023d046000f30303f5040303f5030402040404 }, raw.NAS-IP-Address = 0x0404, raw.NAS-IP-Address = 0x0404
 
 count
-match 23
+match 25