ike_sa_manager enumerable, not iterable
This commit is contained in:
@@ -488,7 +488,7 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
|
||||
* uses to serve pool addresses. */
|
||||
return peer_cfg_create(msg->add_conn.name,
|
||||
msg->add_conn.ikev2 ? 2 : 1, ike_cfg, me, other,
|
||||
msg->add_conn.me.sendcert, msg->add_conn.auth_method,
|
||||
msg->add_conn.me.sendcert, UNIQUE_NO, msg->add_conn.auth_method,
|
||||
msg->add_conn.eap_type, msg->add_conn.eap_vendor,
|
||||
msg->add_conn.rekey.tries, rekey, reauth, jitter, over,
|
||||
msg->add_conn.mobike, msg->add_conn.dpd.delay,
|
||||
|
||||
@@ -147,7 +147,7 @@ static void terminate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *o
|
||||
bool child;
|
||||
int len;
|
||||
ike_sa_t *ike_sa;
|
||||
iterator_t *iterator;
|
||||
enumerator_t *enumerator;
|
||||
stroke_log_info_t info;
|
||||
|
||||
string = msg->terminate.name;
|
||||
@@ -197,8 +197,8 @@ static void terminate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *o
|
||||
info.out = out;
|
||||
info.level = msg->output_verbosity;
|
||||
|
||||
iterator = charon->controller->create_ike_sa_iterator(charon->controller);
|
||||
while (iterator->iterate(iterator, (void**)&ike_sa))
|
||||
enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
|
||||
while (enumerator->enumerate(enumerator, &ike_sa))
|
||||
{
|
||||
child_sa_t *child_sa;
|
||||
iterator_t *children;
|
||||
@@ -213,7 +213,7 @@ static void terminate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *o
|
||||
{
|
||||
id = child_sa->get_reqid(child_sa);
|
||||
children->destroy(children);
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
charon->controller->terminate_child(charon->controller, id,
|
||||
(controller_cb_t)stroke_log, &info);
|
||||
@@ -227,7 +227,7 @@ static void terminate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *o
|
||||
{
|
||||
id = ike_sa->get_unique_id(ike_sa);
|
||||
/* unlock manager first */
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
charon->controller->terminate_ike(charon->controller, id,
|
||||
(controller_cb_t)stroke_log, &info);
|
||||
@@ -235,9 +235,8 @@ static void terminate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *o
|
||||
}
|
||||
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
DBG1(DBG_CFG, "no such SA found");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,7 +284,7 @@ static void unroute(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out
|
||||
{
|
||||
char *name;
|
||||
ike_sa_t *ike_sa;
|
||||
iterator_t *iterator;
|
||||
enumerator_t *enumerator;
|
||||
stroke_log_info_t info;
|
||||
|
||||
name = msg->terminate.name;
|
||||
@@ -293,8 +292,8 @@ static void unroute(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out
|
||||
info.out = out;
|
||||
info.level = msg->output_verbosity;
|
||||
|
||||
iterator = charon->controller->create_ike_sa_iterator(charon->controller);
|
||||
while (iterator->iterate(iterator, (void**)&ike_sa))
|
||||
enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
|
||||
while (enumerator->enumerate(enumerator, &ike_sa))
|
||||
{
|
||||
child_sa_t *child_sa;
|
||||
iterator_t *children;
|
||||
@@ -308,7 +307,7 @@ static void unroute(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out
|
||||
{
|
||||
id = child_sa->get_reqid(child_sa);
|
||||
children->destroy(children);
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
charon->controller->unroute(charon->controller, id,
|
||||
(controller_cb_t)stroke_log, &info);
|
||||
return;
|
||||
@@ -316,7 +315,7 @@ static void unroute(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out
|
||||
}
|
||||
children->destroy(children);
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
DBG1(DBG_CFG, "no such SA found");
|
||||
}
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
|
||||
child_cfg_t *child_cfg;
|
||||
ike_sa_t *ike_sa;
|
||||
char *name = NULL;
|
||||
bool found = FALSE;
|
||||
time_t uptime;
|
||||
|
||||
name = msg->status.name;
|
||||
@@ -240,20 +241,18 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
||||
iterator = charon->ike_sa_manager->create_iterator(charon->ike_sa_manager);
|
||||
if (all && iterator->get_count(iterator) > 0)
|
||||
{
|
||||
fprintf(out, "Security Associations:\n");
|
||||
}
|
||||
while (iterator->iterate(iterator, (void**)&ike_sa))
|
||||
fprintf(out, "Security Associations:\n");
|
||||
enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
|
||||
while (enumerator->enumerate(enumerator, &ike_sa))
|
||||
{
|
||||
bool ike_printed = FALSE;
|
||||
child_sa_t *child_sa;
|
||||
iterator_t *children = ike_sa->create_child_sa_iterator(ike_sa);
|
||||
|
||||
|
||||
if (name == NULL || streq(name, ike_sa->get_name(ike_sa)))
|
||||
{
|
||||
log_ike_sa(out, ike_sa, all);
|
||||
found = TRUE;
|
||||
ike_printed = TRUE;
|
||||
}
|
||||
|
||||
@@ -264,6 +263,7 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
|
||||
if (!ike_printed)
|
||||
{
|
||||
log_ike_sa(out, ike_sa, all);
|
||||
found = TRUE;
|
||||
ike_printed = TRUE;
|
||||
}
|
||||
log_child_sa(out, child_sa, all);
|
||||
@@ -271,7 +271,19 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
|
||||
}
|
||||
children->destroy(children);
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
if (!found)
|
||||
{
|
||||
if (name)
|
||||
{
|
||||
fprintf(out, " no match\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(out, " none\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user