tcpdump mailing list archives

any device doesn't work anymore


From: Giovanni Venturi <giovanni () ksniffer org>
Date: Tue, 18 Nov 2008 00:15:13 +0100

As reported in man:

pcap_create() is used to create a packet capture handle to look at packets on 
the network. source is a string that specifies the network device to open; on 
Linux systems with 2.2 or later kernels, a source argument of "any" or NULL 
can be used to capture packets from all interfaces. 

block1:
      if ((m_pcapfp = pcap_create("any", errbuf)) == NULL)
        cout << "NULLLLLLLLLLLLLLLLLLLLLLLLLL";
      pcap_set_snaplen(m_pcapfp, PKTMAX);
      pcap_set_promisc(m_pcapfp, 0);
      pcap_activate(m_pcapfp);

block2:
      if (pcap_open_live("any", PKTMAX, 0, -1, errbuf) == NULL)
      {cout << errbuf; return;}

just block told me that:

SIOCGIFHWADDR: No such device

All what worked before doesn't work now anymore. :(

If I use NULL no block tell me that there is a problem. I got crash on 
(FD_SET):

#ifdef HAVE_PCAP_GET_SELECTABLE_FD
    m_pcap_fd = pcap_get_selectable_fd(m_pcapfp);
#else
    m_pcap_fd = pcap_fileno(m_pcapfp);
#endif

FD_ZERO(&m_fdset);
FD_SET(m_pcap_fd, &m_fdset);


What's happening?

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: