aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/stroke
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-10-08 11:31:18 +0200
committerMartin Willi <martin@revosec.ch>2012-10-24 11:34:30 +0200
commita32a8d4a673190d02587c18c9953b648cf93669e (patch)
tree3634b8923ac39856814d750ea5678b03cea3d815 /src/libcharon/plugins/stroke
parent418f4bc7a5a8d581889ca8e7b9da2c6ff0d9b94f (diff)
downloadstrongswan-a32a8d4a673190d02587c18c9953b648cf93669e.tar.bz2
strongswan-a32a8d4a673190d02587c18c9953b648cf93669e.tar.xz
Add stroke IKE rekey counters
Diffstat (limited to 'src/libcharon/plugins/stroke')
-rw-r--r--src/libcharon/plugins/stroke/stroke_counter.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libcharon/plugins/stroke/stroke_counter.c b/src/libcharon/plugins/stroke/stroke_counter.c
index fb8a47a16..b46ca0d6c 100644
--- a/src/libcharon/plugins/stroke/stroke_counter.c
+++ b/src/libcharon/plugins/stroke/stroke_counter.c
@@ -65,6 +65,29 @@ struct private_stroke_counter_t {
spinlock_t *lock;
};
+METHOD(listener_t, ike_rekey, bool,
+ private_stroke_counter_t *this, ike_sa_t *old, ike_sa_t *new)
+{
+ stroke_counter_type_t type;
+ ike_sa_id_t *id;
+
+ id = new->get_id(new);
+ if (id->is_initiator(id))
+ {
+ type = COUNTER_INIT_IKE_SA_REKEY;
+ }
+ else
+ {
+ type = COUNTER_RESP_IKE_SA_REKEY;
+ }
+
+ this->lock->lock(this->lock);
+ this->counter[type]++;
+ this->lock->unlock(this->lock);
+
+ return TRUE;
+}
+
METHOD(stroke_counter_t, destroy, void,
private_stroke_counter_t *this)
{
@@ -81,6 +104,9 @@ stroke_counter_t *stroke_counter_create()
INIT(this,
.public = {
+ .listener = {
+ .ike_rekey = _ike_rekey,
+ },
.destroy = _destroy,
},
.lock = spinlock_create(),