Nmap Development mailing list archives

Re: OS X 10.6 diagnosis: pcap timeout and bpf device access


From: David Fifield <david () bamsoftware com>
Date: Tue, 10 Nov 2009 20:47:17 -0700

On Tue, Nov 10, 2009 at 01:35:13PM -0700, David Fifield wrote:
On Tue, Nov 10, 2009 at 10:32:29AM -0500, Walt Scrivens wrote:
As I said in my earlier e-mail, I compiled for 32 bit configuration
and nmap seemed to work OK.

I just installed Apple's latest update, 10.6.2, and re-complied
without the 32-bit switches; nmap now seems to work properly!

That's good. Their update must have fixed the read timeouts. I haven't
tried it yet, but if it really is fixed, then maybe we don't have to do
anything. I was about to write a poll replacement for pcap_select. On
the other hand, I think I'll do that anyway, because then we get the
benefit of having pcap_select work on Mac OS X past 10.6, and Nmap won't
be broken for users of 10.6 and 10.6.1.

It works for me too with 10.6.2. So my guess is that this will work for
people building from source as long as they're updated.

I tried writing a poll replacement for pcap_select, but it's not
working. The call to poll always returns 0. The same code works on
Linux. I'm open to other suggestions. For now I'm going to build
releases in 32-bit mode, and those who build from source on 10.6 and
10.6.1 will have to use the -m32 workaround.

int pcap_select(pcap_t *p, struct timeval *timeout) {
  struct pollfd pfd;
  int ret;

  if ((pfd.fd = my_pcap_get_selectable_fd(p)) == -1)
    return -1;
  pfd.events = POLLIN;

  do {
    errno = 0;
    ret = poll(&pfd, 1, timeout->tv_sec * 1000 + timeout->tv_usec / 1000);
    if (ret == -1) {
      if (errno == EINTR)
        error("%s: %s", __func__, strerror(errno));
      else
        fatal("Your system does not support select()ing on pcap devices \
(%s). PLEASE REPORT THIS ALONG WITH DETAILED SYSTEM INFORMATION TO THE \
nmap-dev MAILING LIST!", strerror(errno));
    }
  } while (ret == -1);

  return ret;
}

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


Current thread: