-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix/dhcpv6 fixups #5759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/dhcpv6 fixups #5759
Changes from all commits
2c333da
f6b0359
4a9cff7
d0192ca
551b275
75d1520
f63fd69
1f58ae5
307ab60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -269,7 +269,7 @@ static ssize_t decode_vsa(TALLOC_CTX *ctx, fr_pair_list_t *out, | |
| if (data_len < 8) return fr_pair_raw_from_network(ctx, out, parent, data, data_len); | ||
|
|
||
| memcpy(&pen, data, sizeof(pen)); | ||
| pen = htonl(pen); | ||
| pen = ntohl(pen); | ||
|
|
||
| /* | ||
| * Verify that the parent (which should be a VSA) | ||
|
|
@@ -366,24 +366,39 @@ static ssize_t decode_option(TALLOC_CTX *ctx, fr_pair_list_t *out, | |
| slen = fr_pair_array_from_network(ctx, out, da, data + 4, len, decode_ctx, decode_value); | ||
|
|
||
| } else if (da->type == FR_TYPE_VSA) { | ||
| bool append = false; | ||
| fr_pair_t *vp; | ||
|
|
||
| vp = fr_pair_find_by_da(out, NULL, da); | ||
| if (!vp) { | ||
| fr_pair_list_t staging_list; | ||
|
|
||
| vp = fr_pair_afrom_da(ctx, da); | ||
| if (!vp) return PAIR_DECODE_FATAL_ERROR; | ||
| PAIR_ALLOCED(vp); | ||
|
|
||
| append = true; | ||
| } | ||
|
|
||
| slen = decode_vsa(vp, &vp->vp_group, da, data + 4, len, decode_ctx); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the correct thing here, is to do the same as we do in the raw label, but output the raw attribute within the VSA vp we already allocated, NOT free the vp. @alandekok @ndptech do you agree?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's a lot of similar issues elsewhere. I'll take a look. |
||
| if (append) { | ||
| fr_pair_list_init(&staging_list); | ||
| slen = decode_vsa(vp, &staging_list, da, data + 4, len, decode_ctx); | ||
| if (slen < 0) { | ||
| fr_pair_list_free(&staging_list); | ||
| TALLOC_FREE(vp); | ||
| } else { | ||
| fr_pair_append(out, vp); | ||
| goto raw; | ||
| } | ||
| fr_pair_list_append(&vp->vp_group, &staging_list); | ||
| fr_pair_append(out, vp); | ||
| } else { | ||
| fr_pair_t *tail = fr_pair_list_tail(&vp->vp_group); | ||
|
|
||
| slen = decode_vsa(vp, &vp->vp_group, da, data + 4, len, decode_ctx); | ||
| if (slen < 0) { | ||
| /* Remove any new options added to the group */ | ||
| fr_pair_t *p = tail ? fr_pair_list_next(&vp->vp_group, tail) : fr_pair_list_head(&vp->vp_group); | ||
| while (p) { | ||
| fr_pair_t *next = fr_pair_list_next(&vp->vp_group, p); | ||
| fr_pair_remove(&vp->vp_group, p); | ||
| TALLOC_FREE(p); | ||
| p = next; | ||
| } | ||
| goto raw; | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the justification for from claude for needing to make this thread safe? I don't think this is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, it didn't reference any call sites which actually needed this. Remove this commit and add a
@notesaying that init and deinit are only called by the main thred and do not need to be thread-safe. Ideally you'd add that to all init functions of the same type.