From: Arne Schwabe Date: Sat, 1 Jan 2022 16:25:26 +0000 (+0100) Subject: Remove link_mtu parameter when running up/down scripts X-Git-Tag: v2.6_beta1~293 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3780ce0e16c2cd06e77357a30df3c43595c98cab;p=thirdparty%2Fopenvpn.git 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 Acked-by: Gert Doering 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 --- diff --git a/Changes.rst b/Changes.rst index cf6a2f86d..7d6fb7f72 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/doc/man-sections/script-options.rst b/doc/man-sections/script-options.rst index 22990f4f4..77877a5d6 100644 --- a/doc/man-sections/script-options.rst +++ b/doc/man-sections/script-options.rst @@ -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 diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 9ea6dacf3..8e1e43cbb 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"); @@ -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",