aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-04-21 16:50:17 +0200
committerMartin Willi <martin@revosec.ch>2013-05-06 17:01:13 +0200
commitbdaf9f97e6cd3e97f4b947e8748efd5b34c4c72e (patch)
treedac80e8ebe04ee3774dfef8fc8d68a2a615656e3 /src
parent470aad7e0cbeb7d927161ba425715173b521afec (diff)
downloadstrongswan-bdaf9f97e6cd3e97f4b947e8748efd5b34c4c72e.tar.bz2
strongswan-bdaf9f97e6cd3e97f4b947e8748efd5b34c4c72e.tar.xz
child-sa: query SAD/SPD just for what we actually need to update statistics
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/sa/child_sa.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libcharon/sa/child_sa.c b/src/libcharon/sa/child_sa.c
index a8c246bfb..5861fe37c 100644
--- a/src/libcharon/sa/child_sa.c
+++ b/src/libcharon/sa/child_sa.c
@@ -527,12 +527,15 @@ METHOD(child_sa_t, get_usestats, void,
private_child_sa_t *this, bool inbound,
time_t *time, u_int64_t *bytes, u_int64_t *packets)
{
- if (update_usebytes(this, inbound) != FAILED)
+ if ((!bytes && !packets) || update_usebytes(this, inbound) != FAILED)
{
/* there was traffic since last update or the kernel interface
* does not support querying the number of usebytes.
*/
- update_usetime(this, inbound);
+ if (time)
+ {
+ update_usetime(this, inbound);
+ }
}
if (time)
{