controller: Use the CHILD_SA unique_id to terminate CHILD_SAs
This commit is contained in:
@@ -1551,8 +1551,8 @@ static void clear_start_action(private_vici_config_t *this,
|
||||
enumerator_t *enumerator, *children;
|
||||
child_sa_t *child_sa;
|
||||
ike_sa_t *ike_sa;
|
||||
u_int32_t reqid = 0, *del;
|
||||
array_t *reqids = NULL;
|
||||
u_int32_t id = 0, *del;
|
||||
array_t *ids = NULL;
|
||||
char *name;
|
||||
|
||||
name = child_cfg->get_name(child_cfg);
|
||||
@@ -1568,23 +1568,23 @@ static void clear_start_action(private_vici_config_t *this,
|
||||
{
|
||||
if (streq(name, child_sa->get_name(child_sa)))
|
||||
{
|
||||
reqid = child_sa->get_reqid(child_sa);
|
||||
array_insert_create(&reqids, ARRAY_TAIL, &reqid);
|
||||
id = child_sa->get_unique_id(child_sa);
|
||||
array_insert_create(&ids, ARRAY_TAIL, &id);
|
||||
}
|
||||
}
|
||||
children->destroy(children);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
if (array_count(reqids))
|
||||
if (array_count(ids))
|
||||
{
|
||||
while (array_remove(reqids, ARRAY_HEAD, &del))
|
||||
while (array_remove(ids, ARRAY_HEAD, &del))
|
||||
{
|
||||
DBG1(DBG_CFG, "closing '%s' #%u", name, *del);
|
||||
charon->controller->terminate_child(charon->controller,
|
||||
*del, NULL, NULL, 0);
|
||||
}
|
||||
array_destroy(reqids);
|
||||
array_destroy(ids);
|
||||
}
|
||||
break;
|
||||
case ACTION_ROUTE:
|
||||
@@ -1601,14 +1601,14 @@ static void clear_start_action(private_vici_config_t *this,
|
||||
{
|
||||
if (streq(name, child_sa->get_name(child_sa)))
|
||||
{
|
||||
reqid = child_sa->get_reqid(child_sa);
|
||||
id = child_sa->get_reqid(child_sa);
|
||||
break;
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
if (reqid)
|
||||
if (id)
|
||||
{
|
||||
charon->traps->uninstall(charon->traps, reqid);
|
||||
charon->traps->uninstall(charon->traps, id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -264,11 +264,11 @@ CALLBACK(terminate, vici_message_t*,
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (child_id && child_sa->get_reqid(child_sa) != child_id)
|
||||
if (child_id && child_sa->get_unique_id(child_sa) != child_id)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
current = child_sa->get_reqid(child_sa);
|
||||
current = child_sa->get_unique_id(child_sa);
|
||||
array_insert(ids, ARRAY_TAIL, ¤t);
|
||||
}
|
||||
csas->destroy(csas);
|
||||
|
||||
Reference in New Issue
Block a user