From 342bd3f7767f32af6c65302673fda700e7d79b5d Mon Sep 17 00:00:00 2001 From: Kim Date: Sun, 8 May 2016 05:34:54 -0400 Subject: [PATCH] Fix ipv6 address format in log message --- src/local.c | 5 ++++- src/server.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/local.c b/src/local.c index 66b59dc4..e72abac6 100644 --- a/src/local.c +++ b/src/local.c @@ -468,7 +468,10 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents) } if (verbose) { - LOGI("connect to %s:%s", host, port); + if (request->atyp == 4) + LOGI("connect to [%s]:%s", host, port); + else + LOGI("connect to %s:%s", host, port); } if ((acl && (request->atyp == 1 || request->atyp == 4) && acl_match_ip(host))) { diff --git a/src/server.c b/src/server.c index 3a23f52e..e540d66d 100644 --- a/src/server.c +++ b/src/server.c @@ -759,7 +759,10 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents) } if (verbose) { - LOGI("connect to: %s:%d", host, ntohs(port)); + if ((atyp & ADDRTYPE_MASK) == 4) + LOGI("connect to [%s]:%d", host, ntohs(port)); + else + LOGI("connect to %s:%d", host, ntohs(port)); } if (server->auth && !ss_check_hash(server->buf, server->chunk, server->d_ctx, BUF_SIZE)) {