Fixes to build without TCP
authorAlan T. DeKok <aland@freeradius.org>
Thu, 4 Feb 2010 17:09:22 +0000 (18:09 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 4 Feb 2010 17:10:56 +0000 (18:10 +0100)
src/lib/packet.c
src/main/client.c
src/main/event.c

index 5fd40a6..095f406 100644 (file)
@@ -432,6 +432,13 @@ int fr_packet_list_socket_add(fr_packet_list_t *pl, int sockfd, int proto,
                return 0;
        }
 
+#ifndef WITH_TCP
+       if (proto != IPPROTO_UDP) {
+               fr_strerror_printf("only UDP is supported");
+               return 0;
+       }
+#endif
+
        ps = NULL;
        i = start = SOCK2OFFSET(sockfd);
 
@@ -452,7 +459,9 @@ int fr_packet_list_socket_add(fr_packet_list_t *pl, int sockfd, int proto,
 
        memset(ps, 0, sizeof(*ps));
        ps->ctx = ctx;
+#ifdef WITH_TCP
        ps->proto = proto;
+#endif
 
        /*
         *      Get address family, etc. first, so we know if we
index 247ce1d..d378d4b 100644 (file)
@@ -491,11 +491,7 @@ RADCLIENT *client_find(const RADCLIENT_LIST *clients,
  */
 RADCLIENT *client_find_old(const fr_ipaddr_t *ipaddr)
 {
-       return client_find(root_clients, ipaddr
-#ifdef WITH_TCP
-                          , IPPROTO_UDP
-#endif
-                          );
+       return client_find(root_clients, ipaddr, IPPROTO_UDP);
 }
 
 static struct in_addr cl_ip4addr;
index 4b6380f..0f9dcb5 100644 (file)
@@ -3429,6 +3429,12 @@ void event_new_fd(rad_listen_t *this)
                fr_event_fd_delete(el, 0, this->fd);
                FD_MUTEX_UNLOCK(&fd_mutex);
 
+#ifdef WITH_TCP
+               /*
+                *      We track requests using this socket only for
+                *      TCP.  For UDP, we don't currently close
+                *      sockets.
+                */
 #ifdef WITH_PROXY
                if (this->type != RAD_LISTEN_PROXY)
 #endif
@@ -3476,7 +3482,8 @@ void event_new_fd(rad_listen_t *this)
                                goto finish;
                        }
                }
-#endif
+#endif /* WITH_PROXY */
+#endif /* WITH_TCP */
 
                /*
                 *      Re-open the socket, pointing it to /dev/null.
@@ -3512,6 +3519,7 @@ void event_new_fd(rad_listen_t *this)
                 */
        }
 
+#ifdef WITH_TCP
        /*
         *      Called ONLY from the main thread.  On the following
         *      conditions:
@@ -3623,6 +3631,9 @@ finish:
                 */
                listen_free(&this);
        }
+#endif /* WITH_TCP */
+
+       return 1;
 }
 
 static void handle_signal_self(int flag)
@@ -3683,6 +3694,7 @@ static void handle_signal_self(int flag)
        }
 #endif
 
+#ifdef WITH_TCP
 #ifdef WITH_PROXY
        /*
         *      Add event handlers for idle timeouts && maximum lifetime.
@@ -3726,7 +3738,8 @@ static void handle_signal_self(int flag)
 
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
        }
-#endif
+#endif /* WITH_PROXY */
+#endif /* WITH_TCP */
 }
 
 #ifdef __MINGW32__