static int client6_sock = -1;
static struct queue *server_replyq = NULL;
+static struct addrinfo *srcres = NULL;
+
+void udpsetsrcres(char *source) {
+ if (!srcres)
+ srcres = resolve_hostport_addrinfo(RAD_UDP, source);
+}
+
void removeudpclientfromreplyq(struct client *c) {
struct list_node *n;
struct request *r;
switch (conf->addrinfo->ai_family) {
case AF_INET:
if (client4_sock < 0) {
- client4_sock = bindtoaddr(getsrcprotores(RAD_UDP), AF_INET, 0, 1);
+ 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->host);
}
break;
case AF_INET6:
if (client6_sock < 0) {
- client6_sock = bindtoaddr(getsrcprotores(RAD_UDP), AF_INET6, 0, 1);
+ 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->host);
}
void initextraudp() {
pthread_t cl4th, cl6th, srvth;
+
+ if (srcres) {
+ freeaddrinfo(srcres);
+ srcres = NULL;
+ }
if (client4_sock >= 0)
if (pthread_create(&cl4th, NULL, udpclientrd, (void *)&client4_sock))