server-rxmaxmtu-option-20060221
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 22 Feb 2006 04:07:34 +0000 (04:07 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 22 Feb 2006 04:07:34 +0000 (04:07 +0000)
add -rxmaxmtu <bytes> to allow setting the max send and receive RX MTU size

src/bozo/bosserver.c
src/ptserver/ptserver.c
src/viced/viced.c
src/vlserver/vlserver.c
src/volser/volmain.c

index 398a1d8..635a681 100644 (file)
@@ -718,6 +718,7 @@ main(int argc, char **argv, char **envp)
     struct ktc_encryptionKey tkey;
     int i;
     char namebuf[AFSDIR_PATH_MAX];
+    int rxMaxMTU = -1;
 #ifndef AFS_NT40_ENV
     int nofork = 0;
     struct stat sb;
@@ -812,6 +813,20 @@ main(int argc, char **argv, char **envp)
            bozo_isrestricted = 1;
        }
 #endif
+       else if (!strcmp(argv[i], "-rxmaxmtu")) {
+           if ((i + 1) >= argc) {
+               fprintf(stderr, "missing argument for -rxmaxmtu\n"); 
+               exit(1); 
+           }
+           rxMaxMTU = atoi(argv[++i]);
+           if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || 
+               (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
+               printf("rxMaxMTU %d% invalid; must be between %d-%d\n",
+                       rxMaxMTU, RX_MIN_PACKET_SIZE, 
+                       RX_MAX_PACKET_DATA_SIZE);
+               exit(1);
+           }
+       }
        else if (strcmp(argv[code], "-auditlog") == 0) {
            int tempfd, flags;
            FILE *auditout;
@@ -849,12 +864,14 @@ main(int argc, char **argv, char **envp)
 #ifndef AFS_NT40_ENV
            printf("Usage: bosserver [-noauth] [-log] "
                   "[-auditlog <log path>] "
+                  "[-rxmaxmtu <bytes>] "
                   "[-syslog[=FACILITY]] "
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-nofork] " "[-help]\n");
 #else
            printf("Usage: bosserver [-noauth] [-log] "
                   "[-auditlog <log path>] "
+                  "[-rxmaxmtu <bytes>] "
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-help]\n");
 #endif
@@ -1006,6 +1023,10 @@ main(int argc, char **argv, char **envp)
     /* Disable jumbograms */
     rx_SetNoJumbo();
 
+    if (rxMaxMTU != -1) {
+       rx_SetMaxMTU(rxMaxMTU);
+    }
+
     tservice = rx_NewService( /* port */ 0, /* service id */ 1,
                             /*service name */ "bozo",
                             /* security classes */
index 9567dbd..7cdfb4b 100644 (file)
@@ -166,6 +166,7 @@ int pr_realmNameLen;
 char *pr_realmName;
 
 int restricted = 0;
+int rxMaxMTU = -1;
 
 static struct afsconf_cell info;
 
@@ -349,6 +350,20 @@ main(int argc, char **argv)
            } else
                printf("Warning: auditlog %s not writable, ignored.\n", fileName);
        }
+       else if (!strncmp(arg, "-rxmaxmtu", alen)) {
+           if ((a + 1) >= argc) {
+               fprintf(stderr, "missing argument for -rxmaxmtu\n");
+               PT_EXIT(1);
+           }
+           rxMaxMTU = atoi(argv[++a]);
+           if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
+                (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
+               printf("rxMaxMTU %d% invalid; must be between %d-%d\n",
+                       rxMaxMTU, RX_MIN_PACKET_SIZE,
+                       RX_MAX_PACKET_DATA_SIZE);
+               PT_EXIT(1);
+           }
+       } 
        else if (*arg == '-') {
            /* hack in help flag support */
 
@@ -359,7 +374,7 @@ main(int argc, char **argv)
                   "[-syslog[=FACILITY]] "
                   "[-p <number of processes>] [-rebuild] "
                   "[-groupdepth <depth>] "
-                  "[-restricted] "
+                  "[-restricted] [-rxmaxmtu <bytes>]"
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-default_access default_user_access default_group_access] "
                   "[-help]\n");
@@ -368,7 +383,7 @@ main(int argc, char **argv)
                   "[-auditlog <log path>] "
                   "[-p <number of processes>] [-rebuild] "
                   "[-default_access default_user_access default_group_access] "
-                  "[-restricted] "
+                  "[-restricted] [-rxmaxmtu <bytes>]"
                   "[-groupdepth <depth>] " "[-help]\n");
 #endif
 #else
@@ -379,13 +394,13 @@ main(int argc, char **argv)
                   "[-p <number of processes>] [-rebuild] "
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-default_access default_user_access default_group_access] "
-                  "[-restricted] "
+                  "[-restricted] [-rxmaxmtu <bytes>]"
                   "[-help]\n");
 #else /* AFS_NT40_ENV */
            printf("Usage: ptserver [-database <db path>] "
                   "[-auditlog <log path>] "
                   "[-default_access default_user_access default_group_access] "
-                  "[-restricted] "
+                  "[-restricted] [-rxmaxmtu <bytes>]"
                   "[-p <number of processes>] [-rebuild] " "[-help]\n");
 #endif
 #endif
@@ -499,6 +514,10 @@ main(int argc, char **argv)
     /* Disable jumbograms */
     rx_SetNoJumbo();
 
+    if (rxMaxMTU != -1) {
+       rx_SetMaxMTU(rxMaxMTU);
+    }
+
     tservice =
        rx_NewService(0, PRSRV, "Protection Server", sc, 3,
                      PR_ExecuteRequest);
index 086960d..27986d6 100644 (file)
@@ -167,6 +167,7 @@ int SawPctSpare;
 int debuglevel = 0;
 int printBanner = 0;
 int rxJumbograms = 1;          /* default is to send and receive jumbograms. */
+int rxMaxMTU = -1;
 afs_int32 implicitAdminRights = PRSFS_LOOKUP;  /* The ADMINISTER right is 
                                                 * already implied */
 afs_int32 readonlyServer = 0;
@@ -735,6 +736,7 @@ FlagMsg()
     strcat(buffer, "[-rxpck <number of rx extra packets>] ");
     strcat(buffer, "[-rxdbg (enable rx debugging)] ");
     strcat(buffer, "[-rxdbge (enable rxevent debugging)] ");
+    strcat(buffer, "[-rxmaxmtu <bytes>] ");
 #if AFS_PTHREAD_ENV
     strcat(buffer, "[-vattachpar <number of volume attach threads>] ");
 #endif
@@ -1051,6 +1053,19 @@ ParseArgs(int argc, char *argv[])
 #endif
        else if (!strcmp(argv[i], "-nojumbo")) {
            rxJumbograms = 0;
+       } else if (!strcmp(argv[i], "-rxmaxmtu")) {
+           if ((i + 1) >= argc) {
+               fprintf(stderr, "missing argument for -rxmaxmtu\n"); 
+               return -1; 
+           }
+           rxMaxMTU = atoi(argv[++i]);
+           if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || 
+               (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
+               printf("rxMaxMTU %d% invalid; must be between %d-%d\n",
+                      rxMaxMTU, RX_MIN_PACKET_SIZE, 
+                      RX_MAX_PACKET_DATA_SIZE);
+               return -1;
+           }
        } else if (!strcmp(argv[i], "-realm")) {
            extern char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
            extern int  num_lrealms;
@@ -1801,6 +1816,9 @@ main(int argc, char *argv[])
        /* Don't send and don't allow 3.4 clients to send jumbograms. */
        rx_SetNoJumbo();
     }
+    if (rxMaxMTU != -1) {
+       rx_SetMaxMTU(rxMaxMTU);
+    }
     rx_GetIFInfo();
     rx_SetRxDeadTime(30);
     sc[0] = rxnull_NewServerSecurityObject();
index d2f4711..c278842 100644 (file)
@@ -71,6 +71,7 @@ static CheckSignal();
 int LogLevel = 0;
 int smallMem = 0;
 int rxJumbograms = 1;          /* default is to send and receive jumbo grams */
+int rxMaxMTU = -1;
 
 static void
 CheckSignal_Signal()
@@ -178,6 +179,20 @@ main(argc, argv)
        } else if (strcmp(argv[index], "-nojumbo") == 0) {
            rxJumbograms = 0;
 
+       } else if (!strcmp(argv[i], "-rxmaxmtu")) {
+           if ((i + 1) >= argc) {
+               fprintf(stderr, "missing argument for -rxmaxmtu\n"); 
+               return -1; 
+           }
+           rxMaxMTU = atoi(argv[++i]);
+           if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || 
+               (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
+               printf("rxMaxMTU %d% invalid; must be between %d-%d\n",
+                      rxMaxMTU, RX_MIN_PACKET_SIZE, 
+                      RX_MAX_PACKET_DATA_SIZE);
+               return -1;
+           }
+
        } else if (strcmp(argv[index], "-smallmem") == 0) {
            smallMem = 1;
 
@@ -230,12 +245,14 @@ main(argc, argv)
            /* support help flag */
 #ifndef AFS_NT40_ENV
            printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
+                  "[-rxmaxmtu <bytes>] "
                   "[-auditlog <log path>] "
                   "[-syslog[=FACILITY]] "
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-help]\n");
 #else
            printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
+                  "[-rxmaxmtu <bytes>] "
                   "[-auditlog <log path>] "
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-help]\n");
@@ -323,6 +340,9 @@ main(argc, argv)
     if (!rxJumbograms) {
        rx_SetNoJumbo();
     }
+    if (rxMaxMTU != -1) {
+       rx_SetMaxMTU(rxMaxMTU);
+    }
     rx_SetRxDeadTime(50);
 
     memset(HostAddress, 0, sizeof(HostAddress));
index 63eeae6..ca643b5 100644 (file)
@@ -242,6 +242,7 @@ main(int argc, char **argv)
     char commandLine[150];
     int i;
     int rxJumbograms = 1;      /* default is to send and receive jumbograms. */
+    int rxMaxMTU = -1;
     int bufSize = 0;           /* temp variable to read in udp socket buf size */
 
 #ifdef AFS_AIX32_ENV
@@ -326,6 +327,19 @@ main(int argc, char **argv)
                printf("Warning: auditlog %s not writable, ignored.\n", fileName);
        } else if (strcmp(argv[code], "-nojumbo") == 0) {
            rxJumbograms = 0;
+       } else if (!strcmp(argv[code], "-rxmaxmtu")) {
+           if ((code + 1) >= argc) {
+               fprintf(stderr, "missing argument for -rxmaxmtu\n"); 
+               exit(1); 
+           }
+           rxMaxMTU = atoi(argv[++code]);
+           if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || 
+               (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
+               printf("rxMaxMTU %d% invalid; must be between %d-%d\n",
+                      rxMaxMTU, RX_MIN_PACKET_SIZE, 
+                      RX_MAX_PACKET_DATA_SIZE);
+               exit(1);
+           }
        } else if (strcmp(argv[code], "-sleep") == 0) {
            sscanf(argv[++code], "%d/%d", &TTsleep, &TTrun);
            if ((TTsleep < 0) || (TTrun <= 0)) {
@@ -365,6 +379,7 @@ main(int argc, char **argv)
 #ifndef AFS_NT40_ENV
            printf("Usage: volserver [-log] [-p <number of processes>] "
                   "[-auditlog <log path>] "
+                  "[-nojumbo] [-rxmaxmtu <bytes>] "
                   "[-udpsize <size of socket buffer in bytes>] "
                   "[-syslog[=FACILITY]] "
                   "[-enable_peer_stats] [-enable_process_stats] "
@@ -372,6 +387,7 @@ main(int argc, char **argv)
 #else
            printf("Usage: volserver [-log] [-p <number of processes>] "
                   "[-auditlog <log path>] "
+                  "[-nojumbo] [-rxmaxmtu <bytes>] "
                   "[-udpsize <size of socket buffer in bytes>] "
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-help]\n");
@@ -420,6 +436,9 @@ main(int argc, char **argv)
        /* Don't allow 3.4 vos clients to send jumbograms and we don't send. */
        rx_SetNoJumbo();
     }
+    if (rxMaxMTU != -1) {
+       rx_SetMaxMTU(rxMaxMTU);
+    }
     rx_GetIFInfo();
     rx_SetRxDeadTime(420);
     memset(busyFlags, 0, sizeof(busyFlags));