afs_int32
-afs_ServerDown(struct srvAddr *sa)
+afs_ServerDown(struct srvAddr *sa, int code)
{
struct server *aserver = sa->server;
afs_MarkServerUpOrDown(sa, SRVR_ISDOWN);
if (sa->sa_portal == aserver->cell->vlport)
print_internet_address
- ("afs: Lost contact with volume location server ", sa, "", 1);
+ ("afs: Lost contact with volume location server ", sa, "", 1, code);
else
print_internet_address("afs: Lost contact with file server ", sa, "",
- 1);
+ 1, code);
return 1;
} /*ServerDown */
if (tc->parent->srvr == sa) {
afs_MarkServerUpOrDown(sa, 0);
print_internet_address("afs: volume location server ", sa,
- " is back up", 2);
+ " is back up", 2, code);
}
}
if (( results[i] >= 0 ) && (sa->sa_flags & SRVADDR_ISDOWN) &&
(tc->parent->srvr == sa)) {
/* server back up */
- print_internet_address("afs: file server ", sa, " is back up", 2);
+ print_internet_address("afs: file server ", sa, " is back up", 2,
+ results[i]);
ObtainWriteLock(&afs_xserver, 244);
ObtainWriteLock(&afs_xsrvAddr, 245);
} else {
if (results[i] < 0) {
/* server crashed */
- afs_ServerDown(sa);
+ afs_ServerDown(sa, results[i]);
ForceNewConnections(sa); /* multi homed clients */
}
}
}
void
-CkSrv_GetCaps(struct rx_connection **rxconns, int nconns, int nservers,
- struct afs_conn **conns, struct srvAddr **addrs)
+CkSrv_GetCaps(int nconns, struct rx_connection **rxconns,
+ struct afs_conn **conns)
{
Capabilities *caps;
afs_int32 *results;
afs_int32 i;
struct server *ts;
- caps = afs_osi_Alloc(nservers * sizeof (Capabilities));
+ caps = afs_osi_Alloc(nconns * sizeof (Capabilities));
osi_Assert(caps != NULL);
- memset(caps, 0, nservers * sizeof(Capabilities));
+ memset(caps, 0, nconns * sizeof(Capabilities));
- results = afs_osi_Alloc(nservers * sizeof (afs_int32));
+ results = afs_osi_Alloc(nconns * sizeof (afs_int32));
osi_Assert(results != NULL);
AFS_GUNLOCK();
AFS_GLOCK();
for ( i = 0 ; i < nconns ; i++ ) {
- ts = addrs[i]->server;
+ ts = conns[i]->parent->srvr->server;
if ( !ts )
continue;
ts->capabilities = 0;
}
CkSrv_MarkUpDown(conns, nconns, results);
- afs_osi_Free(caps, nservers * sizeof(Capabilities));
- afs_osi_Free(results, nservers * sizeof(afs_int32));
+ afs_osi_Free(caps, nconns * sizeof(Capabilities));
+ afs_osi_Free(results, nconns * sizeof(afs_int32));
}
/* check down servers (if adown), or running servers (if !adown) */
* AFS_LS_ALL - check all */
void
afs_LoopServers(int adown, struct cell *acellp, int vlalso,
- void (*func1) (struct rx_connection **rxconns, int nconns,
- int nservers, struct afs_conn **conns,
- struct srvAddr **addrs),
- void (*func2) (struct rx_connection **rxconns, int nconns,
- int nservers, struct afs_conn **conns,
- struct srvAddr **addrs))
+ void (*func1) (int nservers, struct rx_connection **rxconns,
+ struct afs_conn **conns),
+ void (*func2) (int nservers, struct rx_connection **rxconns,
+ struct afs_conn **conns))
{
struct vrequest treq;
struct server *ts;
struct afs_conn **conns;
int nconns;
struct rx_connection **rxconns;
- afs_int32 *conntimer, *results;
+ afs_int32 *conntimer;
AFS_STATCNT(afs_CheckServers);
osi_Assert(rxconns != NULL);
conntimer = afs_osi_Alloc(j * sizeof (afs_int32));
osi_Assert(conntimer != NULL);
- results = afs_osi_Alloc(j * sizeof (afs_int32));
- osi_Assert(results != NULL);
for (i = 0; i < j; i++) {
struct rx_connection *rxconn;
conntimer[nconns]=0;
}
nconns++;
- }
+ } else /* not holding, kill ref */
+ afs_PutConn(tc, rxconn, SHARED_LOCK);
} /* Outer loop over addrs */
- (*func1)(rxconns, nconns, j, conns, addrs);
+ afs_osi_Free(addrs, srvAddrCount * sizeof(*addrs));
+ addrs = NULL;
+
+ (*func1)(nconns, rxconns, conns);
if (func2) {
- (*func2)(rxconns, nconns, j, conns, addrs);
+ (*func2)(nconns, rxconns, conns);
}
for (i = 0; i < nconns; i++) {
afs_PutConn(conns[i], rxconns[i], SHARED_LOCK); /* done with it now */
}
- afs_osi_Free(addrs, srvAddrCount * sizeof(*addrs));
afs_osi_Free(conns, j * sizeof(struct afs_conn *));
afs_osi_Free(rxconns, j * sizeof(struct rx_connection *));
afs_osi_Free(conntimer, j * sizeof(afs_int32));
- afs_osi_Free(results, j * sizeof(afs_int32));
} /*afs_CheckServers*/
return;
}
#else /* AFS_USERSPACE_IP_ADDR */
-#if (! defined(AFS_SUN5_ENV)) && (! defined(AFS_DARWIN_ENV)) && (! defined(AFS_OBSD47_ENV)) && defined(USEIFADDR)
+#if (! defined(AFS_SUN5_ENV)) && (! defined(AFS_DARWIN_ENV)) && (! defined(AFS_OBSD47_ENV)) && (! defined(AFS_FBSD_ENV)) && defined(USEIFADDR)
void
afsi_SetServerIPRank(struct srvAddr *sa, struct in_ifaddr *ifa)
{
#endif /* IFF_POINTTOPOINT */
}
#endif /*(!defined(AFS_SUN5_ENV)) && defined(USEIFADDR) */
-#if (defined(AFS_DARWIN_ENV) || defined(AFS_OBSD47_ENV)) && defined(USEIFADDR)
+#if (defined(AFS_DARWIN_ENV) || defined(AFS_OBSD47_ENV) || defined(AFS_FBSD_ENV)) && defined(USEIFADDR)
#ifndef afs_min
#define afs_min(A,B) ((A)<(B)) ? (A) : (B)
#endif
{
struct sockaddr sout;
struct sockaddr_in *sin;
+#if defined(AFS_DARWIN80_ENV) && !defined(UKERNEL)
int t;
+#else
+ void *t;
+#endif
afs_uint32 subnetmask, myAddr, myNet, myDstaddr, mySubnet, netMask;
afs_uint32 serverAddr;
#else
TAILQ_FOREACH(ifa, &in_ifaddrhead, ia_link) {
#endif
- afsi_SetServerIPRank(sa, ifa);
+ afsi_SetServerIPRank(sa, &ifa->ia_ifa);
}}
#elif defined(AFS_OBSD_ENV)
{
ObtainWriteLock(&afs_xserver, 723);
/* we forced a conn above; important we mark it down if needed */
if ((code < 0) && (code != RXGEN_OPCODE)) {
- afs_ServerDown(tc->parent->srvr);
+ afs_ServerDown(tc->parent->srvr, code);
ForceNewConnections(tc->parent->srvr); /* multi homed clients */
}
afs_PutConn(tc, rxconn, SHARED_LOCK);