Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2047?usp=email

to review the following change.


Change subject: multi: resume deferred auth through multi_io_action()
......................................................................

multi: resume deferred auth through multi_io_action()

multi_process_file_closed() is the last place where multi_process_post()
runs without a multi_io_action() following it, so any output it produces
stays in m->pending across event_wait().

Add TA_INSTANCE_POST, which only runs multi_process_post() on the given
instance, and use it so pending output is flushed as for every other
event. Likewise, an instance signalled during this post-processing is
now closed right away instead of on its next event. This is needed
before m->pending can be removed.

Change-Id: I49777902951d3a05c48cddd0d33c14e028e5d706
Signed-off-by: Gianmarco De Gregori <[email protected]>
---
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/multi_io.c
M src/openvpn/multi_io.h
4 files changed, 13 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/47/2047/1

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index cf6a584..2841a81 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -2829,7 +2829,7 @@
  * (or be deferred again by client-connect)
  */
 void
-multi_process_file_closed(struct multi_context *m, const unsigned int 
mpp_flags)
+multi_process_file_closed(struct multi_context *m)
 {
     char buffer[INOTIFY_EVENT_BUFFER_SIZE];
     ssize_t buffer_i = 0;
@@ -2857,7 +2857,7 @@
             if (mi)
             {
                 /* continue authentication, perform NCP negotiation and send 
push_reply */
-                multi_process_post(m, mi, mpp_flags);
+                multi_io_action(m, mi, NULL, TA_INSTANCE_POST, false);
             }
             else
             {
diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h
index 5aed191..31635ba 100644
--- a/src/openvpn/multi.h
+++ b/src/openvpn/multi.h
@@ -380,9 +380,8 @@
  * Continues authentication and sends push_repl
  *
  * @param m multi_context
- * @param mpp_flags
  */
-void multi_process_file_closed(struct multi_context *m, const unsigned int 
mpp_flags);
+void multi_process_file_closed(struct multi_context *m);

 #endif

diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c
index d1b7bf4..24a6918 100644
--- a/src/openvpn/multi_io.c
+++ b/src/openvpn/multi_io.c
@@ -85,6 +85,9 @@
         case TA_TUN_WRITE_TIMEOUT:
             return "TA_TUN_WRITE_TIMEOUT";

+        case TA_INSTANCE_POST:
+            return "TA_INSTANCE_POST";
+
         default:
             return "?";
     }
@@ -500,6 +503,11 @@
             multi_process_post(m, mi, mpp_flags);
             break;

+        case TA_INSTANCE_POST:
+            ASSERT(mi);
+            multi_process_post(m, mi, mpp_flags);
+            break;
+
         default:
             msg(M_FATAL, "MULTI IO: multi_io_dispatch, unhandled action=%d", 
action);
     }
@@ -670,7 +678,7 @@
 #ifdef ENABLE_ASYNC_PUSH
                 else if (e->arg == MULTI_IO_FILE_CLOSE_WRITE)
                 {
-                    multi_process_file_closed(m, MPP_PRE_SELECT | 
MPP_RECORD_TOUCH);
+                    multi_process_file_closed(m);
                 }
 #endif
         }
diff --git a/src/openvpn/multi_io.h b/src/openvpn/multi_io.h
index 7ae25c6..591225c 100644
--- a/src/openvpn/multi_io.h
+++ b/src/openvpn/multi_io.h
@@ -44,6 +44,7 @@
 #define TA_INITIAL               8
 #define TA_TIMEOUT               9
 #define TA_TUN_WRITE_TIMEOUT     10
+#define TA_INSTANCE_POST         11

 /*
  * I/O state and events tracker

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2047?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I49777902951d3a05c48cddd0d33c14e028e5d706
Gerrit-Change-Number: 2047
Gerrit-PatchSet: 1
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to