From owner-svn-src-user@FreeBSD.ORG Tue Dec 31 00:45:25 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A35CDDE; Tue, 31 Dec 2013 00:45:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 276AE105B; Tue, 31 Dec 2013 00:45:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBV0jPN3007783; Tue, 31 Dec 2013 00:45:25 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBV0jOF9007782; Tue, 31 Dec 2013 00:45:24 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201312310045.rBV0jOF9007782@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 31 Dec 2013 00:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r260116 - user/ae/inet6/usr.sbin/jls X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2013 00:45:25 -0000 Author: ae Date: Tue Dec 31 00:45:24 2013 New Revision: 260116 URL: http://svnweb.freebsd.org/changeset/base/260116 Log: Migrate jls(8) from using struct in6_addr to struct sockaddr_in6. Modified: user/ae/inet6/usr.sbin/jls/jls.c Modified: user/ae/inet6/usr.sbin/jls/jls.c ============================================================================== --- user/ae/inet6/usr.sbin/jls/jls.c Tue Dec 31 00:21:15 2013 (r260115) +++ user/ae/inet6/usr.sbin/jls/jls.c Tue Dec 31 00:45:24 2013 (r260116) @@ -35,12 +35,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -363,7 +365,7 @@ print_jail(int pflags, int jflags) char *nname; char **param_values; int i, ai, jid, count, n, spc; - char ipbuf[INET6_ADDRSTRLEN]; + char ipbuf[INET6_ADDRSTRLEN + IF_NAMESIZE + 1]; jid = jailparam_get(params, nparams, jflags); if (jid < 0) @@ -396,15 +398,20 @@ print_jail(int pflags, int jflags) #endif #ifdef INET6 if (ip6_ok && !strcmp(params[n].jp_name, "ip6.addr")) { - count = params[n].jp_valuelen / sizeof(struct in6_addr); - for (ai = 0; ai < count; ai++) - if (inet_ntop(AF_INET6, - &((struct in6_addr *) - params[n].jp_value)[ai], - ipbuf, sizeof(ipbuf)) == NULL) - err(1, "inet_ntop"); + struct sockaddr_in6 *sa6; + + count = params[n].jp_valuelen / + sizeof(struct sockaddr_in6); + for (ai = 0; ai < count; ai++) { + sa6 = &((struct sockaddr_in6 *) + params[n].jp_value)[ai]; + if (getnameinfo((struct sockaddr *)sa6, + sa6->sin6_len, ipbuf, sizeof(ipbuf), + NULL, 0, NI_NUMERICHOST) != 0) + err(1, "getnameinfo"); else printf("%6s %s\n", "", ipbuf); + } n++; } #endif