hostapd and radius server

Mark Glines mark-hostap
Thu May 27 09:13:01 PDT 2004


On do, mei 27, 2004 at 10:14:39 +0200, Ulf Jakobsson wrote:
> Hi,
> 
> I've noticed something strange with the hostapd regading radius servers.
> 
> I've got a radius server on an ethernet interface and a WLAN client 
> connecting to a WIFI interface and every time (during boot for example) 
>  the WIFI interface initiates before the ethernet interface, hostapd 
> seems to not send any requests to the radius server.
> (The client I'm using runs xsupplicant)
> 
> 
> I've tested this with both the 0.2.1 and the 0.1.3 versions.
> 
> It's not a problem if I for instance restart the hostapd or if the WIFI 
> interface is initiated after the ethernet interface.
> 
> Any ideas?

Hmm.  I sent a patch to the list in October 2003 which makes hostapd recover
from ethernet status changes.  I didn't get any response.  My original message
is: http://sisyphus.iocaine.com/pipermail/hostap/2003-October/004463.html

I think there's a good chance the same patch will fix your issue.  I've
attached it; can you please test it?

Mark
-------------- next part --------------
Index: hostapd/radius_client.c
===================================================================
RCS file: /cvs/hostap/hostapd/radius_client.c,v
retrieving revision 1.4
diff -u -r1.4 radius_client.c
--- hostapd/radius_client.c	9 May 2003 21:45:55 -0000	1.4
+++ hostapd/radius_client.c	16 Oct 2003 22:32:51 -0000
@@ -18,6 +18,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
+#include <errno.h>
 
 #include "hostapd.h"
 #include "radius.h"
@@ -87,6 +88,9 @@
 }
 
 
+static int radius_client_init_acct(hostapd *hapd);
+static int radius_client_init_auth(hostapd *hapd);
+
 static int radius_client_retransmit(hostapd *hapd,
 				    struct radius_msg_list *entry, time_t now)
 {
@@ -102,8 +106,16 @@
 	HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "Resending RADIUS message (id=%d)"
 		      "\n", entry->msg->hdr->identifier);
 
-	if (send(s, entry->msg->buf, entry->msg->buf_used, 0) < 0)
+	if (send(s, entry->msg->buf, entry->msg->buf_used, 0) < 0) {
 		perror("send[RADIUS]");
+		if(errno == ENOTCONN) {
+			close(s);
+			if (entry->msg_type == RADIUS_ACCT)
+				radius_client_init_acct(hapd);
+			else
+				radius_client_init_auth(hapd);
+		}
+	}
 
 	entry->next_try = now + entry->next_wait;
 	entry->next_wait *= 2;
@@ -291,8 +303,16 @@
 		radius_msg_dump(msg);
 
 	res = send(s, msg->buf, msg->buf_used, 0);
-	if (res < 0)
+	if (res < 0) {
 		perror("send[RADIUS]");
+		if(errno == ENOTCONN) {
+			close(s);
+			if (msg_type == RADIUS_ACCT)
+				radius_client_init_acct(hapd);
+			else
+				radius_client_init_auth(hapd);
+		}
+	}
 
 	radius_client_list_add(hapd, msg, msg_type, shared_secret,
 			       shared_secret_len);



More information about the Hostap mailing list