summaryrefslogtreecommitdiff
path: root/dtls.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2012-04-11 13:30:30 +0200
committerLinus Nordberg <linus@nordu.net>2012-04-11 13:30:30 +0200
commit62eb41a8bf4be835265df15f0183a4682a71ba31 (patch)
tree16c06fc992aa2dd07e9898d8051f3a4c3ba74bd4 /dtls.c
parentd40144aec7a0bf59a05f236102bf094363caa32e (diff)
Don't cry and die on a configured server (!) which doesn't resolve (DNS). Just cry some.postpone-resolving
Part of fixing RADSECPROXY-30.
Diffstat (limited to 'dtls.c')
-rw-r--r--dtls.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/dtls.c b/dtls.c
index 19386c4..9913cd9 100644
--- a/dtls.c
+++ b/dtls.c
@@ -28,6 +28,7 @@
#include <openssl/err.h>
#include "hash.h"
#include "radsecproxy.h"
+#include "common.h"
#ifdef RADPROT_DTLS
#include "debug.h"
@@ -40,7 +41,7 @@ void *udpdtlsserverrd(void *arg);
int dtlsconnect(struct server *server, struct timeval *when, int timeout, char *text);
void *dtlsclientrd(void *arg);
int clientradputdtls(struct server *server, unsigned char *rad);
-void addserverextradtls(struct clsrvconf *conf);
+int addserverextradtls(const struct clsrvconf *conf);
void dtlssetsrcres();
void initextradtls();
@@ -665,27 +666,8 @@ void *dtlsclientrd(void *arg) {
return NULL;
}
-void addserverextradtls(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 addserverextradtls(const struct clsrvconf *conf) {
+ return addserverextra(conf, &client4_sock, &client6_sock, srcres);
}
void initextradtls() {