Messages in this thread | ![/](/images/icornerl.gif) | | Date | Mon, 28 Jun 2004 21:06:25 -0700 | From | Ulrich Drepper <> | Subject | inconsistency between SIOCGIFCONF and SIOCGIFNAME |
| |
POSIX does not specify the if_indextoname and if_nameindex functions, they are only vaguely specified in an RFC. So there is some room for interpretation but still I think it is an issue.
If SIOCGIFCONF to query the system's interfaces only active interfaces are returned. But SIOCGIFNAME (and SIOCGIFINDEX) allow querying interfaces which are down and not fully initialized.
RFC 3493 says if_nameindex should return *all* interfaces. This means that neither if_indextoname or if_nametoindex (defined in the same rfc) should define more interfaces.
With the current kernels all I could do is to make if_indextoname and if_nametoindex slower by always calling if_nameindex implicitly to see whether the interface is defined at all. It would be much better if the kernel could do the right thing. I.e., do one of the following:
~ if the SIOCGIFCONF, return all interfaces SIOCGIFNAME also knows about.
~ do not allow SIOCGIFNAME and SIOCGIFINDEX) to return values if SIOCGIFCONF, would not return any.
-- ➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |