mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Justin Cormack <justin@specialbusservice.com>
To: musl@lists.openwall.com
Subject: Re: if_nameindex and getifaddrs
Date: Sun, 8 Jun 2014 11:03:17 +0100	[thread overview]
Message-ID: <CAK4o1Wx_yY+meWAC3eYhwJOfkyWbzCn88B1fDUDjZDJgp7oirg@mail.gmail.com> (raw)
In-Reply-To: <20140607231820.GA12864@brightrain.aerifal.cx>

On Sun, Jun 8, 2014 at 12:18 AM, Rich Felker <dalias@libc.org> wrote:
> However, there's been some concern that this code would not work for
> users who are using musl on non-Linux kernels with a Linux syscall API
> but not a netlink API (e.g. BSD Linux 'emulation'), and it's probably
> also somewhat larger and less efficient with memory than it needs to
> be.
>
> Getting the full list of interfaces is definitely possible without
> netlink: /proc/net/dev has all the real interface names and they're
> trivial to parse without any fancy parser code. The list does not
> contain legacy-style aliases (e.g. eth0:2) but these can be obtained
> from SIOCGIFCONF if desired (as they are now). As far as I can tell,
> legacy aliases are purely associated with a configured IPv4 address.
> They simply do not exist with IPv6 interfaces or in an unconfigured
> state (and they shate their interface index number with the underlying
> base interface). So this method of listing interfaces would be
> complete.
>
> Of course I'm not convinced (despite the fact that I rather dislike
> netlink) that it's any better than using netlink. It may at least
> partially work on BSD via SIOCGIFCONF -- it seems (some?) BSD's might
> support SIOCGIFCONF even for IPv6, but I'm not even clear if the ioctl
> interface is really compatible or not.
>
> If if_nameindex produced a complete list with unconfigured and v6-only
> interfaces included (by whatever means) then the current getifaddrs
> implementation would "work" in the sense of not omitting interfaces,
> but it still might not produce as much output as some users want.
>
> The above is a summary of my understanding of the situation and some
> possible ways forward. I'd welcome some comments, particularly on
> anything that would help us keep/improve BSD compatibility alongside
> fixing the issues on Linux.

I only know a bit about the NetBSD Linux emulation, as I help out the
main developer with testing. It is currently not very complete in the
networking areas, but there are tests for some of it, and they will be
added eventually. Currently there isn't /proc/net/dev emulation in the
Linux /proc emulation. Not sure how complete the ioctl emulation is,
but at least it is easier to add than netlink. The alias interfaces
are another complexity, as I don;t think there has ever been an ipv4
alias equivalent in NetBSD so that would have to be emulated too.

I think most of the work is on their side; I can go and eg add tests
for all the ioctls in Musl.

Justin


      reply	other threads:[~2014-06-08 10:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07 23:18 Rich Felker
2014-06-08 10:03 ` Justin Cormack [this message]

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=CAK4o1Wx_yY+meWAC3eYhwJOfkyWbzCn88B1fDUDjZDJgp7oirg@mail.gmail.com \
    --to=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).