Nmap Development mailing list archives

Re: Nsock has trouble handling pcap reads on Windows


From: Luis MartinGarcia <luis.mgarc () gmail com>
Date: Thu, 5 Aug 2010 20:36:53 +0200

On Wed, Aug 4, 2010 at 9:53 PM, David Fifield <david () bamsoftware com> wrote:

The concept of the patch looks right. Instead of adding a new pcap_reads
member, see if you can test whether the list nsp->evl.pcap_read_events
is empty.

In this part of the patch:

+#if HAVE_PCAP
+    #ifndef PCAP_CAN_DO_SELECT
+        /* Force a low timeout when capturing packets on systems where
+         * the pcap descriptor is not select()able. */
+        if(ms->pcap_reads>0){
+            event_msecs=PCAP_POLL_INTERVAL;
+        }
+    #endif
+#endif

you should not increase event_msecs, only decrease it. So if event_msecs
is 1 for example, it should not be increased to 2.

With these changes you can commit the patch.

David Fifield


Hi David,

I made the changes you suggested. I attach a few files:

nsock_pcap.diff : This is the actual patch.
nping_before.txt : Shows nping's behaviour before applying the patch.
nping_after.txt : Shows how it improved after the patch was applied.
Look at the times and RTT computations.
nmap_script_ipidseq_before.txt : Shows how the ipidiseq.nse script
behaved before the patch. I had to tune NSE a bit so it does no 50ms
timeouts but 5000ms oens. I had to modify this in order to show that
this also affects Nmap. With the current implementation it affects but
its harder to see because the maximum time Nsock sleeps is 50ms.
nmap_script_ipidseq_after.txt : Shows behaviour after the patch.
tuned_nse.diff : Shows the changes I made to reproduce the problem in nmap.

I've just applied the patch, but I'd be happy to revert it if anyone
finds a problem with it.

Regards,

Luis MartinGarcia.

Attachment: nmap_script_ipidseq_after.txt
Description:

Attachment: nsock_pcap.diff
Description:

Attachment: nmap_script_ipidseq_before.txt
Description:

Attachment: nping_after.txt
Description:

Attachment: nping_before.txt
Description:

Attachment: tuned_nse.diff
Description:

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Current thread: