From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] getifaddrs wrapper Date: Sat, 25 Jul 2015 14:59:33 +0200 Message-ID: <87a8ukcs0a.fsf@gnu.org> References: <87mvzvykfx.fsf@gnu.org> <87a8veeoip.fsf@gnu.org> <87wpy0un8l.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIz3E-0008Jp-8N for guix-devel@gnu.org; Sat, 25 Jul 2015 08:59:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIz3A-0001xo-8F for guix-devel@gnu.org; Sat, 25 Jul 2015 08:59:40 -0400 In-Reply-To: (Rohan Prinja's message of "Fri, 17 Jul 2015 16:27:16 +0530") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Rohan Prinja Cc: guix-devel Hi Rohan, Sorry for the delay. Commit e7f5691 adds the =E2=80=98getifaddrs=E2=80=99 = bindings under the name =E2=80=98network-interfaces=E2=80=99 (there was already a pr= ocedure with that name, which I=E2=80=99ve renamed to =E2=80=98network-interface-names= =E2=80=99 in b89e740.) I ended up doing things differently from your patch, notably because I was willing to get more support from =E2=80=98define-c-struct=E2=80=99, whi= ch led me to find a couple of shortcomings that needed to be fixed (apologies for not noticing these earlier!). I=E2=80=99ve written tests which, unlike yours, do not use the =E2=80=98ifc= onfig=E2=80=99 command, mostly because there are several =E2=80=98ifconfig=E2=80=99 implem= entations so I doubt we can reliably parse their output, and because I don=E2=80=99t want tests to introduce an additional dependency. Anyway, now one can do things like this: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(guix build syscalls) scheme@(guile-user)> ,use(srfi srfi-1) scheme@(guile-user)> (network-interfaces) $13 =3D (# # # # # # #) scheme@(guile-user)> (filter (lambda (i) (=3D AF_INET6 (sockaddr:fam (interface-address i)))) (network-interfaces)) $14 =3D (# #) --8<---------------cut here---------------end--------------->8--- Pretty neat, no? :-) Note that family 17 is AF_PACKET. Currently libguile does not support AF_PACKET, which means we cannot do much with these addresses. Comments & bug reports welcome! Thanks again for your earlier work on this. Even if the final patch is different, your work and the discussions we=E2=80=99ve had have been helpfu= l in getting things into shape. Ludo=E2=80=99.