#include <roken.h>
+#include <afs/opr.h>
+
#ifdef AFS_NT40_ENV
# include <WINNT/syscfg.h>
#else
#include "rx_atomic.h"
#include "rx_globals.h"
#include "rx_stats.h"
+#include "rx_peer.h"
+#include "rx_packet.h"
+
#ifdef AFS_PTHREAD_ENV
/*
va_end(ap);
fflush(stderr);
fflush(stdout);
- afs_abort();
+ opr_abort();
}
/*
fudge_netmask(rxi_NetAddrs[rxi_numNetAddrs]);
#ifdef SIOCGIFNETMASK
res = ioctl(s, SIOCGIFNETMASK, ifr);
- if ((res == 0)) {
+ if (res == 0) {
a = (struct sockaddr_in *)&ifr->ifr_addr;
myNetMasks[rxi_numNetAddrs] = ntohl(a->sin_addr.s_addr);
/* fprintf(stderr, "if %s subnetmask=0x%x\n",
struct sockaddr_in addr;
#endif
-
-
LOCK_IF_INIT;
if (!Inited) {
UNLOCK_IF_INIT;
UNLOCK_IF_INIT;
}
-#ifdef ADAPT_MTU
/* try to second-guess IP, and identify which link is most likely to
* be used for traffic to/from this host. */
ppaddr = ntohl(pp->host);
pp->ifMTU = 0;
- pp->timeout.sec = 2;
- pp->rateFlag = 2; /* start timing after two full packets */
+ rx_rto_setPeerTimeoutSecs(pp, 2);
/* I don't initialize these, because I presume they are bzero'd...
* pp->burstSize pp->burst pp->burstWait.sec pp->burstWait.usec
- * pp->timeout.usec */
+ */
LOCK_IF;
for (ix = 0; ix < rxi_numNetAddrs; ++ix) {
if ((rxi_NetAddrs[ix] & myNetMasks[ix]) == (ppaddr & myNetMasks[ix])) {
#ifdef IFF_POINTOPOINT
if (myNetFlags[ix] & IFF_POINTOPOINT)
- pp->timeout.sec = 4;
+ rx_rto_setPeerTimeoutSecs(pp, 4);
#endif /* IFF_POINTOPOINT */
+
rxmtu = myNetMTUs[ix] - RX_IPUDP_SIZE;
if (rxmtu < RX_MIN_PACKET_SIZE)
rxmtu = RX_MIN_PACKET_SIZE;
}
UNLOCK_IF;
if (!pp->ifMTU) { /* not local */
- pp->timeout.sec = 3;
+ rx_rto_setPeerTimeoutSecs(pp, 3);
pp->ifMTU = MIN(rx_MyMaxSendSize, RX_REMOTE_PACKET_SIZE);
}
-#else /* ADAPT_MTU */
- pp->rateFlag = 2; /* start timing after two full packets */
- pp->timeout.sec = 2;
- pp->ifMTU = MIN(rx_MyMaxSendSize, OLD_MAX_PACKET_SIZE);
-#endif /* ADAPT_MTU */
#if defined(ADAPT_PMTU) && defined(IP_MTU)
sock=socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sock != OSI_NULLSOCKET) {
/* Override max MTU. If rx_SetNoJumbo is called, it must be
called before calling rx_SetMaxMTU since SetNoJumbo clobbers rx_maxReceiveSize */
-void
+int
rx_SetMaxMTU(int mtu)
{
+ if (mtu < RX_MIN_PACKET_SIZE || mtu > RX_MAX_PACKET_DATA_SIZE)
+ return EINVAL;
+
rx_MyMaxSendSize = rx_maxReceiveSizeUser = rx_maxReceiveSize = mtu;
+
+ return 0;
}
#if defined(ADAPT_PMTU)