summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2009-01-29 13:44:58 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2009-01-29 13:44:58 +0000
commit392c109abc2a14421f4e56f587b8d24a6fb3d6c3 (patch)
treeff6ab4b2cbe18c3f64e3df9270e7a3c89c4d1903 /radsecproxy.c
parent9f542fc2c8905be58015a428f0240ebff20658ef (diff)
minor fixes to hostport stuff
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@464 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 7266597..8df4e1d 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -1884,14 +1884,14 @@ void *clientwr(void *arg) {
void createlistener(uint8_t type, char *arg) {
pthread_t th;
- struct addrinfo *listenres, *res;
+ struct addrinfo *res;
int s = -1, on = 1, *sp = NULL;
-
- listenres = resolvepassiveaddrinfo(arg, protodefs[type]->portdefault, protodefs[type]->socktype);
- if (!listenres)
+ struct hostportres *hp = newhostport(arg, protodefs[type]->portdefault, 0);
+
+ if (!hp || !resolvehostport(hp, protodefs[type]->socktype, 1))
debugx(1, DBG_ERR, "createlistener: failed to resolve %s", arg);
- for (res = listenres; res; res = res->ai_next) {
+ for (res = hp->addrinfo; res; res = res->ai_next) {
s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (s < 0) {
debug(DBG_WARN, "createlistener: socket failed");
@@ -1920,8 +1920,8 @@ void createlistener(uint8_t type, char *arg) {
if (!sp)
debugx(1, DBG_ERR, "createlistener: socket/bind failed");
- debug(DBG_WARN, "createlistener: listening for %s on %s", protodefs[type]->name, arg);
- freeaddrinfo(listenres);
+ debug(DBG_WARN, "createlistener: listening for %s on %s:%s", protodefs[type]->name, hp->host ? hp->host : "*", hp->port);
+ freehostport(hp);
}
void createlisteners(uint8_t type) {