From: Alan T. DeKok Date: Thu, 1 Apr 2021 15:07:05 +0000 (-0400) Subject: track the number of IDs used, so that we can allocate a free listener X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbc924c0ee03d826dd1ab4a4dbca04c0a88ac978;p=thirdparty%2Ffreeradius-server.git track the number of IDs used, so that we can allocate a free listener --- diff --git a/src/include/listen.h b/src/include/listen.h index ca97671622..36646e23c3 100644 --- a/src/include/listen.h +++ b/src/include/listen.h @@ -90,6 +90,8 @@ struct rad_listen { uint32_t coa_mrc; uint32_t coa_mrt; uint32_t coa_mrd; + + int num_ids_used; /* for proxying CoA packets */ #endif #endif diff --git a/src/main/process.c b/src/main/process.c index f4d0c99e0a..6e9140e213 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -2216,6 +2216,16 @@ static void remove_from_proxy_hash_nl(REQUEST *request, bool yank) if (!request->in_proxy_hash) return; +#ifdef COA_TUNNEL + /* + * Track how many IDs are used. This information + * helps the listen_coa_find() function get a + * listener which has free IDs. + */ + rad_assert(request->proxy_listener->num_ids_used > 0); + request->proxy_listener->num_ids_used--; +#endif + fr_packet_list_id_free(proxy_list, request->proxy, yank); request->in_proxy_hash = false; @@ -2368,6 +2378,15 @@ static int insert_into_proxy_hash(REQUEST *request) goto fail; } +#ifdef COA_TUNNEL + /* + * Track how many IDs are used. This information + * helps the listen_coa_find() function get a + * listener which has free IDs. + */ + request->proxy_listener->num_ids_used++; +#endif + /* * Add it to the event loop. Ensure that we have * only one mutex locked at a time.