Folks, I was trying to check for specific errors in libpcap I/O functions such as pcap_next_ex() and pcap_inject().
However, the relevant manpages indicate that these functions return -1 on error, and don't mention the setting of any "errno-like" variable that specifies the specific error that occurred. While there exist functions such as pcap_geterr() to print an error-specific message, I'm rather interested in obtaining an error code such that my program can act differently depending on the specific return error. If that's possible? If so, how? FWIW, I've checked /usr/include/pcap/pcap.h, and while there exist error codes such as: #define PCAP_ERROR -1 /* generic error code */ #define PCAP_ERROR_BREAK -2 /* loop terminated by pcap_breakloop */ [....] #define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */ they don't seem to be returned when the corresponding error condition occurs in pcap_next_ex() or other libpcap I/O functions. For instance, if I take an interface down with ifconfig, pcap_next_ex() returns -1, and not -9 (PCAP_ERROR_IFACE_NOT_UP). Thanks! Best regards, -- Fernando Gont e-mail: [email protected] || [email protected] 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.
