mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 21:47:45 +00:00
STABLE14-viced-unspecified-host-hash-port-20060313
h_Alloc_r was not specifying the port for the newly allocated host when adding the host to the hash table. Use hashInsert_r instead so mistakes like this won't happen in the future. (cherry picked from commit a8b82b1a744859a3ce2796fd17f997e0bdd2b570)
This commit is contained in:
parent
7d4e522638
commit
8f3883282a
@ -450,7 +450,7 @@ h_gethostcps_r(register struct host *host, register afs_int32 now)
|
||||
slept ? (host->cpsCall = FT_ApproxTime()) : (host->cpsCall = now);
|
||||
|
||||
H_UNLOCK;
|
||||
code = pr_GetHostCPS(htonl(host->host), &host->hcps);
|
||||
code = pr_GetHostCPS(ntohl(host->host), &host->hcps);
|
||||
H_LOCK;
|
||||
if (code) {
|
||||
/*
|
||||
@ -504,7 +504,7 @@ h_gethostcps_r(register struct host *host, register afs_int32 now)
|
||||
|
||||
/* args in net byte order */
|
||||
void
|
||||
h_flushhostcps(register afs_uint32 hostaddr, register afs_uint32 hport)
|
||||
h_flushhostcps(register afs_uint32 hostaddr, register afs_uint16 hport)
|
||||
{
|
||||
register struct host *host;
|
||||
int held = 0;
|
||||
@ -531,29 +531,20 @@ struct host *
|
||||
h_Alloc_r(register struct rx_connection *r_con)
|
||||
{
|
||||
struct servent *serverentry;
|
||||
register index = h_HashIndex(rxr_HostOf(r_con));
|
||||
register struct host *host;
|
||||
static struct rx_securityClass *sc = 0;
|
||||
afs_int32 now;
|
||||
struct h_hashChain *h_hashChain;
|
||||
#if FS_STATS_DETAILED
|
||||
afs_uint32 newHostAddr_HBO; /*New host IP addr, in host byte order */
|
||||
#endif /* FS_STATS_DETAILED */
|
||||
|
||||
host = GetHT();
|
||||
|
||||
h_hashChain = (struct h_hashChain *)malloc(sizeof(struct h_hashChain));
|
||||
if (!h_hashChain) {
|
||||
ViceLog(0, ("Failed malloc in h_Alloc_r\n"));
|
||||
assert(0);
|
||||
}
|
||||
h_hashChain->hostPtr = host;
|
||||
h_hashChain->addr = rxr_HostOf(r_con);
|
||||
h_hashChain->next = hostHashTable[index];
|
||||
hostHashTable[index] = h_hashChain;
|
||||
|
||||
host->host = rxr_HostOf(r_con);
|
||||
host->port = rxr_PortOf(r_con);
|
||||
|
||||
hashInsert_r(host->host, host->port, host);
|
||||
|
||||
if (consolePort == 0) { /* find the portal number for console */
|
||||
#if defined(AFS_OSF_ENV)
|
||||
serverentry = getservbyname("ropcons", "");
|
||||
@ -609,7 +600,7 @@ h_Alloc_r(register struct rx_connection *r_con)
|
||||
/* Note: host should be released by caller if 0 == *heldp and non-null */
|
||||
/* hostaddr and hport are in network order */
|
||||
struct host *
|
||||
h_Lookup_r(afs_uint32 haddr, afs_uint32 hport, int *heldp)
|
||||
h_Lookup_r(afs_uint32 haddr, afs_uint16 hport, int *heldp)
|
||||
{
|
||||
register afs_int32 now;
|
||||
register struct host *host = 0;
|
||||
|
@ -200,8 +200,10 @@ extern int h_Lock_r(register struct host *host);
|
||||
extern int DeleteAllCallBacks_r(struct host *host, int deletefe);
|
||||
extern struct host *h_Alloc(register struct rx_connection *r_con);
|
||||
extern struct host *h_Alloc_r(register struct rx_connection *r_con);
|
||||
extern struct host *h_Lookup_r(afs_uint32 hostaddr, afs_uint32 hport,
|
||||
extern struct host *h_Lookup_r(afs_uint32 hostaddr, afs_uint16 hport,
|
||||
int *heldp);
|
||||
extern void hashInsert_r(afs_uint32 addr, afs_uint16 port,
|
||||
struct host* host);
|
||||
extern struct host *h_LookupUuid_r(afsUUID * uuidp);
|
||||
extern int h_FreeConnection(struct rx_connection *tcon);
|
||||
extern void h_Enumerate(int (*proc) (), char *param);
|
||||
@ -215,7 +217,7 @@ extern void h_PrintStats();
|
||||
extern void h_PrintClients();
|
||||
extern void h_GetWorkStats();
|
||||
extern void h_flushhostcps(register afs_uint32 hostaddr,
|
||||
register afs_uint32 hport);
|
||||
register afs_uint16 hport);
|
||||
struct Interface *MultiVerifyInterface_r();
|
||||
|
||||
struct host *(hosttableptrs[h_MAXHOSTTABLES]); /* Used by h_itoh */
|
||||
|
Loading…
x
Reference in New Issue
Block a user