From: Martin Willi Date: Sun, 21 Apr 2013 14:50:17 +0000 (+0200) Subject: child-sa: query SAD/SPD just for what we actually need to update statistics X-Git-Tag: 5.1.0dr1~153^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdaf9f97e6cd3e97f4b947e8748efd5b34c4c72e;p=thirdparty%2Fstrongswan.git child-sa: query SAD/SPD just for what we actually need to update statistics --- diff --git a/src/libcharon/sa/child_sa.c b/src/libcharon/sa/child_sa.c index a8c246bfbe..5861fe37c2 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) {