child-sa: Suppress CHILD_SA state changes if there is no change
authorTobias Brunner <tobias@strongswan.org>
Mon, 7 Aug 2017 10:13:06 +0000 (12:13 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 7 Aug 2017 12:22:13 +0000 (14:22 +0200)
src/libcharon/sa/child_sa.c

index 6c6804c..4225267 100644 (file)
@@ -296,12 +296,15 @@ METHOD(child_sa_t, get_config, child_cfg_t*,
 METHOD(child_sa_t, set_state, void,
           private_child_sa_t *this, child_sa_state_t state)
 {
-       DBG2(DBG_CHD, "CHILD_SA %s{%d} state change: %N => %N",
-                get_name(this), this->unique_id,
-                child_sa_state_names, this->state,
-                child_sa_state_names, state);
-       charon->bus->child_state_change(charon->bus, &this->public, state);
-       this->state = state;
+       if (this->state != state)
+       {
+               DBG2(DBG_CHD, "CHILD_SA %s{%d} state change: %N => %N",
+                        get_name(this), this->unique_id,
+                        child_sa_state_names, this->state,
+                        child_sa_state_names, state);
+               charon->bus->child_state_change(charon->bus, &this->public, state);
+               this->state = state;
+       }
 }
 
 METHOD(child_sa_t, get_state, child_sa_state_t,