Re: Bug#630206: libnss-myhostname: FTBFS: fatal error: asm/types.h: No such file or directory
On Thu, 16.06.11 10:59, Robert Millan (email@example.com) wrote:
> 2011/6/15 Lennart Poettering <firstname.lastname@example.org>:
> > I have commited this now, though I am pretty sure this is actually
> > broken. You cannot just go and make up ifindexes. You need to determine
> > the kernel ifindexes for your interfaces. You probably simply need to
> > call if_nametoindex() on all ifa_name fields.
> In my tests I didn't observe any ill effects. What is this needed for?
It's used all over the place. For example on IPv6 the ifindex is
required to make link-local addresses usable. (i.e. a link-local address
is private to a specific link, hence you need to specify the link
explicitly by means of the ifindex it is behind, which normally happens
automatically if you use getaddrinfo() but will not work for you.)
Also quite a few other APIs use ifindexes, for example the mcast APIs,
or IP_PKTINFO or IP_RECVINTERFACE or IPV6_PKTINFO or IP_MULTICAST_IF.
In general it is smart never to deal with interface names internally in
apps, but use ifindexes instead, since names can be changed dynamically,
and indexes are fixed during the entire existance of an
interface. interface names should only be use in user configuration and
for presentation purposes. (i.e. on the way in our out of a process, but
not in the process itself).
So, in short: you are at least breaking mcast, breaking link-local
addressing and matching up of addresses with packets right now. And
there's probably a lot more.
Lennart Poettering - Red Hat, Inc.