From owner-freebsd-net@freebsd.org Wed Dec 9 16:52:15 2015 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91A7B9D5A6F for ; Wed, 9 Dec 2015 16:52:15 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward18h.cmail.yandex.net (forward18h.cmail.yandex.net [87.250.230.160]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B1C1121E; Wed, 9 Dec 2015 16:52:14 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from smtp2h.mail.yandex.net (smtp2h.mail.yandex.net [84.201.187.145]) by forward18h.cmail.yandex.net (Yandex) with ESMTP id 66D1F207AE; Wed, 9 Dec 2015 19:52:05 +0300 (MSK) Received: from smtp2h.mail.yandex.net (localhost [127.0.0.1]) by smtp2h.mail.yandex.net (Yandex) with ESMTP id 52B4E17000E9; Wed, 9 Dec 2015 19:52:04 +0300 (MSK) Received: by smtp2h.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id tr8T2fJiAV-q3eGE4DB; Wed, 9 Dec 2015 19:52:03 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1449679923; bh=cwOc0astTtLSDHUFue8bVutvi5I8L5VhbkPt6Go0DdY=; h=Subject:To:References:Cc:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type; b=VR4rIMfHNNO5jN0WFp/nxJ9Cryoo0pgd7L2HeiubIUC3r0dXRddFVWbUnH/2nCaVp 7Z7Ggp6HQbFssl3UmybVHtZEelnrjxJKYHeruDCuHIw64w+qhO2ptJ/32Yfi6s9M1d gsp/10H09af+nFRm1EN3G3FXQEvjwX9Y7/9UBMb0= Authentication-Results: smtp2h.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-ForeignMX: US Subject: Re: IPv6 Address as text (C) To: Ken Moore , Hiroki Sato References: <5668369F.9020309@pcbsd.org> <20151209.233515.1592617248580059512.hrs@allbsd.org> <566847F3.7060900@pcbsd.org> Cc: freebsd-net@freebsd.org From: "Andrey V. Elsukov" Message-ID: <56685C23.600@yandex.ru> Date: Wed, 9 Dec 2015 19:51:47 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <566847F3.7060900@pcbsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1bsEEwJBHPTohNj7ncfRsJ17QrMhGb6gw" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2015 16:52:15 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1bsEEwJBHPTohNj7ncfRsJ17QrMhGb6gw Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 09.12.15 18:25, Ken Moore wrote: Simple example: #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include int main(int argc, char **argv) { char buf[INET6_ADDRSTRLEN]; struct ifaddrs *ifap, *ifa; int error; if (getifaddrs(&ifap) !=3D 0) err(1, "getifaddrs"); for (ifa =3D ifap; ifa; ifa =3D ifa->ifa_next) if (ifa->ifa_addr->sa_family =3D=3D AF_INET6) { error =3D getnameinfo(ifa->ifa_addr, ifa->ifa_addr->sa_len, buf, sizeof(buf), NULL, 0, NI_NUMERICHOST); if (error !=3D 0) err(1, "%s", gai_strerror(error)); printf("%s\n", buf); } freeifaddrs(ifap); return (0); } --=20 WBR, Andrey V. Elsukov --1bsEEwJBHPTohNj7ncfRsJ17QrMhGb6gw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWaFwmAAoJEAHF6gQQyKF6+x0IALRhJeeoUOAjElj5vctkSv7H q10R82pc2w7c+5u+ZwsKkofgkpQIxDdTI6XmTMFDG4YJzVfSfBKpzFnEwghc3r5f sn78fEc0hk5mlBImAMiHVb3Uo+xeWkKLJxMIE1jvKF7gfI5SxVM6mMmoL7YLIy5S bqdU3Rk4jFIz6PjPA6M3gid+8qyvbc9GfFxsrzgCmAvrZPFeg7X/UHmC7BxJDSQl pRZDZFYPPeAN4ppW/lL6FZTWN6TAXMm85Anqp/iCIJXQXKAKDFCJAw8kSdKUptMZ HS6lAXm/FITXRAzVVBGP7/UoasV/E+t/7y4yCI/4kKH1imRZHGPSOANBFJevBT4= =uVxP -----END PGP SIGNATURE----- --1bsEEwJBHPTohNj7ncfRsJ17QrMhGb6gw--