[Winpcap-users] Losing link hangs the application
Gianluca Varenni
gianluca.varenni at cacetech.com
Wed Feb 28 02:34:53 GMT 2007
Eli,
(un)fortunately there were several modifications to the driver to better handle cable and board removal that could cause weird problems and crashes (BSODs).
Do you know exactly where your application hangs? Does it hang on a PacketReceive or PacketSend? Can you kill the app while the app is hung? Or it stays as a zombie (i.e. you still see the executable listed in the processes tab of task manager?). Debugging such issues is not straightforward, sometimes involving a bit of kernel debugging and two machines...
First I suggest you to migrate to WinPcap 4.0 (at least for testing). Moreover, it would be useful if you can create a small application that shows the issue, and send it to winpcap-bugs.
Have a nice day
GV
----- Original Message -----
From: Eli Iser
To: winpcap-users at winpcap.org
Sent: Tuesday, February 20, 2007 12:04 PM
Subject: [Winpcap-users] Losing link hangs the application
Hello,
I'm developing a router application on Windows XP using Packet32 from WinPCap version 3.1. I know I should use WinPCap, but I prefer the simpler interface of Packet32, as I do every aspect of the application myself.
The application basicly has two threads: one reads packets from NIC A, checks in the routing table and then sends via NIC B. The other thread reads packets from NIC B and routes them via NIC A. Answering ARP requests and receiving ARP replies is a case where I have cross-thread access, so the sending of the packets is protected with a mutex for every NIC.
The problem I have is thus: when I pull the ethernet cable from NIC A I obviously lose the packets from it, but sometimes (quite reproducable, though not predictable) my entire application threads hang until I plug the cable back, restoring link to the adapter. I examined the state of both threads and it seems that both threads are accessing the same adapter, which I've unplugged. In one occasion one thread is writing to the adapter and the other is reading from it. In another case one thread is writing while the other is getting statistics from it.
At first I was sure that this was because I modified the Packet32 code to use Overlapped IO, but I than reverted back to the original code and the problem still happens.
Maybe I'm doing something wrong? How well does the Packet32 code handle multithreaded access?
I'll be glad for any help and suggestions.
As a side note, I'd rather try and figure out the problem before moving my code to use WinPCap 4 (if indeed it is a know bug of 3.1), since I've been developing the app for quite some time, and wouldn't like to retest all of it again.
Thank you,
Eli Iser
------------------------------------------------------------------------------
_______________________________________________
Winpcap-users mailing list
Winpcap-users at winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20070228/c93f86bd/attachment.htm
More information about the Winpcap-users
mailing list