Right. if_nameindex does not return eth0 if I boot up without an ethernet connection. Maybe this is a system dependent thing? I am running on a RH8 based system.
Or a libc thing? I'm running on FC2.
The if_nameindex code looked a little nicer, but a loop on if_indextoname() is not so bad.
Although I don't like the idea of predefined limits :) I'll probably submit a patch based on if_nameindex in the meantime, hopefully tomorrow if Alexandre commits the patch I already sent today. It removes a lot of the silliness of ifenum.c, so aside from not directly solving your problem, take a look at that and perhaps patch it.
--Juan
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com