]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Cache process function by packet name
authorAlan T. DeKok <aland@freeradius.org>
Thu, 14 Sep 2017 15:53:44 +0000 (11:53 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 14 Sep 2017 23:30:31 +0000 (19:30 -0400)
src/modules/proto_radius/proto_radius.c

index fd167b0e9c8a57abd0be181dc95eaf36f408db42..6583a5010abc34d55aed3a2e6bb68241c6d05c51 100644 (file)
@@ -379,6 +379,23 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
                inst->process_by_code[code] = app_process->process;     /* Store the process function */
                inst->code_allowed[code] = true;
 
+               /*
+                *      Add handlers for the virtual server calls.
+                *      This is so that when one virtual server wants
+                *      to call another, it just looks up the data
+                *      here by packet name, and doesn't need to troll
+                *      through all of the listeners.
+                */
+               if (!cf_data_find(inst->server_cs, fr_io_process_t, fr_packet_codes[code])) {
+                       fr_io_process_t process, *process_p;
+
+                       process = inst->process_by_code[code];
+                       process_p = talloc(inst->server_cs, fr_io_process_t);
+                       *process_p = process;
+
+                       (void) cf_data_add(inst->server_cs, process_p, fr_packet_codes[code], NULL);
+               }
+
                i++;
        }