]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
structs support "length=uint8"
authorAlan T. DeKok <aland@freeradius.org>
Sat, 25 Feb 2023 14:44:59 +0000 (09:44 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 27 Feb 2023 14:12:25 +0000 (09:12 -0500)
at least the encoder / decoder support it.

doc/antora/modules/reference/pages/dictionary/struct.adoc
src/lib/util/dict_tokenize.c

index 10b33413af7feee1a569100dd72466a6b9bce19c..3dd7e1dba77deb8ac00a3a2bfe0ec1a1b6d0842e 100644 (file)
@@ -47,6 +47,7 @@ Common flags and meanings
 [cols="30%,70%"]
 |=====
 | Name             | Description
+| `length=uint8`  | When encoding or decoding the structure, it is prefixed by a `uint8` field containing the length of the structure.
 | `length=uint16`  | When encoding or decoding the structure, it is prefixed by a `uint16` field containing the length of the structure.
 |=====
 
index d32d0fe2cac00a1baeaf61c259936ce1e671c6ef..93bcc38437b81bdb24d92a1324792108d965ca85 100644 (file)
@@ -1632,13 +1632,18 @@ static int dict_read_process_struct(dict_tokenize_ctx_t *ctx, char **argv, int a
         *      with any other type of length.
         */
        if (argc == 4) {
-               if (strcmp(argv[3], "length=uint16") != 0) {
+               if (strcmp(argv[3], "length=uint16") == 0) {
+                       flags.extra = 1;
+                       flags.subtype = FLAG_LENGTH_UINT16;
+
+               }  else if (strcmp(argv[3], "length=uint8") == 0) {
+                       flags.extra = 1;
+                       flags.subtype = FLAG_LENGTH_UINT8;
+
+               } else {
                        fr_strerror_printf("Unknown option '%s'", argv[3]);
                        return -1;
                }
-
-               flags.extra = 1;
-               flags.subtype = FLAG_LENGTH_UINT16;
        }
 
        /*