[PATCH V2 02/11] mainloop: Fix pause/resume on gateways without DTLS

Kevin Cernekee cernekee at gmail.com
Mon Feb 8 22:34:08 PST 2016

Some gateways have DTLS disabled, so they do not send any X-DTLS-*
options upon connection.  This causes vpninfo->dtls_state to remain in
DTLS_SECRET state forever.  Currently we override this state to
DTLS_SLEEPING on pause/resume, which is bad because the DTLS mainloop
will get invoked on reconnection and it will start printing
"No DTLS address" errors on every packet.

Instead we should check for (vpninfo->dtls_state > DTLS_DISABLED), as is
done elsewhere in the code.

Reported-by: Holger Dell <holger.dell at gmail.com>
Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
 mainloop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mainloop.c b/mainloop.c
index 8a830d795c2f..8b7b9a55fc22 100644
--- a/mainloop.c
+++ b/mainloop.c
@@ -250,7 +250,7 @@ int openconnect_mainloop(struct openconnect_info *vpninfo,
 			/* close all connections and wait for the user to call
 			   openconnect_mainloop() again */
 			openconnect_close_https(vpninfo, 0);
-			if (vpninfo->dtls_state != DTLS_DISABLED) {
+			if (vpninfo->dtls_state > DTLS_DISABLED) {
 				vpninfo->dtls_state = DTLS_SLEEPING;
 				vpninfo->new_dtls_started = 0;

More information about the openconnect-devel mailing list