Reverted the interface changes introduced in 3f720dc7.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user