Date: Sun, 8 Jun 2014 11:03:17 +0100 From: Justin Cormack <justin@...cialbusservice.com> To: musl@...ts.openwall.com Subject: Re: if_nameindex and getifaddrs On Sun, Jun 8, 2014 at 12:18 AM, Rich Felker <dalias@...c.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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.