Don't use the unknown tcp process anymore
This commit is contained in:
65
process.cpp
65
process.cpp
@@ -124,53 +124,6 @@ Process * findProcess (unsigned long inode)
|
|||||||
return findProcess (node);
|
return findProcess (node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if we have identified any previously unknown
|
|
||||||
* connections are now known
|
|
||||||
*
|
|
||||||
* When this is the case, something weird is going on.
|
|
||||||
* This function is only called in bughunt-mode
|
|
||||||
*/
|
|
||||||
void reviewUnknown ()
|
|
||||||
{
|
|
||||||
ConnList * curr_conn = unknowntcp->connections;
|
|
||||||
ConnList * previous_conn = NULL;
|
|
||||||
|
|
||||||
while (curr_conn != NULL) {
|
|
||||||
unsigned long inode = conninode[curr_conn->getVal()->refpacket->gethashstring()];
|
|
||||||
if (inode != 0)
|
|
||||||
{
|
|
||||||
Process * proc = findProcess (inode);
|
|
||||||
if (proc != unknowntcp && proc != NULL)
|
|
||||||
{
|
|
||||||
if (DEBUG || bughuntmode)
|
|
||||||
std::cout << "FIXME: Previously unknown inode " << inode << " now got process - apparently it makes sense to review unknown connections\n";
|
|
||||||
/* Yay! - but how can this happen? */
|
|
||||||
assert(false);
|
|
||||||
|
|
||||||
/* TODO: this needs some investigation/refactoring - we should never get here due to assert(false) */
|
|
||||||
|
|
||||||
if (previous_conn != NULL)
|
|
||||||
{
|
|
||||||
previous_conn->setNext (curr_conn->getNext());
|
|
||||||
proc->connections = new ConnList (curr_conn->getVal(), proc->connections);
|
|
||||||
delete curr_conn;
|
|
||||||
curr_conn = previous_conn;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unknowntcp->connections = curr_conn->getNext();
|
|
||||||
proc->connections = new ConnList (curr_conn->getVal(), proc->connections);
|
|
||||||
delete curr_conn;
|
|
||||||
curr_conn = unknowntcp->connections;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
previous_conn = curr_conn;
|
|
||||||
if (curr_conn != NULL)
|
|
||||||
curr_conn = curr_conn->getNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int ProcList::size ()
|
int ProcList::size ()
|
||||||
{
|
{
|
||||||
int i=1;
|
int i=1;
|
||||||
@@ -193,7 +146,7 @@ void check_all_procs ()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* returns the process from proclist with matching pid
|
* returns the process from proclist with matching pid
|
||||||
* if the inode is not associated with any PID, return the unknown process
|
* if the inode is not associated with any PID, return NULL
|
||||||
* if the process is not yet in the proclist, add it
|
* if the process is not yet in the proclist, add it
|
||||||
*/
|
*/
|
||||||
Process * getProcess (unsigned long inode, const char * devicename)
|
Process * getProcess (unsigned long inode, const char * devicename)
|
||||||
@@ -204,7 +157,7 @@ Process * getProcess (unsigned long inode, const char * devicename)
|
|||||||
{
|
{
|
||||||
if (DEBUG || bughuntmode)
|
if (DEBUG || bughuntmode)
|
||||||
std::cout << "No PID information for inode " << inode << std::endl;
|
std::cout << "No PID information for inode " << inode << std::endl;
|
||||||
return unknowntcp;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Process * proc = findProcess (node);
|
Process * proc = findProcess (node);
|
||||||
@@ -212,8 +165,7 @@ Process * getProcess (unsigned long inode, const char * devicename)
|
|||||||
if (proc != NULL)
|
if (proc != NULL)
|
||||||
return proc;
|
return proc;
|
||||||
|
|
||||||
Process * newproc = new Process (inode, devicename);
|
Process * newproc = new Process (inode, devicename, node->name);
|
||||||
newproc->name = strdup(node->name);
|
|
||||||
newproc->pid = node->pid;
|
newproc->pid = node->pid;
|
||||||
|
|
||||||
char procdir [100];
|
char procdir [100];
|
||||||
@@ -319,14 +271,13 @@ Process * getProcess (Connection * connection, const char * devicename)
|
|||||||
std::cout << " inode # " << inode << std::endl;
|
std::cout << " inode # " << inode << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Process * proc;
|
Process * proc = NULL;
|
||||||
if (inode == 0) {
|
if (inode != 0)
|
||||||
|
proc = getProcess(inode, devicename);
|
||||||
|
|
||||||
|
if (proc == NULL) {
|
||||||
proc = new Process (0, "", connection->refpacket->gethashstring());
|
proc = new Process (0, "", connection->refpacket->gethashstring());
|
||||||
processes = new ProcList (proc, processes);
|
processes = new ProcList (proc, processes);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
proc = getProcess(inode, devicename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc->connections = new ConnList (connection, proc->connections);
|
proc->connections = new ConnList (connection, proc->connections);
|
||||||
|
|||||||
Reference in New Issue
Block a user