fr_pair_t *vp;
fr_pair_t *maxms, *mtu, *netaddr;
fr_value_box_t box;
+ fr_dcursor_t our_cursor;
fr_pair_list_init(&head);
+ fr_dcursor_init(&our_cursor, &head);
+
if (data[1] > 1) {
fr_strerror_printf("Packet is not Ethernet: %u",
data[1]);
fr_strerror_const_push("Cannot decode packet due to internal error");
error:
talloc_free(vp);
- fr_dcursor_head(cursor);
- fr_dcursor_free_list(cursor);
+ fr_dcursor_head(&our_cursor);
+ fr_dcursor_free_list(&our_cursor);
return -1;
}
if (!vp) continue;
- fr_dcursor_append(cursor, vp);
+ fr_dcursor_append(&our_cursor, vp);
}
/*
* Loop over the options.
*/
- fr_dcursor_head(cursor);
+ fr_dcursor_head(&our_cursor);
/*
* Nothing uses tail after this call, if it does in the future
while (p < end) {
if (p[0] == 0) break; /* padding */
- len = fr_dhcpv4_decode_option(ctx, cursor, dict_dhcpv4, p, (end - p), NULL);
+ len = fr_dhcpv4_decode_option(ctx, &our_cursor, dict_dhcpv4, p, (end - p), NULL);
if (len <= 0) {
- fr_dcursor_head(cursor);
- fr_dcursor_free_list(cursor);
+ fr_dcursor_head(&our_cursor);
+ fr_dcursor_free_list(&our_cursor);
return len;
}
p += len;
while (p < end) {
if (p[0] == 0) break; /* padding */
- len = fr_dhcpv4_decode_option(ctx, cursor, dict_dhcpv4,
+ len = fr_dhcpv4_decode_option(ctx, &our_cursor, dict_dhcpv4,
p, end - p, NULL);
if (len <= 0) {
- fr_dcursor_head(cursor);
- fr_dcursor_free_list(cursor);
+ fr_dcursor_head(&our_cursor);
+ fr_dcursor_free_list(&our_cursor);
return len;
}
p += len;
len = fr_dhcpv4_decode_option(ctx, cursor, dict_dhcpv4,
p, end - p, NULL);
if (len <= 0) {
- fr_dcursor_head(cursor);
- fr_dcursor_free_list(cursor);
+ fr_dcursor_head(&our_cursor);
+ fr_dcursor_free_list(&our_cursor);
return len;
}
p += len;
fr_value_box_cast(vp, &vp->data, vp->da->type, vp->da, &box);
}
- fr_dcursor_append(cursor, vp);
+ fr_dcursor_append(&our_cursor, vp);
/*
* Client can request a LARGER size, but not a smaller
* FIXME: Nuke attributes that aren't used in the normal
* header for discover/requests.
*/
+ fr_dcursor_merge(cursor, &our_cursor);
return 0;
}