diff options
Diffstat (limited to 'udp.c')
-rw-r--r-- | udp.c | 26 |
1 files changed, 4 insertions, 22 deletions
@@ -25,6 +25,7 @@ #include <regex.h> #include <pthread.h> #include "radsecproxy.h" +#include "common.h" #include "hostport.h" #ifdef RADPROT_UDP @@ -36,7 +37,7 @@ static char **getlistenerargs(); void *udpserverrd(void *arg); int clientradputudp(struct server *server, unsigned char *rad); void addclientudp(struct client *client); -void addserverextraudp(struct clsrvconf *conf); +int addserverextraudp(const struct clsrvconf *conf); void udpsetsrcres(); void initextraudp(); @@ -316,27 +317,8 @@ void addclientudp(struct client *client) { client->replyq = server_replyq; } -void addserverextraudp(struct clsrvconf *conf) { - switch (((struct hostportres *)list_first(conf->hostports)->data)->addrinfo->ai_family) { - case AF_INET: - if (client4_sock < 0) { - client4_sock = bindtoaddr(srcres, AF_INET, 0, 1); - if (client4_sock < 0) - debugx(1, DBG_ERR, "addserver: failed to create client socket for server %s", conf->name); - } - conf->servers->sock = client4_sock; - break; - case AF_INET6: - if (client6_sock < 0) { - client6_sock = bindtoaddr(srcres, AF_INET6, 0, 1); - if (client6_sock < 0) - debugx(1, DBG_ERR, "addserver: failed to create client socket for server %s", conf->name); - } - conf->servers->sock = client6_sock; - break; - default: - debugx(1, DBG_ERR, "addserver: unsupported address family"); - } +int addserverextraudp(const struct clsrvconf *conf) { + return addserverextra(conf, &client4_sock, &client6_sock, srcres); } void initextraudp() { |