Nmap Development mailing list archives
RE: Win32 port
From: "Heine, Matthew" <mheine () harris com>
Date: Wed, 27 Feb 2002 09:29:02 -0500
Actual diff on that patch is as follows for those wondering what changed... ========================================================== 107c107 < ---
110a111
113c114 < // Note: I could use SO_RCVTIMEO but I don't trust it... ---
// Note: I could use SO_RCVTIMEO but I don't trust it...
119c120,126 < if(0 == select(0, &fds, 0, 0, &tv)) return 0; ---
if(0 == select(0, &fds, 0, 0, &tv)) { if(len) *len = 0; return 0; }
122a130
146c154,155 < ---
========================================================== -----Original Message----- From: KevinĀ³ Davis [mailto:kevin.davis () mindless com] Sent: Wednesday, February 27, 2002 6:29 AM To: Stou Sandalski; 'Paul Ellison'; nmap-dev () insecure org Subject: Re: Win32 port A while back I posted a problem I had with nmap crashing on Windows boxes - sometimes. Andy Lutomirski posted a patch that fixed things for me. Hopefully this has made it into the developer's hands and will be implemented in the next release. See below for the fix: Change readip_rawrecv in rawrecv.c to this: char *rawrecv_readip(pcap_t *pd, unsigned int *len, long to_usec) { int rcvlen; DWORD time1, time2; fd_set fds; TIMEVAL tv; if(-2 != (long)pd) fatal("rawrecv_readip: called with non-rawrecv handle\n"); begin: // Note: I could use SO_RCVTIMEO but I don't trust it... time1 = GetTickCount(); FD_ZERO(&fds); FD_SET(s, &fds); tv.tv_usec = to_usec % 1000000; tv.tv_sec = to_usec / 1000000; if(0 == select(0, &fds, 0, 0, &tv)) { if(len) *len = 0; return 0; } rcvlen = recv(s, buf, sizeof(buf), 0); time2 = GetTickCount() + 10; if(rcvlen > 0) { if(rcvlen >= sizeof(struct ip) && filter(buf, rcvlen)) { if(len) *len = rcvlen; return buf; } else { to_usec -= 1000 * (time2 - time1); if(to_usec < 0) { if(len) *len = 0; return 0; } goto begin; } } else { DWORD err = WSAGetLastError(); if(err != WSAETIMEDOUT && err != WSAEWOULDBLOCK) fatal("rawrecv: recv failed (%lu)\n", err); if(len) *len = 0; return 0; } } --------------------------------------- KevinĀ³ Davis What could possibly go wrong? kevin.davis () mindless com --------------------------------------------------------------------- For help using this (nmap-dev) mailing list, send a blank email to nmap-dev-help () insecure org . List run by ezmlm-idx (www.ezmlm.org).
Current thread:
- RE: Win32 port Heine, Matthew (Feb 27)