<div dir="ltr"><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">I found one different thing between deletion of ikesa
and childsa in StrongSwan v5.3.1 like below</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">Comparing with childsa, Is there any reason for missing
recreation of ikesa?(refer to yellow blocks)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif;color:blue">src/libcharon/sa/ikev2/tasks/ike_delete.c</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">METHOD(task_t,
build_i, status_t,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
private_ike_delete_t *this, message_t *message)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">{</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
delete_payload_t *delete_payload;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
DBG0(DBG_IKE, "deleting IKE_SA %s[%d] between %H[%Y]...%H[%Y]",</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->get_name(this->ike_sa),</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->get_unique_id(this->ike_sa),</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->get_my_host(this->ike_sa),</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->get_my_id(this->ike_sa),</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->get_other_host(this->ike_sa),</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->get_other_id(this->ike_sa));</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
delete_payload = delete_payload_create(PLV2_DELETE, PROTO_IKE);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
message->add_payload(message, (payload_t*)delete_payload);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
if (this->ike_sa->get_state(this->ike_sa) == IKE_REKEYING)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
{</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->rekeyed = TRUE;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
}</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->set_state(this->ike_sa, IKE_DELETING);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
DBG1(DBG_IKE, "sending DELETE for IKE_SA %s[%d]",</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->get_name(this->ike_sa),</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->ike_sa->get_unique_id(this->ike_sa));</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
return NEED_MORE;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">}</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif;color:blue"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif;color:blue">src/libcharon/sa/ikev2/tasks/child_delete.c</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">METHOD(task_t,
build_i, status_t,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
private_child_delete_t *this, message_t *message)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">{</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
child_sa_t *child_sa;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
child_sa = this->ike_sa->get_child_sa(this->ike_sa, this->protocol,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->spi, TRUE);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
if (!child_sa)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
{ /* check if it is an outbound sa */</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
child_sa = this->ike_sa->get_child_sa(this->ike_sa, this->protocol,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->spi, FALSE);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
if (!child_sa)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
{ /* child does not exist anymore */</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
return SUCCESS;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
}</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
/* we work only with the inbound SPI */</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->spi = child_sa->get_spi(child_sa, TRUE);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
}</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->child_sas->insert_last(this->child_sas, child_sa);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
if (child_sa->get_state(child_sa) == CHILD_REKEYING)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
{</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
this->rekeyed = TRUE;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
}</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
log_children(this);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
build_payloads(this, message);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue"> <span style="background:yellow">if (!this->rekeyed && this->expired)</span></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue;background:yellow"> {</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue;background:yellow">
child_cfg_t *child_cfg;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue;background:yellow"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue;background:yellow">
DBG1(DBG_IKE, "scheduling CHILD_SA recreate after hard expire");</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue;background:yellow">
child_cfg = child_sa->get_config(child_sa);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue;background:yellow">
this->ike_sa->queue_task(this->ike_sa, (task_t*)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue;background:yellow">
child_create_create(this->ike_sa, child_cfg->get_ref(child_cfg),</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue;background:yellow">
FALSE, NULL, NULL));</span><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue"></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New';color:blue"> }</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
return NEED_MORE;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">}</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif"> </span></p></div>