The `openconnect_set_dpd()` API function, and the command-line option
`--force-dpd=SEC`, specify an exact DPD (Dead Peer Detection) interval for
the client, which is intended to override the server-specified value.
However, several protocols
would simply *ignore* the specified interval, and accept the
server's interval, if the server's interval was *less* than the one
specified via API or command-line.
- AnyConnect/ocserv has behaved this way since the `--force-dpd` option was
first added in 2012 (see
54784befa190a670a7c33661e505415eaaab8dd1)
- ESP support, added for oNCP/Pulse, copied this behavior
- Fortinet copied this behavior
- Array copied this behavior
This behavior can cause problems for protocols where DPD, or reconnection in
general, is broken, and where a user wishes to specify a long interval (e.g.
`--force-dpd=99999`) to effectively disable DPD. Specifically, Fortinet is
affected by this; see
https://gitlab.com/openconnect/openconnect/-/issues/334#note_732774445.
The straightforward solution here is just to make the `--force-dpd` option
do what it says, and set the client's DPD interval unconditionally.
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
/* We don't support DPD yet...*/
if (dpd) {
- if (!vpninfo->ssl_times.dpd || vpninfo->ssl_times.dpd > dpd)
+ if (!vpninfo->ssl_times.dpd)
vpninfo->ssl_times.dpd = dpd;
- if (!vpninfo->dtls_times.dpd || vpninfo->dtls_times.dpd > dpd)
+ if (!vpninfo->dtls_times.dpd)
vpninfo->dtls_times.dpd = dpd;
}
vpninfo->dtls_times.keepalive = atol(colon);
} else if (!strcmp(buf + i, "DPD")) {
int j = atol(colon);
- if (j && (!vpninfo->dtls_times.dpd || j < vpninfo->dtls_times.dpd))
+ if (j && !vpninfo->dtls_times.dpd)
vpninfo->dtls_times.dpd = j;
} else if (!strcmp(buf + i, "Rekey-Method")) {
if (!strcmp(colon, "new-tunnel"))
vpninfo->idle_timeout = atol(colon);
} else if (!strcmp(buf + 7, "DPD")) {
int j = atol(colon);
- if (j && (!vpninfo->ssl_times.dpd || j < vpninfo->ssl_times.dpd))
+ if (j && !vpninfo->ssl_times.dpd)
vpninfo->ssl_times.dpd = j;
} else if (!strcmp(buf + 7, "Rekey-Time")) {
vpninfo->ssl_times.rekey = atol(colon);
vpninfo->dtls_state == DTLS_NOSECRET)
return -EINVAL;
- if (vpninfo->esp_ssl_fallback)
- vpninfo->dtls_times.dpd = vpninfo->esp_ssl_fallback;
- else
- vpninfo->dtls_times.dpd = vpninfo->dtls_attempt_period;
+ /* XX: set ESP DPD interval if not already set */
+ if (!vpninfo->dtls_times.dpd) {
+ if (vpninfo->esp_ssl_fallback)
+ vpninfo->dtls_times.dpd = vpninfo->esp_ssl_fallback;
+ else
+ vpninfo->dtls_times.dpd = vpninfo->dtls_attempt_period;
+ }
print_esp_keys(vpninfo, _("incoming"), &vpninfo->esp_in[vpninfo->current_esp_in]);
print_esp_keys(vpninfo, _("outgoing"), &vpninfo->esp_out);
vpn_progress(vpninfo, PRG_INFO, _("Idle timeout is %d minutes.\n"), sec/60);
} else if (xmlnode_is_named(xml_node, "dtls-config") && !xmlnode_get_prop(xml_node, "heartbeat-interval", &s)) {
int sec = atoi(s);
- if (sec && (!vpninfo->dtls_times.dpd || sec < vpninfo->dtls_times.dpd))
+ if (sec && !vpninfo->dtls_times.dpd)
vpninfo->dtls_times.dpd = vpninfo->ssl_times.dpd = sec;
} else if (xmlnode_is_named(xml_node, "auth-ses")) {
/* These settings were apparently added in v6.2.1 of the Fortigate server,