mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
Factor out an nmap_raw_socket function.
This does the common setup of a raw socket that we use everywhere.
This commit is contained in:
parent
19d1115ef1
commit
a53e00afa1
8 changed files with 31 additions and 53 deletions
10
FPEngine.cc
10
FPEngine.cc
|
|
@ -184,17 +184,9 @@ void FPNetworkControl::init(const char *ifname, devtype iftype) {
|
|||
fatal("dnet: failed to open device %s", ifname);
|
||||
this->rawsd = -1;
|
||||
} else {
|
||||
#ifdef WIN32
|
||||
win32_fatal_raw_sockets(ifname);
|
||||
#endif
|
||||
if (this->rawsd >= 0)
|
||||
close(this->rawsd);
|
||||
if ((this->rawsd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
|
||||
pfatal("Couldn't obtain raw socket in %s", __func__);
|
||||
broadcast_socket(this->rawsd);
|
||||
#ifndef WIN32
|
||||
sethdrinclude(this->rawsd);
|
||||
#endif
|
||||
rawsd = nmap_raw_socket(ifname);
|
||||
}
|
||||
|
||||
/* De-register existing callers */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue