Rx: Correct AFS_NT40_ENV rx_GetIFInfo max MTU assignments
[openafs.git] / src / rx / rx_user.c
index fdffd85..eb62ed7 100644 (file)
@@ -9,11 +9,11 @@
 
 /* rx_user.c contains routines specific to the user space UNIX implementation of rx */
 
+/* rxi_syscall is currently not prototyped */
+
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
 
 # include <sys/types.h>
 # include <errno.h>
@@ -30,6 +30,7 @@ RCSID
 # 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) 
@@ -45,6 +46,14 @@ RCSID
 #define IPPORT_USERRESERVED 5000
 # endif
 
+#if defined(HAVE_LINUX_ERRQUEUE_H) && defined(ADAPT_PMTU)
+#include <linux/types.h>
+#include <linux/errqueue.h>
+#ifndef IP_MTU
+#define IP_MTU 14
+#endif
+#endif
+
 #ifndef AFS_NT40_ENV
 # include <sys/time.h>
 #endif
@@ -102,13 +111,6 @@ rxi_GetHostUDPSocket(u_int ahost, u_short port)
     int pmtu=IP_PMTUDISC_DONT;
 #endif
 #endif
-#if defined(HAVE_LINUX_ERRQUEUE_H) && defined(ADAPT_PMTU)
-#include <linux/types.h>
-#include <linux/errqueue.h>
-#ifndef IP_MTU
-#define IP_MTU 14
-#endif
-#endif
 
 #if !defined(AFS_NT40_ENV) 
     if (ntohs(port) >= IPPORT_RESERVED && ntohs(port) < IPPORT_USERRESERVED) {
@@ -324,15 +326,6 @@ rx_getAllAddr(afs_uint32 * buffer, int maxSize)
     /* The IP address list can change so we must query for it */
     rx_GetIFInfo();
 
-#ifdef AFS_DJGPP_ENV
-    /* we don't want to use the loopback adapter which is first */
-    /* this is a bad bad hack.
-     * and doesn't hold true on Windows.
-     */
-    if ( rxi_numNetAddrs > 1 )
-        offset = 1;
-#endif /* AFS_DJGPP_ENV */
-
     for (count = 0; offset < rxi_numNetAddrs && maxSize > 0;
         count++, offset++, maxSize--)
        buffer[count] = htonl(rxi_NetAddrs[offset]);
@@ -354,15 +347,6 @@ rx_getAllAddrMaskMtu(afs_uint32 addrBuffer[], afs_uint32 maskBuffer[],
     /* The IP address list can change so we must query for it */
     rx_GetIFInfo();
 
-#ifdef AFS_DJGPP_ENV
-    /* we don't want to use the loopback adapter which is first */
-    /* this is a bad bad hack.
-     * and doesn't hold true on Windows.
-     */
-    if ( rxi_numNetAddrs > 1 )
-        offset = 1;
-#endif /* AFS_DJGPP_ENV */
-
     for (count = 0; 
          offset < rxi_numNetAddrs && maxSize > 0;
          count++, offset++, maxSize--) {
@@ -418,12 +402,14 @@ rx_GetIFInfo(void)
         maxsize =
             rxi_nRecvFrags * rxsize + (rxi_nRecvFrags - 1) * UDP_HDR_SIZE;
         maxsize = rxi_AdjustMaxMTU(rxsize, maxsize);
-        if (rx_maxReceiveSize < maxsize) {
+        if (rx_maxReceiveSize > maxsize) {
             rx_maxReceiveSize = MIN(RX_MAX_PACKET_SIZE, maxsize);
             rx_maxReceiveSize =
                 MIN(rx_maxReceiveSize, rx_maxReceiveSizeUser);
         }
-
+        if (rx_MyMaxSendSize > maxsize) {
+            rx_MyMaxSendSize = MIN(RX_MAX_PACKET_SIZE, maxsize);
+        }
     }
     UNLOCK_IF;
 
@@ -460,14 +446,12 @@ fudge_netmask(afs_uint32 addr)
 
 #if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) 
 int
-rxi_syscall(a3, a4, a5)
-     afs_uint32 a3, a4;
-     void *a5;
+rxi_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
 {
     afs_uint32 rcode;
-    void (*old) ();
+    void (*old) (int);
 
-    old = (void (*)())signal(SIGSYS, SIG_IGN);
+    old = signal(SIGSYS, SIG_IGN);
 
 #if defined(AFS_SGI_ENV)
     rcode = afs_syscall(a3, a4, a5);