Hi, Guys,
Here is my situation, I am running jpcap in solaris environment, and trying to capturing DHCP OFFER AND DHCP ACK , DHCP NACK , DHCP RELEASE packets. In my sitation, jpcap program runs on the same host as my local DHCP server; when a client requests a IP address, DHCP SERVER will allocate IP address; my program will capture packets that sents to port 67 and host (hosname): packet DHCP OFFER and DHCP ACK will be captured in this case. My jpcap program does capture DHCP OFFER packet, but i do not see DHCP ACK packet until my dhcp issue a DHCP RELEASE or anyother DHCP client issue a DHCP DIscovery message. I think this is a bug in SOLARIS; The DHCP ACK packet seems to be blocked until the device gets a filtered packet again.
In jpcap.c code, if i change the calling of pcap_dispatch(..., cnt,..) from 1 to cnt, this problem gone. Can anyone fully explain this? Thanks
Logged In: YES
user_id=1262793
Originator: NO
This will be fixed in 2.0.0. A 'count' of 1 is no longer used unless supplied by the application.
EJP
Logged In: YES
user_id=1262793
Originator: NO
This issue has been addressed in the forthcoming release 2.0.
Every call to pcap_dispatch() implies a context switch, and every context switch is an overhead, and overhead increases the chances of dropping packets.
So, as noted above, pcap_dispatch() should be called directly with the required 'cnt' value, rather than inside a loop 'for (int i = 0; i < cnt; i++)', to minimize context switching.