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>
This commit is contained in:
Jouni Malinen 2015-03-01 18:38:00 +02:00
parent 7c5658c661
commit b4a9292cfb

View file

@ -1176,19 +1176,29 @@ static void radius_retry_primary_timer(void *eloop_ctx, void *timeout_ctx)
conf->auth_server != conf->auth_servers) { conf->auth_server != conf->auth_servers) {
oserv = conf->auth_server; oserv = conf->auth_server;
conf->auth_server = conf->auth_servers; conf->auth_server = conf->auth_servers;
radius_change_server(radius, conf->auth_server, oserv, 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_sock,
radius->auth_serv_sock6, 1); radius->auth_serv_sock6, 1);
} }
}
if (radius->acct_sock >= 0 && conf->acct_servers && if (radius->acct_sock >= 0 && conf->acct_servers &&
conf->acct_server != conf->acct_servers) { conf->acct_server != conf->acct_servers) {
oserv = conf->acct_server; oserv = conf->acct_server;
conf->acct_server = conf->acct_servers; conf->acct_server = conf->acct_servers;
radius_change_server(radius, conf->acct_server, oserv, 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_sock,
radius->acct_serv_sock6, 0); radius->acct_serv_sock6, 0);
} }
}
if (conf->retry_primary_interval) if (conf->retry_primary_interval)
eloop_register_timeout(conf->retry_primary_interval, 0, eloop_register_timeout(conf->retry_primary_interval, 0,