tcpdump mailing list archives

Re: Fw: Problems with fnct pcap_lookupdev()


From: César Cárdenas <ccardena () itesm mx>
Date: Wed, 28 Apr 2004 16:22:38 +0200

Many Thanks GV:

It works now!!!
I have another question but I'll pose it to another message because is different,

Best regards,
César

ps by the way, where I can see the list messages...I did not found in the
www.tcpdump.org page.

-- Mensaje Original --
From: "Gisle Vanem" <giva () bgnett no>
To: <ccardena () itesm mx>
Subject: Fw: [tcpdump-workers] Problems with fnct pcap_lookupdev()
Date: Wed, 28 Apr 2004 12:16:13 +0200



----- Original Message ----- 
From: "Gisle Vanem" <giva () bgnett no>
To: <tcpdump-workers () lists sandelman ca>
Sent: Wednesday, April 28, 2004 11:53 AM
Subject: Re: [tcpdump-workers] Problems with fnct pcap_lookupdev()


"César Cárdenas" <ccard
na () itesm mx> said:

When I run the following simple code:

#include <stdio.h>
#include <pcap.h>

int main()
    {
    char           *dev;                    /*The device to sniff on*/
    char           err
uf[PCAP_ERRBUF_SIZE];/*Error string*/

    dev = pcap_lookupdev (errbuf);
    printf("Device: %s\n%s\n", dev, errbuf);
    return (0);
    }

The results are (in a DOS window):

Device: \
á=L

I a
using Dev-cpp v 4.9.8.0. Does any body knows where is the problem?

It's because the devicename is in Unicode. Use a test like
  if (dev[1] == 0)  /* unicode */
        printf("Device: %S\n", dev);
  else printf("Device: %s\n", dev);


errbuf isn't filled if pcap_lokupdev() succeedes. So don't use it.

It suppose to give results like:

eth0
fddi

Not on Windows; there you'll get the long unfriendly names
you quoted.

--gv







-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.


Current thread: