From 50d079ea8a266e142450561f6ced5564bfe8840c Mon Sep 17 00:00:00 2001 From: Douglas Engert Date: Sun, 31 May 2009 02:23:11 +0000 Subject: [PATCH] STABLE14-afsd-allow-maxmtu-override-20090530 LICENSE IPL10 FIXES 124880 rxi_Findcbi, rxi_FIndIfnet, rxi_FindIfMTU "failure" end up returning the RX_REMOTE_PACKET_SIZE as the mtu to use unless we allow our override to apply, so we do that. then, add an afsd switch to allow setting it. afsd man page update required and will follow. ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== LICENSE IPL10 FIXES 124880 man page update to document previous work (cherry picked from commit 74df876dafb9cf80ab5a8099b4202f2205bd9791) --- doc/man-pages/pod8/afsd.pod | 10 +++++++++- src/afs/afs_call.c | 2 ++ src/afsd/afs.conf.linux | 2 ++ src/afsd/afsd.c | 17 +++++++++++++++++ src/config/afs_args.h | 1 + src/rx/rx_kcommon.c | 10 +++++----- 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/doc/man-pages/pod8/afsd.pod b/doc/man-pages/pod8/afsd.pod index d46c35e2d..a2f1f0970 100644 --- a/doc/man-pages/pod8/afsd.pod +++ b/doc/man-pages/pod8/afsd.pod @@ -25,7 +25,8 @@ B [B<-afsdb>] [B<-backuptree>] [B<-nosettime>] S<<< [B<-prealloc> >] >>> [B<-rmtsys>] S<<< [B<-rootvol> >] >>> - [B<-rxbind>] S<<< [B<-rxpck> value for rx_extraPackets ] >>> + [B<-rxbind>] S<<< [B<-rxmaxmtu> value for maximum MTU ] >>> + S<<< [B<-rxpck> value for rx_extraPackets ] >>> [B<-settime>] [B<-shutdown>] S<<< [B<-splitcache> >] >>> S<<< [B<-stat> >] >>> [B<-verbose>] @@ -628,6 +629,13 @@ B<-dynroot> is given. Bind the Rx socket (one interface only). +=item B<-rxmaxmtu> > + +Set a limit for the largest maximum transfer unit (network packet size) that +the AFS client on this machine will be willing to transmit. This switch can +be used where an artificial limit on the network precludes packets as large +as the discoverable MTU from being transmitted successfully. + =item B<-rxpck> > Set rx_extraPackets to this value. This sets the number of extra Rx diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 0e4c4d78d..3b3298b47 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -1163,6 +1163,8 @@ afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6) } else if (parm == AFSOP_SET_RXPCK) { rx_extraPackets = parm2; afscall_set_rxpck_received = 1; + } else if (parm == AFSOP_SET_RXMAXMTU) { + rx_MyMaxSendSize = rx_maxReceiveSizeUser = rx_maxReceiveSize = parm2; } else code = EINVAL; diff --git a/src/afsd/afs.conf.linux b/src/afsd/afs.conf.linux index 6cdc675aa..25a8d496b 100644 --- a/src/afsd/afs.conf.linux +++ b/src/afsd/afs.conf.linux @@ -59,6 +59,8 @@ ENABLE_DYNROOT=on # -logfile Place where to put the logfile (default in /etc/AFSLog. # -waitclose make close calls always synchronous (slows em down, tho) # -files_per_subdir [n] number of files per cache subdir. (def=2048) +# -rxmaxmtu Max mtu. Useful when using VPN when packets might fragment. +# a value of 1244 should work. # -shutdown Shutdown afs daemons # --------------------------------------------------------------------------- XXLARGE="-fakestat -stat 4000 -dcache 4000 -daemons 6 -volumes 256 -files 50000" diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index c469a4c41..e81d13106 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -31,6 +31,7 @@ * -confdir The configuration directory . * -nosettime Don't keep checking the time to avoid drift (default). * -settime Keep checking the time to avoid drift. + * -rxmaxmtu Set the max mtu to help with VPN issues. * -verbose Be chatty. * -disable-dynamic-vcaches Disable the use of -stat value as the starting size of * the size of the vcache/stat cache pool, @@ -319,6 +320,7 @@ int afsd_dynamic_vcaches = 0; /* Enable dynamic-vcache support */ int afsd_verbose = 0; /*Are we being chatty? */ int afsd_debug = 0; /*Are we printing debugging info? */ int afsd_CloseSynch = 0; /*Are closes synchronous or not? */ +int rxmaxmtu = 0; /* Are we forcing a limit on the mtu? */ #ifdef AFS_SGI62_ENV #define AFSD_INO_T ino64_t @@ -1761,6 +1763,12 @@ mainproc(struct cmd_syndesc *as, void *arock) printf("afsd: %s dynamically allocated vcaches\n", ( afsd_dynamic_vcaches ? "enabling" : "disabling" )); #endif + /* set -rxmaxmtu */ + if (as->parms[35].items) { + /* -rxmaxmtu */ + rxmaxmtu = atoi(as->parms[35].items->data); + } + /* * Pull out all the configuration info for the workstation's AFS cache and * the cellular community we're willing to let our users see. @@ -2173,6 +2181,14 @@ mainproc(struct cmd_syndesc *as, void *arock) fullpn_CellInfoFile); call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile); + if (rxmaxmtu) { + if (afsd_verbose) + printf("%s: Setting rxmaxmtu in kernel = %d\n", rn, rxmaxmtu); + code = call_syscall(AFSOP_SET_RXMAXMTU, rxmaxmtu); + if (code) + printf("%s: Error seting rxmaxmtu\n", rn); + } + if (enable_dynroot) { if (afsd_verbose) printf("%s: Enabling dynroot support in kernel.\n", rn); @@ -2472,6 +2488,7 @@ main(int argc, char **argv) "set the time"); cmd_AddParm(ts, "-rxpck", CMD_SINGLE, CMD_OPTIONAL, "set rx_extraPackets to this value"); cmd_AddParm(ts, "-disable-dynamic-vcaches", CMD_FLAG, CMD_OPTIONAL, "disable stat/vcache cache growing as needed"); + cmd_AddParm(ts, "-rxmaxmtu", CMD_SINGLE, CMD_OPTIONAL, "set rx max MTU to use"); return (cmd_Dispatch(argc, argv)); } diff --git a/src/config/afs_args.h b/src/config/afs_args.h index d3a06be4f..1f8ca28c3 100644 --- a/src/config/afs_args.h +++ b/src/config/afs_args.h @@ -47,6 +47,7 @@ #define AFSOP_BASIC_INIT 36 /* used to be part of START_AFS */ #define AFSOP_SET_BACKUPTREE 37 /* enable backup tree support */ #define AFSOP_SET_RXPCK 38 /*set rx_extraPackets*/ +#define AFSOP_SET_RXMAXMTU 40 /* set rx_MyMaxSendSize,rx_maxReceiveSizeUser,rx_maxReceiveSize */ /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */ #define AFSCALL_PIOCTL 20 diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 2382467d8..71b2927b2 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -389,7 +389,7 @@ rxi_InitPeerParams(register struct rx_peer *pp) if (i == -1) { pp->timeout.sec = 3; /* pp->timeout.usec = 0; */ - pp->ifMTU = RX_REMOTE_PACKET_SIZE; + pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize); } else { pp->timeout.sec = 2; /* pp->timeout.usec = 0; */ @@ -405,7 +405,7 @@ rxi_InitPeerParams(register struct rx_peer *pp) pp->ifMTU = rxmtu; } } else { /* couldn't find the interface, so assume the worst */ - pp->ifMTU = RX_REMOTE_PACKET_SIZE; + pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize); } #else /* AFS_USERSPACE_IP_ADDR */ #ifdef AFS_DARWIN80_ENV @@ -441,7 +441,7 @@ rxi_InitPeerParams(register struct rx_peer *pp) } else { /* couldn't find the interface, so assume the worst */ pp->timeout.sec = 3; /* pp->timeout.usec = 0; */ - pp->ifMTU = RX_REMOTE_PACKET_SIZE; + pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize); } #endif /* else AFS_USERSPACE_IP_ADDR */ #else /* AFS_SUN5_ENV */ @@ -450,7 +450,7 @@ rxi_InitPeerParams(register struct rx_peer *pp) if (mtu <= 0) { pp->timeout.sec = 3; /* pp->timeout.usec = 0; */ - pp->ifMTU = RX_REMOTE_PACKET_SIZE; + pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize); } else { pp->timeout.sec = 2; /* pp->timeout.usec = 0; */ @@ -466,7 +466,7 @@ rxi_InitPeerParams(register struct rx_peer *pp) pp->ifMTU = rxmtu; } } else { /* couldn't find the interface, so assume the worst */ - pp->ifMTU = RX_REMOTE_PACKET_SIZE; + pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE,rx_MyMaxSendSize); } #endif /* AFS_SUN5_ENV */ #else /* ADAPT_MTU */ -- 2.39.5