From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4831 Path: news.gmane.org!not-for-mail From: Timo Teras Newsgroups: gmane.linux.lib.musl.general Subject: Re: if_nameindex/getifaddrs and dhcpcd issue Date: Tue, 8 Apr 2014 15:25:59 +0300 Message-ID: <20140408152559.124030b1@vostro> 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 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1396959891 31077 80.91.229.3 (8 Apr 2014 12:24:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Apr 2014 12:24:51 +0000 (UTC) Cc: justin@specialbusservice.com To: musl@lists.openwall.com Original-X-From: musl-return-4835-gllmg-musl=m.gmane.org@lists.openwall.com Tue Apr 08 14:24:45 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 1WXV4y-0007eC-6i for gllmg-musl@plane.gmane.org; Tue, 08 Apr 2014 14:24:40 +0200 Original-Received: (qmail 22340 invoked by uid 550); 8 Apr 2014 12:24:39 -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 22332 invoked from network); 8 Apr 2014 12:24:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=rGaHvg23V+dWw25VTNI/27rL1RL82d7JwARKU/dpB2I=; b=ThAgL5c5OlfxQwOqMy9R3Z8rTeovbxJQ0BF/u7sqo3fhkqBNucieQpQEkhsn8IcdBI yCQNBk87g2OFrWzLkeJByBXWgwOJV4q55tg8cqQ/trbuRG3xoZtdREjlD+0D1SSIR4m/ vbgiTt2WeR5nUcMUIN12yb4gi0PuKkLefVcGqNgLYfRU1u9B8Eb6YncExOmEmgZnNiWo UA0YV7lJiX2UEuGd8AwEoJ0BVVyRmzeFQatHbOSA5HReTRuo5JjVcQ9wn/+eR2DWSoDA uQEdx6aDRgl3k7n0GYKSLiBx2VswYEZxoKn13IEAYZu4A1mf/2gaL566Fjiv5MHleNlx bR2w== X-Received: by 10.112.50.194 with SMTP id e2mr2606610lbo.4.1396959867499; Tue, 08 Apr 2014 05:24:27 -0700 (PDT) Original-Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= In-Reply-To: X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; i486-alpine-linux-uclibc) Xref: news.gmane.org gmane.linux.lib.musl.general:4831 Archived-At: On Tue, 8 Apr 2014 11:07:47 +0100 Justin Cormack wrote: > On Tue, Apr 8, 2014 at 10:11 AM, Natanael Copa > wrote: > > (snip) > > 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 We are not implementing full netlink. Just the bits to do enumeration. > implement a new library to do netlink stuff that provides compatible > interfaces (you could use libnetlink too). The glibc implementation is > 723 lines of code, and it is probably hard to make the implementation The basic netlink code for enumeration can be done in ~50 lines of code (depending on how you count). The rest of code is parsing the messages needed. More lines come of course from the headers that are needed to be imported. > a lot smaller, but you could make a full netlink library in not much > more as it is complicated but uniform (I wrote a partly complete one > in 1000 lines of Lua). > > 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. We should not be looking at dhcpd. It's the APIs musl implements: getifaddrs() and if_nameindex() - they are not currently exposing all the information they should. I'd prefer using netlink, instead of trying to parse and connect data from various /proc files. IMHO, if someone wants to be linux compatible today, it's easier to implement the netlink stuff; than the /proc stuff. /proc has equally linux specific things in it and is mainly intended to be human readable with few exceptions. /sys would be better option as it's inteded to be machine readable, but it's still text too. netlink is here to stay, there's no alternate way to do certain things. So I'd rather use it. It's the interface kernel people intended to be used for the thing in question. I'm willing to write an alternative getifaddrs() and if_nameindex() implementations using netlink. Perhaps let's see how they end up? - Timo