Skip to content

Commit

Permalink
check DPD config
Browse files Browse the repository at this point in the history
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Sep 23, 2008
1 parent 44683f8 commit ada1373
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions dtls.c
Expand Up @@ -159,7 +159,6 @@ static int connect_dtls_socket(struct anyconnect_info *vpninfo, int dtls_port)
vpninfo->dtls_ssl = dtls_ssl;
return 0;
}
static char start_dtls_hdr[8] = {'S', 'T', 'F', 1, 0, 0, 7, 0};

int setup_dtls(struct anyconnect_info *vpninfo)
{
Expand All @@ -181,10 +180,12 @@ int setup_dtls(struct anyconnect_info *vpninfo)
for (i = 0; i < 64; i += 2)
vpninfo->dtls_session_id[i/2] = hex(dtls_opt->value + i);
sessid_found = 1;
} else if (!strcmp(dtls_opt->option, "X-DTLS-Port")) {
} else if (!strcmp(dtls_opt->option + 7, "Port")) {
dtls_port = atol(dtls_opt->value);
} else if (!strcmp(dtls_opt->option, "X-DTLS-Keepalive")) {
} else if (!strcmp(dtls_opt->option + 7, "Keepalive")) {
vpninfo->dtls_keepalive = atol(dtls_opt->value);
} else if (!strcmp(dtls_opt->option + 7, "DPD")) {
vpninfo->dtls_dpd = atol(dtls_opt->value);
}

dtls_opt = dtls_opt->next;
Expand All @@ -201,9 +202,8 @@ int setup_dtls(struct anyconnect_info *vpninfo)
fcntl(vpninfo->dtls_fd, F_SETFL, fcntl(vpninfo->dtls_fd, F_GETFL) | O_NONBLOCK);

vpn_add_pollfd(vpninfo, vpninfo->ssl_fd, POLLIN|POLLHUP|POLLERR);
vpninfo->last_ssl_tx = time(NULL);
vpninfo->last_ssl_tx = vpninfo->last_ssl_tx = time(NULL);

SSL_write(vpninfo->https_ssl, start_dtls_hdr, sizeof(start_dtls_hdr));
return 0;
}

Expand Down
6 changes: 4 additions & 2 deletions ssl.c
Expand Up @@ -234,6 +234,8 @@ static int start_ssl_connection(struct anyconnect_info *vpninfo)

if (!strcmp(buf + 7, "Keepalive")) {
vpninfo->ssl_keepalive = atol(colon);
} else if (!strcmp(buf + 7, "DPD")) {
vpninfo->ssl_dpd = atol(colon);
} else if (!strcmp(buf + 7, "Content-Encoding")) {
if (!strcmp(colon, "deflate"))
vpninfo->deflate = 1;
Expand All @@ -253,9 +255,9 @@ static int start_ssl_connection(struct anyconnect_info *vpninfo)
BIO_set_nbio(SSL_get_wbio(vpninfo->https_ssl),1);

fcntl(vpninfo->ssl_fd, F_SETFL, fcntl(vpninfo->ssl_fd, F_GETFL) | O_NONBLOCK);

vpninfo->ssl_pfd = vpn_add_pollfd(vpninfo, vpninfo->ssl_fd, POLLIN|POLLHUP|POLLERR);
vpninfo->last_ssl_tx = time(NULL);

vpninfo->last_ssl_tx = vpninfo->last_ssl_tx = time(NULL);
return 0;
}

Expand Down

0 comments on commit ada1373

Please sign in to comment.