aboutsummaryrefslogtreecommitdiff
path: root/pcap-npf.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-12-27 13:10:16 -0800
committerGuy Harris <gharris@sonic.net>2020-12-27 13:10:16 -0800
commit4f389694e580a62693aa19799ddfc44c2c729841 (patch)
tree56f8620446e4d7a5ff1fe16fe06bec0acf07d3ae /pcap-npf.c
parent696192563264273e4b7727f72eefb022b72df4e1 (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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pcap-npf.c b/pcap-npf.c
index 201597d8..1b18608d 100644
--- a/pcap-npf.c
+++ b/pcap-npf.c
@@ -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;
}
}