Cygwin's ioctl(SIOCGIFFLAGS) always sets the IFF_UP flag
Jonathan Lennox
lennox@cs.columbia.edu
Fri Dec 29 16:44:00 GMT 2006
I've discovered that Cygwin's ioctl(SIOCGIFFLAGS) call always sets the
IFF_UP flag, even if the interface being queried is disabled or
unconfigured.
Compare the output of the program local-if.c (attached below) to the output
of ipconfig.exe, when I have one interface disabled:
$ ./local-if
eth0: AF=2 (INET): flags=0x63 (up broadcast notrailers running) addr=0.0.0.0
lo: AF=2 (INET): flags=0x69 (up loopback notrailers running) addr=127.0.0.1
eth1: AF=2 (INET): flags=0x63 (up broadcast notrailers running) addr=192.168.1.104
eth2: AF=2 (INET): flags=0x63 (up broadcast notrailers running) addr=192.168.1.173
$ ipconfig
Windows IP Configuration
Ethernet adapter Wireless Network Connection:
IP Address. . . . . . . . . . . . : 192.168.1.104
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
Ethernet adapter Local Area Connection 3:
IP Address. . . . . . . . . . . . : 192.168.1.173
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Ethernet adapter Local Area Connection 4:
Media State . . . . . . . . . . . : Media disconnected
Some experimentation shows that following get_2k_ifconf's call to
GetIfEntry, Windows does indeed set MIB_IFROW.dwOperStatus to
MIB_IF_OPER_STATUS_NON_OPERATIONAL, but the cygwin library
ignores this field.
A non-configured interface should be easily reproducable; any DHCP interface
should enter this state following "ipconfig /release".
This is on Windows XP SP2; the actual unconfigured interface I'm using is an
OpenVPN tunnel.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: local-if.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20061229/9bd4eac2/attachment.c>
-------------- next part --------------
--
Jonathan Lennox
lennox@cs.columbia.edu
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list