* transport, via a call to fr_dhcpv4_ok().
*/
fr_cursor_init(&cursor, &request->request_pairs);
- if (fr_dhcpv4_decode(packet, packet->data, packet->data_len, &cursor, &packet->code) < 0) {
+ if (fr_dhcpv4_decode(request->request_ctx, packet->data, packet->data_len, &cursor, &packet->code) < 0) {
RPEDEBUG("Failed decoding packet");
return -1;
}
*/
static void dhcpv4_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *list, bool received)
{
- int i;
+ size_t i;
#ifdef WITH_IFINDEX_NAME_RESOLUTION
char if_name[IFNAMSIZ];
#endif
* Print the fields in the header, too.
*/
RINDENT();
- for (i = 0; dhcp_header_attrs[i] != NULL; i++) {
+ for (i = 0; i < dhcp_header_attrs_len; i++) {
fr_pair_t *vp;
if (!*dhcp_header_attrs[i]) continue;
&attr_dhcp_client_hardware_address,
&attr_dhcp_server_host_name,
&attr_dhcp_boot_filename,
- NULL
};
+size_t dhcp_header_attrs_len = NUM_ELEMENTS(dhcp_header_attrs);
char const *dhcp_message_types[] = {
"invalid",
#endif
extern fr_dict_attr_t const **dhcp_header_attrs[];
+extern size_t dhcp_header_attrs_len;
extern char const *dhcp_message_types[];
extern int dhcp_header_sizes[];
extern uint8_t eth_bcast[ETH_ADDR_LEN];
/*
* Decode the header.
*/
- for (i = 0; i < 14; i++) {
+ for (i = 0; i < dhcp_header_attrs_len; i++) {
vp = fr_pair_afrom_da(ctx, *dhcp_header_attrs[i]);
if (!vp) {
fr_strerror_const_push("Cannot decode packet due to internal error");