Hi.

How did you manage packets? Remember that a packet returned by pcap_next_ex
remains valid up to the next call to pcap_next_ex or pcap_close (whatever
comes first). Since you are delaying packets, you must copy then before
calling pcap_next_ex to receive the next packet.

If this is your case, I can also provide you some hints on why the bug does
not exploit when there is no delay.

Have a nice day
GV

----- Original Message ----- 
From: "Frank Natoli" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 01, 2004 4:22 PM
Subject: [WinPcap-users] Send only pcap interface


> As I see a number of other members are doing, I am writing a packet relay
program using Winpcap. Test system has two NICs, to relay packets across two
LANs.
>
> Program has a thread to be used for capture purposes, one for each NIC.
Each thread performs pcap_open_live and pcap_next_ex.
>
> Program also has a thread to be used for relay purposes, one for each NIC.
Each thread performs pcap_open_live and pcap_sendpacket as needed.
>
> Everything works fine, capture on one NIC, relay/send on another (discard
echo back packets), both directions. Can ping across the program, again in
both directions.
>
> Problem occurs when relay thread intentionally delays packets via Win32
Sleep. Amount of sleep is programmable. When set to 3000ms, program works
badly, failing to relay many packets, occasionally succeeding but eventually
crashing with some memory allocation fault, deep inside Win32.
>
> Question is this: do the two pcap_open_live on same NIC (one for capture,
one for relay, separate threads) somehow affect one another? If the thread
that is doing pcap_sendpacket only (occasionally delayed) interfering with
the thread that is doing pcap_next_ex on the same NIC?
>
> Thanks for your time.
>
>
> ==================================================================
>  This is the WinPcap users list. It is archived at
>  http://www.mail-archive.com/[EMAIL PROTECTED]/
>
>  To unsubscribe use
>  mailto: [EMAIL PROTECTED]
> ==================================================================
>





==================================================================
 This is the WinPcap users list. It is archived at
 http://www.mail-archive.com/[EMAIL PROTECTED]/

 To unsubscribe use 
 mailto: [EMAIL PROTECTED]
==================================================================

Reply via email to