[Openvpn-devel,v3,06/14] Update fragment and mssfix related warnings

Message ID 20220101162532.2251835-7-arne@rfc2549.org
State Superseded
Headers show
Series Big buffer/frame refactoring patch set v3 | expand

Commit Message

Arne Schwabe Jan. 1, 2022, 5:25 a.m. UTC
The warning that fragment/mssfix needs also tun-mtu set to 1500 makes
little sense. Remove it completely. Instead warn if there are incosistencies
between --fragment and mssfix.

Patch v2: clarify the mssfix and fragment mtu warning message

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/init.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Arne Schwabe Jan. 29, 2022, 4:07 a.m. UTC | #1
c->options.ce.fragment, c->options.ce.mssfix);
> +    }
> +    if (c->options.ce.fragment > 0 && c->options.ce.mssfix > 0
> +        && c->options.ce.fragment_encap != c->options.ce.mssfix_encap)

Note that fragment_encap is added in

[Openvpn-devel] [PATCH v3 09/14] Add mtu paramter to --fragment and 
change fragment calculation

and this patch needs to added after that patch to avoid an compile error.

Arne

Patch

diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 642460c1..f3b0776c 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -3255,12 +3255,17 @@  do_init_frame(struct context *c)
 #endif
 
 #ifdef ENABLE_FRAGMENT
-    if ((c->options.ce.mssfix || c->options.ce.fragment)
-        && TUN_MTU_SIZE(&c->c2.frame_fragment) != ETHERNET_MTU)
+    if (c->options.ce.fragment > 0 && c->options.ce.mssfix > c->options.ce.fragment)
     {
-        msg(M_WARN,
-            "WARNING: normally if you use --mssfix and/or --fragment, you should also set --tun-mtu %d (currently it is %d)",
-            ETHERNET_MTU, TUN_MTU_SIZE(&c->c2.frame_fragment));
+        msg(M_WARN, "WARNING: if you use --mssfix and --fragment, you should "
+                    "set --fragment (%d) larger or equal than --mssfix (%d)",
+                    c->options.ce.fragment, c->options.ce.mssfix);
+    }
+    if (c->options.ce.fragment > 0 && c->options.ce.mssfix > 0
+        && c->options.ce.fragment_encap != c->options.ce.mssfix_encap)
+    {
+        msg(M_WARN, "WARNING: if you use --mssfix and --fragment, you should "
+                    "use the \"mtu\" flag for both or none of of them.");
     }
 #endif
 }