[tcpdump-workers] libpcap error codes?

2020-10-07 Thread Fernando Gont via tcpdump-workers
--- Begin Message ---

Hi,

WHile using pcap_inject() in Linux, it is failing with "pcap_inject(): 
send: Resource temporarily unavailable". In principle, one would expect 
that for temporary problems (such as this one), one may one to wait a 
bit and retry.  So it would make sense to somehow be able to process the 
error code/condition, and act differently depending on the error type.


Is there a way to get an error code (say, int value), as opposed to a 
text describing it?


Thanks,
--
Fernando Gont
SI6 Networks
e-mail: fg...@si6networks.com
PGP Fingerprint:  31C6 D484 63B2 8FB1 E3C4 AE25 0D55 1D4E 7492




--- End Message ---
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Re: [tcpdump-workers] libpcap error codes?

2020-10-07 Thread Guy Harris via tcpdump-workers
--- Begin Message ---
On Oct 7, 2020, at 1:30 PM, Fernando Gont via tcpdump-workers 
 wrote:

> WHile using pcap_inject() in Linux, it is failing with "pcap_inject(): send: 
> Resource temporarily unavailable". In principle, one would expect that for 
> temporary problems (such as this one), one may one to wait a bit and retry.  
> So it would make sense to somehow be able to process the error 
> code/condition, and act differently depending on the error type.
> 
> Is there a way to get an error code (say, int value), as opposed to a text 
> describing it?

There isn't, other than looking at errno.

A new API could be added that returns a PCAP_ERROR_ value rather than -1 on 
error (so as not to break source or binary compatibility with code using the 
existing APIs).--- End Message ---
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Re: [tcpdump-workers] libpcap error codes?

2020-10-07 Thread Denis Ovsienko via tcpdump-workers
--- Begin Message ---
On Wed, 7 Oct 2020 14:37:41 -0700
Guy Harris via tcpdump-workers 
wrote:

[...]

> A new API could be added that returns a PCAP_ERROR_ value rather than
> -1 on error (so as not to break source or binary compatibility with
> code using the existing APIs).

Do you mean to introduce a function like pcap_error(), which the
developers would be able to interrogate if they need in use cases like
this? Then existing functions could be slowly updated as needed to store
the fault details somewhere for that function.

-- 
Denis Ovsienko
--- End Message ---
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Re: [tcpdump-workers] libpcap error codes?

2020-10-07 Thread Guy Harris via tcpdump-workers
--- Begin Message ---
On Oct 7, 2020, at 3:16 PM, Denis Ovsienko via tcpdump-workers 
 wrote:

> Do you mean to introduce a function like pcap_error(), which the
> developers would be able to interrogate if they need in use cases like
> this? Then existing functions could be slowly updated as needed to store
> the fault details somewhere for that function.

I was thinking of a new API for injecting packets, which would directly return 
a PCAP_ERROR_ value.  A pcap_last_error() routine would also handle that case, 
but if a new routine would return a success vs. failure value, it might as well 
return an error code, so pcap_last_error() would be useful only for existing 
routines.--- End Message ---
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers