From: Alan T. DeKok Date: Wed, 25 Apr 2018 23:12:51 +0000 (-0400) Subject: add "client find" function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddfdcae487c5d0c6fa5af6cf1cc1900e9823ef8d;p=thirdparty%2Ffreeradius-server.git add "client find" function which should be in the app_io anyways... --- diff --git a/src/lib/io/application.h b/src/lib/io/application.h index f7732b64dea..6679c25f681 100644 --- a/src/lib/io/application.h +++ b/src/lib/io/application.h @@ -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; diff --git a/src/lib/io/io.h b/src/lib/io/io.h index 8dc6dedbaf1..f7f0f9afc95 100644 --- a/src/lib/io/io.h +++ b/src/lib/io/io.h @@ -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 diff --git a/src/lib/io/master.c b/src/lib/io/master.c index d77b6a80529..e71da867b29 100644 --- a/src/lib/io/master.c +++ b/src/lib/io/master.c @@ -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; diff --git a/src/modules/proto_radius/proto_radius_udp.c b/src/modules/proto_radius/proto_radius_udp.c index 2346cfc0196..51060b292f1 100644 --- a/src/modules/proto_radius/proto_radius_udp.c +++ b/src/modules/proto_radius/proto_radius_udp.c @@ -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, };