X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Flisten.c;h=57c96070d7aaf445815a09e611c6a8d78a84649a;hb=bca85674a83f94b9cfae0ebdc129bbaf645c8f7d;hp=02977a5f68866ac5a8a6cadb3624cfc523f856d2;hpb=51201aa52650f9f0b27d0915a56733ed6bf40333;p=freeradius.git diff --git a/src/main/listen.c b/src/main/listen.c index 02977a5..57c9607 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -84,7 +84,7 @@ static rad_listen_t *listen_alloc(RAD_LISTEN_TYPE type); /* * Find a per-socket client. */ -RADCLIENT *client_listener_find(const rad_listen_t *listener, +RADCLIENT *client_listener_find(rad_listen_t *listener, const fr_ipaddr_t *ipaddr, int src_port) { #ifdef WITH_DYNAMIC_CLIENTS @@ -725,6 +725,7 @@ static int socket_print(const rad_listen_t *this, char *buffer, size_t bufsize) return 1; } +#ifdef WITH_PROXY /* * Maybe it's a socket that we opened to a home server. */ @@ -755,7 +756,8 @@ static int socket_print(const rad_listen_t *this, char *buffer, size_t bufsize) return 1; } -#endif +#endif /* WITH_PROXY */ +#endif /* WITH_TCP */ ADDSTRING(" address "); @@ -868,18 +870,21 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this) * TCP requires a destination IP for sockets. * UDP doesn't, so it's allowed. */ +#ifdef WITH_PROXY if ((this->type == RAD_LISTEN_PROXY) && (sock->proto != IPPROTO_UDP)) { cf_log_err(cf_sectiontoitem(cs), "Proxy listeners can only listen on proto = udp"); return -1; } -#endif +#endif /* WITH_PROXY */ +#endif /* WITH_TCP */ } sock->my_ipaddr = ipaddr; sock->my_port = listen_port; +#ifdef WITH_PROXY if (check_config) { if (home_server_find(&sock->my_ipaddr, sock->my_port, sock->proto)) { char buffer[128]; @@ -892,6 +897,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this) return 0; /* don't do anything */ } +#endif /* * If we can bind to interfaces, do so, @@ -2441,6 +2447,7 @@ static rad_listen_t *listen_parse(CONF_SECTION *cs, const char *server) return this; } +#ifdef WITH_PROXY static int is_loopback(const fr_ipaddr_t *ipaddr) { /* @@ -2460,6 +2467,7 @@ static int is_loopback(const fr_ipaddr_t *ipaddr) return 0; } +#endif /* * Generate a list of listeners. Takes an input list of @@ -2809,12 +2817,12 @@ void listen_free(rad_listen_t **head) } #ifdef WITH_TCP - if ((this->type == RAD_LISTEN_AUTH) || + if ((this->type == RAD_LISTEN_AUTH) #ifdef WITH_ACCT - (this->type == RAD_LISTEN_ACCT) || + || (this->type == RAD_LISTEN_ACCT) #endif #ifdef WITH_PROXY - (this->type == RAD_LISTEN_PROXY) + || (this->type == RAD_LISTEN_PROXY) #endif ) { listen_socket_t *sock = this->data; @@ -2840,8 +2848,11 @@ RADCLIENT_LIST *listener_find_client_list(const fr_ipaddr_t *ipaddr, for (this = mainconfig.listen; this != NULL; this = this->next) { listen_socket_t *sock; - if ((this->type != RAD_LISTEN_AUTH) && - (this->type != RAD_LISTEN_ACCT)) continue; + if ((this->type != RAD_LISTEN_AUTH) +#ifdef WITH_ACCOUNTING + && (this->type != RAD_LISTEN_ACCT) +#endif + ) continue; sock = this->data; @@ -2866,8 +2877,11 @@ rad_listen_t *listener_find_byipaddr(const fr_ipaddr_t *ipaddr, int port) * FIXME: For TCP, ignore the *secondary* * listeners associated with the main socket. */ - if ((this->type != RAD_LISTEN_AUTH) && - (this->type != RAD_LISTEN_ACCT)) continue; + if ((this->type != RAD_LISTEN_AUTH) +#ifdef WITH_ACCOUNTING + && (this->type != RAD_LISTEN_ACCT) +#endif + ) continue; sock = this->data;