HW address w/o connection in iphlpapi

most at museresearch.com most at museresearch.com
Tue Jan 24 18:20:02 CST 2006


>> Wait. This works better than getifaddrs. It successfully returns info
>> for "down" devices on my RH8 based linux box, with my creaky old
>> wine-20050419.
> (snip)

Yikes! It turns out if_nameindex() doesn't return info for down devices,
but if_indextoname() does. It's all so touchy... So, attached is an
alternate patch using if_indextoname() that does work; my last one
doesn't.

Just for kicks I also attached a cpp file adapted from MSDN that can do a
quick test. To build it do:

$ wineg++ -c show-eths.cpp
$ wineg++ -o show-eths.exe.so show-eths.o
$ wine ./show-eths.exe.so

You should get a listing for eth0 whether you boot with an ethernet
connection or not. Note that to witness the problem you have to actually
reboot with no ethernet connection. Just doing "ifdown eth0" isn't enough.

> Cool, thanks for that.  Like I mention in the comments, if_nameindex has
> the disadvantage that it doesn't handle virtual interfaces.  I'll try to
> hack this up to use a combination of if_nameindex and SIOCGIFCONF if I
> can, but feel free to beat me to it ;)

I'm betting you'll get there first! %) ... mo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-20050419-muse-ifenum.patch
Type: application/octet-stream
Size: 4015 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20060124/64eb4a6f/wine-20050419-muse-ifenum.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: show-eths.cpp
Type: application/octet-stream
Size: 2870 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20060124/64eb4a6f/show-eths.obj


More information about the wine-devel mailing list