fr_packet_dst2id_t my_pd, *pd;
fr_packet_socket_t *ps;
- if (!pl || !pl->alloc_id || !request) return 0;
+ if (!pl || !pl->alloc_id || !request) {
+ fr_strerror_printf("Invalid arguments");
+ return 0;
+ }
/*
* Error out if no destination is specified.
}
src_any = fr_inaddr_any(&request->src_ipaddr);
- if (src_any < 0) return 0;
+ if (src_any < 0) {
+ fr_strerror_printf("Error checking src IP address");
+ return 0;
+ }
/*
* MUST specify a destination address.
*/
- if (fr_inaddr_any(&request->dst_ipaddr) != 0) return 0;
+ if (fr_inaddr_any(&request->dst_ipaddr) != 0) {
+ fr_strerror_printf("Error checking dst IP address");
+ return 0;
+ }
my_pd.dst_ipaddr = request->dst_ipaddr;
my_pd.dst_port = request->dst_port;
if (!fr_hash_table_insert(pl->dst2id_ht, pd)) {
free(pd);
+ fr_strerror_printf("Failed inserting into hash");
return 0;
}
}
redo:
id++;
id &= 0xff;
- if (id == start) return 0;
+ if (id == start) {
+ fr_strerror_printf("All IDs are being used");
+ return 0;
+ }
}
free_mask = ~((~pd->id[id]) & pl->mask);
}
}
- if (start < 0) return 0; /* bad error */
+ if (start < 0) {
+ fr_strerror_printf("Internal sanity check failed");
+ return 0; /* bad error */
+ }
pd->id[id] |= (1 << start);
ps = &pl->sockets[start];