From ca72f01c513e288af5ebb35946064a248a871476 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Love=20H=C3=B6rnquist-=C3=85strand?= Date: Wed, 19 Feb 2003 02:37:36 +0000 Subject: [PATCH] STABLE12-viced-fix-port-logging-20030218 FIXES 1307 put port in correct byte order when logging (cherry picked from commit 45a43078f0580c11e24ba34ea82518e5d4445967) --- src/viced/afsfileprocs.c | 10 ++++++---- src/viced/callback.c | 18 +++++++++--------- src/viced/host.c | 33 ++++++++++++++++----------------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index e35f22a2d..4d4e0fcb7 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -320,11 +320,13 @@ retry: ViceLog(0,("BreakDelayedCallbacks FAILED for host %08x which IS UP. Possible network or routing failure.\n",thost->host)); if ( MultiProbeAlternateAddress_r (thost) ) { ViceLog(0, ("MultiProbe failed to find new address for host %x.%d\n", - thost->host, thost->port)); - code = -1; + afs_inet_ntoa_r(thost->host, hoststr), + ntohs(thost->port))); + code = -1; } else { - ViceLog(0, ("MultiProbe found new address for host %x.%d\n", - thost->host, thost->port)); + ViceLog(0, ("MultiProbe found new address for host %s:%d\n", + afs_inet_ntoa_r(thost->host, hoststr), + ntohs(thost->port))); if (BreakDelayedCallBacks_r(thost)) { ViceLog(0,("BreakDelayedCallbacks FAILED AGAIN for host %08x which IS UP. Possible network or routing failure.\n",thost->host)); code = -1; diff --git a/src/viced/callback.c b/src/viced/callback.c index 76c44bbb5..a49709165 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -819,7 +819,7 @@ static void MultiBreakCallBack_r(cba, ncbas, afidp, xhost) ViceLog(7, ("BCB: Failed on file %u.%d.%d, host %x.%d is down\n", afidp->AFSCBFids_val->Volume, afidp->AFSCBFids_val->Vnode, - afidp->AFSCBFids_val->Unique, hp->host, hp->port)); + afidp->AFSCBFids_val->Unique, hp->host, ntohs(hp->port))); } H_LOCK @@ -872,7 +872,7 @@ BreakCallBack(xhost, fid, flag) int hostindex; ViceLog(7,("BCB: BreakCallBack(all but %x.%d, (%u,%d,%d))\n", - xhost->host, xhost->port, fid->Volume, fid->Vnode, + xhost->host, ntohs(xhost->port), fid->Volume, fid->Vnode, fid->Unique)); H_LOCK @@ -903,7 +903,7 @@ BreakCallBack(xhost, fid, flag) } else if (thishost->hostFlags & VENUSDOWN) { ViceLog(7,("BCB: %x.%d is down; delaying break call back\n", - thishost->host, thishost->port)); + thishost->host, ntohs(thishost->port))); cb->status = CB_DELAYED; } else { @@ -964,7 +964,7 @@ DeleteCallBack(host, fid) pcb = FindCBPtr(fe, host); if (!*pcb) { ViceLog(8,("DCB: No call back for host %x.%d, (%u, %d, %d)\n", - host->host, host->port, fid->Volume, fid->Vnode, fid->Unique)); + host->host, ntohs(host->port), fid->Volume, fid->Vnode, fid->Unique)); h_Unlock_r(host); H_UNLOCK return; @@ -1094,7 +1094,7 @@ int BreakDelayedCallBacks_r(host) if (ShowProblems) { ViceLog(0, ("CB: Call back connect back failed (in break delayed) for %x.%d\n", - host->host, host->port)); + host->host, ntohs(host->port))); } host->hostFlags |= VENUSDOWN; } @@ -1139,13 +1139,13 @@ int BreakDelayedCallBacks_r(host) if (ShowProblems) { ViceLog(0, ("CB: XCallBackBulk failed, host=%x.%d; callback list follows:\n", - host->host, host->port)); + host->host, ntohs(host->port))); } for (i = 0; ihost, host->port, + host->host, ntohs(host->port), fids[i].Volume, fids[i].Vnode, fids[i].Unique)); } /* used to do this: @@ -1196,10 +1196,10 @@ static int MultiBreakVolumeCallBack_r (host, isheld, parms) return 0; /* Release hold */ } ViceLog(8,("BVCB: volume call back for host %x.%d failed\n", - host->host,host->port)); + host->host,ntohs(host->port))); if (ShowProblems) { ViceLog(0, ("CB: volume callback for host %x.%d failed\n", - host->host, host->port)); + host->host, ntohs(host->port))); } DeleteAllCallBacks_r(host); /* Delete all callback state rather than attempting to selectively remember to diff --git a/src/viced/host.c b/src/viced/host.c index 8d3a79781..18f5e5b7e 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -600,7 +600,7 @@ struct host *h_Alloc_r(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 @@ -982,7 +982,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; @@ -1000,7 +1000,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); @@ -1040,12 +1040,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 @@ -1064,7 +1064,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 : "")); @@ -1088,7 +1088,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; @@ -1097,7 +1097,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) { @@ -1114,8 +1114,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); @@ -1130,7 +1130,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); } @@ -1423,7 +1423,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 @@ -1507,7 +1507,7 @@ int GetClient(tcon, 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; } @@ -1572,7 +1572,7 @@ static int h_PrintClient(host, held, 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); @@ -1651,7 +1651,7 @@ static int h_DumpHost(host, held, 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, @@ -2074,7 +2074,7 @@ struct interfaceAddr *interf; { int i, j; int number, count; - afs_int32 myPort, myHost; + afs_int32 myHost; int found; struct Interface *interface; @@ -2085,7 +2085,6 @@ struct interfaceAddr *interf; host->host, interf->numberOfInterfaces)); number = interf->numberOfInterfaces; - myPort = host->port; myHost = host->host; /* current interface address */ /* validation checks */ -- 2.39.5