From: Alan T. DeKok Date: Wed, 21 Jun 2017 13:14:04 +0000 (-0400) Subject: Add event_list_set for proto_radius_udp X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4e71180246972e4fff1cca5d6c645d1c45d41f6;p=thirdparty%2Ffreeradius-server.git Add event_list_set for proto_radius_udp --- diff --git a/src/modules/proto_radius/proto_radius_udp.c b/src/modules/proto_radius/proto_radius_udp.c index d4a5e0ecf25..ab772acf465 100644 --- a/src/modules/proto_radius/proto_radius_udp.c +++ b/src/modules/proto_radius/proto_radius_udp.c @@ -51,6 +51,8 @@ typedef struct { int sockfd; + fr_event_list_t *el; //!< for cleanup timers on Access-Request + fr_ipaddr_t ipaddr; //!< Ipaddr to listen on. bool ipaddr_is_set; //!< ipaddr config item is set. @@ -209,6 +211,33 @@ static int mod_fd(void const *instance) return inst->sockfd; } + +/** Set the event list for a new socket + * + * @param[in] instance of the RADIUS UDP I/O path. + */ +static void mod_event_list_set(void const *instance, fr_event_list_t *el) +{ + proto_radius_udp_t *inst; + + memcpy(&inst, &instance, sizeof(inst)); /* const issues */ + + inst = talloc_get_type_abort(instance, proto_radius_udp_t); + + /* + * Only Access-Request gets a cleanup delay. + */ + if (!inst->parent->code_allowed[FR_CODE_ACCESS_REQUEST]) return; + + /* + * And then, only if it is non-zero. + */ + if (!inst->cleanup_delay) return; + + inst->el = el; +} + + static int mod_instantiate(void *instance, CONF_SECTION *cs) { proto_radius_udp_t *inst = talloc_get_type_abort(instance, proto_radius_udp_t); @@ -287,5 +316,6 @@ fr_app_io_t proto_radius_udp = { .open = mod_open, .read = mod_read, .write = mod_write, - .fd = mod_fd + .fd = mod_fd, + .event_list_set = mod_event_list_set, };