#include <regex.h>
#include <pthread.h>
#include "radsecproxy.h"
+#include "common.h"
#include "hostport.h"
#ifdef RADPROT_UDP
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();
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() {