From owner-svn-src-all@FreeBSD.ORG Mon Mar 7 10:39:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CA91106564A; Mon, 7 Mar 2011 10:39:26 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AF4E8FC18; Mon, 7 Mar 2011 10:39:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p27AdQVA032269; Mon, 7 Mar 2011 10:39:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p27AdQMO032267; Mon, 7 Mar 2011 10:39:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201103071039.p27AdQMO032267@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Mar 2011 10:39:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219371 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2011 10:39:26 -0000 Author: pjd Date: Mon Mar 7 10:39:26 2011 New Revision: 219371 URL: http://svn.freebsd.org/changeset/base/219371 Log: Use %S to print IP address and port number. MFC after: 2 weeks Modified: head/sbin/hastd/proto_tcp4.c Modified: head/sbin/hastd/proto_tcp4.c ============================================================================== --- head/sbin/hastd/proto_tcp4.c Mon Mar 7 10:38:18 2011 (r219370) +++ head/sbin/hastd/proto_tcp4.c Mon Mar 7 10:39:26 2011 (r219371) @@ -475,22 +475,6 @@ tcp4_descriptor(const void *ctx) return (tctx->tc_fd); } -static void -sin2str(struct sockaddr_in *sinp, char *addr, size_t size) -{ - in_addr_t ip; - unsigned int port; - - PJDLOG_ASSERT(addr != NULL); - PJDLOG_ASSERT(sinp->sin_family == AF_INET); - - ip = ntohl(sinp->sin_addr.s_addr); - port = ntohs(sinp->sin_port); - PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%u.%u.%u.%u:%u", - ((ip >> 24) & 0xff), ((ip >> 16) & 0xff), ((ip >> 8) & 0xff), - (ip & 0xff), port) < (ssize_t)size); -} - static bool tcp4_address_match(const void *ctx, const char *addr) { @@ -529,7 +513,7 @@ tcp4_local_address(const void *ctx, char PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size); return; } - sin2str(&sin, addr, size); + PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%S", &sin) < (ssize_t)size); } static void @@ -547,7 +531,7 @@ tcp4_remote_address(const void *ctx, cha PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size); return; } - sin2str(&sin, addr, size); + PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%S", &sin) < (ssize_t)size); } static void