Scott Lambert wrote:
> Could the server do the bind calls for the listen sockets and check
> to see if the bound IP is the same as the one specified in the bind
> call and if not, update the server to use the bound IP rather than the
> configured IP at least in the case of listen { ipaddr = * }.
Yes. Try the attached patch. It seems to work, but test it for yourself.
> Thank you for your time and patience.
My patience is often a reflection of the effort I see people putting
into solving the problems they see.
Alan DeKok.
Index: src/main/listen.c
===================================================================
RCS file: /source/radiusd/src/main/listen.c,v
retrieving revision 1.100
diff -u -r1.100 listen.c
--- src/main/listen.c 4 Sep 2007 15:25:11 -0000 1.100
+++ src/main/listen.c 24 Sep 2007 12:59:25 -0000
@@ -862,6 +862,34 @@
return -1;
}
+ {
+ struct sockaddr_storage src;
+ socklen_t sizeof_src = sizeof(src);
+
+ memset(&src, 0, sizeof_src);
+ if (getsockname(this->fd, (struct sockaddr *) &src,
+ &sizeof_src) < 0) {
+ return -1;
+ }
+
+ if (src.ss_family == AF_INET) {
+ struct sockaddr_in *s4;
+
+ s4 = (struct sockaddr_in *)&src;
+ sock->ipaddr.ipaddr.ip4addr = s4->sin_addr;
+
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
+ } else if (src.ss_family == AF_INET6) {
+ struct sockaddr_in6 *s6;
+
+ s6 = (struct sockaddr_in6 *)&src;
+ sock->ipaddr.ipaddr.ip6addr = s6->sin6_addr;
+#endif
+ } else {
+ return -1;
+ }
+ }
+
#if 0
#ifdef O_NONBLOCK
if ((flags = fcntl(this->fd, F_GETFL, NULL)) < 0) {
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html