diff options
author | Andreas Steffen <andreas@strongswan.org> | 2009-08-07 05:59:09 +0200 |
---|---|---|
committer | Andreas Steffen <andreas@strongswan.org> | 2009-08-07 05:59:09 +0200 |
commit | 99dd42918e53426174795e2950c7b5fffe42e07b (patch) | |
tree | f2fbf9d75c3e92593225b4148d4bc192bb455f62 /src | |
parent | 79ff6141449c95fe59b4c3905cc0cb89420860ff (diff) | |
download | strongswan-99dd42918e53426174795e2950c7b5fffe42e07b.tar.bz2 strongswan-99dd42918e53426174795e2950c7b5fffe42e07b.tar.xz |
do not set usetime if query_policy() fails
Diffstat (limited to 'src')
-rw-r--r-- | src/charon/sa/child_sa.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/charon/sa/child_sa.c b/src/charon/sa/child_sa.c index 574dcb819..14d174ab5 100644 --- a/src/charon/sa/child_sa.c +++ b/src/charon/sa/child_sa.c @@ -378,7 +378,7 @@ static enumerator_t* create_policy_enumerator(private_child_sa_t *this) * update the cached usebytes * returns SUCCESS if the usebytes have changed, FAILED if not or no SPIs * are available, and NOT_SUPPORTED if the kernel interface does not support - * quering the usebytes. + * querying the usebytes. */ static status_t update_usebytes(private_child_sa_t *this, bool inbound) { @@ -466,6 +466,11 @@ static void update_usetime(private_child_sa_t *this, bool inbound) } } enumerator->destroy(enumerator); + + if (last_use == 0) + { + return; + } if (inbound) { this->my_usetime = last_use; @@ -483,7 +488,10 @@ static void get_usestats(private_child_sa_t *this, bool inbound, time_t *time, u_int64_t *bytes) { if (update_usebytes(this, inbound) != FAILED) - { /* there was traffic since last update or the KI does not support it */ + { + /* there was traffic since last update or the kernel interface + * does not support querying the number of usebytes. + */ update_usetime(this, inbound); } if (time) |