[Openvpn-devel,v3,08/14] Remove link_mtu parameter when running up/down scripts

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

Commit Message

Arne Schwabe Jan. 1, 2022, 5:25 a.m. UTC
The link mtu is no longer used and calculating a compatibility link
MTU just for scripts makes little sense as well. Replace the parameter
instead with a fixed paramter 0.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 Changes.rst        |  2 ++
 src/openvpn/init.c | 16 +++-------------
 2 files changed, 5 insertions(+), 13 deletions(-)

Comments

Gert Doering Feb. 3, 2022, 1:35 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

"Because it makes sense".  Client-side and server-side tested (I do not
have any scripts that look at link_mtu, I have other scripts that might
be upset).  Code change is simple enough.

For reference, this was 16/21 in v1 of the series, and got a NAK 
for "missing update to script-options.rst".  This is still not in, 
so we agreed on IRC this morning that I'll do the missing text 
adjustments, which I have done.

Your patch has been applied to the master branch.

commit 3780ce0e16c2cd06e77357a30df3c43595c98cab (master)
Author: Arne Schwabe
Date:   Sat Jan 1 17:25:26 2022 +0100

     Remove link_mtu parameter when running up/down scripts

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220101162532.2251835-9-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23493.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/Changes.rst b/Changes.rst
index cf6a2f86..7d6fb7f7 100644
--- a/Changes.rst
+++ b/Changes.rst
@@ -128,6 +128,8 @@  User-visible Changes
 - CHACHA20-POLY1305 is included in the default of ``--data-ciphers`` when available.
 - Option ``--prng`` is ignored as we rely on the SSL library random number generator.
 - Option ``--nobind`` is default when ``--client`` or ``--pull`` is used in the configuration
+- :code:`link_mtu` parameter is removed from environment or replaced with 0 when scripts are
+  called with parameters. This parameter is unreliable and no longer internally calculated.
 
 Overview of changes in 2.5
 ==========================
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index f3b0776c..1c5d03a8 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -113,7 +113,6 @@  run_up_down(const char *command,
 #endif
             const char *dev_type,
             int tun_mtu,
-            int link_mtu,
             const char *ifconfig_local,
             const char *ifconfig_remote,
             const char *context,
@@ -129,7 +128,6 @@  run_up_down(const char *command,
     }
     setenv_str(es, "script_context", context);
     setenv_int(es, "tun_mtu", tun_mtu);
-    setenv_int(es, "link_mtu", link_mtu);
     setenv_str(es, "dev", arg);
     if (dev_type)
     {
@@ -157,11 +155,8 @@  run_up_down(const char *command,
         struct argv argv = argv_new();
         ASSERT(arg);
         argv_printf(&argv,
-                    "%s %d %d %s %s %s",
-                    arg,
-                    tun_mtu, link_mtu,
-                    ifconfig_local, ifconfig_remote,
-                    context);
+                    "%s %d 0 %s %s %s",
+                    arg, tun_mtu, ifconfig_local, ifconfig_remote, context);
 
         if (plugin_call(plugins, plugin_type, &argv, NULL, es) != OPENVPN_PLUGIN_FUNC_SUCCESS)
         {
@@ -177,7 +172,7 @@  run_up_down(const char *command,
         ASSERT(arg);
         setenv_str(es, "script_type", script_type);
         argv_parse_cmd(&argv, command);
-        argv_printf_cat(&argv, "%s %d %d %s %s %s", arg, tun_mtu, link_mtu,
+        argv_printf_cat(&argv, "%s %d 0 %s %s %s", arg, tun_mtu,
                         ifconfig_local, ifconfig_remote, context);
         argv_msg(M_INFO, &argv);
         openvpn_run_script(&argv, es, S_FATAL, "--up/--down");
@@ -1848,7 +1843,6 @@  do_open_tun(struct context *c)
 #endif
                 dev_type_string(c->options.dev, c->options.dev_type),
                 TUN_MTU_SIZE(&c->c2.frame),
-                EXPANDED_SIZE(&c->c2.frame),
                 print_in_addr_t(c->c1.tuntap->local, IA_EMPTY_IF_UNDEF, &gc),
                 print_in_addr_t(c->c1.tuntap->remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
                 "init",
@@ -1898,7 +1892,6 @@  else
 #endif
                     dev_type_string(c->options.dev, c->options.dev_type),
                     TUN_MTU_SIZE(&c->c2.frame),
-                    EXPANDED_SIZE(&c->c2.frame),
                     print_in_addr_t(c->c1.tuntap->local, IA_EMPTY_IF_UNDEF, &gc),
                     print_in_addr_t(c->c1.tuntap->remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
                     "restart",
@@ -1978,7 +1971,6 @@  do_close_tun(struct context *c, bool force)
 #endif
                             NULL,
                             TUN_MTU_SIZE(&c->c2.frame),
-                            EXPANDED_SIZE(&c->c2.frame),
                             print_in_addr_t(local, IA_EMPTY_IF_UNDEF, &gc),
                             print_in_addr_t(remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
                             "init",
@@ -2009,7 +2001,6 @@  do_close_tun(struct context *c, bool force)
 #endif
                         NULL,
                         TUN_MTU_SIZE(&c->c2.frame),
-                        EXPANDED_SIZE(&c->c2.frame),
                         print_in_addr_t(local, IA_EMPTY_IF_UNDEF, &gc),
                         print_in_addr_t(remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
                         "init",
@@ -2048,7 +2039,6 @@  do_close_tun(struct context *c, bool force)
 #endif
                             NULL,
                             TUN_MTU_SIZE(&c->c2.frame),
-                            EXPANDED_SIZE(&c->c2.frame),
                             print_in_addr_t(local, IA_EMPTY_IF_UNDEF, &gc),
                             print_in_addr_t(remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
                             "restart",