tcpdump mailing list archives

Re: error executing ksniff with libpcap 1.0.0


From: Giovanni Venturi <giovanni () ksniffer org>
Date: Mon, 17 Nov 2008 22:46:00 +0100

Alle lunedì 17 novembre 2008, Guy Harris ha scritto:
On Nov 16, 2008, at 1:28 PM, Giovanni Venturi wrote:
Hello,
I'm the author of ksniffer a GUI interface under KDE 3 to capture
network
packet.
Till libpcap < 1.0.0 (the last stable you released) all was ok in
the packet
capture, but now I get the following error message:

This appears to be a duplicate of your earlier message; see my recent
reply to the last message you sent (summary: pcap_next() is a
troublesome API as it can return NULL even if no error has occurred;
pcap_next_ex() is better, or you could try using pcap_dispatch()
directly).
To make the pcap_next/pcap_ex non blocking under Linux I use:

    FD_ZERO(&m_fdset);
    FD_SET(m_pcap_fd, &m_fdset);
    m_fdtimeout.tv_sec = 0;
    m_fdtimeout.tv_usec = CAP_READ_TIMEOUT*1000;
    selRet = select(m_pcap_fd+1, &m_fdset, NULL, NULL, &m_fdtimeout);

No possibility to delete this ugly code with libpcap 1.0.0?
I've seen:

 int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf);

Doesn't work under Linux?

Giovanni
-- 
A KDE Italian translator and KSniffer core developer
Slackware GNU/Linux current version - kernel 2.6.27.4
KSniffer Project - http://www.ksniffer.org/

Attachment: signature.asc
Description: This is a digitally signed message part.


Current thread: