[Openvpn-devel,15/21] Update fragment and mssfix related warnings

Message ID 20211207170211.3275837-16-arne@rfc2549.org
State New
Headers show
Series
  • Big buffer/frame refactoring patch set
Related show

Commit Message

Arne Schwabe Dec. 7, 2021, 5:02 p.m.
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.

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

Comments

Frank Lichtenheld Dec. 10, 2021, 5:18 p.m. | #1
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>

> Arne Schwabe <arne@rfc2549.org> hat am 07.12.2021 18:02 geschrieben:
> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
> index 31ae250bc..4f08e560a 100644
> --- a/src/openvpn/init.c
> +++ b/src/openvpn/init.c
> @@ -3183,12 +3183,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 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 for both or none.");

"the mtu parameter"? Or do you actually mean "the mtu" here?

Regards,
--
Frank Lichtenheld

Patch

diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 31ae250bc..4f08e560a 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -3183,12 +3183,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 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 for both or none.");
     }
 #endif
 }