Browse code

Remove link_mtu parameter when running up/down scripts

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>

Arne Schwabe authored on 2022/01/02 01:25:26
Showing 3 changed files
... ...
@@ -128,6 +128,8 @@ User-visible Changes
128 128
 - CHACHA20-POLY1305 is included in the default of ``--data-ciphers`` when available.
129 129
 - Option ``--prng`` is ignored as we rely on the SSL library random number generator.
130 130
 - Option ``--nobind`` is default when ``--client`` or ``--pull`` is used in the configuration
131
+- :code:`link_mtu` parameter is removed from environment or replaced with 0 when scripts are
132
+  called with parameters. This parameter is unreliable and no longer internally calculated.
131 133
 
132 134
 Overview of changes in 2.5
133 135
 ==========================
... ...
@@ -376,15 +376,17 @@ SCRIPT HOOKS
376 376
   For ``--dev tun`` execute as:
377 377
   ::
378 378
 
379
-      cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip [init | restart]
379
+      cmd tun_dev tun_mtu 0 ifconfig_local_ip ifconfig_remote_ip [init | restart]
380 380
 
381 381
   For ``--dev tap`` execute as:
382 382
   ::
383 383
 
384
-       cmd tap_dev tap_mtu link_mtu ifconfig_local_ip ifconfig_netmask [init | restart]
384
+       cmd tap_dev tap_mtu 0 ifconfig_local_ip ifconfig_netmask [init | restart]
385 385
 
386 386
   See the `Environmental Variables`_ section below for additional
387
-  parameters passed as environmental variables.
387
+  parameters passed as environmental variables.  The ``0`` argument
388
+  used to be ``link_mtu`` which is no longer passed to scripts - to
389
+  keep the argument order, it was replaced with ``0``.
388 390
 
389 391
   Note that if ``cmd`` includes arguments, all OpenVPN-generated arguments
390 392
   will be appended to them to build an argument list with which the
... ...
@@ -664,9 +666,9 @@ instances.
664 664
     ``--client-connect`` and ``--client-disconnect`` scripts.
665 665
 
666 666
 :code:`link_mtu`
667
-    The maximum packet size (not including the IP header) of tunnel data in
668
-    UDP tunnel transport mode. Set prior to ``--up`` or ``--down`` script
669
-    execution.
667
+    No longer passed to scripts since OpenVPN 2.6.0.  Used to be the
668
+    maximum packet size (not including the IP header) of tunnel data in
669
+    UDP tunnel transport mode.
670 670
 
671 671
 :code:`local`
672 672
     The ``--local`` parameter. Set on program initiation and reset on
... ...
@@ -113,7 +113,6 @@ run_up_down(const char *command,
113 113
 #endif
114 114
             const char *dev_type,
115 115
             int tun_mtu,
116
-            int link_mtu,
117 116
             const char *ifconfig_local,
118 117
             const char *ifconfig_remote,
119 118
             const char *context,
... ...
@@ -129,7 +128,6 @@ run_up_down(const char *command,
129 129
     }
130 130
     setenv_str(es, "script_context", context);
131 131
     setenv_int(es, "tun_mtu", tun_mtu);
132
-    setenv_int(es, "link_mtu", link_mtu);
133 132
     setenv_str(es, "dev", arg);
134 133
     if (dev_type)
135 134
     {
... ...
@@ -157,11 +155,8 @@ run_up_down(const char *command,
157 157
         struct argv argv = argv_new();
158 158
         ASSERT(arg);
159 159
         argv_printf(&argv,
160
-                    "%s %d %d %s %s %s",
161
-                    arg,
162
-                    tun_mtu, link_mtu,
163
-                    ifconfig_local, ifconfig_remote,
164
-                    context);
160
+                    "%s %d 0 %s %s %s",
161
+                    arg, tun_mtu, ifconfig_local, ifconfig_remote, context);
165 162
 
166 163
         if (plugin_call(plugins, plugin_type, &argv, NULL, es) != OPENVPN_PLUGIN_FUNC_SUCCESS)
167 164
         {
... ...
@@ -177,7 +172,7 @@ run_up_down(const char *command,
177 177
         ASSERT(arg);
178 178
         setenv_str(es, "script_type", script_type);
179 179
         argv_parse_cmd(&argv, command);
180
-        argv_printf_cat(&argv, "%s %d %d %s %s %s", arg, tun_mtu, link_mtu,
180
+        argv_printf_cat(&argv, "%s %d 0 %s %s %s", arg, tun_mtu,
181 181
                         ifconfig_local, ifconfig_remote, context);
182 182
         argv_msg(M_INFO, &argv);
183 183
         openvpn_run_script(&argv, es, S_FATAL, "--up/--down");
... ...
@@ -1784,7 +1779,6 @@ do_open_tun(struct context *c)
1784 1784
 #endif
1785 1785
                 dev_type_string(c->options.dev, c->options.dev_type),
1786 1786
                 TUN_MTU_SIZE(&c->c2.frame),
1787
-                EXPANDED_SIZE(&c->c2.frame),
1788 1787
                 print_in_addr_t(c->c1.tuntap->local, IA_EMPTY_IF_UNDEF, &gc),
1789 1788
                 print_in_addr_t(c->c1.tuntap->remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
1790 1789
                 "init",
... ...
@@ -1834,7 +1828,6 @@ else
1834 1834
 #endif
1835 1835
                     dev_type_string(c->options.dev, c->options.dev_type),
1836 1836
                     TUN_MTU_SIZE(&c->c2.frame),
1837
-                    EXPANDED_SIZE(&c->c2.frame),
1838 1837
                     print_in_addr_t(c->c1.tuntap->local, IA_EMPTY_IF_UNDEF, &gc),
1839 1838
                     print_in_addr_t(c->c1.tuntap->remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
1840 1839
                     "restart",
... ...
@@ -1914,7 +1907,6 @@ do_close_tun(struct context *c, bool force)
1914 1914
 #endif
1915 1915
                             NULL,
1916 1916
                             TUN_MTU_SIZE(&c->c2.frame),
1917
-                            EXPANDED_SIZE(&c->c2.frame),
1918 1917
                             print_in_addr_t(local, IA_EMPTY_IF_UNDEF, &gc),
1919 1918
                             print_in_addr_t(remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
1920 1919
                             "init",
... ...
@@ -1945,7 +1937,6 @@ do_close_tun(struct context *c, bool force)
1945 1945
 #endif
1946 1946
                         NULL,
1947 1947
                         TUN_MTU_SIZE(&c->c2.frame),
1948
-                        EXPANDED_SIZE(&c->c2.frame),
1949 1948
                         print_in_addr_t(local, IA_EMPTY_IF_UNDEF, &gc),
1950 1949
                         print_in_addr_t(remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
1951 1950
                         "init",
... ...
@@ -1984,7 +1975,6 @@ do_close_tun(struct context *c, bool force)
1984 1984
 #endif
1985 1985
                             NULL,
1986 1986
                             TUN_MTU_SIZE(&c->c2.frame),
1987
-                            EXPANDED_SIZE(&c->c2.frame),
1988 1987
                             print_in_addr_t(local, IA_EMPTY_IF_UNDEF, &gc),
1989 1988
                             print_in_addr_t(remote_netmask, IA_EMPTY_IF_UNDEF, &gc),
1990 1989
                             "restart",