From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4844 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: if_nameindex/getifaddrs and dhcpcd issue Date: Tue, 8 Apr 2014 18:59:32 -0400 Message-ID: <20140408225932.GI26358@brightrain.aerifal.cx> References: <20140408111147.5f79729f@ncopa-desktop.alpinelinux.org> <20140408134255.GE26358@brightrain.aerifal.cx> <20140408231620.64546259@ncopa-laptop> 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 1396997992 14372 80.91.229.3 (8 Apr 2014 22:59:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Apr 2014 22:59:52 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4848-gllmg-musl=m.gmane.org@lists.openwall.com Wed Apr 09 00:59:47 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 1WXezZ-0003ML-IW for gllmg-musl@plane.gmane.org; Wed, 09 Apr 2014 00:59:45 +0200 Original-Received: (qmail 28152 invoked by uid 550); 8 Apr 2014 22:59:44 -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 28140 invoked from network); 8 Apr 2014 22:59:44 -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:4844 Archived-At: On Tue, Apr 08, 2014 at 10:30:34PM +0100, Justin Cormack wrote: > On Tue, Apr 8, 2014 at 10:16 PM, Natanael Copa wrote: > > It looks like the reason for this is that you can provide a wilcard, eg > > 'eth*' and it will monitor all interfaces that fnmatches that. > > > >> The other case, where no interface is specified on the command line > >> and dhcpcd tries all interfaces, is buggy usage by the caller. There > >> are all sorts of interfaces that might exist, unconfigured, and which > >> might not be appropriate to send dhcpc requests on. I assume dhcpcd > >> has some heuristics to avoid selecting things like unconfigured > >> tunnel, slip, etc. interfaces but if so that's just an ugly hack. The > >> operation of "try all instances of a given type of resource" is just > >> wrong by design. > > > > Yes you can configure a list of exact interfaces that you want dhcpcd > > to monitor or you can have a black list - with wilcards. > > > > See allowinterfaces and denyinterfaces (which also can be specified on > > command line) http://roy.marples.name/man/html5/dhcpcd.conf.html > > > > dhcpcd is more an ifplugd + dhcp client wit optional support for dbus. > > It can also get notifications from wpa_supplicant. You can even have > > dhcpcd to set static ip addresses. So its more an alternative to > > NetworkManager than to udhcpc. > > > > Other thing it can handle is currently unknown interfaces. For example > > the laptop I use right now does not have any ethernet port, only wifi. > > I do have an ethernet USB adapter. So eth0 is not there at bootup. I > > currently get error messages on screen due to udhcpc does not find the > > configured eth0 interface. > > > > To solve this, without needing install the full NetworkManager suite or > > systemds networkd, I can simply let dhcpcd run in manager mode, and it > > will run the show. There is even a dhcpcd-ui applet that gives me link > > status etc on my desktop. > > Sounds like the sort of design that should have netlink built into it > then. You can do all sorts of useful things then, like listen on a > netlink socket for new interfaces being created. Yes. The above explanation of dhcpcd makes it clear what it's enumerating interfaces for, but also suggests it should be using netlink entirely rather than libc to avoid TOCTOU races on device insertion/removal. Rich