From 2f06f2c646b60bbfad575b8d3655d1bb2ba88503 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Thu, 10 Jun 2010 10:07:04 +0200 Subject: [PATCH] Catch "ping" packets before --- src/main/event.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/event.c b/src/main/event.c index 76275f7..892333f 100644 --- a/src/main/event.c +++ b/src/main/event.c @@ -3164,6 +3164,19 @@ REQUEST *received_proxy_response(RADIUS_PACKET *packet) gettimeofday(&now, NULL); /* + * "ping" packets have a different algorithm for marking + * a home server alive. They also skip all of the CoA, + * etc. checks. + */ + if (!request->packet) { + request->proxy_reply = packet; + received_response_to_ping(request); + request->proxy_reply = NULL; /* caller will free it */ + ev_request_free(&request); + return NULL; + } + + /* * Maybe move this earlier in the decision process? * Having it here means that late or duplicate proxy * replies no longer get the home server marked as @@ -3174,9 +3187,7 @@ REQUEST *received_proxy_response(RADIUS_PACKET *packet) * mark it alive on *any* packet, even if it's lost all * of the *other* packets in the last 10s. */ - if (request->proxy->code != PW_STATUS_SERVER) { - request->home_server->state = HOME_STATE_ALIVE; - } + request->home_server->state = HOME_STATE_ALIVE; #ifdef WITH_COA /* @@ -3225,7 +3236,7 @@ REQUEST *received_proxy_response(RADIUS_PACKET *packet) RDEBUG2("Ignoring proxy reply that arrived after we sent a reply to the NAS"); return NULL; } - + #ifdef WITH_STATS /* * The average includes our time to receive packets and @@ -3301,17 +3312,6 @@ REQUEST *received_proxy_response(RADIUS_PACKET *packet) } #endif - /* - * There's no incoming request, so it's a proxied packet - * we originated. - */ - if (!request->packet) { - received_response_to_ping(request); - request->proxy_reply = NULL; /* caller will free it */ - ev_request_free(&request); - return NULL; - } - request->child_state = REQUEST_QUEUED; request->when = now; request->delay = USEC; -- 2.1.4