From: Alan T. DeKok Date: Thu, 4 Feb 2010 17:09:22 +0000 (+0100) Subject: Fixes to build without TCP X-Git-Url: http://www.project-moonshot.org/gitweb/?p=freeradius.git;a=commitdiff_plain;h=30c03d55e0e587777b043174c78b76461ba4bde5 Fixes to build without TCP --- diff --git a/src/lib/packet.c b/src/lib/packet.c index 5fd40a6..095f406 100644 --- a/src/lib/packet.c +++ b/src/lib/packet.c @@ -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 diff --git a/src/main/client.c b/src/main/client.c index 247ce1d..d378d4b 100644 --- a/src/main/client.c +++ b/src/main/client.c @@ -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; diff --git a/src/main/event.c b/src/main/event.c index 4b6380f..0f9dcb5 100644 --- a/src/main/event.c +++ b/src/main/event.c @@ -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__