24 RCSID(
"$Id: 80a69d6923beb24d2eb02f2eee7f3813bd8cedf4 $")
26 #include <freeradius-devel/server/base.h>
27 #include <freeradius-devel/util/rb.h>
28 #include <freeradius-devel/io/application.h>
29 #include <freeradius-devel/util/dlist.h>
30 #include <freeradius-devel/util/debug.h>
51 for (i = 0; i < 256; i++) {
69 static int8_t
te_cmp(
void const *one,
void const *two)
75 ret = memcmp(a->vector, b->vector,
sizeof(a->vector));
223 talloc_set_destructor(te->
binding, NULL);
241 if (te == &tt->
id[te->
id]) {
304 memcpy(te->vector, vector,
sizeof(te->vector));
348 te = &tt->
id[packet_id];
365 memcpy(&my_te.vector, vector,
sizeof(my_te.vector));
375 te = &tt->
id[packet_id];
389 if (memcmp(te->vector, vector,
sizeof(te->vector)) != 0) {
437 "[%zu] %"PRIu64
" - Allocated at %s:%u to request %p (%s), uctx %p",
442 "[%zu] %"PRIu64
" - Freed at %s:%u",
446 if (extra) extra(log, log_type,
file,
line, entry);
#define CMP(_a, _b)
Same as CMP_PREFER_SMALLER use when you don't really care about ordering, you just want an ordering.
fr_dcursor_eval_t void const * uctx
#define fr_cond_assert_msg(_x, _fmt,...)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
#define fr_dlist_init(_head, _type, _field)
Initialise the head structure of a doubly linked list.
static unsigned int fr_dlist_num_elements(fr_dlist_head_t const *head)
Return the number of elements in the dlist.
static void * fr_dlist_head(fr_dlist_head_t const *list_head)
Return the HEAD item of a list or NULL if the list is empty.
static int fr_dlist_insert_tail(fr_dlist_head_t *list_head, void *ptr)
Insert an item into the tail of a list.
static void * fr_dlist_remove(fr_dlist_head_t *list_head, void *ptr)
Remove an item from the list.
void fr_log(fr_log_t const *log, fr_log_type_t type, char const *file, int line, char const *fmt,...)
Send a server log message to its destination.
uint32_t fr_rand(void)
Return a 32-bit random number.
#define fr_rb_inline_talloc_alloc(_ctx, _type, _field, _data_cmp, _data_free)
Allocs a red black that verifies elements are of a specific talloc type.
bool fr_rb_insert(fr_rb_tree_t *tree, void const *data)
bool fr_rb_delete(fr_rb_tree_t *tree, void const *data)
void * fr_rb_find(fr_rb_tree_t const *tree, void const *data)
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
void radius_track_state_log(fr_log_t const *log, fr_log_type_t log_type, char const *file, int line, radius_track_t *tt, radius_track_log_extra_t extra)
Print out the state of every tracking entry.
static int8_t te_cmp(void const *one, void const *two)
Compare two radius_track_entry_t.
int radius_track_entry_update(radius_track_entry_t *te, uint8_t const *vector)
Update a tracking entry with the authentication vector.
int _radius_track_entry_reserve(char const *file, int line, radius_track_entry_t **te_out, TALLOC_CTX *ctx, radius_track_t *tt, request_t *request, uint8_t code, void *uctx)
Allocate a tracking entry.
radius_track_t * radius_track_alloc(TALLOC_CTX *ctx)
Create an radius_track_t.
int _radius_track_entry_release(char const *file, int line, radius_track_entry_t **te_to_free)
Release a tracking entry.
static int _radius_track_entry_release_on_free(radius_track_entry_t ***te_p)
Ensures the entry is released when the ctx passed to radius_track_entry_reserve is freed.
void radius_track_use_authenticator(radius_track_t *tt, bool flag)
Use Request Authenticator (or not) as an Identifier.
radius_track_entry_t * radius_track_entry_find(radius_track_t *tt, uint8_t packet_id, uint8_t const *vector)
Find a tracking entry from a request authenticator.
char const * file
Where the entry was allocated.
fr_dlist_head_t free_list
so we allocate by least recently used
#define radius_track_entry_release(_te)
bool use_authenticator
whether to use the request authenticator as an ID
void * uctx
Result/resumption context.
fr_rb_tree_t * subtree[UINT8_MAX+1]
for Original-Request-Authenticator
int line
Where the entry was freed.
uint64_t operation
Incremented each alloc and de-alloc.
unsigned int num_requests
number of requests in the allocation
uint8_t code
packet code (sigh)
radius_track_entry_t id[UINT8_MAX+1]
which ID was used
#define radius_track_entry_reserve(_te_out, _ctx, _tt, _request, _code, _uctx)
int next_id
next ID to allocate
void(* radius_track_log_extra_t)(fr_log_t const *log, fr_log_type_t log_type, char const *file, int line, radius_track_entry_t *te)
uint64_t operation
Used to give an idea of the alloc/free timeline.
request_t * request
as always...
radius_track_entry_t *** binding
Binding chunk we use to release the entry when its parent is freed.
Track one request to a response.
#define fr_strerror_const(_msg)