return (char *) inet_ntoa(temp);
}
+/* same as above, but to a non-static buffer, must be freed by called */
+char* afs_inet_ntoa_r(afs_uint32 addr)
+{
+ char *buf;
+ int temp;
+
+ temp = ntohl(addr);
+ buf = (char *) malloc(16); /* length of xxx.xxx.xxx.xxx\0 */
+ buf[15] = 0;
+
+ sprintf(buf, "%d.%d.%d.%d",
+ (temp >> 24 ) & 0xff,
+ (temp >> 16 ) & 0xff,
+ (temp >> 8 ) & 0xff,
+ (temp ) & 0xff);
+ return buf;
+}
+
/*
* gettmpdir() -- Returns pointer to global temporary directory string.
* Always succeeds. Never attempt to deallocate directory string.
goto retry;
}
} else {
- ViceLog(0,("CB: WhoAreYou failed for %x.%d, error %d\n",
- host->host, host->port, code));
+ char *hoststr = afs_inet_ntoa_r(host->host);
+ ViceLog(0,("CB: WhoAreYou failed for %s:%d, error %d\n",
+ hoststr, ntohs(host->port), code));
host->hostFlags |= VENUSDOWN;
+ free(hoststr);
}
host->hostFlags |= ALTADDR;
h_Unlock_r(host);
}
}
if (code) {
- ViceLog(0,("CB: RCallBackConnectBack failed for %x.%d\n",
- host->host, host->port));
+ char *hoststr = afs_inet_ntoa_r(host->host);
+ ViceLog(0,("CB: RCallBackConnectBack failed for %s:%d\n",
+ hoststr, ntohs(host->port)));
host->hostFlags |= VENUSDOWN;
+ free(hoststr);
}
else
host->hostFlags |= RESETDONE;
host->hostFlags |= ALTADDR; /* alternate addresses valid */
if ( code )
{
+ char *hoststr = afs_inet_ntoa_r(host->host);
ViceLog(0,
- ("CB: RCallBackConnectBack (host.c) failed for host %x.%d\n",
- host->host, host->port));
+ ("CB: RCallBackConnectBack (host.c) failed for host %s:%d\n",
+ hoststr, ntohs(host->port)));
host->hostFlags |= VENUSDOWN;
+ free(hoststr);
}
/* Note: it's safe to delete hosts even if they have call
* back state, because break delayed callbacks (called when a
H_LOCK
if(code) {
if ( MultiProbeAlternateAddress_r(host) ) {
+ char *hoststr = afs_inet_ntoa_r(host->host);
ViceLog(0,
- ("ProbeUuid failed for host %x.%d\n",
- host->host, host->port));
+ ("ProbeUuid failed for host %s:%d\n",
+ hoststr, ntohs(host->port)));
host->hostFlags |= VENUSDOWN;
+ free(hoststr);
}
}
} else {
code = RXAFSCB_Probe(host->callback_rxcon);
H_LOCK
if (code) {
- ViceLog(0, ("ProbeUuid failed for host %x.%d\n",
- host->host, host->port));
+ char *hoststr = afs_inet_ntoa_r(host->host);
+ ViceLog(0, ("ProbeUuid failed for host %s:%d\n",
+ hoststr, ntohs(host->port)));
host->hostFlags |= VENUSDOWN;
+ free(hoststr);
}
}
}
ViceLog(0, ("Can't find address for FileServer '%s'\n", FS_HostName));
}
else {
+ char *hoststr;
bcopy(he->h_addr, &FS_HostAddr_NBO, 4);
+ hoststr = afs_inet_ntoa_r(FS_HostAddr_NBO);
FS_HostAddr_HBO = ntohl(FS_HostAddr_NBO);
- ViceLog(0,("FileServer %s has address 0x%x (0x%x in host byte order)\n",
- FS_HostName, FS_HostAddr_NBO, FS_HostAddr_HBO));
+ ViceLog(0,("FileServer %s has address %s (0x%x or 0x%x in host byte order)\n",
+ FS_HostName, hoststr, FS_HostAddr_NBO, FS_HostAddr_HBO));
+ free(hoststr);
}
/* Install handler to catch the shutdown signal */