]> The Tcpdump Group git mirrors - libpcap/commitdiff
Report the Windows error status if PacketSendPacket() fails.
authorGuy Harris <[email protected]>
Sat, 20 Feb 2021 09:52:36 +0000 (01:52 -0800)
committerGuy Harris <[email protected]>
Thu, 25 Feb 2021 18:59:22 +0000 (10:59 -0800)
That gives more information about the failure.

(cherry picked from commit fad6b5f8dfcef124ce883571c045af8179292d21)

pcap-npf.c

index b9b4642c382f16f045cfe84bc6f3609048f789ed..5a2e2ace0cef5b62c0b408026e0fe1c2a330d09b 100644 (file)
@@ -900,7 +900,8 @@ pcap_inject_npf(pcap_t *p, const void *buf, int size)
 
        PacketInitPacket(&pkt, (PVOID)buf, size);
        if(PacketSendPacket(pw->adapter,&pkt,TRUE) == FALSE) {
-               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketSendPacket failed");
+               pcap_fmt_errmsg_for_win32_err(p->errbuf, PCAP_ERRBUF_SIZE,
+                   GetLastError(), "send error: PacketSendPacket failed");
                return (-1);
        }