From 1c5b4d8f3808a9db6d150a0e56f2c3f908d752b1 Mon Sep 17 00:00:00 2001 From: venaas Date: Fri, 16 Feb 2007 08:53:15 +0000 Subject: added tcp and udp listen directives git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@60 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- util.c | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 3c48e71..ae733eb 100644 --- a/util.c +++ b/util.c @@ -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; -- cgit v1.1