]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix spurious ignoring of pushed config options (trac#349).
authorJens Wagner <jwagner@hexonet.net>
Tue, 7 Jan 2014 21:07:54 +0000 (22:07 +0100)
committerGert Doering <gert@greenie.muc.de>
Sun, 30 Nov 2014 17:52:41 +0000 (18:52 +0100)
The function incoming_push_message(...) in push.c uses a local variable
option_types_found, that gets passed to do_up(...).

If the server push got split into several parts, only the last part
(PUSH_MSG_REPLY) option_types_found is used for do_up (initilized as 0
locally), the previous ones (PUSH_MSG_CONTINUATION) are ignored.

So e.g. a ping config, pushed by the server in the first push, followed
by a lot of "push route" configs, causing a second push message, will
have the do_up() called, but without e.g. the OPT_P_TIMER flag, so those
options will be silently ignored.

The patch resolves that, by introducing "push_option_types_found" in
"c->options" and using that as storage.

Fix trac bug #349.

Acked-by: Gert Doering <gert@greenie.muc.de>
URL: https://community.openvpn.net/openvpn/ticket/349
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 1aac9a0b7a4046822a0134cd8693a828f2e16576)

options.c
options.h
push.c

index 7a5e35d6642158c2daf3108ca7abb944d158c3b0..0d789fc38f07d01acb734b076ac2f6aef1baffd7 100644 (file)
--- a/options.c
+++ b/options.c
@@ -2377,6 +2377,7 @@ pre_pull_restore (struct options *o)
     }
 
   o->push_continuation = 0;
+  o->push_option_types_found = 0;
 }
 
 #endif
index dd49355712036994a229119c02d5ba5351703ae9..8d1fd0aedef8ab1238743f83fa201931d85875e7 100644 (file)
--- a/options.h
+++ b/options.h
@@ -420,6 +420,7 @@ struct options
   bool client;
   bool pull; /* client pull of config options from server */
   int push_continuation;
+  unsigned int push_option_types_found;
   const char *auth_user_pass_file;
   struct options_pre_pull *pre_pull;
 
diff --git a/push.c b/push.c
index 1367c3eb2676559b4a66b79761145c5a001be84e..a6ec391d7b415bdf616d14b193b2c8fdfe57f445 100644 (file)
--- a/push.c
+++ b/push.c
@@ -161,8 +161,10 @@ incoming_push_message (struct context *c, const struct buffer *buffer)
     msg (D_PUSH_ERRORS, "WARNING: Received bad push/pull message: %s", BSTR (buffer));
   else if (status == PUSH_MSG_REPLY || status == PUSH_MSG_CONTINUATION)
     {
+      c->options.push_option_types_found |= option_types_found;
+
       if (status == PUSH_MSG_REPLY)
-       do_up (c, true, option_types_found); /* delay bringing tun/tap up until --push parms received from remote */
+       do_up (c, true, c->options.push_option_types_found ); /* delay bringing tun/tap up until --push parms received from remote */
       event_timeout_clear (&c->c2.push_request_interval);
     }