Index: osscan2.cc =================================================================== --- osscan2.cc (revision 11131) +++ osscan2.cc (working copy) @@ -931,6 +931,9 @@ ethptr = ð } else { /* Init our raw socket */ +#ifdef WIN32 + win32_warn_raw_sockets(t->deviceName()); +#endif if ((rawsd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0 ) pfatal("socket troubles in %s", __func__); unblock_socket(rawsd); Index: output.h =================================================================== --- output.h (revision 11131) +++ output.h (working copy) @@ -125,6 +125,12 @@ #include "nmap.h" #include "global_structures.h" +#ifdef WIN32 +/* Display a warning that a device is not Ethernet and so raw sockets + will be used. The warning is shown only once per unique device name. */ +void win32_warn_raw_sockets(const char *devname); +#endif + /* Prints the familiar Nmap tabular output showing the "interesting" ports found on the machine. It also handles the Machine/Greppable output and the XML output. It is pretty ugly -- in particular I Index: idle_scan.cc =================================================================== --- idle_scan.cc (revision 11131) +++ idle_scan.cc (working copy) @@ -391,6 +391,9 @@ proxy->rawsd = -1; proxy->ethptr = &proxy->eth; } else { +#ifdef WIN32 + win32_warn_raw_sockets(proxy->host.deviceName()); +#endif if ((proxy->rawsd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0 ) pfatal("socket troubles in %s", __func__); unblock_socket(proxy->rawsd); Index: output.cc =================================================================== --- output.cc (revision 11131) +++ output.cc (working copy) @@ -114,6 +114,7 @@ #include "Target.h" #include "utils.h" +#include #include #include #include @@ -294,6 +295,17 @@ } #ifdef WIN32 +/* Display a warning that a device is not Ethernet and so raw sockets + will be used. The warning is shown only once per unique device name. */ +void win32_warn_raw_sockets(const char *devname) { + static set shown_names; + + if (shown_names.find(devname) == shown_names.end()) { + error("WARNING: Using raw sockets because %s is not an ethernet device. This probably won't work on Windows.\n", devname); + shown_names.insert(devname); + } +} + /* From tcpip.cc. */ bool DnetName2PcapName(const char *dnetdev, char *pcapdev, int pcapdevlen); Index: scan_engine.cc =================================================================== --- scan_engine.cc (revision 11131) +++ scan_engine.cc (working copy) @@ -1525,6 +1525,9 @@ rawsd = -1; } else { /* Initialize a raw socket */ +#ifdef WIN32 + win32_warn_raw_sockets(Targets[0]->deviceName()); +#endif if ((rawsd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0 ) pfatal("socket troubles in %s", __func__); /* We do not wan't to unblock the socket since we want to wait Index: traceroute.cc =================================================================== --- traceroute.cc (revision 11131) +++ traceroute.cc (working copy) @@ -216,6 +216,9 @@ if (ethsd == NULL) fatal ("dnet: Failed to open device %s", device_name); } else { +#ifdef WIN32 + win32_warn_raw_sockets(device_name); +#endif if ((fd = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) pfatal ("Traceroute: socket troubles"); broadcast_socket (fd);