From: Alan T. DeKok Date: Wed, 1 Mar 2023 21:45:16 +0000 (-0500) Subject: let's not shout. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7371bcd28c27168dbfbe7fc239fa0512ce56282b;p=thirdparty%2Ffreeradius-server.git let's not shout. RADCLIENT -> fr_client_t RADCLIENT_LIST -> fr_client_list_t --- diff --git a/src/bin/radmin.c b/src/bin/radmin.c index f38a68e2950..6bfd234d56f 100644 --- a/src/bin/radmin.c +++ b/src/bin/radmin.c @@ -781,7 +781,7 @@ static int cmd_show_config_item(FILE *fp, FILE *fp_err, UNUSED void *ctx, fr_cmd static int cmd_show_client(FILE *fp, FILE *fp_err, UNUSED void *ctx, fr_cmd_info_t const *info) { - RADCLIENT *client; + fr_client_t *client; if (info->argc >= 2) { int proto; diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index 4734e259955..a5d6c875bf7 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -99,10 +99,10 @@ fr_dict_attr_autoload_t unit_test_module_dict_attr[] = { */ static void usage(main_config_t const *config, int status); -static RADCLIENT *client_alloc(TALLOC_CTX *ctx, char const *ip, char const *name) +static fr_client_t *client_alloc(TALLOC_CTX *ctx, char const *ip, char const *name) { CONF_SECTION *cs; - RADCLIENT *client; + fr_client_t *client; cs = cf_section_alloc(ctx, NULL, "client", name); MEM(cf_pair_alloc(cs, "ipaddr", ip, T_OP_EQ, T_BARE_WORD, T_BARE_WORD)); @@ -124,7 +124,7 @@ static RADCLIENT *client_alloc(TALLOC_CTX *ctx, char const *ip, char const *name return client; } -static request_t *request_from_file(TALLOC_CTX *ctx, FILE *fp, RADCLIENT *client, CONF_SECTION *server_cs) +static request_t *request_from_file(TALLOC_CTX *ctx, FILE *fp, fr_client_t *client, CONF_SECTION *server_cs) { fr_pair_t *vp; request_t *request; @@ -561,7 +561,7 @@ int main(int argc, char *argv[]) fr_pair_list_t filter_vps; bool xlat_only = false; fr_event_list_t *el = NULL; - RADCLIENT *client = NULL; + fr_client_t *client = NULL; fr_dict_t *dict = NULL; fr_dict_t const *dict_check; char const *receipt_file = NULL; diff --git a/src/lib/io/base.h b/src/lib/io/base.h index 70a5ba8a166..38ed2a60266 100644 --- a/src/lib/io/base.h +++ b/src/lib/io/base.h @@ -273,7 +273,7 @@ typedef struct fr_io_track_s fr_io_track_t; /* in master.h */ * - NULL on error * - !NULL the packet tracking structure */ -typedef void *(*fr_io_track_create_t)(void const *instance, void *thread_instance, RADCLIENT *client, fr_io_track_t *track, uint8_t const *packet, size_t packet_len); +typedef void *(*fr_io_track_create_t)(void const *instance, void *thread_instance, fr_client_t *client, fr_io_track_t *track, uint8_t const *packet, size_t packet_len); /** Compare two tracking structures for storing in a duplicate detection tree. * @@ -301,7 +301,7 @@ typedef void *(*fr_io_track_create_t)(void const *instance, void *thread_instanc * - >0 on packet two "larger" than packet one * - =0 on the two packets being identical */ -typedef int (*fr_io_track_cmp_t)(void const *instance, void *thread_instance, RADCLIENT *client, void const *one, void const *two); +typedef int (*fr_io_track_cmp_t)(void const *instance, void *thread_instance, fr_client_t *client, void const *one, void const *two); /** Handle an error on the socket. * @@ -337,14 +337,14 @@ typedef int (*fr_io_close_t)(fr_listen_t *li); typedef struct { fr_socket_t socket; //!< src/dst ip and port. - RADCLIENT const *radclient; //!< old-style client definition + fr_client_t const *radclient; //!< old-style client definition } fr_io_address_t; typedef int (*fr_io_connection_set_t)(fr_listen_t *li, fr_io_address_t *connection); -typedef struct rad_client RADCLIENT; +typedef struct fr_client_s fr_client_t; -typedef RADCLIENT *(*fr_io_client_find_t)(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto); +typedef fr_client_t *(*fr_io_client_find_t)(fr_listen_t *li, 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); diff --git a/src/lib/io/master.c b/src/lib/io/master.c index b9d099b1484..bcef29c5293 100644 --- a/src/lib/io/master.c +++ b/src/lib/io/master.c @@ -84,7 +84,7 @@ struct fr_io_client_s { fr_io_client_state_t state; //!< state of this client fr_ipaddr_t src_ipaddr; //!< packets come from this address fr_ipaddr_t network; //!< network for dynamic clients - RADCLIENT *radclient; //!< old-style definition of this client + fr_client_t *radclient; //!< old-style definition of this client int packets; //!< number of packets using this client int pending_id; //!< for pending clients @@ -352,13 +352,13 @@ static fr_io_pending_packet_t *pending_packet_pop(fr_io_thread_t *thread) return pending; } -static RADCLIENT *radclient_clone(TALLOC_CTX *ctx, RADCLIENT const *parent) +static fr_client_t *radclient_clone(TALLOC_CTX *ctx, fr_client_t const *parent) { - RADCLIENT *c; + fr_client_t *c; if (!parent) return NULL; - c = talloc_zero(ctx, RADCLIENT); + c = talloc_zero(ctx, fr_client_t); if (!c) return NULL; /* @@ -464,7 +464,7 @@ static fr_io_connection_t *fr_io_connection_alloc(fr_io_instance_t const *inst, fr_io_connection_t *connection; dl_module_inst_t *dl_inst = NULL; fr_listen_t *li; - RADCLIENT *radclient; + fr_client_t *radclient; /* * Reload the app_io module as a "new" library. This @@ -844,12 +844,12 @@ static void get_inst(fr_listen_t *li, fr_io_instance_t const **inst, fr_io_threa } -static RADCLIENT *radclient_alloc(TALLOC_CTX *ctx, int ipproto, fr_io_address_t *address) +static fr_client_t *radclient_alloc(TALLOC_CTX *ctx, int ipproto, fr_io_address_t *address) { - RADCLIENT *radclient; + fr_client_t *radclient; char *shortname; - MEM(radclient = talloc_zero(ctx, RADCLIENT)); + MEM(radclient = talloc_zero(ctx, fr_client_t)); fr_value_box_aprint(radclient, &shortname, fr_box_ipaddr(address->socket.inet.src_ipaddr), NULL); radclient->longname = radclient->shortname = shortname; @@ -1377,7 +1377,7 @@ do_read: * allowed, try to define a dynamic client. */ if (!client) { - RADCLIENT *radclient = NULL; + fr_client_t *radclient = NULL; fr_io_client_state_t state; fr_ipaddr_t const *network = NULL; @@ -1446,7 +1446,7 @@ do_read: /* * Create our own local client. This client * holds our state which really shouldn't go into - * RADCLIENT. + * fr_client_t. * * Note that we create a new top-level talloc * context for this client, as there may be tens @@ -2171,7 +2171,7 @@ static ssize_t mod_write(fr_listen_t *li, void *packet_ctx, fr_time_t request_ti fr_io_connection_t *connection; fr_io_track_t *track = talloc_get_type_abort(packet_ctx, fr_io_track_t); fr_io_client_t *client; - RADCLIENT *radclient; + fr_client_t *radclient; fr_listen_t *child; fr_event_list_t *el; diff --git a/src/lib/server/client.c b/src/lib/server/client.c index 17a838d3082..6cbb8da0af2 100644 --- a/src/lib/server/client.c +++ b/src/lib/server/client.c @@ -49,7 +49,7 @@ RCSID("$Id$") /** Group of clients * */ -struct rad_client_list { +struct fr_client_list_s { char const *name; //!< Name of the client list. #ifdef WITH_TRIE fr_trie_t *v4_udp; @@ -61,14 +61,14 @@ struct rad_client_list { #endif }; -static RADCLIENT_LIST *root_clients = NULL; //!< Global client list. +static fr_client_list_t *root_clients = NULL; //!< Global client list. #ifndef WITH_TRIE static int8_t client_cmp(void const *one, void const *two) { int ret; - RADCLIENT const *a = one; - RADCLIENT const *b = two; + fr_client_t const *a = one; + fr_client_t const *b = two; ret = fr_ipaddr_cmp(&a->ipaddr, &b->ipaddr); if (ret != 0) return ret; @@ -90,9 +90,9 @@ void client_list_free(void) /** Free a client * - * It's up to the caller to ensure that it's deleted from any RADCLIENT_LIST. + * It's up to the caller to ensure that it's deleted from any fr_client_list_t. */ -void client_free(RADCLIENT *client) +void client_free(fr_client_t *client) { if (!client) return; @@ -107,9 +107,9 @@ void client_free(RADCLIENT *client) * - New client list on success. * - NULL on error (OOM). */ -RADCLIENT_LIST *client_list_init(CONF_SECTION *cs) +fr_client_list_t *client_list_init(CONF_SECTION *cs) { - RADCLIENT_LIST *clients = talloc_zero(cs, RADCLIENT_LIST); + fr_client_list_t *clients = talloc_zero(cs, fr_client_list_t); if (!clients) return NULL; @@ -153,10 +153,10 @@ RADCLIENT_LIST *client_list_init(CONF_SECTION *cs) * instead do post-processing? Though those two clients can have * different secrets... and the trie code doesn't allow 2 * fr_trie_user_t nodes in a row. So we would have to instead - * handle that ourselves, with a wrapper around the RADCLIENT + * handle that ourselves, with a wrapper around the fr_client_t * structure that does udp/tcp/wildcard demultiplexing */ -static fr_trie_t *clients_trie(RADCLIENT_LIST const *clients, fr_ipaddr_t const *ipaddr, +static fr_trie_t *clients_trie(fr_client_list_t const *clients, fr_ipaddr_t const *ipaddr, int proto) { if (ipaddr->af == AF_INET) { @@ -173,7 +173,7 @@ static fr_trie_t *clients_trie(RADCLIENT_LIST const *clients, fr_ipaddr_t const } #endif /* WITH_TRIE */ -/** Add a client to a RADCLIENT_LIST +/** Add a client to a fr_client_list_t * * @param clients list to add client to, may be NULL if global client list is being used. * @param client to add. @@ -181,13 +181,13 @@ static fr_trie_t *clients_trie(RADCLIENT_LIST const *clients, fr_ipaddr_t const * - true on success. * - false on failure. */ -bool client_add(RADCLIENT_LIST *clients, RADCLIENT *client) +bool client_add(fr_client_list_t *clients, fr_client_t *client) { #ifdef WITH_TRIE fr_trie_t *trie; #else #endif - RADCLIENT *old; + fr_client_t *old; char buffer[FR_IPADDR_PREFIX_STRLEN]; if (!client) return false; @@ -247,7 +247,7 @@ bool client_add(RADCLIENT_LIST *clients, RADCLIENT *client) * If the client list already exists, use that. * Otherwise, create a new client list. */ - clients = cf_data_value(cf_data_find(cs, RADCLIENT_LIST, NULL)); + clients = cf_data_value(cf_data_find(cs, fr_client_list_t, NULL)); if (!clients) { clients = client_list_init(cs); if (!clients) { @@ -288,7 +288,7 @@ bool client_add(RADCLIENT_LIST *clients, RADCLIENT *client) #else /* WITH_TRIE */ if (!clients->tree[client->ipaddr.prefix]) { - clients->tree[client->ipaddr.prefix] = fr_rb_inline_talloc_alloc(clients, RADCLIENT, node, client_cmp, + clients->tree[client->ipaddr.prefix] = fr_rb_inline_talloc_alloc(clients, fr_client_t, node, client_cmp, NULL); if (!clients->tree[client->ipaddr.prefix]) { return false; @@ -341,7 +341,7 @@ bool client_add(RADCLIENT_LIST *clients, RADCLIENT *client) } -void client_delete(RADCLIENT_LIST *clients, RADCLIENT *client) +void client_delete(fr_client_list_t *clients, fr_client_t *client) { #ifdef WITH_TRIE fr_trie_t *trie; @@ -368,22 +368,22 @@ void client_delete(RADCLIENT_LIST *clients, RADCLIENT *client) #endif } -RADCLIENT *client_findbynumber(UNUSED const RADCLIENT_LIST *clients, UNUSED int number) +fr_client_t *client_findbynumber(UNUSED const fr_client_list_t *clients, UNUSED int number) { return NULL; } /* - * Find a client in the RADCLIENTS list. + * Find a client in the fr_client_tS list. */ -RADCLIENT *client_find(RADCLIENT_LIST const *clients, fr_ipaddr_t const *ipaddr, int proto) +fr_client_t *client_find(fr_client_list_t const *clients, fr_ipaddr_t const *ipaddr, int proto) { #ifdef WITH_TRIE fr_trie_t *trie; #else int i, max; - RADCLIENT my_client, *client; + fr_client_t my_client, *client; #endif if (!clients) clients = root_clients; @@ -425,11 +425,11 @@ static char const *cl_srcipaddr = NULL; static char const *hs_proto = NULL; static CONF_PARSER limit_config[] = { - { FR_CONF_OFFSET("max_connections", FR_TYPE_UINT32, RADCLIENT, limit.max_connections), .dflt = "16" }, + { FR_CONF_OFFSET("max_connections", FR_TYPE_UINT32, fr_client_t, limit.max_connections), .dflt = "16" }, - { FR_CONF_OFFSET("lifetime", FR_TYPE_TIME_DELTA, RADCLIENT, limit.lifetime), .dflt = "0" }, + { FR_CONF_OFFSET("lifetime", FR_TYPE_TIME_DELTA, fr_client_t, limit.lifetime), .dflt = "0" }, - { FR_CONF_OFFSET("idle_timeout", FR_TYPE_TIME_DELTA, RADCLIENT, limit.idle_timeout), .dflt = "30s" }, + { FR_CONF_OFFSET("idle_timeout", FR_TYPE_TIME_DELTA, fr_client_t, limit.idle_timeout), .dflt = "30s" }, CONF_PARSER_TERMINATOR }; @@ -440,19 +440,19 @@ static const CONF_PARSER client_config[] = { { FR_CONF_POINTER("src_ipaddr", FR_TYPE_STRING, &cl_srcipaddr) }, - { FR_CONF_OFFSET("require_message_authenticator", FR_TYPE_BOOL, RADCLIENT, message_authenticator), .dflt = "no" }, + { FR_CONF_OFFSET("require_message_authenticator", FR_TYPE_BOOL, fr_client_t, message_authenticator), .dflt = "no" }, - { FR_CONF_OFFSET("dedup_authenticator", FR_TYPE_BOOL, RADCLIENT, dedup_authenticator), .dflt = "no" }, + { FR_CONF_OFFSET("dedup_authenticator", FR_TYPE_BOOL, fr_client_t, dedup_authenticator), .dflt = "no" }, - { FR_CONF_OFFSET("secret", FR_TYPE_STRING | FR_TYPE_SECRET, RADCLIENT, secret) }, - { FR_CONF_OFFSET("shortname", FR_TYPE_STRING, RADCLIENT, shortname) }, + { FR_CONF_OFFSET("secret", FR_TYPE_STRING | FR_TYPE_SECRET, fr_client_t, secret) }, + { FR_CONF_OFFSET("shortname", FR_TYPE_STRING, fr_client_t, shortname) }, - { FR_CONF_OFFSET("nas_type", FR_TYPE_STRING, RADCLIENT, nas_type) }, + { FR_CONF_OFFSET("nas_type", FR_TYPE_STRING, fr_client_t, nas_type) }, - { FR_CONF_OFFSET("virtual_server", FR_TYPE_STRING, RADCLIENT, server) }, - { FR_CONF_OFFSET("response_window", FR_TYPE_TIME_DELTA, RADCLIENT, response_window) }, + { FR_CONF_OFFSET("virtual_server", FR_TYPE_STRING, fr_client_t, server) }, + { FR_CONF_OFFSET("response_window", FR_TYPE_TIME_DELTA, fr_client_t, response_window) }, - { FR_CONF_OFFSET("track_connections", FR_TYPE_BOOL, RADCLIENT, use_connected) }, + { FR_CONF_OFFSET("track_connections", FR_TYPE_BOOL, fr_client_t, use_connected) }, { FR_CONF_POINTER("proto", FR_TYPE_STRING, &hs_proto) }, { FR_CONF_POINTER("limit", FR_TYPE_SUBSECTION, NULL), .subcs = (void const *) limit_config }, @@ -470,19 +470,19 @@ static const CONF_PARSER client_config[] = { #define TLS_UNUSED UNUSED #endif -RADCLIENT_LIST *client_list_parse_section(CONF_SECTION *section, int proto, TLS_UNUSED bool tls_required) +fr_client_list_t *client_list_parse_section(CONF_SECTION *section, int proto, TLS_UNUSED bool tls_required) { bool global = false; CONF_SECTION *cs = NULL; - RADCLIENT *c = NULL; - RADCLIENT_LIST *clients = NULL; + fr_client_t *c = NULL; + fr_client_list_t *clients = NULL; CONF_SECTION *server_cs = NULL; /* * Be forgiving. If there's already a clients, return * it. Otherwise create a new one. */ - clients = cf_data_value(cf_data_find(section, RADCLIENT_LIST, NULL)); + clients = cf_data_value(cf_data_find(section, fr_client_list_t, NULL)); if (clients) return clients; /* @@ -696,11 +696,11 @@ int client_map_section(CONF_SECTION *out, CONF_SECTION const *map, client_value_ * @param ctx to allocate new clients in. * @param cs to process as a client. * @param server_cs The virtual server that this client belongs to. - * @return new RADCLIENT struct. + * @return new fr_client_t struct. */ -RADCLIENT *client_afrom_cs(TALLOC_CTX *ctx, CONF_SECTION *cs, CONF_SECTION *server_cs) +fr_client_t *client_afrom_cs(TALLOC_CTX *ctx, CONF_SECTION *cs, CONF_SECTION *server_cs) { - RADCLIENT *c; + fr_client_t *c; char const *name2; CONF_PAIR *cp; @@ -713,7 +713,7 @@ RADCLIENT *client_afrom_cs(TALLOC_CTX *ctx, CONF_SECTION *cs, CONF_SECTION *serv /* * The size is fine.. Let's create the buffer */ - c = talloc_zero(ctx, RADCLIENT); + c = talloc_zero(ctx, fr_client_t); c->cs = cs; memset(&cl_ipaddr, 0, sizeof(cl_ipaddr)); @@ -910,13 +910,13 @@ RADCLIENT *client_afrom_cs(TALLOC_CTX *ctx, CONF_SECTION *cs, CONF_SECTION *serv * - New client. * - NULL on error. */ -RADCLIENT *client_afrom_query(TALLOC_CTX *ctx, char const *identifier, char const *secret, +fr_client_t *client_afrom_query(TALLOC_CTX *ctx, char const *identifier, char const *secret, char const *shortname, char const *type, char const *server, bool require_ma) { - RADCLIENT *c; + fr_client_t *c; char buffer[128]; - c = talloc_zero(ctx, RADCLIENT); + c = talloc_zero(ctx, fr_client_t); if (fr_inet_pton(&c->ipaddr, identifier, -1, AF_UNSPEC, true, true) < 0) { PERROR("Failed parsing client IP"); @@ -948,12 +948,12 @@ RADCLIENT *client_afrom_query(TALLOC_CTX *ctx, char const *identifier, char cons * - New client on success. * - NULL on error. */ -RADCLIENT *client_afrom_request(TALLOC_CTX *ctx, request_t *request) +fr_client_t *client_afrom_request(TALLOC_CTX *ctx, request_t *request) { static int cnt; CONF_SECTION *cs; char src_buf[128], buffer[256]; - RADCLIENT *c; + fr_client_t *c; if (!request) return NULL; @@ -1059,10 +1059,10 @@ RADCLIENT *client_afrom_request(TALLOC_CTX *ctx, request_t *request) * - The new client on success. * - NULL on failure. */ -RADCLIENT *client_read(char const *filename, CONF_SECTION *server_cs, bool check_dns) +fr_client_t *client_read(char const *filename, CONF_SECTION *server_cs, bool check_dns) { char const *p; - RADCLIENT *c; + fr_client_t *c; CONF_SECTION *cs; char buffer[256]; @@ -1111,9 +1111,9 @@ RADCLIENT *client_read(char const *filename, CONF_SECTION *server_cs, bool check /** Search up a list of requests trying to locate one which has a client * */ -RADCLIENT *client_from_request(request_t *request) +fr_client_t *client_from_request(request_t *request) { - RADCLIENT *client; + fr_client_t *client; request_t *parent = request; do { diff --git a/src/lib/server/client.h b/src/lib/server/client.h index 8a625daae01..cfef4c89bde 100644 --- a/src/lib/server/client.h +++ b/src/lib/server/client.h @@ -30,8 +30,8 @@ RCSIDH(clients_h, "$Id$") extern "C" { #endif -typedef struct rad_client RADCLIENT; -typedef struct rad_client_list RADCLIENT_LIST; +typedef struct fr_client_s fr_client_t; +typedef struct fr_client_list_s fr_client_list_t; /** Callback for retrieving values when building client sections * @@ -74,7 +74,7 @@ typedef int (*client_value_cb_t)(char **out, CONF_PAIR const *cp, void *data); /** Describes a host allowed to send packets to the server * */ -struct rad_client { +struct fr_client_s { fr_rb_node_t node; //!< Entry in the client tree. fr_ipaddr_t ipaddr; //!< IPv4/IPv6 address of the host. @@ -116,35 +116,35 @@ struct rad_client { fr_socket_limit_t limit; //!< Connections per client (TCP clients only). }; -RADCLIENT_LIST *client_list_init(CONF_SECTION *cs); +fr_client_list_t *client_list_init(CONF_SECTION *cs); void client_list_free(void); -RADCLIENT_LIST *client_list_parse_section(CONF_SECTION *section, int proto, bool tls_required); +fr_client_list_t *client_list_parse_section(CONF_SECTION *section, int proto, bool tls_required); -void client_free(RADCLIENT *client); +void client_free(fr_client_t *client); -bool client_add(RADCLIENT_LIST *clients, RADCLIENT *client); +bool client_add(fr_client_list_t *clients, fr_client_t *client); -void client_delete(RADCLIENT_LIST *clients, RADCLIENT *client); +void client_delete(fr_client_list_t *clients, fr_client_t *client); -RADCLIENT *client_afrom_request(TALLOC_CTX *ctx, request_t *request); +fr_client_t *client_afrom_request(TALLOC_CTX *ctx, request_t *request); int client_map_section(CONF_SECTION *out, CONF_SECTION const *map, client_value_cb_t func, void *data); -RADCLIENT *client_afrom_cs(TALLOC_CTX *ctx, CONF_SECTION *cs, CONF_SECTION *server_cs); +fr_client_t *client_afrom_cs(TALLOC_CTX *ctx, CONF_SECTION *cs, CONF_SECTION *server_cs); -RADCLIENT *client_afrom_query(TALLOC_CTX *ctx, char const *identifier, char const *secret, char const *shortname, +fr_client_t *client_afrom_query(TALLOC_CTX *ctx, char const *identifier, char const *secret, char const *shortname, char const *type, char const *server, bool require_ma) CC_HINT(nonnull(2, 3)); -RADCLIENT *client_find(RADCLIENT_LIST const *clients, fr_ipaddr_t const *ipaddr, int proto); +fr_client_t *client_find(fr_client_list_t const *clients, fr_ipaddr_t const *ipaddr, int proto); -RADCLIENT *client_findbynumber(RADCLIENT_LIST const *clients, int number); +fr_client_t *client_findbynumber(fr_client_list_t const *clients, int number); -RADCLIENT *client_read(char const *filename, CONF_SECTION *server_cs, bool check_dns); +fr_client_t *client_read(char const *filename, CONF_SECTION *server_cs, bool check_dns); -RADCLIENT *client_from_request(request_t *request); +fr_client_t *client_from_request(request_t *request); #ifdef __cplusplus } #endif diff --git a/src/lib/server/request.h b/src/lib/server/request.h index b1eabae1d98..9e925908a50 100644 --- a/src/lib/server/request.h +++ b/src/lib/server/request.h @@ -35,8 +35,7 @@ extern "C" { typedef struct fr_async_s fr_async_t; typedef struct request_s request_t; -typedef struct rad_listen rad_listen_t; -typedef struct rad_client RADCLIENT; +typedef struct fr_client_s fr_client_t; #ifdef __cplusplus } @@ -214,7 +213,7 @@ struct request_s { fr_radius_packet_t *packet; //!< Incoming request. fr_radius_packet_t *reply; //!< Outgoing response. - RADCLIENT *client; //!< The client that originally sent us the request. + fr_client_t *client; //!< The client that originally sent us the request. request_master_state_t master_state; //!< Set by the master thread to signal the child that's currently //!< working with the request, to do something. diff --git a/src/lib/server/snmp.c b/src/lib/server/snmp.c index 4a433bd0627..b69aa6ab914 100644 --- a/src/lib/server/snmp.c +++ b/src/lib/server/snmp.c @@ -188,7 +188,7 @@ static int snmp_client_index(UNUSED TALLOC_CTX *ctx, void **snmp_ctx_out, UNUSED fr_snmp_map_t const *map, NDEBUG_UNUSED void const *snmp_ctx_in, uint32_t index_num) { - RADCLIENT *client; + fr_client_t *client; fr_assert(!snmp_ctx_in); @@ -203,7 +203,7 @@ static int snmp_client_index(UNUSED TALLOC_CTX *ctx, void **snmp_ctx_out, static int snmp_client_index_get(UNUSED TALLOC_CTX *ctx, fr_value_box_t *out, UNUSED fr_snmp_map_t const *map, void *snmp_ctx) { - RADCLIENT *client = snmp_ctx; + fr_client_t *client = snmp_ctx; fr_assert(client); @@ -215,7 +215,7 @@ static int snmp_client_index_get(UNUSED TALLOC_CTX *ctx, fr_value_box_t *out, static int snmp_client_ipv4addr_get(UNUSED TALLOC_CTX *ctx, fr_value_box_t *out, NDEBUG_UNUSED fr_snmp_map_t const *map, void *snmp_ctx) { - RADCLIENT *client = snmp_ctx; + fr_client_t *client = snmp_ctx; fr_assert(client); fr_assert(map->da->type == FR_TYPE_IPV4_ADDR); @@ -236,7 +236,7 @@ static int snmp_client_ipv4addr_get(UNUSED TALLOC_CTX *ctx, fr_value_box_t *out, static int snmp_client_id_get(TALLOC_CTX *ctx, fr_value_box_t *out, NDEBUG_UNUSED fr_snmp_map_t const *map, void *snmp_ctx) { - RADCLIENT *client = snmp_ctx; + fr_client_t *client = snmp_ctx; fr_assert(client); fr_assert(map->da->type == FR_TYPE_STRING); @@ -249,7 +249,7 @@ static int snmp_client_id_get(TALLOC_CTX *ctx, fr_value_box_t *out, static int snmp_auth_client_stats_offset_get(UNUSED TALLOC_CTX *ctx, fr_value_box_t *out, fr_snmp_map_t const *map, void *snmp_ctx) { - RADCLIENT *client = snmp_ctx; + fr_client_t *client = snmp_ctx; fr_assert(client); fr_assert(map->da->type == FR_TYPE_UINT32); diff --git a/src/lib/server/tmpl_eval.c b/src/lib/server/tmpl_eval.c index e1e4fdcb417..aa655de16c9 100644 --- a/src/lib/server/tmpl_eval.c +++ b/src/lib/server/tmpl_eval.c @@ -1105,7 +1105,7 @@ static int tmpl_eval_pair_virtual(TALLOC_CTX *ctx, FR_DLIST_HEAD(fr_value_box_li * Some non-packet expansions */ if (tmpl_attr_tail_da(vpt) == attr_client_shortname) { - RADCLIENT *client = client_from_request(request); + fr_client_t *client = client_from_request(request); if (!client || !client->shortname) return 0; MEM(value = fr_value_box_alloc_null(ctx)); @@ -1166,7 +1166,7 @@ static int tmpl_eval_pair_virtual(TALLOC_CTX *ctx, FR_DLIST_HEAD(fr_value_box_li fr_value_box_memdup(ctx, value, tmpl_attr_tail_da(vpt), packet->vector, sizeof(packet->vector), true); } else if (tmpl_attr_tail_da(vpt) == attr_client_ip_address) { - RADCLIENT *client = client_from_request(request); + fr_client_t *client = client_from_request(request); if (client) { MEM(value = fr_value_box_alloc_null(ctx)); fr_value_box_ipaddr(value, NULL, &client->ipaddr, false); /* Enum might not match type */ diff --git a/src/listen/bfd/proto_bfd.c b/src/listen/bfd/proto_bfd.c index fa964b992a5..5336e7bb1f6 100644 --- a/src/listen/bfd/proto_bfd.c +++ b/src/listen/bfd/proto_bfd.c @@ -126,7 +126,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d proto_bfd_t const *inst = talloc_get_type_abort_const(instance, proto_bfd_t); fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; - RADCLIENT const *client; + fr_client_t const *client; fr_pair_t *vp, *reply, *my, *your; /* @@ -163,7 +163,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, client); + request->client = UNCONST(fr_client_t *, client); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); @@ -240,7 +240,7 @@ static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8 fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; ssize_t data_len; - RADCLIENT const *client; + fr_client_t const *client; /* * Process layer NAK, or "Do not respond". @@ -256,7 +256,7 @@ static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8 * Dynamic client stuff */ if (client->dynamic && !client->active) { - RADCLIENT *new_client; + fr_client_t *new_client; fr_assert(buffer_len >= sizeof(client)); diff --git a/src/listen/bfd/proto_bfd_udp.c b/src/listen/bfd/proto_bfd_udp.c index c682d7e7f82..f5c00b535f1 100644 --- a/src/listen/bfd/proto_bfd_udp.c +++ b/src/listen/bfd/proto_bfd_udp.c @@ -61,7 +61,7 @@ typedef struct { bool send_buff_is_set; //!< Whether we were provided with a send_buff bool dynamic_clients; //!< whether we have dynamic clients - RADCLIENT_LIST *clients; //!< local clients + fr_client_list_t *clients; //!< local clients fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients @@ -389,10 +389,10 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) { proto_bfd_udp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_bfd_udp_t); - RADCLIENT *client; + fr_client_t *client; /* * Prefer local clients. diff --git a/src/listen/control/proto_control_unix.c b/src/listen/control/proto_control_unix.c index b5cc339edae..0b23671806b 100644 --- a/src/listen/control/proto_control_unix.c +++ b/src/listen/control/proto_control_unix.c @@ -57,7 +57,7 @@ typedef struct { FILE *misc; fr_cmd_info_t *info; //!< for running commands - RADCLIENT radclient; //!< for faking out clients + fr_client_t radclient; //!< for faking out clients } proto_control_unix_thread_t; typedef struct { @@ -1193,7 +1193,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) { proto_control_unix_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_control_unix_thread_t); diff --git a/src/listen/cron/proto_cron_crontab.c b/src/listen/cron/proto_cron_crontab.c index 0c3903953aa..099808b819d 100644 --- a/src/listen/cron/proto_cron_crontab.c +++ b/src/listen/cron/proto_cron_crontab.c @@ -75,7 +75,7 @@ struct proto_cron_tab_s { cron_tab_t tab[5]; - RADCLIENT *client; //!< static client + fr_client_t *client; //!< static client }; @@ -459,7 +459,7 @@ static int mod_decode(void const *instance, request_t *request, UNUSED uint8_t * /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, address->radclient); + request->client = UNCONST(fr_client_t *, address->radclient); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); @@ -704,7 +704,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) { proto_cron_crontab_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_cron_crontab_t); @@ -716,13 +716,13 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_cron_crontab_t *inst = talloc_get_type_abort(mctx->inst->data, proto_cron_crontab_t); CONF_SECTION *conf = mctx->inst->data; - RADCLIENT *client; + fr_client_t *client; fr_pair_t *vp; FILE *fp; bool done = false; fr_pair_list_init(&inst->pair_list); - inst->client = client = talloc_zero(inst, RADCLIENT); + inst->client = client = talloc_zero(inst, fr_client_t); if (!inst->client) return 0; client->ipaddr.af = AF_INET; diff --git a/src/listen/detail/proto_detail.h b/src/listen/detail/proto_detail.h index e07060d1f20..49109d31d47 100644 --- a/src/listen/detail/proto_detail.h +++ b/src/listen/detail/proto_detail.h @@ -94,7 +94,7 @@ struct proto_detail_work_s { fr_rb_node_t filename_node; //!< for dedup - RADCLIENT *client; //!< so the rest of the server doesn't complain + fr_client_t *client; //!< so the rest of the server doesn't complain }; typedef struct proto_detail_work_thread_s proto_detail_work_thread_t; diff --git a/src/listen/detail/proto_detail_work.c b/src/listen/detail/proto_detail_work.c index a4819203a3f..624acd4642f 100644 --- a/src/listen/detail/proto_detail_work.c +++ b/src/listen/detail/proto_detail_work.c @@ -817,9 +817,9 @@ static char const *mod_name(fr_listen_t *li) static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_detail_work_t *inst = talloc_get_type_abort(mctx->inst->data, proto_detail_work_t); - RADCLIENT *client; + fr_client_t *client; - client = inst->client = talloc_zero(inst, RADCLIENT); + client = inst->client = talloc_zero(inst, fr_client_t); if (!inst->client) return 0; client->ipaddr.af = AF_INET; diff --git a/src/listen/dhcpv4/proto_dhcpv4.c b/src/listen/dhcpv4/proto_dhcpv4.c index 6b6e569ca61..c76f75a2229 100644 --- a/src/listen/dhcpv4/proto_dhcpv4.c +++ b/src/listen/dhcpv4/proto_dhcpv4.c @@ -195,7 +195,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d proto_dhcpv4_t const *inst = talloc_get_type_abort_const(instance, proto_dhcpv4_t); fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; - RADCLIENT const *client; + fr_client_t const *client; fr_radius_packet_t *packet = request->packet; /* @@ -233,7 +233,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, client); + request->client = UNCONST(fr_client_t *, client); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); @@ -256,7 +256,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf dhcp_packet_t *reply = (dhcp_packet_t *) buffer; dhcp_packet_t *original = (dhcp_packet_t *) request->packet->data; ssize_t data_len; - RADCLIENT const *client; + fr_client_t const *client; /* * process layer NAK, or "Do not respond". We also never @@ -277,7 +277,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf * Dynamic client stuff */ if (client->dynamic && !client->active) { - RADCLIENT *new_client; + fr_client_t *new_client; fr_assert(buffer_len >= sizeof(client)); diff --git a/src/listen/dhcpv4/proto_dhcpv4_udp.c b/src/listen/dhcpv4/proto_dhcpv4_udp.c index 8b2d9afe3dd..4ec35d45247 100644 --- a/src/listen/dhcpv4/proto_dhcpv4_udp.c +++ b/src/listen/dhcpv4/proto_dhcpv4_udp.c @@ -68,8 +68,8 @@ typedef struct { //!< buffer value. bool dynamic_clients; //!< whether we have dynamic clients - RADCLIENT_LIST *clients; //!< local clients - RADCLIENT *default_client; //!< default 0/0 client + fr_client_list_t *clients; //!< local clients + fr_client_t *default_client; //!< default 0/0 client fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients @@ -588,7 +588,7 @@ static int mod_fd_set(fr_listen_t *li, int fd) } -static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client, +static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, fr_io_track_t *track, uint8_t const *packet, size_t packet_len) { proto_dhcpv4_track_t *t; @@ -627,7 +627,7 @@ static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_i return t; } -static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client, +static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, void const *one, void const *two) { int ret; @@ -671,7 +671,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) size_t num; CONF_ITEM *ci; CONF_SECTION *server_cs; - RADCLIENT *client; + fr_client_t *client; inst->cs = conf; @@ -782,7 +782,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) /* * Create a fake client. */ - client = inst->default_client = talloc_zero(inst, RADCLIENT); + client = inst->default_client = talloc_zero(inst, fr_client_t); if (!inst->default_client) return 0; client->ipaddr.af = AF_INET; @@ -795,7 +795,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) { proto_dhcpv4_udp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_dhcpv4_udp_t); @@ -803,7 +803,7 @@ static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, in * Prefer local clients. */ if (inst->clients) { - RADCLIENT *client; + fr_client_t *client; client = client_find(inst->clients, ipaddr, ipproto); if (client) return client; diff --git a/src/listen/dhcpv6/proto_dhcpv6.c b/src/listen/dhcpv6/proto_dhcpv6.c index 026e362b7b9..0f56ea8b0cd 100644 --- a/src/listen/dhcpv6/proto_dhcpv6.c +++ b/src/listen/dhcpv6/proto_dhcpv6.c @@ -195,7 +195,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d proto_dhcpv6_t const *inst = talloc_get_type_abort_const(instance, proto_dhcpv6_t); fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; - RADCLIENT const *client; + fr_client_t const *client; fr_radius_packet_t *packet = request->packet; /* @@ -232,7 +232,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, client); + request->client = UNCONST(fr_client_t *, client); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); @@ -255,7 +255,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf fr_dhcpv6_packet_t *reply = (fr_dhcpv6_packet_t *) buffer; fr_dhcpv6_packet_t *original = (fr_dhcpv6_packet_t *) request->packet->data; ssize_t data_len; - RADCLIENT const *client; + fr_client_t const *client; /* * Process layer NAK, never respond, or "Do not respond". @@ -274,7 +274,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf * Dynamic client stuff */ if (client->dynamic && !client->active) { - RADCLIENT *new_client; + fr_client_t *new_client; fr_assert(buffer_len >= sizeof(client)); diff --git a/src/listen/dhcpv6/proto_dhcpv6_udp.c b/src/listen/dhcpv6/proto_dhcpv6_udp.c index d78b335b3ae..45ac1bf31fe 100644 --- a/src/listen/dhcpv6/proto_dhcpv6_udp.c +++ b/src/listen/dhcpv6/proto_dhcpv6_udp.c @@ -68,8 +68,8 @@ typedef struct { //!< buffer value. bool dynamic_clients; //!< whether we have dynamic clients - RADCLIENT_LIST *clients; //!< local clients - RADCLIENT *default_client; //!< default 0/0 client + fr_client_list_t *clients; //!< local clients + fr_client_t *default_client; //!< default 0/0 client fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients @@ -387,7 +387,7 @@ static int mod_fd_set(fr_listen_t *li, int fd) return 0; } -static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client, +static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, fr_io_track_t *track, uint8_t const *packet, size_t packet_len) { proto_dhcpv6_track_t *t; @@ -442,7 +442,7 @@ static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_i } -static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client, +static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, void const *one, void const *two) { int ret; @@ -473,7 +473,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) size_t num; CONF_ITEM *ci; CONF_SECTION *server_cs; - RADCLIENT *client; + fr_client_t *client; CONF_SECTION *conf = mctx->inst->conf; inst->cs = conf; @@ -631,7 +631,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) /* * Create a fake client. */ - client = inst->default_client = talloc_zero(inst, RADCLIENT); + client = inst->default_client = talloc_zero(inst, fr_client_t); if (!inst->default_client) return 0; client->ipaddr = (fr_ipaddr_t ) { @@ -646,7 +646,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) { proto_dhcpv6_udp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_dhcpv6_udp_t); @@ -654,7 +654,7 @@ static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, in * Prefer local clients. */ if (inst->clients) { - RADCLIENT *client; + fr_client_t *client; client = client_find(inst->clients, ipaddr, ipproto); if (client) return client; diff --git a/src/listen/dns/proto_dns.c b/src/listen/dns/proto_dns.c index e9d47aa1365..8ea07c08273 100644 --- a/src/listen/dns/proto_dns.c +++ b/src/listen/dns/proto_dns.c @@ -176,7 +176,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d proto_dns_t const *inst = talloc_get_type_abort_const(instance, proto_dns_t); fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; - RADCLIENT const *client; + fr_client_t const *client; fr_dns_packet_t const *packet = (fr_dns_packet_t const *) data; fr_dns_ctx_t packet_ctx; @@ -223,7 +223,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, client); + request->client = UNCONST(fr_client_t *, client); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); diff --git a/src/listen/dns/proto_dns_udp.c b/src/listen/dns/proto_dns_udp.c index ab5246209fc..2f0bc52eeab 100644 --- a/src/listen/dns/proto_dns_udp.c +++ b/src/listen/dns/proto_dns_udp.c @@ -60,8 +60,8 @@ typedef struct { bool recv_buff_is_set; //!< Whether we were provided with a receive //!< buffer value. - RADCLIENT_LIST *clients; //!< local clients - RADCLIENT *default_client; //!< default 0/0 client + fr_client_list_t *clients; //!< local clients + fr_client_t *default_client; //!< default 0/0 client fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients @@ -341,7 +341,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) size_t num; CONF_ITEM *ci; CONF_SECTION *server_cs; - RADCLIENT *client; + fr_client_t *client; inst->cs = conf; @@ -412,7 +412,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) /* * Create a fake client. */ - client = inst->default_client = talloc_zero(inst, RADCLIENT); + client = inst->default_client = talloc_zero(inst, fr_client_t); if (!inst->default_client) return 0; client->ipaddr = (fr_ipaddr_t ) { @@ -427,7 +427,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) { proto_dns_udp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_dns_udp_t); @@ -435,7 +435,7 @@ static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, in * Prefer local clients. */ if (inst->clients) { - RADCLIENT *client; + fr_client_t *client; client = client_find(inst->clients, ipaddr, ipproto); if (client) return client; diff --git a/src/listen/load/proto_load_step.c b/src/listen/load/proto_load_step.c index 516b3f83ee4..ad8b897eda5 100644 --- a/src/listen/load/proto_load_step.c +++ b/src/listen/load/proto_load_step.c @@ -69,7 +69,7 @@ struct proto_load_step_s { int code; uint32_t max_attributes; //!< Limit maximum decodable attributes - RADCLIENT *client; //!< static client + fr_client_t *client; //!< static client fr_load_config_t load; //!< load configuration bool repeat; //!, do we repeat the load generation @@ -286,7 +286,7 @@ static int mod_decode(void const *instance, request_t *request, UNUSED uint8_t * /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, address->radclient); + request->client = UNCONST(fr_client_t *, address->radclient); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); @@ -382,7 +382,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) { proto_load_step_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_load_step_t); @@ -394,11 +394,11 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_load_step_t *inst = talloc_get_type_abort(mctx->inst->data, proto_load_step_t); CONF_SECTION *conf = mctx->inst->conf; - RADCLIENT *client; + fr_client_t *client; fr_pair_t *vp; fr_pair_list_init(&inst->pair_list); - inst->client = client = talloc_zero(inst, RADCLIENT); + inst->client = client = talloc_zero(inst, fr_client_t); if (!inst->client) return 0; client->ipaddr.af = AF_INET; diff --git a/src/listen/radius/proto_radius.c b/src/listen/radius/proto_radius.c index 07c3b534d04..5c46979fc69 100644 --- a/src/listen/radius/proto_radius.c +++ b/src/listen/radius/proto_radius.c @@ -202,7 +202,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d proto_radius_t const *inst = talloc_get_type_abort_const(instance, proto_radius_t); fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; - RADCLIENT const *client; + fr_client_t const *client; fr_assert(data[0] < FR_RADIUS_CODE_MAX); @@ -247,7 +247,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, client); + request->client = UNCONST(fr_client_t *, client); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); @@ -320,7 +320,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; ssize_t data_len; - RADCLIENT const *client; + fr_client_t const *client; /* * Process layer NAK, or "Do not respond". @@ -339,7 +339,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf * Dynamic client stuff */ if (client->dynamic && !client->active) { - RADCLIENT *new_client; + fr_client_t *new_client; fr_assert(buffer_len >= sizeof(client)); diff --git a/src/listen/radius/proto_radius_tcp.c b/src/listen/radius/proto_radius_tcp.c index 632140e2964..4230d8ab0e0 100644 --- a/src/listen/radius/proto_radius_tcp.c +++ b/src/listen/radius/proto_radius_tcp.c @@ -62,7 +62,7 @@ typedef struct { bool dynamic_clients; //!< whether we have dynamic clients bool dedup_authenticator; //!< dedup using the request authenticator - RADCLIENT_LIST *clients; //!< local clients + fr_client_list_t *clients; //!< local clients fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients @@ -345,7 +345,7 @@ static int mod_fd_set(fr_listen_t *li, int fd) return 0; } -static int mod_track_compare(void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client, +static int mod_track_compare(void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, void const *one, void const *two) { int ret; @@ -596,7 +596,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) { proto_radius_tcp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_radius_tcp_t); @@ -604,7 +604,7 @@ static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, in * Prefer local clients. */ if (inst->clients) { - RADCLIENT *client; + fr_client_t *client; client = client_find(inst->clients, ipaddr, ipproto); if (client) return client; diff --git a/src/listen/radius/proto_radius_udp.c b/src/listen/radius/proto_radius_udp.c index 1102425644f..5fc26207132 100644 --- a/src/listen/radius/proto_radius_udp.c +++ b/src/listen/radius/proto_radius_udp.c @@ -66,7 +66,7 @@ typedef struct { bool dynamic_clients; //!< whether we have dynamic clients bool dedup_authenticator; //!< dedup using the request authenticator - RADCLIENT_LIST *clients; //!< local clients + fr_client_list_t *clients; //!< local clients fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients @@ -375,13 +375,13 @@ static int mod_fd_set(fr_listen_t *li, int fd) return 0; } -static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client, +static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, fr_io_track_t *track, uint8_t const *packet, UNUSED size_t packet_len) { return talloc_memdup(track, packet, RADIUS_HEADER_LENGTH); } -static int mod_track_compare(void const *instance, UNUSED void *thread_instance, RADCLIENT *client, +static int mod_track_compare(void const *instance, UNUSED void *thread_instance, fr_client_t *client, void const *one, void const *two) { int ret; @@ -510,10 +510,10 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) { proto_radius_udp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_radius_udp_t); - RADCLIENT *client; + fr_client_t *client; /* * Prefer local clients. diff --git a/src/listen/tacacs/proto_tacacs.c b/src/listen/tacacs/proto_tacacs.c index d7b404aad52..5cb73aaea85 100644 --- a/src/listen/tacacs/proto_tacacs.c +++ b/src/listen/tacacs/proto_tacacs.c @@ -190,7 +190,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d proto_tacacs_t const *inst = talloc_get_type_abort_const(instance, proto_tacacs_t); fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; - RADCLIENT const *client; + fr_client_t const *client; int code = -1; fr_tacacs_packet_t const *pkt = (fr_tacacs_packet_t const *)data; char const *secret; @@ -268,7 +268,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, client); + request->client = UNCONST(fr_client_t *, client); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); @@ -357,7 +357,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; ssize_t data_len; - RADCLIENT const *client; + fr_client_t const *client; char const *secret; size_t secretlen = 0; @@ -396,7 +396,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf * Dynamic client stuff */ if (client->dynamic && !client->active) { - RADCLIENT *new_client; + fr_client_t *new_client; fr_assert(buffer_len >= sizeof(client)); diff --git a/src/listen/tacacs/proto_tacacs_tcp.c b/src/listen/tacacs/proto_tacacs_tcp.c index e7d3e08d1e2..0f6ec7ab716 100644 --- a/src/listen/tacacs/proto_tacacs_tcp.c +++ b/src/listen/tacacs/proto_tacacs_tcp.c @@ -63,7 +63,7 @@ typedef struct { bool recv_buff_is_set; //!< Whether we were provided with a recv_buff bool dynamic_clients; //!< whether we have dynamic clients - RADCLIENT_LIST *clients; //!< local clients + fr_client_list_t *clients; //!< local clients fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients @@ -449,7 +449,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } -static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) { proto_tacacs_tcp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_tacacs_tcp_t); @@ -457,7 +457,7 @@ static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, in * Prefer local clients. */ if (inst->clients) { - RADCLIENT *client; + fr_client_t *client; client = client_find(inst->clients, ipaddr, ipproto); if (client) return client; diff --git a/src/listen/vmps/proto_vmps.c b/src/listen/vmps/proto_vmps.c index 058493eb87f..208a9ee21b2 100644 --- a/src/listen/vmps/proto_vmps.c +++ b/src/listen/vmps/proto_vmps.c @@ -183,7 +183,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d proto_vmps_t const *inst = talloc_get_type_abort_const(instance, proto_vmps_t); fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; - RADCLIENT const *client; + fr_client_t const *client; fr_radius_packet_t *packet = request->packet; fr_assert(data[0] < FR_VMPS_CODE_MAX); @@ -224,7 +224,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d /* * Set the rest of the fields. */ - request->client = UNCONST(RADCLIENT *, client); + request->client = UNCONST(fr_client_t *, client); request->packet->socket = address->socket; fr_socket_addr_swap(&request->reply->socket, &address->socket); @@ -245,7 +245,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; ssize_t data_len; - RADCLIENT const *client; + fr_client_t const *client; fr_dcursor_t cursor; /* @@ -265,7 +265,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf * Dynamic client stuff */ if (client->dynamic && !client->active) { - RADCLIENT *new_client; + fr_client_t *new_client; fr_assert(buffer_len >= sizeof(client)); diff --git a/src/listen/vmps/proto_vmps_udp.c b/src/listen/vmps/proto_vmps_udp.c index 62ee4983261..d550080147d 100644 --- a/src/listen/vmps/proto_vmps_udp.c +++ b/src/listen/vmps/proto_vmps_udp.c @@ -68,7 +68,7 @@ typedef struct { fr_ipaddr_t *allow; //!< allowed networks for dynamic clients fr_ipaddr_t *deny; //!< denied networks for dynamic clients - RADCLIENT_LIST *clients; //!< local clients + fr_client_list_t *clients; //!< local clients } proto_vmps_udp_t; @@ -345,7 +345,7 @@ static int mod_fd_set(fr_listen_t *li, int fd) return 0; } -static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client, +static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, fr_io_track_t *track, uint8_t const *buffer, size_t buffer_len) { proto_vmps_track_t *t; @@ -368,7 +368,7 @@ static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_i return t; } -static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client, +static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, void const *one, void const *two) { proto_vmps_track_t const *a = talloc_get_type_abort_const(one, proto_vmps_track_t); @@ -479,10 +479,10 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) // @todo - allow for "wildcard" clients, which allow anything // and then rely on "networks" to filter source IPs... // which means we probably want to filter on "networks" even if there are no dynamic clients -static RADCLIENT *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) +static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto) { proto_vmps_udp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_vmps_udp_t); - RADCLIENT *client; + fr_client_t *client; /* * Prefer local clients. diff --git a/src/modules/rlm_client/rlm_client.c b/src/modules/rlm_client/rlm_client.c index 95045947e35..26d7f122b82 100644 --- a/src/modules/rlm_client/rlm_client.c +++ b/src/modules/rlm_client/rlm_client.c @@ -119,7 +119,7 @@ static rlm_rcode_t map_proc_client(UNUSED void *mod_inst, UNUSED void *proc_inst { rlm_rcode_t rcode = RLM_MODULE_OK; map_t const *map = NULL; - RADCLIENT *client; + fr_client_t *client; client_get_vp_ctx_t uctx; if (!fr_value_box_list_empty(client_override)) { @@ -236,7 +236,7 @@ static xlat_action_t xlat_client(TALLOC_CTX *ctx, fr_dcursor_t *out, char const *value = NULL; fr_ipaddr_t ip; CONF_PAIR *cp; - RADCLIENT *client = NULL; + fr_client_t *client = NULL; fr_value_box_t *field = fr_value_box_list_head(in); fr_value_box_t *client_ip = fr_value_box_list_next(in, field); fr_value_box_t *vb; @@ -292,7 +292,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, UNU char const *value; CONF_PAIR *cp; char buffer[2048]; - RADCLIENT *client; + fr_client_t *client; /* * Ensure we're only being called from the main thread, diff --git a/src/modules/rlm_couchbase/mod.c b/src/modules/rlm_couchbase/mod.c index 747d18706b6..44b80f42f09 100644 --- a/src/modules/rlm_couchbase/mod.c +++ b/src/modules/rlm_couchbase/mod.c @@ -716,7 +716,7 @@ int mod_load_client_documents(rlm_couchbase_t *inst, CONF_SECTION *tmpl, CONF_SE json_object *json, *j_value; /* json object holders */ json_object *jrows = NULL; /* json object to hold view rows */ CONF_SECTION *client; /* freeradius config list */ - RADCLIENT *c; /* freeradius client */ + fr_client_t *c; /* freeradius client */ /* get handle */ handle = fr_pool_connection_get(inst->pool, NULL); diff --git a/src/modules/rlm_opendirectory/rlm_opendirectory.c b/src/modules/rlm_opendirectory/rlm_opendirectory.c index 008a4a95be6..655d0de435d 100644 --- a/src/modules/rlm_opendirectory/rlm_opendirectory.c +++ b/src/modules/rlm_opendirectory/rlm_opendirectory.c @@ -387,7 +387,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, mod rlm_opendirectory_t const *inst = talloc_get_type_abort_const(mctx->inst->data, rlm_opendirectory_t); struct passwd *userdata = NULL; int ismember = 0; - RADCLIENT *client = NULL; + fr_client_t *client = NULL; uuid_t uuid; uuid_t guid_sacl; uuid_t guid_nasgroup; diff --git a/src/modules/rlm_radius/rlm_radius.c b/src/modules/rlm_radius/rlm_radius.c index 4239b94bcee..44542166f30 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -392,7 +392,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul rlm_radius_t const *inst = talloc_get_type_abort_const(mctx->inst->data, rlm_radius_t); rlm_rcode_t rcode; unlang_action_t ua; - RADCLIENT *client; + fr_client_t *client; void *rctx = NULL; diff --git a/src/modules/rlm_radutmp/rlm_radutmp.c b/src/modules/rlm_radutmp/rlm_radutmp.c index f2676c380b7..31a0fb4162e 100644 --- a/src/modules/rlm_radutmp/rlm_radutmp.c +++ b/src/modules/rlm_radutmp/rlm_radutmp.c @@ -195,7 +195,7 @@ static unlang_action_t CC_HINT(nonnull) mod_accounting(rlm_rcode_t *p_result, mo char *filename = NULL; char *expanded = NULL; - RADCLIENT *client; + fr_client_t *client; if (request->dict != dict_radius) RETURN_MODULE_NOOP; diff --git a/src/modules/rlm_unix/rlm_unix.c b/src/modules/rlm_unix/rlm_unix.c index 8ec555d3827..5e6310ccde8 100644 --- a/src/modules/rlm_unix/rlm_unix.c +++ b/src/modules/rlm_unix/rlm_unix.c @@ -349,7 +349,7 @@ static unlang_action_t CC_HINT(nonnull) mod_accounting(rlm_rcode_t *p_result, mo #endif uint32_t nas_port = 0; bool port_seen = true; - RADCLIENT *client; + fr_client_t *client; /* * No radwtmp. Don't do anything. diff --git a/src/process/radius/base.c b/src/process/radius/base.c index d3d09ff3144..49235aeb4a5 100644 --- a/src/process/radius/base.c +++ b/src/process/radius/base.c @@ -248,7 +248,7 @@ static char *auth_name(char *buf, size_t buflen, request_t *request) fr_pair_t *pair; uint32_t port = 0; /* RFC 2865 NAS-Port is 4 bytes */ char const *tls = ""; - RADCLIENT *client = client_from_request(request); + fr_client_t *client = client_from_request(request); cli = fr_pair_find_by_da(&request->request_pairs, NULL, attr_calling_station_id); diff --git a/src/process/tacacs/base.c b/src/process/tacacs/base.c index 81f79d9b563..75020633835 100644 --- a/src/process/tacacs/base.c +++ b/src/process/tacacs/base.c @@ -246,7 +246,7 @@ static const CONF_PARSER config[] = { static char *auth_name(char *buf, size_t buflen, request_t *request) { char const *tls = ""; - RADCLIENT *client = client_from_request(request); + fr_client_t *client = client_from_request(request); if (request->packet->socket.inet.dst_port == 0) tls = " via proxy to virtual server"; diff --git a/src/process/ttls/base.c b/src/process/ttls/base.c index 92bf2fee623..6aaef35f503 100644 --- a/src/process/ttls/base.c +++ b/src/process/ttls/base.c @@ -246,7 +246,7 @@ static char *auth_name(char *buf, size_t buflen, request_t *request) fr_pair_t *pair; uint32_t port = 0; /* RFC 2865 NAS-Port is 4 bytes */ char const *tls = ""; - RADCLIENT *client = client_from_request(request); + fr_client_t *client = client_from_request(request); cli = fr_pair_find_by_da(&request->request_pairs, NULL, attr_calling_station_id);