]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
track the number of IDs used, so that we can allocate a free listener
authorAlan T. DeKok <aland@freeradius.org>
Thu, 1 Apr 2021 15:07:05 +0000 (11:07 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 22 Jul 2021 13:55:20 +0000 (09:55 -0400)
src/include/listen.h
src/main/process.c

index ca97671622dc2f622b1dd716aaff6fdb7d7fdf04..36646e23c374427b62ae1457d1537797f93d8d08 100644 (file)
@@ -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
 
index c528e585619a27e9b070c1784d0113c1ba7e44ef..65bd94094d1fffed5c18448f2e9125d87ce074bd 100644 (file)
@@ -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.