Added display of warning produced by pcap_findalldevs() where a warning message is provided when no devices are available (OSX). - Sergey Oboguev
This commit is contained in:
parent
fd1cd463f9
commit
938450bbf5
1 changed files with 6 additions and 0 deletions
|
@ -3159,6 +3159,7 @@ pcap_if_t* dev;
|
|||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
memset(list, 0, max*sizeof(*list));
|
||||
errbuf[0] = '\0';
|
||||
/* retrieve the device list */
|
||||
if (pcap_findalldevs(&alldevs, errbuf) == -1) {
|
||||
char* msg = "Eth: error in pcap_findalldevs: %s\r\n";
|
||||
|
@ -3166,6 +3167,11 @@ if (pcap_findalldevs(&alldevs, errbuf) == -1) {
|
|||
if (sim_log) fprintf (sim_log, msg, errbuf);
|
||||
}
|
||||
else {
|
||||
if (errbuf[0]) {
|
||||
char* msg = "Eth: pcap_findalldevs warning: %s\r\n";
|
||||
printf (msg, errbuf);
|
||||
if (sim_log) fprintf (sim_log, msg, errbuf);
|
||||
}
|
||||
/* copy device list into the passed structure */
|
||||
for (i=0, dev=alldevs; dev && (i < max); dev=dev->next, ++i) {
|
||||
if ((dev->flags & PCAP_IF_LOOPBACK) || (!strcmp("any", dev->name))) continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue