inconsistency between SIOCGIFCONF and SIOCGIFNAME

From: Ulrich Drepper
Date: Mon Jun 28 2004 - 23:10:24 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/