[strongSwan-dev] Correct place to destroy peer_cfg in plugin?

Ian Hailey ihailey at 88project.com
Thu Apr 8 11:55:47 CEST 2010

Hello all,

I am working on a plugin similar to the NM plugin, it accepts connection requests containing a configuration which is created in a similar to that found in the NM connect_. I would like for the peer_cfg created in the connection handler to be release (destroyed) when the IKE SA is deleted due to failure or termination. 

Currently when the IKE SA is destroyed (ike_sa->destroy) I see that the in the call to DESTROY_IF(this->peer_cfg) that the refcount is 2 (as a result of the call to ike_sa->set_peer_cfg) so does not get deleted at this time and is in fact never released. 

Could anyone offer some advice as to when the correct time would be to delete the peer_cfg? My attempt to add peer_cfg->destroy to the listener->ike_state_change when the state is IKE_DESTROYING failed.



More information about the Dev mailing list