From: Alan T. DeKok Date: Sat, 25 Feb 2023 14:44:59 +0000 (-0500) Subject: structs support "length=uint8" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1d1a8ffb8e7512755411e0bb7cd98c2f067875f;p=thirdparty%2Ffreeradius-server.git structs support "length=uint8" at least the encoder / decoder support it. --- diff --git a/doc/antora/modules/reference/pages/dictionary/struct.adoc b/doc/antora/modules/reference/pages/dictionary/struct.adoc index 10b33413af7..3dd7e1dba77 100644 --- a/doc/antora/modules/reference/pages/dictionary/struct.adoc +++ b/doc/antora/modules/reference/pages/dictionary/struct.adoc @@ -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. |===== diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index d32d0fe2cac..93bcc38437b 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -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; } /*