This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Wierdness of WSASendTo()??


Ok, I have done some browsing, and now I'm totally 
confused.

According to Microsoft, there are 2 headers and libraries:
winsock.h
Ws2tcpip.h

Since I can seem to use the IP_HDRINCL macro, I am picking
ws2tcpip.h file.

However, I can't seem to figure out how to set the option.
When I invoke the following code fragment:

#ifdef IP_HDRINCL
  /*  FreeBSD wants this to avoid sending out packets with protocol type RAW
      to the network.  */
  if(setsockopt(sendsock, SOL_IP, IP_HDRINCL, &trueopt, sizeof(trueopt)))
  {
    perror("setsockopt(IP_HDRINCL,1)");
    return -1;
  }
#endif

I get the following from strace, which indicates that maybe cygwin doesn't
support IP_HDRINCL???  

  202  280647 [main] mtr 2576 cygwin_socket: socket (2, 3, 255)
 4034  284681 [main] mtr 2576 wsock_init: res 0
  210  284891 [main] mtr 2576 wsock_init: wVersion 514
  281  285172 [main] mtr 2576 wsock_init: wHighVersion 514
  177  285349 [main] mtr 2576 wsock_init: szDescription WinSock 2.0
  174  285523 [main] mtr 2576 wsock_init: szSystemStatus Running
  171  285694 [main] mtr 2576 wsock_init: iMaxSockets 0
  170  285864 [main] mtr 2576 wsock_init: iMaxUdpDg 0
  372  286236 [main] mtr 2576 wsock_init: lpVendorInfo 0
64252  350488 [main] mtr 2576 fdsock: not setting socket inheritance since winsock2_active 1
  272  350760 [main] mtr 2576 dtable::build_fhandler: fd 3, fh 0x615607C0
  169  350929 [main] mtr 2576 fdsock: fd 3, name '/dev/udp', soc 0x27C
  168  351097 [main] mtr 2576 cygwin_socket: 3 = socket (2, 3, 255)
 5043  356140 [main] mtr 2576 cygwin_setsockopt: setsockopt optval=1
  352  356492 [main] mtr 2576 cygwin_setsockopt: 0 = setsockopt (3, 0, 1 (SO_DEBUG), 22FE40, 4)


Do I need to maybe restructure my code so that I do not create a header???


On Thu, 11 Apr 2002 17:07:40 +0200, Corinna Vinschen wrote:

>On Thu, Apr 11, 2002 at 08:20:59AM -0600, Mark Paulus wrote:
>> MTR believes it's sending out a good ICMP packet of 64 bytes (0x40).
>> cygwin_sendto() also thinks it's sending out 64 bytes (as reported by strace).
>> 
>> However, tcpdump on my linux box is receiving 84 bytes.  
>> 
>> What it looks like to me is that somehow WSASendTo is re-formatting 
>> the packet that is going out.  But, this
>> turns it into an invalid packet, and causes a "network unreachable" error
>> on the linux box, and the response never comes back.
>> 
>> Has anyone seen this behaviour before??
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/wsanxref_8xo2.asp
>
>Look for IP_HDRINCL.
>
>
>Corinna
>
>-- 
>Corinna Vinschen                  Please, send mails regarding Cygwin to
>Cygwin Developer                                mailto:cygwin@cygwin.com
>Red Hat, Inc.
>
>--
>Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>Bug reporting:         http://cygwin.com/bugs.html
>Documentation:         http://cygwin.com/docs.html
>FAQ:                   http://cygwin.com/faq/
>




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]