mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 21:51:28 +00:00
Don't fatal() on iflist if npcap isn't found
This commit is contained in:
@@ -309,16 +309,18 @@ void win32_fatal_raw_sockets(const char *devname) {
|
|||||||
words the names of interfaces Nmap has no way of using.*/
|
words the names of interfaces Nmap has no way of using.*/
|
||||||
static void print_iflist_pcap_mapping(const struct interface_info *iflist,
|
static void print_iflist_pcap_mapping(const struct interface_info *iflist,
|
||||||
int numifs) {
|
int numifs) {
|
||||||
pcap_if_t *pcap_ifs;
|
pcap_if_t *pcap_ifs = NULL;
|
||||||
std::list<const pcap_if_t *> leftover_pcap_ifs;
|
std::list<const pcap_if_t *> leftover_pcap_ifs;
|
||||||
std::list<const pcap_if_t *>::iterator leftover_p;
|
std::list<const pcap_if_t *>::iterator leftover_p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Build a list of "leftover" libpcap interfaces. Initially it contains all
|
/* Build a list of "leftover" libpcap interfaces. Initially it contains all
|
||||||
the interfaces. */
|
the interfaces. */
|
||||||
|
if (o.have_pcap) {
|
||||||
pcap_ifs = getpcapinterfaces();
|
pcap_ifs = getpcapinterfaces();
|
||||||
for (const pcap_if_t *p = pcap_ifs; p != NULL; p = p->next)
|
for (const pcap_if_t *p = pcap_ifs; p != NULL; p = p->next)
|
||||||
leftover_pcap_ifs.push_front(p);
|
leftover_pcap_ifs.push_front(p);
|
||||||
|
}
|
||||||
|
|
||||||
if (numifs > 0 || !leftover_pcap_ifs.empty()) {
|
if (numifs > 0 || !leftover_pcap_ifs.empty()) {
|
||||||
NmapOutputTable Tbl(1 + numifs + leftover_pcap_ifs.size(), 2);
|
NmapOutputTable Tbl(1 + numifs + leftover_pcap_ifs.size(), 2);
|
||||||
@@ -362,8 +364,10 @@ static void print_iflist_pcap_mapping(const struct interface_info *iflist,
|
|||||||
log_flush_all();
|
log_flush_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pcap_ifs) {
|
||||||
pcap_freealldevs(pcap_ifs);
|
pcap_freealldevs(pcap_ifs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Print a detailed list of Nmap interfaces and routes to
|
/* Print a detailed list of Nmap interfaces and routes to
|
||||||
|
|||||||
Reference in New Issue
Block a user