tcpdump mailing list archives
linux pcap blocking and cpu utilization
From: four <suroot () gmail com>
Date: Mon, 28 Jun 2004 15:10:01 -0400
Hello All, It seems the issue of linux timeouts and blocking has been discussed on this list before. The issue is that the pcap calls won't return after a timeout period on linux and some other operating systems. Here is the situation: I am trying to build a simple bridging program. If I use pcap_set_nonblock() the function call returns fine, but the program ends up using 100% cpu utilization, presumably because it is simply looping and returning with no packets caught. So the other way is to just have the call wait for a certain packet count. But this doesn't work either because if no packets are coming one way down the wire, but we have recieved some in the other direction, the (singly threaded) program will block on the one direction. So I want to make a simple program that listens and forwards on two interfaces... what is the proper way to implement this on linux so that it doesn't use all the CPU and doesn't require multiple threads? Thanks... -- -=0100=- - This is the tcpdump-workers list. Visit https://lists.sandelman.ca/ to unsubscribe.
Current thread:
- linux pcap blocking and cpu utilization four (Jun 28)
- Re: linux pcap blocking and cpu utilization Guy Harris (Jun 28)