Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <375462FD.CA857D3C@cisco.com> Date: Tue, 01 Jun 1999 15:47:25 -0700 From: "Ashish C. Nagre" Reply-To: ashishcn AT cisco DOT com Organization: Cisco Systems X-Mailer: Mozilla 4.03 [en] (WinNT; U) MIME-Version: 1.0 To: Corinna Vinschen , cygwin AT sourceware DOT cygnus DOT com Subject: ioctl() confusion References: <374C9D2B DOT CBDD1EC4 AT cisco DOT com> <374CA453 DOT 6E07EFD1 AT vinschen DOT de> <374D85CF DOT AC0FFED3 AT cisco DOT com> <374D9F8D DOT 3F370DF3 AT vinschen DOT de> <37544AE1 DOT AFE086C AT cisco DOT com> <37545B80 DOT 4C31E1D1 AT vinschen DOT de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, You said that it could be because of the RAS device. But the host that I am testing on has 3 devices: "lo0" (loopback), "eth0" (ether) and "ppp4" ( the RAS device ??) I am confused really because the flags that are returned when I run the program in the gdb are 0x99 but when I run the executable the flags returned are 0x34. This observation is quite inexplicable to me. I would be really grateful if you could clear this issue with me. If you need I can send you the segment of code where the ioctl() call is made. Meanwhile, I wait for your reply. Thank you for all the help. Regards, Ashish Corinna Vinschen wrote: > > "Ashish C. Nagre" wrote: > > I have made a strange observation, when the following call is made: > > > > ioctl(fd, SIOCGIFFLAGS, (char *)&ifr) > > > > The value returned in the member ifr.ifr_ifru.ifru_flags is different > > when I just run the executable compared to when I run it in the > > debugger. > > ifr.ifr_ifru.ifru_flags = 34 (executable) > > ifr.ifr_ifru.ifru_flags = 99 (in gdb) > > [...] > > Why are the flags returned with different values ? > > The flags are computed through the address of the interface. > Is it possible, that you are testing it on a RAS device, e.g > a modem line? When a modem line isn't connected, it returns > the IP address 0.0.0.0, when it's connected, it returns a legal > address. > In case of address 0.0.0.0, the cygwin DLL knows, that the interface > isn't connected and so returns the flags > IFF_NOTRAILERS | IFF_BROADCAST > The hex value of the above flags is 0x34. > > If the address is a legal IP address, the cygwin DLL knows that the > interface is connected and so returns > IFF_NOTRAILERS | IFF_BROADCAST | IFF_UP | IFF_RUNNING > The hex code is 0x99. > > You see, both values are possible and you should check it out, if > you have tested it under different conditions. > > Regards, > Corinna -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com