Browse code

Clean up documentation for --tun-mtu-max

There was some confusion about how the option
was called...

Change-Id: I5e240c35cd4236e1d845195e4634fd5008f61814
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250823153652.30938-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32663.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Frank Lichtenheld authored on 2025/08/24 00:36:46
Showing 5 changed files
... ...
@@ -587,7 +587,7 @@ routing.
587 587
   packets larger than ``tun-mtu`` (e.g. Linux and FreeBSD) but other platforms
588 588
   (like macOS) limit received packets to the same size as the MTU.
589 589
 
590
+--tun-mtu-max maxmtu
590 591
   This configures the maximum MTU size that a server can push to ``maxmtu``,
591 592
   by configuring the internal buffers to allow at least this packet size.
592 593
   The default for ``maxmtu`` is 1600. Currently, only increasing beyond 1600
... ...
@@ -2916,7 +2916,7 @@ frame_finalize_options(struct context *c, const struct options *o)
2916 2916
 
2917 2917
     /* We always allow at least 1600 MTU packets to be received in our buffer
2918 2918
      * space to allow server to push "baby giant" MTU sizes */
2919
-    frame->tun_max_mtu = max_int(1600, frame->tun_max_mtu);
2919
+    frame->tun_max_mtu = max_int(TUN_MTU_MAX_MIN, frame->tun_max_mtu);
2920 2920
 
2921 2921
     size_t payload_size = frame->tun_max_mtu;
2922 2922
 
... ...
@@ -69,6 +69,11 @@
69 69
 #define TUN_MTU_DEFAULT 1500
70 70
 
71 71
 /*
72
+ * Minimum maximum MTU
73
+ */
74
+#define TUN_MTU_MAX_MIN 1600
75
+
76
+/*
72 77
  * MTU Defaults for TAP devices
73 78
  */
74 79
 #define TAP_MTU_EXTRA_DEFAULT 32
... ...
@@ -297,6 +297,7 @@ static const char usage_message[] =
297 297
     "--tun-mtu-extra n : Assume that tun/tap device might return as many\n"
298 298
     "                  as n bytes more than the tun-mtu size on read\n"
299 299
     "                  (default TUN=0 TAP=%d).\n"
300
+    "--tun-mtu-max n : Maximum pushable MTU (default and minimum=%d).\n"
300 301
     "--link-mtu n    : Take the TCP/UDP device MTU to be n and derive the tun MTU\n"
301 302
     "                  from it.\n"
302 303
     "--mtu-disc type : Should we do Path MTU discovery on TCP/UDP channel?\n"
... ...
@@ -4844,8 +4845,9 @@ usage(void)
4844 4844
 
4845 4845
     fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds,
4846 4846
             o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
4847
-            TAP_MTU_EXTRA_DEFAULT, o.verbosity, o.authname, o.replay_window, o.replay_time,
4848
-            o.tls_timeout, o.renegotiate_seconds, o.handshake_window, o.transition_window);
4847
+            TAP_MTU_EXTRA_DEFAULT, TUN_MTU_MAX_MIN, o.verbosity, o.authname, o.replay_window,
4848
+            o.replay_time, o.tls_timeout, o.renegotiate_seconds, o.handshake_window,
4849
+            o.transition_window);
4849 4850
     fflush(fp);
4850 4851
 
4851 4852
 #endif                                       /* ENABLE_SMALL */
... ...
@@ -7011,7 +7013,7 @@ add_option(struct options *options, char *p[], bool is_inline, const char *file,
7011 7011
             options->ce.occ_mtu = 0;
7012 7012
         }
7013 7013
     }
7014
-    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[3])
7014
+    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[2])
7015 7015
     {
7016 7016
         VERIFY_PERMISSION(OPT_P_MTU | OPT_P_CONNECTION);
7017 7017
         int max_mtu = positive_atoi(p[1], msglevel);
... ...
@@ -721,7 +721,7 @@ prepare_push_reply(struct context *c, struct gc_arena *gc, struct push_list *pus
721 721
         {
722 722
             msg(M_WARN,
723 723
                 "Warning: reported maximum MTU from client (%d) is lower "
724
-                "than MTU used on the server (%d). Add tun-max-mtu %d "
724
+                "than MTU used on the server (%d). Add tun-mtu-max %d "
725 725
                 "to client configuration.",
726 726
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
727 727
         }