Skip to content

Commit

Permalink
Tell updown script if DPD cleared connection
Browse files Browse the repository at this point in the history
We'd like to know if the connection went down because of loss of network
connectivity (DPD) or some other reason. First step, export that data
out of Libreswan.

[TABLET-2117]
  • Loading branch information
derobert committed Nov 17, 2020
1 parent 1f5cd32 commit 9605337
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions programs/pluto/connections.c
Expand Up @@ -2003,6 +2003,7 @@ struct connection *instantiate(struct connection *c, const ip_address *him,
d->newest_isakmp_sa = SOS_NOBODY;
d->newest_ipsec_sa = SOS_NOBODY;
d->spd.eroute_owner = SOS_NOBODY;
d->dpd_killed = FALSE;

/* reset log file info */
d->log_file_name = NULL;
Expand Down Expand Up @@ -4201,6 +4202,7 @@ void liveness_action(struct connection *c, enum ike_version ike_version)
case DPD_ACTION_CLEAR:
libreswan_log("%s action - clearing connection kind %s", ikev,
enum_name(&connection_kind_names, c->kind));
c->dpd_killed = TRUE;
liveness_clear_connection(c, ikev);
break;

Expand Down
1 change: 1 addition & 0 deletions programs/pluto/connections.h
Expand Up @@ -281,6 +281,7 @@ struct connection {
deltatime_t dpd_delay; /* time between checks */
deltatime_t dpd_timeout; /* time after which we are dead */
enum dpd_action dpd_action; /* what to do when we die */
bool dpd_killed; /* dpd caused connection to end */

bool nat_keepalive; /* Send NAT-T Keep-Alives if we are behind NAT */
bool initial_contact; /* Send INITIAL_CONTACT (RFC-2407) payload? */
Expand Down
2 changes: 2 additions & 0 deletions programs/pluto/kernel.c
Expand Up @@ -493,6 +493,8 @@ static void jam_common_shell_out(jambuf_t *buf, const struct connection *c,

jam(buf, "PLUTO_STACK='%s' ", kernel_ops->kern_name);

jam(buf, "PLUTO_DPD_CLEAR=%i ", (int)c->dpd_killed);

if (c->metric != 0) {
jam(buf, "PLUTO_METRIC=%d ", c->metric);
}
Expand Down

0 comments on commit 9605337

Please sign in to comment.