Skip to content

Commit

Permalink
Revert "always call fr_pair_tlvs_from_network() as nested"
Browse files Browse the repository at this point in the history
This reverts commit 53d37c2.
  • Loading branch information
alandekok committed Sep 5, 2023
1 parent 8fef9f8 commit 8726e54
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/protocols/dhcpv6/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ static ssize_t decode_value(TALLOC_CTX *ctx, fr_pair_list_t *out,
return data_len;

case FR_TYPE_GROUP:
vp = fr_pair_afrom_da(ctx, parent);
if (!vp) return PAIR_DECODE_OOM;

/*
* Child VPs go into the child group, not in the
* main parent list. We start decoding
Expand All @@ -191,9 +194,12 @@ static ssize_t decode_value(TALLOC_CTX *ctx, fr_pair_list_t *out,
* header, as we're just decoding the values
* here.
*/
slen = fr_pair_tlvs_from_network(ctx, out, fr_dict_root(dict_dhcpv6), data, data_len, decode_ctx, decode_option, NULL, true);
if (slen < 0) goto raw;
return data_len;
slen = fr_pair_tlvs_from_network(vp, &vp->vp_group, fr_dict_root(dict_dhcpv6), data, data_len, decode_ctx, decode_option, NULL, false);
if (slen < 0) {
talloc_free(vp);
return slen;
}
break;

case FR_TYPE_IPV6_ADDR:
vp = fr_pair_afrom_da(ctx, parent);
Expand Down Expand Up @@ -285,7 +291,7 @@ static ssize_t decode_vsa(TALLOC_CTX *ctx, fr_pair_list_t *out,

FR_PROTO_TRACE("decode context %s -> %s", parent->name, da->name);

return fr_pair_tlvs_from_network(ctx, out, da, data + 4, data_len - 4, decode_ctx, decode_option, NULL, true);
return fr_pair_tlvs_from_network(ctx, out, da, data + 4, data_len - 4, decode_ctx, decode_option, NULL, false);
}

static ssize_t decode_option(TALLOC_CTX *ctx, fr_pair_list_t *out,
Expand Down Expand Up @@ -358,7 +364,7 @@ static ssize_t decode_option(TALLOC_CTX *ctx, fr_pair_list_t *out,
slen = decode_vsa(ctx, out, da, data + 4, len, decode_ctx);

} else if (da->type == FR_TYPE_TLV) {
slen = fr_pair_tlvs_from_network(ctx, out, da, data + 4, len, decode_ctx, decode_option, NULL, true);
slen = fr_pair_tlvs_from_network(ctx, out, da, data + 4, len, decode_ctx, decode_option, NULL, false);

} else {
slen = decode_value(ctx, out, da, data + 4, len, decode_ctx);
Expand Down

0 comments on commit 8726e54

Please sign in to comment.