From 174a9f39da1f09c6ffd9c6f0b3a6a42da5ec4163 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 28 Nov 2010 22:55:24 +0000 Subject: source address to connect from can now be specified git-svn-id: https://svn.spreadspace.org/tcpproxy/trunk@13 e61f0598-a718-4e21-a8f0-0aadfa62ad6b --- src/tcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/tcp.c') diff --git a/src/tcp.c b/src/tcp.c index 0211526..cbc9134 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -60,6 +60,8 @@ char* tcp_endpoint_to_string(tcp_endpoint_t e) addrstr_len = INET6_ADDRSTRLEN + 1; addrport_sep = '.'; break; + case AF_UNSPEC: + return NULL; default: asprintf(&ret, "unknown address type"); return ret; @@ -90,11 +92,11 @@ struct addrinfo* tcp_resolve_endpoint(const char* addr, const char* port, resolv int errcode = getaddrinfo(addr, port, &hints, &res); if (errcode != 0) { - log_printf(ERROR, "Error resolving local address (%s:%s): %s", (addr) ? addr : "*", port, gai_strerror(errcode)); + log_printf(ERROR, "Error resolving local address (%s:%s): %s", (addr) ? addr : "*", (port) ? port : "0", gai_strerror(errcode)); return NULL; } if(!res) { - log_printf(ERROR, "getaddrinfo returned no address for %s:%s", addr, port); + log_printf(ERROR, "getaddrinfo returned no address for %s:%s", (addr) ? addr : "*", (port) ? port : "0"); return NULL; } -- cgit v1.2.3