tcpdump mailing list archives

Re: Checking for specific return errors in libpcap


From: Fernando Gont <fernando () gont com ar>
Date: Fri, 30 Dec 2011 11:21:18 -0300

On 12/29/2011 09:27 PM, Guy Harris wrote:

Setting errno to 0 before calling them, and, if they return -1,
checking the value of errno *might* work.  No guarantees, and bear in
mind that errno values for various conditions are
platform-dependent.

Ultimately, there should perhaps be different APIs, specified to
return PCAP_ERROR_ values on error, so that
[...]

After taking a look at the libpcap code, it seems that a straightforward
way to incorporate the functionality I was mentioning would be to add to
pcap_t a "status" member, and add right before every sentence that
writes to handle->errbuf a sentence that writes the corresponding code
to handle-status.

Then a function "pcap_geterrcode()" would simply return handle->status.

Please let me know what you think, and if you'd be interested in patches
that implement the aforementioned functionality (I'd be interested in
doing the work if there's interest to eventually commit it).

Thanks!

Best regards,
-- 
Fernando Gont
e-mail: fernando () gont com ar || fgont () si6networks com
PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1



-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: