From: Daniel Lenski Date: Wed, 8 Apr 2020 06:25:17 +0000 (-0700) Subject: trigger periodic TNCC even if we have no packets to receive from oNCP, and don't... X-Git-Tag: v8.09~14^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bffb1981d0d6b8d88c2db6964dd0a3c40893001c;p=users%2Fdwmw2%2Fopenconnect.git trigger periodic TNCC even if we have no packets to receive from oNCP, and don't use server's interval if zero Signed-off-by: Daniel Lenski --- diff --git a/auth-juniper.c b/auth-juniper.c index bafbae58..7ca1361a 100644 --- a/auth-juniper.c +++ b/auth-juniper.c @@ -498,7 +498,7 @@ static int tncc_preauth(struct openconnect_info *vpninfo) goto respfail; if (len > 0) { int interval = atoi(recvbuf); - if (interval != vpninfo->trojan_interval) { + if (interval != 0) { vpninfo->trojan_interval = interval; vpn_progress(vpninfo, PRG_DEBUG, _("Got reauth interval from TNCC: %d seconds\n"), diff --git a/oncp.c b/oncp.c index 72b5ed77..243143da 100644 --- a/oncp.c +++ b/oncp.c @@ -899,6 +899,12 @@ int oncp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable) int ret; int work_done = 0; + /* Periodic TNCC */ + if (trojan_check_deadline(vpninfo, timeout)) { + oncp_send_tncc_command(vpninfo, 0); + return 1; + } + if (vpninfo->ssl_fd == -1) goto do_reconnect; @@ -915,11 +921,6 @@ int oncp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable) handle that */ int receive_mtu = MAX(16384, vpninfo->ip_info.mtu); - if (trojan_check_deadline(vpninfo, timeout)) { - /* Periodic TNCC */ - oncp_send_tncc_command(vpninfo, 0); - } - len = receive_mtu + vpninfo->pkt_trailer; if (!vpninfo->cstp_pkt) { vpninfo->cstp_pkt = malloc(sizeof(struct pkt) + len);