Merge pull request #60 from raboof/diagnostics
Add diagnostic logging reading /proc/net/tcp
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern local_addr *local_addrs;
|
extern local_addr *local_addrs;
|
||||||
|
extern bool bughuntmode;
|
||||||
/*
|
/*
|
||||||
* connection-inode table. takes information from /proc/net/tcp.
|
* connection-inode table. takes information from /proc/net/tcp.
|
||||||
* key contains source ip, source port, destination ip, destination
|
* 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_local;
|
||||||
struct in6_addr in6_remote;
|
struct in6_addr in6_remote;
|
||||||
|
|
||||||
// this leaked memory
|
if (bughuntmode) {
|
||||||
// unsigned long * inode = (unsigned long *) malloc (sizeof(unsigned long));
|
std::cout << "ci: " << buffer;
|
||||||
|
}
|
||||||
unsigned long inode;
|
unsigned long inode;
|
||||||
|
|
||||||
int matches = sscanf(buffer, "%*d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %*X "
|
int matches = sscanf(buffer, "%*d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %*X "
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "conninode.cpp"
|
#include "conninode.cpp"
|
||||||
|
|
||||||
local_addr *local_addrs = NULL;
|
local_addr *local_addrs = NULL;
|
||||||
|
bool bughuntmode = false;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
if (!addprocinfo("testfiles/proc_net_tcp")) {
|
if (!addprocinfo("testfiles/proc_net_tcp")) {
|
||||||
|
|||||||
@@ -278,7 +278,8 @@ Process *getProcess(Connection *connection, const char *devicename) {
|
|||||||
// no? refresh and check conn/inode table
|
// no? refresh and check conn/inode table
|
||||||
if (bughuntmode) {
|
if (bughuntmode) {
|
||||||
std::cout << "? new connection not in connection-to-inode table before "
|
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
|
// refresh the inode->pid table first. Presumably processing the renewed
|
||||||
// connection->inode table
|
// connection->inode table
|
||||||
|
|||||||
Reference in New Issue
Block a user