Navigation Menu

Skip to content

Commit

Permalink
trigger periodic TNCC even if we have no packets to receive from oNCP…
Browse files Browse the repository at this point in the history
…, and don't use server's interval if zero

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
  • Loading branch information
dlenski committed Apr 21, 2020
1 parent 0e4fd86 commit bffb198
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion auth-juniper.c
Expand Up @@ -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"),
Expand Down
11 changes: 6 additions & 5 deletions oncp.c
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit bffb198

Please sign in to comment.