Add diagnostic logging reading /proc/net/tcp

This commit is contained in:
Arnout Engelen
2016-03-27 22:14:17 +02:00
parent 286a1a8ad2
commit f5692feb9e
2 changed files with 6 additions and 3 deletions

View File

@@ -35,6 +35,7 @@
#endif
extern local_addr *local_addrs;
extern bool bughuntmode;
/*
* connection-inode table. takes information from /proc/net/tcp.
* key contains source ip, source port, destination ip, destination
@@ -67,8 +68,9 @@ void addtoconninode(char *buffer) {
struct in6_addr in6_local;
struct in6_addr in6_remote;
// this leaked memory
// unsigned long * inode = (unsigned long *) malloc (sizeof(unsigned long));
if (bughuntmode) {
std::cout << "ci: " << buffer;
}
unsigned long inode;
int matches = sscanf(buffer, "%*d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %*X "

View File

@@ -278,7 +278,8 @@ Process *getProcess(Connection *connection, const char *devicename) {
// no? refresh and check conn/inode table
if (bughuntmode) {
std::cout << "? new connection not in connection-to-inode table before "
"refresh.\n";
"refresh, hash " << connection->refpacket->gethashstring()
<< std::endl;
}
// refresh the inode->pid table first. Presumably processing the renewed
// connection->inode table