Skip to contentSkip to conversation

Remove push_reply_deferred variable

PATCH In review Arne Schwabe 3 participants 3 messages Jul 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove push_reply_deferred variable

The variable has no useful function (anymore?).

There is only one place where this variable was checked

    else if (!c->c2.push_reply_deferred && c->c2.context_auth == CAS_SUCCEEDED)

This condition also depends on context_auth == CAS_SUCCEEDED but the only code path that sets context_auth = CAS_SUCCEEDED also sets push_reply_deferred = false;

---
 src/openvpn/multi.c   | 7 -------
 src/openvpn/openvpn.h | 1 -
 src/openvpn/push.c    | 2 +-
 3 files changed, 1 insertion(+), 9 deletions(-)
src/openvpn/multi.c +0 -7
index 95b16744..138701a9 100644
@@ -828,8 +828,6 @@ multi_create_instance(struct multi_context *m, const struct mroute_addr *real)
     mi->did_cid_hash = true;
 #endif
 
-    mi->context.c2.push_reply_deferred = true;
-
 #ifdef ENABLE_ASYNC_PUSH
     mi->context.c2.push_request_received = false;
     mi->inotify_watch = -1;
@@ -2109,11 +2107,6 @@ script_failed:
 
         gc_free(&gc);
     }
-
-    /*
-     * Reply now to client's PUSH_REQUEST query
-     */
-    mi->context.c2.push_reply_deferred = false;
 }
 
 #ifdef ENABLE_ASYNC_PUSH
src/openvpn/openvpn.h +0 -1
index 1afc3a92..4609af3e 100644
@@ -432,7 +432,6 @@ struct context_2
 #if P2MP
 
     /* --ifconfig endpoints to be pushed to client */
-    bool push_reply_deferred;
 #ifdef ENABLE_ASYNC_PUSH
     bool push_request_received;
 #endif
src/openvpn/push.c +1 -1
index 369cd6a4..56d652a3 100644
@@ -803,7 +803,7 @@ process_incoming_push_request(struct context *c)
         send_auth_failed(c, client_reason);
         ret = PUSH_MSG_AUTH_FAILURE;
     }
-    else if (!c->c2.push_reply_deferred && c->c2.context_auth == CAS_SUCCEEDED)
+    else if (c->c2.context_auth == CAS_SUCCEEDED)
     {
         time_t now;
 
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw

Explanation makes sense - double checked that this is indeed the case.

Compiled and smoke-tested.

to 2. heinäk. 2020 klo 15.53 Arne Schwabe ([email protected]...) kirjoitti:

Quoted 77 lines

The variable has no useful function (anymore?).

There is only one place where this variable was checked

    else if (!c->c2.push_reply_deferred && c->c2.context_auth == CAS_SUCCEEDED)

This condition also depends on context_auth == CAS_SUCCEEDED but the only code path that sets context_auth = CAS_SUCCEEDED also sets push_reply_deferred = false;

---
 src/openvpn/multi.c   | 7 -------
 src/openvpn/openvpn.h | 1 -
 src/openvpn/push.c    | 2 +-
 3 files changed, 1 insertion(+), 9 deletions(-)
src/openvpn/multi.c +0 -7
index 95b16744..138701a9 100644
@@ -828,8 +828,6 @@ multi_create_instance(struct multi_context *m, const struct mroute_addr *real)
     mi->did_cid_hash = true;
 #endif
 
-    mi->context.c2.push_reply_deferred = true;
-
 #ifdef ENABLE_ASYNC_PUSH
     mi->context.c2.push_request_received = false;
     mi->inotify_watch = -1;
@@ -2109,11 +2107,6 @@ script_failed:
 
         gc_free(&gc);
     }
-
-    /*
-     * Reply now to client's PUSH_REQUEST query
-     */
-    mi->context.c2.push_reply_deferred = false;
 }
 
 #ifdef ENABLE_ASYNC_PUSH
src/openvpn/openvpn.h +0 -1
index 1afc3a92..4609af3e 100644
@@ -432,7 +432,6 @@ struct context_2
 #if P2MP
 
     /* --ifconfig endpoints to be pushed to client */
-    bool push_reply_deferred;
 #ifdef ENABLE_ASYNC_PUSH
     bool push_request_received;
 #endif
src/openvpn/push.c +1 -2
index 369cd6a4..56d652a3 100644
@@ -803,7 +803,7 @@ process_incoming_push_request(struct context *c)
         send_auth_failed(c, client_reason);
         ret = PUSH_MSG_AUTH_FAILURE;
     }
-    else if (!c->c2.push_reply_deferred && c->c2.context_auth == CAS_SUCCEEDED)
+    else if (c->c2.context_auth == CAS_SUCCEEDED)
     {
         time_t now;
 
--

2.26.2

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Signature · 1 line
-Lev
#2 lore raw
In reply to Arne Schwabe

Your patch has been applied to the master branch.

(I *have* test-compiled this one)

commit 182a2fdd91c5d7a0f6e051182e833f2c7f460cb3

Author: Arne Schwabe
Date:   Thu Jul 2 14:52:24 2020 +0200
     Remove push_reply_deferred variable

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Lev Stipakov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg20186.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering