]> 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>
Fri, 2 Apr 2021 19:14:00 +0000 (15:14 -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 f4d0c99e0a9b63ff3c275e81f7fa6b9eab2ec967..6e9140e213ff5fd555d1493c21224e63477dcf8d 100644 (file)
@@ -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.