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-Tag: release_3_0_24~156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fc80eda0defba7f409d5deb21693b6238168da2;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 ca97671622d..36646e23c37 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 c528e585619..65bd94094d1 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -2221,6 +2221,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; @@ -2373,6 +2383,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.