Casartello, Thomas wrote:
> I tried hardcoding them in the listen section. Same result.

  Weird.

  My guess, then, is that it seems to be a problem with the specific GCC
version on Fedora.

  Please try the attached patch.  If it doesn't work, then the only way
to fix it is for me to get an SSH login to a fedora machine.

  Oh, and 2.0.4. works on Ubuntu, Debian, *BSD, Solaris...

  Alan DeKok.
Index: src/lib/packet.c
===================================================================
RCS file: /source/radiusd/src/lib/packet.c,v
retrieving revision 1.20
diff -u -r1.20 packet.c
--- src/lib/packet.c	1 Jan 2008 17:29:12 -0000	1.20
+++ src/lib/packet.c	15 May 2008 19:34:22 -0000
@@ -175,6 +175,7 @@
 int fr_socket(fr_ipaddr_t *ipaddr, int port)
 {
 	int sockfd;
+	uint16_t sport;
 	struct sockaddr_storage salocal;
 	socklen_t	salen;
 
@@ -185,6 +186,7 @@
 
 	sockfd = socket(ipaddr->af, SOCK_DGRAM, 0);
 	if (sockfd < 0) {
+		librad_log("cannot open socket: %s", strerror(errno));
 		return sockfd;
 	}
 
@@ -194,10 +196,13 @@
 	 */
 	if (udpfromto_init(sockfd) != 0) {
 		close(sockfd);
+		librad_log("cannot initialize udpfromto: %s", strerror(errno));
 		return -1;
 	}
 #endif
 
+	sport = port;
+	sport = htons(sport);
 	memset(&salocal, 0, sizeof(salocal));
 	if (ipaddr->af == AF_INET) {
 		struct sockaddr_in *sa;
@@ -205,7 +210,7 @@
 		sa = (struct sockaddr_in *) &salocal;
 		sa->sin_family = AF_INET;
 		sa->sin_addr = ipaddr->ipaddr.ip4addr;
-		sa->sin_port = htons((uint16_t) port);
+		sa->sin_port = sport;
 		salen = sizeof(*sa);
 
 #ifdef HAVE_STRUCT_SOCKADDR_IN6
@@ -215,7 +220,7 @@
 		sa = (struct sockaddr_in6 *) &salocal;
 		sa->sin6_family = AF_INET6;
 		sa->sin6_addr = ipaddr->ipaddr.ip6addr;
-		sa->sin6_port = htons((uint16_t) port);
+		sa->sin6_port = sport;
 		salen = sizeof(*sa);
 
 #if 1
@@ -242,6 +247,7 @@
 
 	if (bind(sockfd, (struct sockaddr *) &salocal, salen) < 0) {
 		close(sockfd);
+		librad_log("cannot bind socket: %s", strerror(errno));
 		return -1;
 	}
 
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to