[Openvpn-devel,v3] multi: resume deferred auth through multi_io_action()
Commit Message
From: Gianmarco De Gregori <gianmarco@mandelbit.com>
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 <gianmarco@mandelbit.com>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2047
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2047
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
@@ -2841,7 +2841,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;
@@ -2869,7 +2869,7 @@
if (mi)
{
/* continue authentication, perform NCP negotiation and send push_reply */
- multi_process_post(m, mi, mpp_flags);
+ multi_io_action(m, mi, TA_INSTANCE_POST, false);
}
else
{
@@ -382,9 +382,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
@@ -85,6 +85,9 @@
case TA_TUN_WRITE_TIMEOUT:
return "TA_TUN_WRITE_TIMEOUT";
+ case TA_INSTANCE_POST:
+ return "TA_INSTANCE_POST";
+
default:
return "?";
}
@@ -492,6 +495,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);
}
@@ -659,7 +667,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
}
@@ -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