diff options
author | Guy Harris <gharris@sonic.net> | 2020-12-27 13:10:16 -0800 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-12-27 13:10:16 -0800 |
commit | 4f389694e580a62693aa19799ddfc44c2c729841 (patch) | |
tree | 56f8620446e4d7a5ff1fe16fe06bec0acf07d3ae /pcap-npf.c | |
parent | 696192563264273e4b7727f72eefb022b72df4e1 (diff) |
NPF: report the system error for PacketSetHwFilter() failures.
It *does* fail to set promiscuous mode on some devices, such as bridge
devices; knowing what error it is might help us distinguish "we don't
support promiscuous mode" from some other, unexpected error.
Diffstat (limited to 'pcap-npf.c')
-rw-r--r-- | pcap-npf.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1175,7 +1175,9 @@ pcap_activate_npf(pcap_t *p) if (PacketSetHwFilter(pw->adapter,NDIS_PACKET_TYPE_PROMISCUOUS) == FALSE) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "failed to set hardware filter to promiscuous mode"); + pcap_fmt_errmsg_for_win32_err(p->errbuf, + PCAP_ERRBUF_SIZE, GetLastError(), + "failed to set hardware filter to promiscuous mode); goto bad; } } @@ -1193,7 +1195,9 @@ pcap_activate_npf(pcap_t *p) NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_MULTICAST) == FALSE) { - snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "failed to set hardware filter to non-promiscuous mode"); + pcap_fmt_errmsg_for_win32_err(p->errbuf, + PCAP_ERRBUF_SIZE, GetLastError(), + "failed to set hardware filter to non-promiscuous mode"); goto bad; } } |