#include <afsconfig.h>
#include <afs/param.h>
-#ifndef KERNEL
-# include <roken.h>
-#endif /* KERNEL */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
+#include <roken.h>
+
+#include <afs/opr.h>
+
#ifdef AFS_NT40_ENV
# include <WINNT/syscfg.h>
#else
-# include <sys/socket.h>
-# include <sys/file.h>
-# include <netdb.h>
-# include <sys/stat.h>
-# include <netinet/in.h>
-# include <sys/time.h>
# include <net/if.h>
-# include <sys/ioctl.h>
-# include <unistd.h>
#endif
-#include <fcntl.h>
#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV)
# include <sys/syscall.h>
#endif
#endif
#endif
-#ifndef AFS_NT40_ENV
-# include <sys/time.h>
-#endif
-
#include "rx.h"
#include "rx_atomic.h"
#include "rx_globals.h"
#include "rx_stats.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;
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;
+ rx_rto_setPeerTimeoutSecs(pp, 2);
pp->ifMTU = MIN(rx_MyMaxSendSize, OLD_MAX_PACKET_SIZE);
#endif /* ADAPT_MTU */
#if defined(ADAPT_PMTU) && defined(IP_MTU)
/* 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)