From 75515b1ef65bc3ce228bcd6ba5775bfc2e8b49b1 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Sun, 19 Dec 2021 08:18:45 -0500 Subject: [PATCH] encode / decode STRUCT too the same as TLV, because we don't have packed-structures in the internal protocol. And the internal protocol doesn't use protocol-specific encodings. It uses the internal encodings --- src/protocols/internal/decode.c | 5 +++++ src/protocols/internal/encode.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/protocols/internal/decode.c b/src/protocols/internal/decode.c index 26f6d92f12..2e9153fc29 100644 --- a/src/protocols/internal/decode.c +++ b/src/protocols/internal/decode.c @@ -316,8 +316,13 @@ static ssize_t internal_decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dic /* * Structural types + * + * STRUCTs are encoded as TLVs, because the struct + * packing only applies to the original protocol, and not + * to our internal encoding. */ case FR_TYPE_TLV: + case FR_TYPE_STRUCT: if (unlikely(tainted)) goto bad_tainted; slen = internal_decode_tlv(ctx, out, da, &work_dbuff, decode_ctx); diff --git a/src/protocols/internal/encode.c b/src/protocols/internal/encode.c index 04ecfca51a..138ce1be24 100644 --- a/src/protocols/internal/encode.c +++ b/src/protocols/internal/encode.c @@ -154,8 +154,13 @@ static ssize_t internal_encode(fr_dbuff_t *dbuff, /* * Children of TLVs are encoded in the context * of the TLV. + * + * STRUCTs are encoded as TLVs, because the struct + * packing only applies to the original protocol, and not + * to our internal encoding. */ case FR_TYPE_TLV: + case FR_TYPE_STRUCT: /* * We've done the complete stack. * Hopefully this TLV has some -- 2.47.2