From b00e546d76a019d44f98ad6210cefe7e6b62a600 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Tue, 19 Aug 2025 16:36:34 -0400 Subject: [PATCH] a union closes its parent struct for now, unions are all at the end of a struct --- src/lib/util/dict_tokenize.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 73a8399d5a..42ed7bc3a3 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -2355,8 +2355,21 @@ static int dict_read_process_member(dict_tokenize_ctx_t *dctx, char **argv, int goto error; } } + + /* + * TLVs are variable sized, and close the parent struct. + */ + CURRENT_FRAME(dctx)->struct_is_closed = da; } + /* + * Unions close the parent struct, even if they're fixed size. For now, the struct to/from + * network code assumes that a union is the last member of a structure. + */ + if (da->type == FR_TYPE_UNION) { + CURRENT_FRAME(dctx)->struct_is_closed = da; + } + if (unlikely(dict_attr_num_init(da, ++CURRENT_FRAME(dctx)->member_num) < 0)) goto error; if (unlikely(dict_attr_finalise(&da, argv[0]) < 0)) goto error; -- 2.47.3