aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/charon/plugins/stroke/stroke_list.c10
-rw-r--r--src/charon/sa/child_sa.c22
-rw-r--r--src/charon/sa/child_sa.h6
-rw-r--r--src/charon/sa/ike_sa.c6
-rw-r--r--src/charon/sa/tasks/child_delete.c6
5 files changed, 15 insertions, 35 deletions
diff --git a/src/charon/plugins/stroke/stroke_list.c b/src/charon/plugins/stroke/stroke_list.c
index 1a6b5e899..591fd3cae 100644
--- a/src/charon/plugins/stroke/stroke_list.c
+++ b/src/charon/plugins/stroke/stroke_list.c
@@ -175,8 +175,6 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
if (all)
{
- bool change;
-
fprintf(out, "\n%12s{%d}: ", child_sa->get_name(child_sa),
child_sa->get_reqid(child_sa));
@@ -209,22 +207,22 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
}
}
- bytes_in = child_sa->get_usebytes(child_sa, TRUE, &change);
+ bytes_in = child_sa->get_usebytes(child_sa, TRUE);
fprintf(out, ", %lu bytes_i", bytes_in);
if (bytes_in)
{
- use_in = child_sa->get_usetime(child_sa, TRUE, change);
+ use_in = child_sa->get_usetime(child_sa, TRUE);
if (use_in)
{
fprintf(out, " (%ds ago)", now - use_in);
}
}
- bytes_out = child_sa->get_usebytes(child_sa, FALSE, &change);
+ bytes_out = child_sa->get_usebytes(child_sa, FALSE);
fprintf(out, ", %lu bytes_o", bytes_out);
if (bytes_out)
{
- use_out = child_sa->get_usetime(child_sa, FALSE, change);
+ use_out = child_sa->get_usetime(child_sa, FALSE);
if (use_out)
{
fprintf(out, " (%ds ago)", now - use_out);
diff --git a/src/charon/sa/child_sa.c b/src/charon/sa/child_sa.c
index e649b53e2..e316a5055 100644
--- a/src/charon/sa/child_sa.c
+++ b/src/charon/sa/child_sa.c
@@ -377,17 +377,12 @@ static enumerator_t* create_policy_enumerator(private_child_sa_t *this)
/**
* Implementation of child_sa_t.get_usetime
*/
-static u_int32_t get_usetime(private_child_sa_t *this, bool inbound, bool update)
+static u_int32_t get_usetime(private_child_sa_t *this, bool inbound)
{
enumerator_t *enumerator;
traffic_selector_t *my_ts, *other_ts;
u_int32_t last_use = 0;
-
- if (!update)
- {
- return (inbound) ? this->my_usetime : this->other_usetime;
- }
-
+
enumerator = create_policy_enumerator(this);
while (enumerator->enumerate(enumerator, &my_ts, &other_ts))
{
@@ -433,13 +428,12 @@ static u_int32_t get_usetime(private_child_sa_t *this, bool inbound, bool update
/**
* Implementation of child_sa_t.get_usebytes
*/
-static u_int64_t get_usebytes(private_child_sa_t *this, bool inbound, bool *change)
+static u_int64_t get_usebytes(private_child_sa_t *this, bool inbound)
{
status_t status;
u_int64_t bytes;
- *change = FALSE;
- if (inbound)
+ if (inbound)
{
if (this->my_spi)
{
@@ -448,9 +442,7 @@ static u_int64_t get_usebytes(private_child_sa_t *this, bool inbound, bool *chan
this->my_spi, this->protocol, &bytes);
if (status == SUCCESS && bytes > this->my_usebytes)
{
- *change = TRUE;
this->my_usebytes = bytes;
- return bytes;
}
}
return this->my_usebytes;
@@ -464,9 +456,7 @@ static u_int64_t get_usebytes(private_child_sa_t *this, bool inbound, bool *chan
this->other_spi, this->protocol, &bytes);
if (status == SUCCESS && bytes > this->other_usebytes)
{
- *change = TRUE;
this->other_usebytes = bytes;
- return bytes;
}
}
return this->other_usebytes;
@@ -851,8 +841,8 @@ child_sa_t * child_sa_create(host_t *me, host_t* other,
this->public.get_proposal = (proposal_t*(*)(child_sa_t*))get_proposal;
this->public.set_proposal = (void(*)(child_sa_t*, proposal_t *proposal))set_proposal;
this->public.get_lifetime = (u_int32_t(*)(child_sa_t*, bool))get_lifetime;
- this->public.get_usetime = (u_int32_t(*)(child_sa_t*, bool, bool))get_usetime;
- this->public.get_usebytes = (u_int64_t(*)(child_sa_t*, bool, bool*))get_usebytes;
+ this->public.get_usetime = (u_int32_t(*)(child_sa_t*, bool))get_usetime;
+ this->public.get_usebytes = (u_int64_t(*)(child_sa_t*, bool))get_usebytes;
this->public.has_encap = (bool(*)(child_sa_t*))has_encap;
this->public.get_ipcomp = (ipcomp_transform_t(*)(child_sa_t*))get_ipcomp;
this->public.set_ipcomp = (void(*)(child_sa_t*,ipcomp_transform_t))set_ipcomp;
diff --git a/src/charon/sa/child_sa.h b/src/charon/sa/child_sa.h
index 559e57c9a..4f7f02214 100644
--- a/src/charon/sa/child_sa.h
+++ b/src/charon/sa/child_sa.h
@@ -240,19 +240,17 @@ struct child_sa_t {
* Get last use time of the CHILD_SA.
*
* @param inbound TRUE for inbound traffic, FALSE for outbound
- * @param update update time of last use via kernel query
* @return time of last use in seconds
*/
- u_int32_t (*get_usetime)(child_sa_t *this, bool inbound, bool update);
+ u_int32_t (*get_usetime)(child_sa_t *this, bool inbound);
/**
* Get number of bytes processed by CHILD_SA.
*
* @param inbound TRUE for inbound traffic, FALSE for outbound
- * @param[out] change TRUE if change since last query, FALSE else
* @return number of processed bytes
*/
- u_int64_t (*get_usebytes)(child_sa_t *this, bool inbound, bool *change);
+ u_int64_t (*get_usebytes)(child_sa_t *this, bool inbound);
/**
* Get the traffic selectors list added for one side.
diff --git a/src/charon/sa/ike_sa.c b/src/charon/sa/ike_sa.c
index b1d7f382f..1c2de172c 100644
--- a/src/charon/sa/ike_sa.c
+++ b/src/charon/sa/ike_sa.c
@@ -273,11 +273,7 @@ static time_t get_use_time(private_ike_sa_t* this, bool inbound)
enumerator = this->child_sas->create_enumerator(this->child_sas);
while (enumerator->enumerate(enumerator, &child_sa))
{
- u_int64_t use_bytes;
- bool change;
-
- use_bytes = child_sa->get_usebytes(child_sa, inbound, &change);
- use_time = max(use_time, child_sa->get_usetime(child_sa, inbound, change));
+ use_time = max(use_time, child_sa->get_usetime(child_sa, inbound));
}
enumerator->destroy(enumerator);
diff --git a/src/charon/sa/tasks/child_delete.c b/src/charon/sa/tasks/child_delete.c
index 38fb38e1f..6e87ad988 100644
--- a/src/charon/sa/tasks/child_delete.c
+++ b/src/charon/sa/tasks/child_delete.c
@@ -244,15 +244,13 @@ static void log_children(private_child_delete_t *this)
iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
while (iterator->iterate(iterator, (void**)&child_sa))
{
- bool change;
-
DBG0(DBG_IKE, "closing CHILD_SA %s{%d} "
"with SPIs %.8x_i (%lu bytes) %.8x_o (%lu bytes) and TS %#R=== %#R",
child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),
ntohl(child_sa->get_spi(child_sa, TRUE)),
- child_sa->get_usebytes(child_sa, TRUE, &change),
+ child_sa->get_usebytes(child_sa, TRUE),
ntohl(child_sa->get_spi(child_sa, FALSE)),
- child_sa->get_usebytes(child_sa, FALSE, &change),
+ child_sa->get_usebytes(child_sa, FALSE),
child_sa->get_traffic_selectors(child_sa, TRUE),
child_sa->get_traffic_selectors(child_sa, FALSE));
}