From: Alan T. DeKok Date: Fri, 25 Oct 2019 19:57:02 +0000 (-0400) Subject: decode structs, too X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c5fb8ac8490a6bf72276b44e5780b89708daeea;p=thirdparty%2Ffreeradius-server.git decode structs, too --- diff --git a/src/protocols/dhcpv6/decode.c b/src/protocols/dhcpv6/decode.c index cb324e8f60b..2137367591d 100644 --- a/src/protocols/dhcpv6/decode.c +++ b/src/protocols/dhcpv6/decode.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "dhcpv6.h" @@ -85,7 +86,9 @@ static ssize_t decode_value(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_dict_t cons fr_dict_attr_t const *parent, uint8_t const *data, size_t const data_len, void *decoder_ctx) { + ssize_t rcode; VALUE_PAIR *vp; + fr_dict_attr_t const *tlv; switch (parent->type) { default: @@ -103,6 +106,17 @@ static ssize_t decode_value(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_dict_t cons goto raw; } break; + + case FR_TYPE_STRUCT: + rcode = fr_struct_from_network(ctx, cursor, parent, data, data_len, &tlv); + if (rcode < 0) return rcode; + + if (tlv) { + fr_strerror_printf("decode children not implemented"); + return -1; + } + + return data_len; } vp->type = VT_DATA;