diff options
author | venaas <venaas> | 2007-02-16 08:53:15 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2007-02-16 08:53:15 +0000 |
commit | 1c5b4d8f3808a9db6d150a0e56f2c3f908d752b1 (patch) | |
tree | 60efed4f2ab432eb133ce0a35abf651a8b204c5c /util.c | |
parent | 85acbc23c2678f163fe3ea65fad31a6053f65eab (diff) |
added tcp and udp listen directives
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@60 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 27 |
1 files changed, 0 insertions, 27 deletions
@@ -83,33 +83,6 @@ char *addr2string(struct sockaddr *addr, socklen_t len) { return addr_buf[i]; } -int bindport(int type, char *port) { - struct addrinfo hints, *res0, *res; - int s, one = 1; - - memset(&hints, 0, sizeof(hints)); - hints.ai_socktype = type; - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_PASSIVE; - - if (getaddrinfo(NULL, port, &hints, &res0) != 0) { - err("bindport: can't resolve port %s", port); - return -1; - } - for (res = res0; res; res = res->ai_next) { - s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (s >= 0) { - setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); - if (bind(s, res->ai_addr, res->ai_addrlen) == 0) - break; - close(s); - s = -1; - } - } - freeaddrinfo(res0); - return s; -} - int connectport(int type, char *host, char *port) { struct addrinfo hints, *res0, *res; int s; |