Nmap Development mailing list archives

ping fix for windows (finally)


From: "Andy Lutomirski" <Luto () myrealbox com>
Date: Thu, 21 Mar 2002 23:14:31 -0800

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At long last, I think I have fixed pinging on windows.  It was a
royally dumb mistake (thank you MS for stupid error codes -- WSAEINTR
is deprecated -- it is _not_ a sensible description for this mistake,
and the error should have been on the send not the recv anyway). 
nmap for Windows may be getting somewhere, finally... :)

Change win32_socket in winip.c to read: (sorry, I'm way to tired to
make a diff right now)

int win32_socket(int af, int type, int proto)
{
 SOCKET s;
 winip_test(0);

 if(type == SOCK_RAW && proto == IPPROTO_RAW && !rawsock_avail)
 {
  winip_test(1);
  pcapsend_init();
  return 501;
 }

 if(o.debugging > 1 && type == SOCK_RAW && proto == IPPROTO_RAW)
  printf("Opening a real raw socket\n");

 s = socket(af, type, proto);

 // Do this here to save a little time
 if(type == SOCK_RAW && proto == IPPROTO_RAW) sethdrinclude(s);

 return s;
}

(The line that changed is the call to sethdrinclude(s))


Andy Lutomirski

P.S.  Sorry I didn't find this a few days earlier :(  Anyone see the
beginning of a bad tradition?

P.P.S.  Anyone know of a way to get UDP sockets on Windows to stop
failing recieves just becuase they got a port unreachable (that's
sensible behavior if connect() has been called, but IMHO these errors
should be ignored if connect() has not been called -- it sorta
defeats the purpose of connectionless sockets).  Of course it is
quite possible that I'm nuts, but I don't think so...

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPJrZ0zF1mpyDznXTEQKccQCfc2p/XtML1RUPBa1NtP7HT/sPa2oAoNuJ
y7KQVsVOpyHnCfuAq2ELE+s0
=TA64
-----END PGP SIGNATURE-----


Current thread: