mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Show a warning in libdnet whenever a Windows interface type is unrecognized.
(These get mapped to interfaces beginning with "net": net0, net1, etc.) I originally planned to make this a debugging message to be displayed at a certain debuggin level whether the interface type is recognized or not. It looked to be a pain to give libdnet visibility of Nmap debugging level, so instead it just prints a message to stderr only when the interface type is unrecognized.
This commit is contained in:
@@ -346,3 +346,37 @@ Index: src/intf-win32.c
|
|||||||
|
|
||||||
for (i = 0; i < intf->ifcombo[ifrow->dwType].cnt; i++) {
|
for (i = 0; i < intf->ifcombo[ifrow->dwType].cnt; i++) {
|
||||||
if (intf->ifcombo[ifrow->dwType].idx[i] == ifrow->dwIndex)
|
if (intf->ifcombo[ifrow->dwType].idx[i] == ifrow->dwIndex)
|
||||||
|
|
||||||
|
o Show a warning whenever a Windows interface type is unrecognized.
|
||||||
|
Index: src/intf-win32.c
|
||||||
|
===================================================================
|
||||||
|
--- src/intf-win32.c (revision 6321)
|
||||||
|
+++ src/intf-win32.c (working copy)
|
||||||
|
@@ -23,6 +23,8 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
+#include "err.h"
|
||||||
|
+
|
||||||
|
#include "pcap.h"
|
||||||
|
|
||||||
|
struct ifcombo {
|
||||||
|
@@ -42,7 +44,7 @@
|
||||||
|
static char *
|
||||||
|
_ifcombo_name(int type)
|
||||||
|
{
|
||||||
|
- char *name = "net"; /* XXX */
|
||||||
|
+ char *name;
|
||||||
|
|
||||||
|
if (type == MIB_IF_TYPE_ETHERNET) {
|
||||||
|
name = "eth";
|
||||||
|
@@ -56,6 +58,9 @@
|
||||||
|
name = "lo";
|
||||||
|
} else if (type == MIB_IF_TYPE_SLIP) {
|
||||||
|
name = "sl";
|
||||||
|
+ } else {
|
||||||
|
+ name = "net";
|
||||||
|
+ warnx("_ifcombo_name: Mapping unknown interface type %d to \"%s\".\n", type, name);
|
||||||
|
}
|
||||||
|
return (name);
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "err.h"
|
||||||
|
|
||||||
#include "pcap.h"
|
#include "pcap.h"
|
||||||
|
|
||||||
struct ifcombo {
|
struct ifcombo {
|
||||||
@@ -42,7 +44,7 @@ struct intf_handle {
|
|||||||
static char *
|
static char *
|
||||||
_ifcombo_name(int type)
|
_ifcombo_name(int type)
|
||||||
{
|
{
|
||||||
char *name = "net"; /* XXX */
|
char *name;
|
||||||
|
|
||||||
if (type == MIB_IF_TYPE_ETHERNET) {
|
if (type == MIB_IF_TYPE_ETHERNET) {
|
||||||
name = "eth";
|
name = "eth";
|
||||||
@@ -56,6 +58,9 @@ _ifcombo_name(int type)
|
|||||||
name = "lo";
|
name = "lo";
|
||||||
} else if (type == MIB_IF_TYPE_SLIP) {
|
} else if (type == MIB_IF_TYPE_SLIP) {
|
||||||
name = "sl";
|
name = "sl";
|
||||||
|
} else {
|
||||||
|
name = "net";
|
||||||
|
warnx("_ifcombo_name: Mapping unknown interface type %d to \"%s\".\n", type, name);
|
||||||
}
|
}
|
||||||
return (name);
|
return (name);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user