static int receive(int fd, int block, int loop)
{
lookip_response_t resp;
- char *label;
+ char *label, name[32];
int res;
do
resp.id[sizeof(resp.id) - 1] = '\0';
resp.name[sizeof(resp.name) - 1] = '\0';
+ snprintf(name, sizeof(name), "%s[%u]", resp.name, resp.unique_id);
printf("%-12s %16s %16s %20s %s\n",
- label, resp.vip, resp.ip, resp.name, resp.id);
+ label, resp.vip, resp.ip, name, resp.id);
}
while (loop);
identification_t *id;
/** associated connection name */
char *name;
+ /** IKE_SA unique identifier */
+ u_int unique_id;
} entry_t;
/**
static bool notify_up(listener_entry_t *listener, entry_t *entry)
{
if (!listener->cb(listener->user, TRUE, entry->vip, entry->other,
- entry->id, entry->name))
+ entry->id, entry->name, entry->unique_id))
{
free(listener);
return TRUE;
static bool notify_down(listener_entry_t *listener, entry_t *entry)
{
if (!listener->cb(listener->user, FALSE, entry->vip, entry->other,
- entry->id, entry->name))
+ entry->id, entry->name, entry->unique_id))
{
free(listener);
return TRUE;
.other = other->clone(other),
.id = id->clone(id),
.name = strdup(ike_sa->get_name(ike_sa)),
+ .unique_id = ike_sa->get_unique_id(ike_sa),
);
this->lock->read_lock(this->lock);
entry = this->entries->get(this->entries, vip);
if (entry)
{
- cb(user, TRUE, entry->vip, entry->other, entry->id, entry->name);
+ cb(user, TRUE, entry->vip, entry->other, entry->id,
+ entry->name, entry->unique_id);
matches ++;
}
}
enumerator = this->entries->create_enumerator(this->entries);
while (enumerator->enumerate(enumerator, &vip, &entry))
{
- cb(user, TRUE, entry->vip, entry->other, entry->id, entry->name);
+ cb(user, TRUE, entry->vip, entry->other, entry->id,
+ entry->name, entry->unique_id);
matches++;
}
enumerator->destroy(enumerator);
* @param other peer external IP
* @param id peer identity
* @param name associated connection name
+ * @param unique_id unique IKE_SA identifier
* @return TRUE to receive more results, FALSE to cancel
*/
typedef bool (*lookip_callback_t)(void *user, bool up, host_t *vip,
- host_t *other, identification_t *id, char *name);
+ host_t *other, identification_t *id,
+ char *name, u_int unique_id);
/**
* Listener collecting virtual IPs.
* Callback function for listener
*/
static bool listener_cb(entry_t *entry, bool up, host_t *vip,
- host_t *other, identification_t *id, char *name)
+ host_t *other, identification_t *id,
+ char *name, u_int unique_id)
{
lookip_response_t resp = {
.type = entry->type,