add tracing to getLocal
This commit is contained in:
@@ -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(" ");
|
||||||
|
|||||||
@@ -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];
|
||||||
|
|||||||
2
packet.h
2
packet.h
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user