[prev in list] [next in list] [prev in thread] [next in thread] 

List:       winpcap-users
Subject:    [Winpcap-users] Problem with PCAP_OPENFLAG_NOCAPTURE_LOCAL on
From:       "Larry Leo" <leo0888 () gmail ! com>
Date:       2007-09-10 22:13:54
Message-ID: 7cb2728f0709101513x303617c8vea4a6c72c8740454 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi all,

I am having problem using pcap_open() with PCAP_OPENFLAG_NOCAPTURE_LOCAL on
windows 2000.  I  modified basic_dump.c with code from sendpack.c to send
100 bytes to the selected network adapter, but used pcap_open() (from
userlevelbridge) instead of pcap_open_live().  I resulted exe works on win
xp but not on win 2000. I compiled on cygwin and verified using ethereal to
capture the packet.  The pcap_open code from userlevelbridge is:

if((adhandle = pcap_open(d->name,    // name of the device
             65536,        // portion of the packet to capture.
                    // 65536 grants that the whole packet will be captured
on every link layer.
             PCAP_OPENFLAG_PROMISCUOUS |    // flags. We specify that we
don't want to capture loopback packets, and that the driver should deliver
us the packets as fast as possible
             PCAP_OPENFLAG_NOCAPTURE_LOCAL |
             PCAP_OPENFLAG_MAX_RESPONSIVENESS,
             500,        // read timeout
             NULL,        // remote authentication
             errbuf        // error buffer
             )) == NULL)
{
    fprintf(stderr,"\nUnable to open the adapter. %s is not supported by
WinPcap\n", d->name);
    /* Free the device list */
    pcap_freealldevs(alldevs);
    return -1;
}

If I commented out the PCAP_OPENFLAG_NOCAPTURE_LOCAL flag, then it would
work on both win XP and 2000 platforms, but the packet is looped back.

Any help to make the PCAP_OPENFLAG_NOCAPTURE_LOCAL flag work on win 2000
would be appreciated.

Regards,

Larry

[Attachment #5 (text/html)]

Hi all,<br><br>I am having problem using pcap_open() with \
PCAP_OPENFLAG_NOCAPTURE_LOCAL on windows 2000.&nbsp; I&nbsp; modified basic_dump.c \
with code from sendpack.c to send 100 bytes to the selected network adapter, but used \
pcap_open() (from userlevelbridge) instead of pcap_open_live().&nbsp; I resulted exe \
works on win xp but not on win 2000. I compiled on cygwin and verified using ethereal \
to capture the packet.&nbsp; The pcap_open code from userlevelbridge is: \
<br><br>if((adhandle = pcap_open(d-&gt;name,&nbsp;&nbsp;&nbsp; // name of the \
device<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;65536,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // portion of the packet to \
capture. <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // 65536 grants that the whole packet will be \
captured on every link layer. <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp; &nbsp;PCAP_OPENFLAG_PROMISCUOUS |&nbsp;&nbsp;&nbsp; // flags. We \
specify that we don&#39;t want to capture loopback packets, and that the driver \
should deliver us the packets as fast as possible<br>&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;PCAP_OPENFLAG_NOCAPTURE_LOCAL | \
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;PCAP_OPENFLAG_MAX_RESPONSIVENESS,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp; &nbsp;500,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // read \
timeout<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;NULL,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // remote \
authentication<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;errbuf&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // error \
buffer<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;)) == NULL) \
<br>{<br>&nbsp;&nbsp;&nbsp; fprintf(stderr,&quot;\nUnable to open the adapter. %s is \
not supported by WinPcap\n&quot;, d-&gt;name);<br>&nbsp;&nbsp;&nbsp; /* Free the \
device list */<br>&nbsp;&nbsp;&nbsp; pcap_freealldevs(alldevs);<br>&nbsp;&nbsp;&nbsp; \
return -1;<br>}<br><br>If I commented out the PCAP_OPENFLAG_NOCAPTURE_LOCAL flag, \
then it would work on both win XP and 2000 platforms, but the packet is looped back.  \
<br><br>Any help to make the PCAP_OPENFLAG_NOCAPTURE_LOCAL flag work on win 2000 \
would be appreciated.<br><br>Regards,<br><br>Larry<br>



_______________________________________________
Winpcap-users mailing list
Winpcap-users@winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic