1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00

Move win32_fatal_raw_sockets out of nmap_raw_socket.

For the same reason and with the same exception (nse_dnet.cc) as in
r30159.
This commit is contained in:
david
2012-10-31 17:00:55 +00:00
parent 03946ba2f5
commit 7b18ea1bc0
8 changed files with 24 additions and 17 deletions

View File

@@ -139,22 +139,14 @@ static PacketCounter PktCt;
/* Create a raw socket and do things that always apply to raw sockets:
* Emit a fatal error on Windows.
* Set SO_BROADCAST.
* Set IP_HDRINCL.
* Bind to an interface with SO_BINDTODEVICE (if o.device is set).
The socket is created with address family AF_INET, but may be usable for
AF_INET6, depending on the operating system.
The argument warning_device_name is used *only* in the Windows fatal error
message, and does not affect any socket characteristics. The global o.device
controls which interface to bind to with SO_BINDTODEVICE. */
int nmap_raw_socket(const char *warning_device_name) {
AF_INET6, depending on the operating system. */
int nmap_raw_socket() {
int rawsd;
#ifdef WIN32
win32_fatal_raw_sockets(warning_device_name);
#endif
rawsd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if (rawsd < 0)
return rawsd;