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

@@ -31,7 +31,7 @@ char * stripspaces (char * input)
* uses ioctl to get address of this device, and adds it to the
* local_addrs-list.
*/
void getLocal (const char *device)
void getLocal (const char *device, bool tracemode)
{
/* get local IPv4 addresses */
int sock;
@@ -48,6 +48,10 @@ void getLocal (const char *device)
saddr=(struct sockaddr_in*)&iFreq.ifr_addr;
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 */
FILE * ifinfo = fopen ("/proc/net/if_inet6", "r");
char buffer [500];