add tracing to getLocal

This commit is contained in:
Arnout Engelen
2006-02-05 17:24:19 +00:00
parent a04db4b338
commit 501a379af5
3 changed files with 7 additions and 3 deletions

View File

@@ -313,7 +313,7 @@ int main (int argc, char** argv)
handle * handles = NULL; handle * handles = NULL;
device * current_dev = devices; device * current_dev = devices;
while (current_dev != NULL) { while (current_dev != NULL) {
getLocal(current_dev->name); getLocal(current_dev->name, tracemode);
if ((!tracemode) && (!DEBUG)){ if ((!tracemode) && (!DEBUG)){
//caption->append(current_dev->name); //caption->append(current_dev->name);
//caption->append(" "); //caption->append(" ");

View File

@@ -31,7 +31,7 @@ char * stripspaces (char * input)
* uses ioctl to get address of this device, and adds it to the * uses ioctl to get address of this device, and adds it to the
* local_addrs-list. * local_addrs-list.
*/ */
void getLocal (const char *device) void getLocal (const char *device, bool tracemode)
{ {
/* get local IPv4 addresses */ /* get local IPv4 addresses */
int sock; int sock;
@@ -48,6 +48,10 @@ void getLocal (const char *device)
saddr=(struct sockaddr_in*)&iFreq.ifr_addr; saddr=(struct sockaddr_in*)&iFreq.ifr_addr;
local_addrs = new local_addr (saddr->sin_addr.s_addr, local_addrs); local_addrs = new local_addr (saddr->sin_addr.s_addr, local_addrs);
if (tracemode || DEBUG) {
printf ("Adding local address: %s\n", inet_ntoa(saddr->sin_addr));
}
/* also get local IPv6 addresses */ /* also get local IPv6 addresses */
FILE * ifinfo = fopen ("/proc/net/if_inet6", "r"); FILE * ifinfo = fopen ("/proc/net/if_inet6", "r");
char buffer [500]; char buffer [500];

View File

@@ -17,7 +17,7 @@ enum direction {
/* To initialise this module, call getLocal with the currently /* To initialise this module, call getLocal with the currently
* monitored device (e.g. "eth0:1") */ * monitored device (e.g. "eth0:1") */
void getLocal (const char *device); void getLocal (const char *device, bool tracemode);
class Packet class Packet
{ {