aboutsummaryrefslogtreecommitdiffstats
path: root/src/radius
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-03-01 16:38:00 (GMT)
committerJouni Malinen <j@w1.fi>2015-03-01 20:36:52 (GMT)
commitb4a9292cfbd9764ebdcc46469d78b7f701651cf1 (patch)
treefa9587e232e43bca2b71281d662b596efa741a19 /src/radius
parent7c5658c66145ff16a3b95506be40049f8729fe22 (diff)
downloadhostap-b4a9292cfbd9764ebdcc46469d78b7f701651cf1.zip
hostap-b4a9292cfbd9764ebdcc46469d78b7f701651cf1.tar.gz
hostap-b4a9292cfbd9764ebdcc46469d78b7f701651cf1.tar.bz2
RADIUS client: Fix server failover on return-to-primary on error case
If a connection with the primary server cannot be established, restore connection to the previously used server. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/radius')
-rw-r--r--src/radius/radius_client.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/radius/radius_client.c b/src/radius/radius_client.c
index e9d4a55..693f61e 100644
--- a/src/radius/radius_client.c
+++ b/src/radius/radius_client.c
@@ -1176,18 +1176,28 @@ static void radius_retry_primary_timer(void *eloop_ctx, void *timeout_ctx)
conf->auth_server != conf->auth_servers) {
oserv = conf->auth_server;
conf->auth_server = conf->auth_servers;
- radius_change_server(radius, conf->auth_server, oserv,
- radius->auth_serv_sock,
- radius->auth_serv_sock6, 1);
+ if (radius_change_server(radius, conf->auth_server, oserv,
+ radius->auth_serv_sock,
+ radius->auth_serv_sock6, 1) < 0) {
+ conf->auth_server = oserv;
+ radius_change_server(radius, oserv, conf->auth_server,
+ radius->auth_serv_sock,
+ radius->auth_serv_sock6, 1);
+ }
}
if (radius->acct_sock >= 0 && conf->acct_servers &&
conf->acct_server != conf->acct_servers) {
oserv = conf->acct_server;
conf->acct_server = conf->acct_servers;
- radius_change_server(radius, conf->acct_server, oserv,
- radius->acct_serv_sock,
- radius->acct_serv_sock6, 0);
+ if (radius_change_server(radius, conf->acct_server, oserv,
+ radius->acct_serv_sock,
+ radius->acct_serv_sock6, 0) < 0) {
+ conf->acct_server = oserv;
+ radius_change_server(radius, oserv, conf->acct_server,
+ radius->acct_serv_sock,
+ radius->acct_serv_sock6, 0);
+ }
}
if (conf->retry_primary_interval)