From: Nick Porter Date: Mon, 3 Nov 2025 11:55:47 +0000 (+0000) Subject: Add read / write hexdump options to RADIUS app_io X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1af0935b70ee378217be503d12147f7c7e1ec00e;p=thirdparty%2Ffreeradius-server.git Add read / write hexdump options to RADIUS app_io --- diff --git a/src/listen/radius/proto_radius_tcp.c b/src/listen/radius/proto_radius_tcp.c index 599d54de72..a11ae376da 100644 --- a/src/listen/radius/proto_radius_tcp.c +++ b/src/listen/radius/proto_radius_tcp.c @@ -61,11 +61,14 @@ typedef struct { bool recv_buff_is_set; //!< Whether we were provided with a recv_buff bool dynamic_clients; //!< whether we have dynamic clients - fr_client_list_t *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 fr_ipaddr_t *deny; //!< denied networks for dynamic clients + + bool read_hexdump; //!< Do we debug hexdump read packets. + bool write_hexdump; //!< Do we debug hexdump write packets. } proto_radius_tcp_t; @@ -94,6 +97,9 @@ static const conf_parser_t tcp_listen_config[] = { { FR_CONF_OFFSET("max_packet_size", proto_radius_tcp_t, max_packet_size), .dflt = "4096" } , { FR_CONF_OFFSET("max_attributes", proto_radius_tcp_t, max_attributes), .dflt = STRINGIFY(RADIUS_MAX_ATTRIBUTES) } , + { FR_CONF_OFFSET("read_hexdump", proto_radius_tcp_t, read_hexdump) }, + { FR_CONF_OFFSET("write_hexdump", proto_radius_tcp_t, write_hexdump) }, + CONF_PARSER_TERMINATOR }; @@ -418,6 +424,13 @@ static char const *mod_name(fr_listen_t *li) return thread->name; } +static void mod_hexdump_set(fr_listen_t *li, void *data) +{ + proto_radius_tcp_t *inst = talloc_get_type_abort(data, proto_radius_tcp_t); + li->read_hexdump = inst->read_hexdump; + li->write_hexdump = inst->write_hexdump; +} + static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_radius_tcp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_radius_tcp_t); @@ -667,4 +680,5 @@ fr_app_io_t proto_radius_tcp = { .network_get = mod_network_get, .client_find = mod_client_find, .get_name = mod_name, + .hexdump_set = mod_hexdump_set, }; diff --git a/src/listen/radius/proto_radius_udp.c b/src/listen/radius/proto_radius_udp.c index 58b5421633..f543323fa4 100644 --- a/src/listen/radius/proto_radius_udp.c +++ b/src/listen/radius/proto_radius_udp.c @@ -74,6 +74,9 @@ typedef struct { fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients fr_ipaddr_t *deny; //!< denied networks for dynamic clients + + bool read_hexdump; //!< Do we debug hexdump read packets. + bool write_hexdump; //!< Do we debug hexdump write packets. } proto_radius_udp_t; @@ -106,6 +109,9 @@ static const conf_parser_t udp_listen_config[] = { { FR_CONF_OFFSET("max_packet_size", proto_radius_udp_t, max_packet_size), .dflt = "4096" } , { FR_CONF_OFFSET("max_attributes", proto_radius_udp_t, max_attributes), .dflt = STRINGIFY(RADIUS_MAX_ATTRIBUTES) } , + { FR_CONF_OFFSET("read_hexdump", proto_radius_udp_t, read_hexdump) }, + { FR_CONF_OFFSET("write_hexdump", proto_radius_udp_t, write_hexdump) }, + CONF_PARSER_TERMINATOR }; @@ -421,6 +427,12 @@ static char const *mod_name(fr_listen_t *li) return thread->name; } +static void mod_hexdump_set(fr_listen_t *li, void *data) +{ + proto_radius_udp_t *inst = talloc_get_type_abort(data, proto_radius_udp_t); + li->read_hexdump = inst->read_hexdump; + li->write_hexdump = inst->write_hexdump; +} static int mod_instantiate(module_inst_ctx_t const *mctx) { @@ -550,4 +562,5 @@ fr_app_io_t proto_radius_udp = { .network_get = mod_network_get, .client_find = mod_client_find, .get_name = mod_name, + .hexdump_set = mod_hexdump_set, };