From: Alan T. DeKok Date: Sun, 22 Oct 2017 13:04:47 +0000 (-0400) Subject: don't re-insert the connection if we receive multiple packets X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=feb8442af66b96aa0ff1d270892a6588694fceee;p=thirdparty%2Ffreeradius-server.git don't re-insert the connection if we receive multiple packets --- diff --git a/src/modules/rlm_radius/rlm_radius_udp.c b/src/modules/rlm_radius/rlm_radius_udp.c index cf2e082f99c..3ee67fa771c 100644 --- a/src/modules/rlm_radius/rlm_radius_udp.c +++ b/src/modules/rlm_radius/rlm_radius_udp.c @@ -743,6 +743,7 @@ static void conn_read(fr_event_list_t *el, int fd, UNUSED int flags, void *uctx) ssize_t data_len; REQUEST *request = NULL; uint8_t original[20]; + bool reinserted = false; DEBUG3("%s - Reading data for connection %s", c->inst->parent->name, c->name); @@ -821,10 +822,13 @@ redo: */ switch (c->state) { case CONN_ACTIVE: + if (reinserted) break; + if (timercmp(&u->timer.start, &c->mrs_time, >)) { (void) fr_heap_extract(c->thread->active, c); c->mrs_time = u->timer.start; (void) fr_heap_insert(c->thread->active, c); + reinserted = true; } break; @@ -837,6 +841,11 @@ redo: * Transition to active on any one packet. RFC * 3539 says to wait for N status check * responses, but we're happy to do it faster. + * + * If the connection was FULL, then + * mod_finished_request() will ensure that this + * packet has been removed from the connection, + * before any subsequent writes go to it. */ conn_transition(c, CONN_ACTIVE); if (fr_heap_num_elements(c->thread->queued) > 0) fd_active(c);