From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4832 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: if_nameindex/getifaddrs and dhcpcd issue Date: Tue, 8 Apr 2014 14:54:38 +0200 Message-ID: <20140408125438.GN3034@port70.net> References: <20140408111147.5f79729f@ncopa-desktop.alpinelinux.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1396961698 28343 80.91.229.3 (8 Apr 2014 12:54:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Apr 2014 12:54:58 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4836-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 08 14:54:51 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WXVYA-0000qO-W4 for gllmg-musl@plane.gmane.org; Tue, 08 Apr 2014 14:54:51 +0200 Original-Received: (qmail 5544 invoked by uid 550); 8 Apr 2014 12:54:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5530 invoked from network); 8 Apr 2014 12:54:49 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4832 Archived-At: * Justin Cormack [2014-04-08 11:07:47 +0100]: > I am not sure that it is appropriate that a netlink implementation, > which is the only way to do the enumeration correctly in the potential > absense of /proc, should go into Musl. I would be more inclined to one could just try all the numbers.. this "works" even at boot time :) (and there is /sys/class/net/*/ifindex but that does not help libc) #include #include #include #define N 256 struct if_nameindex *if_nameindex() { struct if_nameindex *p = malloc(N*sizeof*p + N*IF_NAMESIZE); if (!p) errno = ENOBUFS; else { char (*name)[IF_NAMESIZE] = (void*)(p+N); int i,j; for (i=1,j=0; i However I can see no reason why dhcp on a specified interface needs to > enumerate interfaces at all, and it only needs to read ipv4 addresses, > unless it is implementing dhcp6 too, maybe it does now. Again dhcp6 > needs netlink, the Musl ipv6 parts for getifaddrs already use /proc > which is definitely unreliable for early boot config in a distro in my > view. if ipv6 things require netlink anyway then probably musl does not have much choice..