From 45a43078f0580c11e24ba34ea82518e5d4445967 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Love=20H=C3=B6rnquist-=C3=85strand?= Date: Wed, 19 Feb 2003 02:21:35 +0000 Subject: [PATCH] viced-fix-port-logging-20030218 FIXES 1307 put port in correct byte order when logging --- src/viced/afsfileprocs.c | 6 ++++-- src/viced/callback.c | 18 +++++++++--------- src/viced/host.c | 39 +++++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 076cc75ac..31e423fb9 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -349,11 +349,13 @@ retry: afs_inet_ntoa_r(thost->host, hoststr))); if ( MultiProbeAlternateAddress_r (thost) ) { ViceLog(0, ("MultiProbe failed to find new address for host %s:%d\n", - afs_inet_ntoa_r(thost->host, hoststr), thost->port)); + afs_inet_ntoa_r(thost->host, hoststr), + ntohs(thost->port))); code = -1; } else { ViceLog(0, ("MultiProbe found new address for host %s:%d\n", - afs_inet_ntoa_r(thost->host, hoststr), thost->port)); + afs_inet_ntoa_r(thost->host, hoststr), + ntohs(thost->port))); if (BreakDelayedCallBacks_r(thost)) { ViceLog(0,("BreakDelayedCallbacks FAILED AGAIN for host %s which IS UP. Possible network or routing failure.\n", afs_inet_ntoa_r(thost->host, hoststr))); diff --git a/src/viced/callback.c b/src/viced/callback.c index 35aba9e0f..6dfc0bdc4 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -796,7 +796,7 @@ static void MultiBreakCallBack_r(struct cbstruct cba[], int ncbas, ViceLog(7, ("BCB: Failed on file %u.%d.%d, host %s:%d is down\n", afidp->AFSCBFids_val->Volume, afidp->AFSCBFids_val->Vnode, - afidp->AFSCBFids_val->Unique, afs_inet_ntoa_r(hp->host,hoststr), hp->port)); + afidp->AFSCBFids_val->Unique, afs_inet_ntoa_r(hp->host,hoststr), ntohs(hp->port))); } H_LOCK @@ -848,7 +848,7 @@ int BreakCallBack(struct host *xhost, AFSFid *fid, int flag) char hoststr[16]; ViceLog(7,("BCB: BreakCallBack(all but %s:%d, (%u,%d,%d))\n", - afs_inet_ntoa_r(xhost->host,hoststr), xhost->port, fid->Volume, fid->Vnode, + afs_inet_ntoa_r(xhost->host,hoststr), ntohs(xhost->port), fid->Volume, fid->Vnode, fid->Unique)); H_LOCK @@ -879,7 +879,7 @@ int BreakCallBack(struct host *xhost, AFSFid *fid, int flag) } else if (thishost->hostFlags & VENUSDOWN) { ViceLog(7,("BCB: %s:%d is down; delaying break call back\n", - afs_inet_ntoa_r(thishost->host,hoststr), thishost->port)); + afs_inet_ntoa_r(thishost->host,hoststr), ntohs(thishost->port))); cb->status = CB_DELAYED; } else { @@ -938,7 +938,7 @@ int DeleteCallBack(struct host *host, AFSFid *fid) pcb = FindCBPtr(fe, host); if (!*pcb) { ViceLog(8,("DCB: No call back for host %s:%d, (%u, %d, %d)\n", - afs_inet_ntoa_r(host->host,hoststr), host->port, fid->Volume, fid->Vnode, fid->Unique)); + afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port), fid->Volume, fid->Vnode, fid->Unique)); h_Unlock_r(host); H_UNLOCK return 0; @@ -1050,7 +1050,7 @@ int BreakDelayedCallBacks_r(struct host *host) if (ShowProblems) { ViceLog(0, ("CB: Call back connect back failed (in break delayed) for %s:%d\n", - afs_inet_ntoa_r(host->host,hoststr), host->port)); + afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port))); } host->hostFlags |= VENUSDOWN; } @@ -1095,13 +1095,13 @@ int BreakDelayedCallBacks_r(struct host *host) if (ShowProblems) { ViceLog(0, ("CB: XCallBackBulk failed, host=%s:%d; callback list follows:\n", - afs_inet_ntoa_r(host->host,hoststr), host->port)); + afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port))); } for (i = 0; ihost,hoststr), host->port, + afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port), fids[i].Volume, fids[i].Vnode, fids[i].Unique)); } /* used to do this: @@ -1146,10 +1146,10 @@ static int MultiBreakVolumeCallBack_r(struct host *host, return 0; /* Release hold */ } ViceLog(8,("BVCB: volume call back for host %s:%d failed\n", - afs_inet_ntoa_r(host->host,hoststr),host->port)); + afs_inet_ntoa_r(host->host,hoststr),ntohs(host->port))); if (ShowProblems) { ViceLog(0, ("CB: volume callback for host %s:%d failed\n", - afs_inet_ntoa_r(host->host,hoststr), host->port)); + afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port))); } DeleteAllCallBacks_r(host, deletefe); /* Delete all callback state rather than attempting to diff --git a/src/viced/host.c b/src/viced/host.c index 37bd8c48d..44621cfbb 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -556,7 +556,7 @@ struct host *h_Alloc_r(register struct rx_connection *r_con) if (serverentry) consolePort = serverentry->s_port; else - consolePort = DEF_ROPCONS; /* Use a default */ + consolePort = htons(DEF_ROPCONS); /* Use a default */ } if (host->port == consolePort) host->Console = 1; /* Make a callback channel even for the console, on the off chance that it @@ -692,7 +692,7 @@ int h_TossStuff_r(register struct host *host) if (h_NBLock_r(host) != 0) { char hoststr[16]; ViceLog(0, ("Warning: h_TossStuff_r failed; Host %s:%d was locked.\n", - afs_inet_ntoa_r(host->host, hoststr), host->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); return; } else { h_Unlock_r(host); @@ -704,8 +704,8 @@ int h_TossStuff_r(register struct host *host) if (client->refCount) { char hoststr[16]; ViceLog(0, ("Warning: Host %s:%d client %x refcount %d while deleting.\n", - afs_inet_ntoa_r(host->host, hoststr), host->port, - client, client->refCount)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), + client, client->refCount)); } if ((client->ViceId != ANONYMOUSID) && client->CPS.prlist_val) { free(client->CPS.prlist_val); @@ -949,7 +949,7 @@ retry: h_Unlock_r(host); if ( !held) h_Release_r(host); ViceLog(125, ("Host %s:%d starting h_Lookup again\n", - afs_inet_ntoa_r(host->host, hoststr), host->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); goto retry; } host->hostFlags &= ~ALTADDR; @@ -971,7 +971,7 @@ retry: if (host->interface) { ViceLog(0, ("Host %s:%d used to support WhoAreYou, deleting.\n", - afs_inet_ntoa_r(host->host, hoststr), host->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); host->hostFlags |= HOSTDELETED; h_Unlock_r(host); if (!held) h_Release_r(host); @@ -1015,12 +1015,12 @@ retry: { /* another thread is doing the initialisation */ ViceLog(125, ("Host %s:%d waiting for host-init to complete\n", - afs_inet_ntoa_r(host->host, hoststr), host->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); h_Lock_r(host); h_Unlock_r(host); if ( !held) h_Release_r(host); ViceLog(125, ("Host %s:%d starting h_Lookup again\n", - afs_inet_ntoa_r(host->host, hoststr), host->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); goto retry; } /* We need to check whether the identity in the host structure @@ -1039,7 +1039,7 @@ retry: afsUUID_to_string(host->interface->uuid, uuid2, 127); ViceLog(0, ("CB: new identity for host %s:%d, deleting(%x %x %s %s)\n", - afs_inet_ntoa_r(host->host, hoststr), host->port, + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), identP->valid, host->interface, identP->valid ? uuid1 : "", host->interface ? uuid2 : "")); @@ -1067,7 +1067,7 @@ retry: rx_SetSpecific(tcon, rxcon_ident_key, identP); ViceLog(25, ("Host %s:%d does not support WhoAreYou.\n", - afs_inet_ntoa_r(host->host, hoststr), host->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); code = 0; } else if (code == 0) { interfValid = 1; @@ -1080,7 +1080,7 @@ retry: identP->uuid = interf.uuid; rx_SetSpecific(tcon, rxcon_ident_key, identP); ViceLog(25, ("WhoAreYou success on %s:%d\n", - afs_inet_ntoa_r(host->host, hoststr), host->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); } } if (code == 0 && !identP->valid) { @@ -1097,8 +1097,8 @@ retry: h_Hold_r(oldHost); h_Lock_r(oldHost); ViceLog(25, ("CB: new addr %s:%d for old host %s:%d\n", - afs_inet_ntoa_r(host->host, hoststr), host->port, - afs_inet_ntoa_r(oldHost->host, hoststr2), oldHost->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), + afs_inet_ntoa_r(oldHost->host, hoststr2), ntohs(oldHost->port))); host->hostFlags |= HOSTDELETED; h_Unlock_r(host); h_Release_r(host); @@ -1113,7 +1113,7 @@ retry: H_LOCK if (code == 0) { ViceLog(25, ("InitCallBackState3 success on %s:%d\n", - afs_inet_ntoa_r(host->host, hoststr), host->port)); + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); assert(interfValid == 1); initInterfaceAddr_r(host, &interf); } @@ -1415,7 +1415,7 @@ ticket name length != 64 ViceLog(0, ("pr_GetCPS failed(%d) for user %d, host %s:%d\n", code, viceid, afs_inet_ntoa_r(client->host->host, hoststr), - client->host->port)); + ntohs(client->host->port))); /* Although ubik_Call (called by pr_GetCPS) traverses thru * all protection servers and reevaluates things if no @@ -1496,7 +1496,7 @@ int GetClient(struct rx_connection * tcon, struct client **cp) ViceLog(1, ("Token for %s at %s:%d expired %d\n", h_UserName(client), afs_inet_ntoa_r(client->host->host, hoststr), - client->host->port, client->expTime)); + ntohs(client->host->port), client->expTime)); H_UNLOCK return VICETOKENDEAD; } @@ -1560,7 +1560,7 @@ h_PrintClient(register struct host *host, int held, StreamHandle_t *file) return held; } sprintf(tmpStr,"Host %s:%d down = %d, LastCall %s", - afs_inet_ntoa_r(host->host, hoststr), host->port, + afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), (host->hostFlags & VENUSDOWN), afs_ctime((time_t *)&host->LastCall, tbuffer, sizeof(tbuffer))); STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file); @@ -1635,7 +1635,7 @@ h_DumpHost(register struct host *host, int held, StreamHandle_t *file) H_LOCK sprintf(tmpStr, "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [", - host->host, host->port, host->index, host->cblist, + host->host, ntohs(host->port), host->index, host->cblist, CheckLock(&host->lock), host->LastCall, host->ActiveCall, (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED, host->Console, host->hostFlags & CLIENTDELETED, @@ -2038,7 +2038,7 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf) { int i, j; int number, count; - afs_int32 myPort, myHost; + afs_int32 myHost; int found; struct Interface *interface; @@ -2049,7 +2049,6 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf) host->host, interf->numberOfInterfaces)); number = interf->numberOfInterfaces; - myPort = host->port; myHost = host->host; /* current interface address */ /* validation checks */ -- 2.39.5