From: Alan T. DeKok Date: Tue, 21 Jun 2011 10:28:33 +0000 (+0200) Subject: TCP connections don't ping home servers. X-Git-Tag: release_3_0_0_beta0~756 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f961ecaaaf99df9f2858331bc14fa3bb8b15d3f2;p=thirdparty%2Ffreeradius-server.git TCP connections don't ping home servers. Instead, we should send pings per CONNECTION, not per SERVER. --- diff --git a/src/main/process.c b/src/main/process.c index 3c64150bad8..e9e7f2f5767 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -2372,6 +2372,9 @@ static void ping_home_server(void *ctx) if ((home->state == HOME_STATE_ALIVE) || (home->ping_check == HOME_PING_CHECK_NONE) || +#ifdef WITH_TCP + (home->proto == IPPROTO_TCP) || +#endif (home->ev != NULL)) { return; } @@ -2523,6 +2526,13 @@ static void mark_home_server_zombie(home_server *home) rad_assert(home->state == HOME_STATE_ALIVE); +#ifdef WITH_TCP + if (home->proto == IPPROTO_TCP) { + DEBUG("WARNING: Not marking TCP server zombie"); + return; + } +#endif + home->state = HOME_STATE_ZOMBIE; home_trigger(home, "home_server.zombie"); @@ -2572,6 +2582,13 @@ void mark_home_server_dead(home_server *home, struct timeval *when) int previous_state = home->state; char buffer[128]; +#ifdef WITH_TCP + if (home->proto == IPPROTO_TCP) { + DEBUG("WARNING: Not marking TCP server dead"); + return; + } +#endif + radlog(L_PROXY, "Marking home server %s port %d as dead.", inet_ntop(home->ipaddr.af, &home->ipaddr.ipaddr, buffer, sizeof(buffer)), @@ -2674,9 +2691,14 @@ static void request_proxied(REQUEST *request, int action) case FR_ACTION_TIMER: /* * If we haven't received a packet for a while, - * mark it as zombie. + * mark it as zombie. If the connection is TCP, + * then another "watchdog timer" function takes + * care of pings, etc. */ if ((home->state == HOME_STATE_ALIVE) && +#ifdef WITH_TCP + (home->proto != IPPROTO_TCP) && +#endif ((home->last_packet + ((home->zombie_period + 3) / 4)) < now.tv_sec)) { mark_home_server_zombie(home); }