mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: if_nameindex/getifaddrs and dhcpcd issue
Date: Wed, 9 Apr 2014 18:18:43 -0400	[thread overview]
Message-ID: <20140409221843.GJ26358@brightrain.aerifal.cx> (raw)
In-Reply-To: <20140409091348.3159011a@ncopa-desktop.alpinelinux.org>

On Wed, Apr 09, 2014 at 09:13:48AM +0200, Natanael Copa wrote:
> On Tue, 8 Apr 2014 11:38:41 -0400
> Rich Felker <dalias@aerifal.cx> wrote:
> 
> > On Tue, Apr 08, 2014 at 03:16:10PM +0100, Justin Cormack wrote:
> > > I was under the impression that the ioctl-based interface for ipv6 is
> > > incomplete under Linux.
> > 
> > Probably "incomplete" in a sense that it can't do some special-purpose
> > stuff that most users don't need.
> 
> You cannot get the configured ipv6 addresses via SIOCGIFCONF. That is
> why musl needs to parse /proc for that.
> 
> ioctl-based interface for ipv4 is also "incomplete". You cannot get
> anything else than the primary address so current musl getifaddrs will
> not give you all configured ipv4 addresses.
> 
> > Busybox entirely avoids netlink, as
> > far as I can tell,
> 
> Not entirely. the iproute implementation in bb uses netlink, but you
> can of course disable that during configuration. A quick grep also
> indicate that busybox ifplugd uses netlink.
> 
> > and it's perfectly acceptable for setting up ipv6,
> > at least in simple setups. You don't even need busybox's iproute2
> > workalikes; ifconfig and route work fine.
> 
> And if you do that, then you cannot assign more than one ip addr on
> each interface. (you'll have to use alias, eth0:1 for that), but yes,
> thats no longer a simple setup.

OK, based on what you're saying, the ioctl interface is unable to
report the existence of interfaces that have only an ipv6 address
configured but no ipv4 addresses. If that's true, then yes, it's
unusable and we need a different approach, either /proc or netlink.
I'm happy to look at both approaches and see which is more efficient.

One advantage of netlink is that it can work before /proc is mounted.
However, it's documented that a fair number of interfaces in libc
depend on /proc, so unless you're going to audit programs for which
libc functions they use, it really makes sense to just make sure /proc
is mounted first. There's really no good reason for mounting /proc not
to be the first line of the init scripts. It also might be able to
make the netlink-based code smaller (in terms of what gets static
linked) than a proc-based version, since stdio/scanf is costly.

One advantage of /proc is that, on a non-linux system, you can just
drop static file in place with contents matching your machine's
configuration.

Rich


  reply	other threads:[~2014-04-09 22:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08  9:11 Natanael Copa
2014-04-08 10:07 ` Justin Cormack
2014-04-08 12:25   ` Timo Teras
2014-04-08 14:23     ` Natanael Copa
2014-04-08 15:45     ` Rich Felker
2014-04-08 16:08       ` Timo Teras
2014-04-08 16:19         ` Justin Cormack
2014-04-08 22:41           ` Rich Felker
2014-04-09  7:17             ` u-igbb
2014-04-09 22:20               ` Rich Felker
2014-04-09 22:32                 ` Justin Cormack
2014-04-10  7:40                 ` u-igbb
2014-04-10  7:52                   ` Rich Felker
2014-04-09 14:02         ` Timo Teras
2014-04-10  0:55           ` Rich Felker
2014-04-09  7:55       ` Natanael Copa
2014-04-08 12:54   ` Szabolcs Nagy
2014-04-08 13:42   ` Rich Felker
2014-04-08 14:16     ` Justin Cormack
2014-04-08 15:38       ` Rich Felker
2014-04-09  7:13         ` Natanael Copa
2014-04-09 22:18           ` Rich Felker [this message]
2014-04-08 21:16     ` Natanael Copa
2014-04-08 21:30       ` Justin Cormack
2014-04-08 22:59         ` Rich Felker
2014-04-08 14:27   ` Natanael Copa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140409221843.GJ26358@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).