]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add "client find" function
authorAlan T. DeKok <aland@freeradius.org>
Wed, 25 Apr 2018 23:12:51 +0000 (19:12 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 25 Apr 2018 23:18:13 +0000 (19:18 -0400)
which should be in the app_io anyways...

src/lib/io/application.h
src/lib/io/io.h
src/lib/io/master.c
src/modules/proto_radius/proto_radius_udp.c

index f7732b64deac711da8d0d321698133e1f22d5254..6679c25f681e05c552b2f16ca3e8f9f9514a8f93 100644 (file)
@@ -127,5 +127,6 @@ typedef struct fr_app_io_t {
        fr_io_data_cmp_t                compare;        //!< compare two packets
        fr_io_connection_set_t          connection_set; //!< set src/dst IP/port of a connection
        fr_io_network_get_t             network_get;    //!< get dynamic network information
+       fr_io_client_find_t             client_find;    //!< find radclient
        void                            *private;       //!< any private APIs it needs to export.
 } fr_app_io_t;
index 8dc6dedbaf13b36c62c26fa3012cf23cbf2a926e..f7f0f9afc95a65bf6f33ff96f9dc97c8fc9ee3fe 100644 (file)
@@ -317,6 +317,10 @@ typedef struct {
 
 typedef int (*fr_io_connection_set_t)(void *instance, fr_io_address_t *connection);
 
+typedef struct radclient RADCLIENT;
+
+typedef RADCLIENT *(*fr_io_client_find_t)(void *instance, fr_ipaddr_t const *ipaddr, int ipproto);
+
 typedef void (*fr_io_network_get_t)(void *instance, int *ipproto, bool *dynamic_clients, fr_trie_t const **trie);
 
 #ifdef __cplusplus
index d77b6a80529860777fd299faa22333f20727419b..e71da867b29f5df31a76090310c5f135db8d47dc 100644 (file)
@@ -986,7 +986,7 @@ redo:
                 */
                rad_assert(!connection);
 
-               radclient = client_find(NULL, &address.src_ipaddr, inst->ipproto);
+               radclient = inst->app_io->client_find(inst->app_io_instance, &address.src_ipaddr, inst->ipproto);
                if (radclient) {
                        state = PR_CLIENT_STATIC;
 
index 2346cfc01961582be485f3cfead253801c4f966e..51060b292f1ecc9e8dfbcc68a0c4192de7a8ccd9 100644 (file)
@@ -647,6 +647,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *cs)
        return 0;
 }
 
+static RADCLIENT *mod_client_find(UNUSED void *instance, fr_ipaddr_t const *ipaddr, int ipproto)
+{
+       return client_find(NULL, ipaddr, ipproto);
+}
+
 #if 0
 static int mod_detach(void *instance)
 {
@@ -680,4 +685,5 @@ fr_app_io_t proto_radius_udp = {
        .compare                = mod_compare,
        .connection_set         = mod_connection_set,
        .network_get            = mod_network_get,
+       .client_find            = mod_client_find,
 };