Add client and server config options IPv4Only and IPv6Only.
[libradsec.git] / udp.c
diff --git a/udp.c b/udp.c
index 4740fd0..c804703 100644 (file)
--- a/udp.c
+++ b/udp.c
@@ -24,9 +24,9 @@
 #include <arpa/inet.h>
 #include <regex.h>
 #include <pthread.h>
-#include "list.h"
-#include "hostport.h"
+#include <assert.h>
 #include "radsecproxy.h"
+#include "hostport.h"
 
 #ifdef RADPROT_UDP
 #include "debug.h"
@@ -86,7 +86,9 @@ static char **getlistenerargs() {
 
 void udpsetsrcres() {
     if (!srcres)
-       srcres = resolvepassiveaddrinfo(protoopts ? protoopts->sourcearg : NULL, NULL, protodefs.socktype);
+       srcres =
+            resolvepassiveaddrinfo(protoopts ? protoopts->sourcearg : NULL,
+                                   AF_UNSPEC, NULL, protodefs.socktype);
 }
 
 void removeudpclientfromreplyq(struct client *c) {
@@ -318,6 +320,7 @@ void addclientudp(struct client *client) {
 }
 
 void addserverextraudp(struct clsrvconf *conf) {
+    assert(list_first(conf->hostports) != NULL);
     switch (((struct hostportres *)list_first(conf->hostports)->data)->addrinfo->ai_family) {
     case AF_INET:
        if (client4_sock < 0) {