Show pcap_inject errors with '-vv' on Windows

This commit is contained in:
Joseph C. Lehner 2022-10-11 18:21:14 +02:00
parent 5ae8412024
commit 25e2364930

View file

@ -780,13 +780,16 @@ int ethsock_send(struct ethsock *sock, void *buf, size_t len)
{ {
if (pcap_inject(sock->pcap, buf, len) != len) { if (pcap_inject(sock->pcap, buf, len) != len) {
#ifdef NMRPFLASH_WINDOWS #ifdef NMRPFLASH_WINDOWS
// In recent Npcap versions, pcap_inject fails if the // Npcap's pcap_inject fails in many cases where neither
// interface is unplugged. This doesn't happen on either // Linux or macOS report an error. For now, we simply
// Linux or macOS. // ignore errors if unplugged (and let all other through
// as well, just printing a debug line).
if (ethsock_is_unplugged(sock)) { if (!ethsock_is_unplugged(sock) && verbosity > 1) {
return 0; pcap_perror(sock->pcap, "pcap_inject");
} }
return 0;
#endif #endif
pcap_perror(sock->pcap, "pcap_inject"); pcap_perror(sock->pcap, "pcap_inject");
return -1; return -1;