On Wed, Oct 22, 2014 at 10:39 PM, Lennart Poettering <lenn...@poettering.net> wrote: > On Wed, 22.10.14 22:12, Tom Gundersen (t...@jklm.no) wrote: > >> On Wed, Oct 22, 2014 at 12:19 PM, Lennart Poettering >> <lenn...@poettering.net> wrote: >> > On Sat, 13.09.14 20:40, Tom Gundersen (t...@jklm.no) wrote: >> > >> >> Yeah, this could happen. It so happens that the loopback link will >> >> always have ifindex 1, so I guess we could just fall back to checking >> >> for that if we don't have the real flags. >> > >> > Is that true even in network namespaces? Is this really exported API? >> > I really don't want to rely on behaviour here that is not considered >> > official API of Linux. >> > >> > If it is safe API of Linux, then we really should drop >> > manager_ifindex_is_loopback() entirely, and just always compare the >> > ifindex. >> > >> > Anyone has some pointers where this is made API? >> >> We may want to ask the kernel guys to export LOOPBACK_IFINDEX, as it >> is not at the moment. However, I think relying on it is fine even >> without that as the kernel will BUG_ON if "lo" does not have ifindex >> 1[0], and no other netdev can have ifindex 1[1]: >> >> /* The loopback device is special if any other network devices >> * is present in a network namespace the loopback device must >> * be present. > > BTW, I changed resolved now to only use LOOPBACK_IFINDEX when > identifying loopback devices, and dropped the code that checks for > IFF_LOOPBACK. That should simplify things a bit. > > I also documented the situation around LOOPBACK_IFINDEX in the > comments.
Thanks! -t _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel