From: Alan T. DeKok Date: Thu, 4 Feb 2010 17:09:22 +0000 (+0100) Subject: Fixes to build without TCP X-Git-Tag: release_3_0_0_beta0~1584 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=839ee8ca88fb24f44f8d282030248eefac27140f;p=freeradius.git 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 64a573e..ee99e33 100644 --- a/src/main/event.c +++ b/src/main/event.c @@ -3446,6 +3446,12 @@ int 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 @@ -3493,7 +3499,8 @@ int 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. @@ -3529,6 +3536,7 @@ int event_new_fd(rad_listen_t *this) */ } +#ifdef WITH_TCP /* * Called ONLY from the main thread. On the following * conditions: @@ -3640,6 +3648,7 @@ finish: */ listen_free(&this); } +#endif /* WITH_TCP */ return 1; } @@ -3702,6 +3711,7 @@ static void handle_signal_self(int flag) } #endif +#ifdef WITH_TCP #ifdef WITH_PROXY /* * Add event handlers for idle timeouts && maximum lifetime. @@ -3745,7 +3755,8 @@ static void handle_signal_self(int flag) PTHREAD_MUTEX_UNLOCK(&proxy_mutex); } -#endif +#endif /* WITH_PROXY */ +#endif /* WITH_TCP */ } #ifndef WITH_SELF_PIPE