]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RADIUS client: Trigger failover more quickly if socket is not valid
authorJouni Malinen <j@w1.fi>
Fri, 30 May 2014 17:52:08 +0000 (20:52 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 30 May 2014 17:52:08 +0000 (20:52 +0300)
It is possible for the connect() call to fail (e.g., due to unreachable
network based on local routing table), so the current auth/acct_sock may
be left to -1. Use that as an addition trigger to allow server failover
operation to be performed more quickly if it is known that the
retransmission attempt will not succeed anyway.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/radius/radius_client.c

index a7f11151dd776500d4fc0daa724f30089317ca96..10056a64aaf6c4ca80d2df1ff0f4fc2b90e08a03 100644 (file)
@@ -390,6 +390,7 @@ static void radius_client_timer(void *eloop_ctx, void *timeout_ctx)
        int auth_failover = 0, acct_failover = 0;
        char abuf[50];
        size_t prev_num_msgs;
+       int s;
 
        entry = radius->msgs;
        if (!entry)
@@ -423,7 +424,10 @@ static void radius_client_timer(void *eloop_ctx, void *timeout_ctx)
                        continue;
                }
 
-               if (entry->attempts > RADIUS_CLIENT_NUM_FAILOVER) {
+               s = entry->msg_type == RADIUS_AUTH ? radius->auth_sock :
+                       radius->acct_sock;
+               if (entry->attempts > RADIUS_CLIENT_NUM_FAILOVER ||
+                   (s < 0 && entry->attempts > 0)) {
                        if (entry->msg_type == RADIUS_ACCT ||
                            entry->msg_type == RADIUS_ACCT_INTERIM)
                                acct_failover++;