]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Remove link_mtu parameter when running up/down scripts
authorArne Schwabe <arne@rfc2549.org>
Sat, 1 Jan 2022 16:25:26 +0000 (17:25 +0100)
committerGert Doering <gert@greenie.muc.de>
Thu, 3 Feb 2022 12:24:44 +0000 (13:24 +0100)
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 parameter 0.

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>
Changes.rst
doc/man-sections/script-options.rst
src/openvpn/init.c

index cf6a2f86da4452e5e72844998dc1d02c3908affa..7d6fb7f7241742ea3ff152913060d5bc0137728b 100644 (file)
@@ -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
 ==========================
index 22990f4f4854e84cd9ad66ee71a6fda588c2d45a..77877a5d65374a9d8510d65b1c93619a4a6eee01 100644 (file)
@@ -376,15 +376,17 @@ SCRIPT HOOKS
   For ``--dev tun`` execute as:
   ::
 
-      cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip [init | restart]
+      cmd tun_dev tun_mtu 0 ifconfig_local_ip ifconfig_remote_ip [init | restart]
 
   For ``--dev tap`` execute as:
   ::
 
-       cmd tap_dev tap_mtu link_mtu ifconfig_local_ip ifconfig_netmask [init | restart]
+       cmd tap_dev tap_mtu 0 ifconfig_local_ip ifconfig_netmask [init | restart]
 
   See the `Environmental Variables`_ section below for additional
-  parameters passed as environmental variables.
+  parameters passed as environmental variables.  The ``0`` argument
+  used to be ``link_mtu`` which is no longer passed to scripts - to
+  keep the argument order, it was replaced with ``0``.
 
   Note that if ``cmd`` includes arguments, all OpenVPN-generated arguments
   will be appended to them to build an argument list with which the
@@ -664,9 +666,9 @@ instances.
     ``--client-connect`` and ``--client-disconnect`` scripts.
 
 :code:`link_mtu`
-    The maximum packet size (not including the IP header) of tunnel data in
-    UDP tunnel transport mode. Set prior to ``--up`` or ``--down`` script
-    execution.
+    No longer passed to scripts since OpenVPN 2.6.0.  Used to be the
+    maximum packet size (not including the IP header) of tunnel data in
+    UDP tunnel transport mode.
 
 :code:`local`
     The ``--local`` parameter. Set on program initiation and reset on
index 9ea6dacf3e4f512948f9f0cd7ecfee8c79b534f6..8e1e43cbb17b41d42353357fe48402af83bbf450 100644 (file)
@@ -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");
@@ -1784,7 +1779,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",
@@ -1834,7 +1828,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",
@@ -1914,7 +1907,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",
@@ -1945,7 +1937,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",
@@ -1984,7 +1975,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",