mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Timo Teras <timo.teras@iki.fi>
To: musl@lists.openwall.com
Cc: justin@specialbusservice.com
Subject: Re: if_nameindex/getifaddrs and dhcpcd issue
Date: Tue, 8 Apr 2014 15:25:59 +0300	[thread overview]
Message-ID: <20140408152559.124030b1@vostro> (raw)
In-Reply-To: <CAK4o1WxCFnwV1911QDh7ZHEd4hey7txGtUBv=AVG5KH5nHGu7w@mail.gmail.com>

On Tue, 8 Apr 2014 11:07:47 +0100
Justin Cormack <justin@specialbusservice.com> wrote:

> On Tue, Apr 8, 2014 at 10:11 AM, Natanael Copa
> <ncopa@alpinelinux.org> 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


  reply	other threads:[~2014-04-08 12:25 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 [this message]
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
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=20140408152559.124030b1@vostro \
    --to=timo.teras@iki.fi \
    --cc=justin@specialbusservice.com \
    --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).