Skip to contentSkip to conversation

Connection entry {tun, link}_mtu_defined not set correctly

PATCH In review David Sommerseth 3 participants 4 messages Feb 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Connection entry {tun, link}_mtu_defined not set correctly

Commit 76809cae0eae07817160b423d3f9551df1a1d68e enabled setting MTU variables inside <connection> blocks. But in that process, the tun_mtu_defined and link_mtu_defined was not set as it should.

By moving this out of the options_postprocess_mutate_invariant() function and into options_postprocess_mutate_ce(), these variables get these *_mtu_defined variables are set correctly in each connection entry.

---
 options.c |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)
options.c +17 -15
index 5e972b1..43e9e27 100644
@@ -2395,6 +2395,8 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
 static void
 options_postprocess_mutate_ce (struct options *o, struct connection_entry *ce)
 {
+  const int dev = dev_type_enum (o->dev, o->dev_type);
+
 #if P2MP_SERVER
   if (o->server_defined || o->server_bridge_defined || o->server_bridge_proxy_dhcp)
     {
@@ -2441,6 +2443,21 @@ options_postprocess_mutate_ce (struct options *o, struct connection_entry *ce)
 #endif      
     }
 
+  /*
+   * Set MTU defaults
+   */
+  {
+    if (!ce->tun_mtu_defined && !ce->link_mtu_defined)
+      {
+	ce->tun_mtu_defined = true;
+      }
+    if ((dev == DEV_TYPE_TAP) && !ce->tun_mtu_extra_defined)
+      {
+	ce->tun_mtu_extra_defined = true;
+	ce->tun_mtu_extra = TAP_MTU_EXTRA_DEFAULT;
+      }
+  }
+
 }
 
 static void
@@ -2455,21 +2472,6 @@ options_postprocess_mutate_invariant (struct options *options)
   if (options->inetd == INETD_NOWAIT)
     options->ifconfig_noexec = true;
 
-  /*
-   * Set MTU defaults
-   */
-  {
-    if (!options->ce.tun_mtu_defined && !options->ce.link_mtu_defined)
-      {
-	options->ce.tun_mtu_defined = true;
-      }
-    if ((dev == DEV_TYPE_TAP) && !options->ce.tun_mtu_extra_defined)
-      {
-	options->ce.tun_mtu_extra_defined = true;
-	options->ce.tun_mtu_extra = TAP_MTU_EXTRA_DEFAULT;
-      }
-  }
-
 #ifdef WIN32
   if ((dev == DEV_TYPE_TUN || dev == DEV_TYPE_TAP) && !options->route_delay_defined)
     {
Signature · 1 line
1.7.4.4
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · David Sommerseth

Commit 76809cae0eae07817160b423d3f9551df1a1d68e enabled setting MTU variables inside <connection> blocks. But in that process, the tun_mtu_defined and link_mtu_defined was not set as it should.

Quoted 9 lines

By moving this out of the options_postprocess_mutate_invariant() function and into options_postprocess_mutate_ce(), these variables get these *_mtu_defined variables are set correctly in each connection entry.

+++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-)

Just a bit more useful info, why this is needed. If you just put the
- --remote option in a connection block like this:

<connection>
remote x.x.x.x 1194
</connection>

Then you will get an assert() error in mtu.c in the frame_finalize().

With this patch, it will work as expected, both with no connection blocks, one like the example above or more connection blocks.

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk86QbAACgkQDC186MBRfrrM3wCdG5sB6PPj3ruB/1eX1QtbPFqS xYEAn3JWSDWWo3Tm5YYF39Gk/+P17eSV
=h8Dd
-----END PGP SIGNATURE-----

#2 lore raw
In reply to David Sommerseth

Hi,

Quoted 10 lines · David Sommerseth

Commit 76809cae0eae07817160b423d3f9551df1a1d68e enabled setting MTU variables inside <connection> blocks. But in that process, the tun_mtu_defined and link_mtu_defined was not set as it should.

By moving this out of the options_postprocess_mutate_invariant() function and into options_postprocess_mutate_ce(), these variables get these *_mtu_defined variables are set correctly in each connection entry.

ACK.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#3 lore raw
In reply to David Sommerseth

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · David Sommerseth

Commit 76809cae0eae07817160b423d3f9551df1a1d68e enabled setting MTU variables inside <connection> blocks. But in that process, the tun_mtu_defined and link_mtu_defined was not set as it should.

Quoted 9 lines

By moving this out of the options_postprocess_mutate_invariant() function and into options_postprocess_mutate_ce(), these variables get these *_mtu_defined variables are set correctly in each connection entry.

32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-)

Applied to master and pushed to -stable and -testing

commit 86e8754cd83d6c91a1ead344aea8c0ee131a9f26

Author: David Sommerseth <[email protected]...>
Date:   Tue Feb 14 11:45:27 2012 +0100
    Connection entry {tun,link}_mtu_defined not set correctly

    Signed-off-by: David Sommerseth <[email protected]...>
    Acked-by: Gert Doering <[email protected]...>

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk86s/UACgkQDC186MBRfrqcSQCfYj0KKbHutmaPPfm8jd+hh1RU QKsAn2Me6yfjxaVb1qoXpcKoJTpumyop
=gEeV
-----END PGP SIGNATURE-----