From e6d6991c815cb4b06efc4b3be4c631e0ef166bc4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 12 Sep 2015 16:17:51 +0100 Subject: [PATCH] Implement `keepalive' site option, to try to keep link always up. --- README | 2 +- debian/changelog | 6 ++++++ site.c | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README b/README index a01156c..98ddec8 100644 --- a/README +++ b/README @@ -390,7 +390,7 @@ site: dict argument [half key-lifetime, or key-lifetime minus 5 mins (mobile: 12 hours), whichever is longer]. keepalive (bool): if True then attempt always to keep a valid session key. - Not actually currently implemented. [false] + [false] log-events (string list): types of events to log for this site unexpected: unexpected key setup packets (may be late retransmissions) setup-init: start of attempt to setup a session key diff --git a/debian/changelog b/debian/changelog index 95d4554..d3be600 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +secnet (0.4.1~~) unstable; urgency=medium + + * Implement `keepalive' site option, to try to keep link always up. + + -- + secnet (0.4.0) unstable; urgency=low Debugging improvements: diff --git a/site.c b/site.c index 70cc316..db78d5f 100644 --- a/site.c +++ b/site.c @@ -296,6 +296,7 @@ struct site { /* configuration information */ string_t localname; string_t remotename; + bool_t keepalive; bool_t local_mobile, peer_mobile; /* Mobile client support */ int32_t transport_peers_max; string_t tunname; /* localname<->remotename by default, used in logs */ @@ -1429,6 +1430,9 @@ static void enter_state_run(struct site *st) memset(st->dhsecret,0,st->dh->len); memset(st->sharedsecret,0,st->sharedsecretlen); set_link_quality(st); + + if (st->keepalive && !current_valid(st)) + initiate_key_setup(st, "keepalive", 0); } static bool_t ensure_resolving(struct site *st) @@ -1967,6 +1971,8 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context, st->localname=dict_read_string(dict, "local-name", True, "site", loc); st->remotename=dict_read_string(dict, "name", True, "site", loc); + st->keepalive=dict_read_bool(dict,"keepalive",False,"site",loc,False); + st->peer_mobile=dict_read_bool(dict,"mobile",False,"site",loc,False); st->local_mobile= dict_read_bool(dict,"local-mobile",False,"site",loc,False); -- 2.30.2