Call nsp_setdevice after nsp_new in our Nsock pools.

The exceptions are the calls in ncat/ncat_connect.c and
nping/EchoServer.cc. Ncat doesn't have an option for the interface, and
I think Nping's -e option is only meant to apply to probes, not to the
echo server listener.
This commit is contained in:
david 2012-10-03 15:43:18 +00:00
parent 3e9f862ce3
commit 422b43be22
5 changed files with 5 additions and 0 deletions

View file

@ -158,6 +158,7 @@ void FPNetworkControl::init(const char *ifname, devtype iftype) {
/* Create a new nsock pool */
if ((this->nsp = nsp_new(NULL)) == NULL)
fatal("Unable to obtain an Nsock pool");
nsp_setdevice(nsp, o.device);
/* Set Trace level */
if (o.packetTrace()) {

View file

@ -1210,6 +1210,7 @@ static void nmap_mass_rdns_core(Target **targets, int num_targets) {
if ((dnspool = nsp_new(NULL)) == NULL)
fatal("Unable to create nsock pool in %s()", __func__);
nsp_setdevice(dnspool, o.device);
if ((lasttrace = o.packetTrace()))
nsp_settrace(dnspool, NULL, NSOCK_TRACE_LEVEL, o.getStartTime());

View file

@ -122,6 +122,7 @@ int ProbeMode::init_nsock(){
/* Create a new nsock pool */
if ((nsp = nsp_new(NULL)) == NULL)
outFatal(QT_3, "Failed to create new pool. QUITTING.\n");
nsp_setdevice(nsp, o.getDevice());
/* Allow broadcast addresses */
nsp_setbroadcast(nsp, 1);

View file

@ -80,6 +80,7 @@ static nsock_pool new_pool (lua_State *L)
{
nsock_pool nsp = nsp_new(NULL);
nsock_pool *nspp;
nsp_setdevice(nsp, o.device);
nsp_setbroadcast(nsp, true);
nspp = (nsock_pool *) lua_newuserdata(L, sizeof(nsock_pool));
*nspp = nsp;

View file

@ -2682,6 +2682,7 @@ int service_scan(vector<Target *> &Targets) {
if ((nsp = nsp_new(SG)) == NULL) {
fatal("%s() failed to create new nsock pool.", __func__);
}
nsp_setdevice(nsp, o.device);
if (o.versionTrace()) {
nsp_settrace(nsp, NULL, NSOCK_TRACE_LEVEL, o.getStartTime());