#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
#ifdef AFS_AIX32_ENV
#include <signal.h>
#endif
#include <lock.h>
#include <afs/afs_args.h>
-extern struct rx_securityClass *rxnull_NewServerSecurityObject();
extern struct hostent *hostutil_GetHostByName();
static PrintCacheConfig(aconn)
int code;
c.cacheConfig_len = 0;
+ c.cacheConfig_val = NULL;
code = RXAFSCB_GetCacheConfig(aconn, 1, &srv_ver, &conflen, &c);
if (code) {
printf("cmdebug: error checking cache config: %s\n",
printf("Host interfaces:\n");
for (i=0; i<addr.numberOfInterfaces; i++) {
- printf("%s", inet_ntoa(&addr.addr_in[i]));
+ printf("%s", afs_inet_ntoa(htonl(addr.addr_in[i])));
if (addr.subnetmask[i])
- printf(", netmask %s", inet_ntoa(&addr.subnetmask[i]));
+ printf(", netmask %s", afs_inet_ntoa(htonl(addr.subnetmask[i])));
if (addr.mtu[i])
printf(", MTU %d", addr.mtu[i]);
printf("\n");
return 0;
}
-static PrintCacheEntries(aconn, aint32)
-int aint32;
-register struct rx_connection *aconn; {
+struct cell_cache {
+ afs_int32 cellnum;
+ char *cellname;
+ struct cell_cache *next;
+};
+
+static char *GetCellName(struct rx_connection *aconn, afs_int32 cellnum)
+{
+ static int no_getcellbynum;
+ static struct cell_cache *cache;
+ struct cell_cache *tcp;
+ int code;
+ char *cellname;
+ serverList sl;
+
+ if (no_getcellbynum)
+ return NULL;
+
+ for (tcp = cache; tcp; tcp = tcp->next)
+ if (tcp->cellnum == cellnum)
+ return tcp->cellname;
+
+ cellname = NULL;
+ sl.serverList_len = 0;
+ sl.serverList_val = NULL;
+ code = RXAFSCB_GetCellByNum(aconn, cellnum, &cellname, &sl);
+ if (code) {
+ if (code == RXGEN_OPCODE)
+ no_getcellbynum = 1;
+ return NULL;
+ }
+
+ if (sl.serverList_val)
+ free (sl.serverList_val);
+ tcp = malloc(sizeof(struct cell_cache));
+ tcp->next = cache;
+ tcp->cellnum = cellnum;
+ tcp->cellname = cellname;
+ cache = tcp;
+
+ return cellname;
+}
+
+static PrintCacheEntries(struct rx_connection *aconn, int aint32)
+{
register int i;
register afs_int32 code;
struct AFSDBCacheEntry centry;
+ char *cellname;
for(i=0;i<10000;i++) {
code = RXAFSCB_GetCE(aconn, i, ¢ry);
if (!aint32 && !IsLocked(¢ry.lock)) continue;
/* otherwise print this entry */
- printf("** Cache entry @ 0x%08x for %d.%d.%d.%d\n", centry.addr, centry.cell,
- centry.netFid.Volume, centry.netFid.Vnode, centry.netFid.Unique);
+ printf("** Cache entry @ 0x%08x for %d.%d.%d.%d", centry.addr,
+ centry.cell, centry.netFid.Volume, centry.netFid.Vnode,
+ centry.netFid.Unique);
+
+ cellname = GetCellName(aconn, centry.cell);
+ if (cellname)
+ printf(" [%s]\n", cellname);
+ else
+ printf("\n");
+
if (IsLocked(¢ry.lock)) {
printf(" locks: ");
PrintLock(¢ry.lock);
#endif
rx_Init(0);
- ts = cmd_CreateSyntax((char *) 0, CommandProc, 0, "probe unik server");
+ ts = cmd_CreateSyntax(NULL, CommandProc, 0, "probe unik server");
cmd_AddParm(ts, "-servers", CMD_SINGLE, CMD_REQUIRED, "server machine");
cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port");
cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "print all info");