Renamed list of additional peer addresses as it now stores all known addresses.
This commit is contained in:
@@ -260,9 +260,8 @@ static void process_ike_update(private_ha_dispatcher_t *this,
|
||||
ike_sa->set_virtual_ip(ike_sa, FALSE, value.host);
|
||||
received_vip = TRUE;
|
||||
break;
|
||||
case HA_ADDITIONAL_ADDR:
|
||||
ike_sa->add_additional_address(ike_sa,
|
||||
value.host->clone(value.host));
|
||||
case HA_PEER_ADDR:
|
||||
ike_sa->add_peer_address(ike_sa, value.host->clone(value.host));
|
||||
break;
|
||||
case HA_CONFIG_NAME:
|
||||
peer_cfg = charon->backends->get_peer_cfg_by_name(
|
||||
|
||||
@@ -185,10 +185,10 @@ METHOD(listener_t, ike_updown, bool,
|
||||
m->add_attribute(m, HA_CONDITIONS, condition);
|
||||
m->add_attribute(m, HA_EXTENSIONS, extension);
|
||||
m->add_attribute(m, HA_CONFIG_NAME, peer_cfg->get_name(peer_cfg));
|
||||
enumerator = ike_sa->create_additional_address_enumerator(ike_sa);
|
||||
enumerator = ike_sa->create_peer_address_enumerator(ike_sa);
|
||||
while (enumerator->enumerate(enumerator, (void**)&addr))
|
||||
{
|
||||
m->add_attribute(m, HA_ADDITIONAL_ADDR, addr);
|
||||
m->add_attribute(m, HA_PEER_ADDR, addr);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ METHOD(ha_message_t, add_attribute, void,
|
||||
case HA_REMOTE_ADDR:
|
||||
case HA_LOCAL_VIP:
|
||||
case HA_REMOTE_VIP:
|
||||
case HA_ADDITIONAL_ADDR:
|
||||
case HA_PEER_ADDR:
|
||||
{
|
||||
host_encoding_t *enc;
|
||||
host_t *host;
|
||||
@@ -386,7 +386,7 @@ METHOD(enumerator_t, attribute_enumerate, bool,
|
||||
case HA_REMOTE_ADDR:
|
||||
case HA_LOCAL_VIP:
|
||||
case HA_REMOTE_VIP:
|
||||
case HA_ADDITIONAL_ADDR:
|
||||
case HA_PEER_ADDR:
|
||||
{
|
||||
host_encoding_t *enc;
|
||||
|
||||
|
||||
@@ -98,8 +98,8 @@ enum ha_message_attribute_t {
|
||||
HA_LOCAL_VIP,
|
||||
/** host_t*, remote virtual IP */
|
||||
HA_REMOTE_VIP,
|
||||
/** host_t*, additional MOBIKE peer address */
|
||||
HA_ADDITIONAL_ADDR,
|
||||
/** host_t*, known peer addresses (used for MOBIKE) */
|
||||
HA_PEER_ADDR,
|
||||
/** u_int8_t, initiator of an exchange, TRUE for local */
|
||||
HA_INITIATOR,
|
||||
/** chunk_t, initiators nonce */
|
||||
|
||||
+20
-20
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2011 Tobias Brunner
|
||||
* Copyright (C) 2006-2012 Tobias Brunner
|
||||
* Copyright (C) 2006 Daniel Roethlisberger
|
||||
* Copyright (C) 2005-2009 Martin Willi
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
@@ -208,9 +208,9 @@ struct private_ike_sa_t {
|
||||
linked_list_t *attributes;
|
||||
|
||||
/**
|
||||
* list of peers additional addresses, transmitted via MOBIKE
|
||||
* list of peer's addresses, additional ones transmitted via MOBIKE
|
||||
*/
|
||||
linked_list_t *additional_addresses;
|
||||
linked_list_t *peer_addresses;
|
||||
|
||||
/**
|
||||
* previously value of received DESTINATION_IP hash
|
||||
@@ -774,28 +774,28 @@ METHOD(ike_sa_t, get_virtual_ip, host_t*,
|
||||
}
|
||||
}
|
||||
|
||||
METHOD(ike_sa_t, add_additional_address, void,
|
||||
METHOD(ike_sa_t, add_peer_address, void,
|
||||
private_ike_sa_t *this, host_t *host)
|
||||
{
|
||||
this->additional_addresses->insert_last(this->additional_addresses, host);
|
||||
this->peer_addresses->insert_last(this->peer_addresses, host);
|
||||
}
|
||||
|
||||
METHOD(ike_sa_t, create_additional_address_enumerator, enumerator_t*,
|
||||
METHOD(ike_sa_t, create_peer_address_enumerator, enumerator_t*,
|
||||
private_ike_sa_t *this)
|
||||
{
|
||||
return this->additional_addresses->create_enumerator(
|
||||
this->additional_addresses);
|
||||
return this->peer_addresses->create_enumerator(this->peer_addresses);
|
||||
}
|
||||
|
||||
METHOD(ike_sa_t, remove_additional_addresses, void,
|
||||
METHOD(ike_sa_t, clear_peer_addresses, void,
|
||||
private_ike_sa_t *this)
|
||||
{
|
||||
enumerator_t *enumerator = create_additional_address_enumerator(this);
|
||||
enumerator_t *enumerator = create_peer_address_enumerator(this);
|
||||
host_t *host;
|
||||
|
||||
while (enumerator->enumerate(enumerator, (void**)&host))
|
||||
{
|
||||
this->additional_addresses->remove_at(this->additional_addresses,
|
||||
enumerator);
|
||||
this->peer_addresses->remove_at(this->peer_addresses,
|
||||
enumerator);
|
||||
host->destroy(host);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
@@ -1879,8 +1879,8 @@ static bool is_any_path_valid(private_ike_sa_t *this)
|
||||
this->other_host, NULL);
|
||||
if (!src)
|
||||
{
|
||||
enumerator = this->additional_addresses->create_enumerator(
|
||||
this->additional_addresses);
|
||||
enumerator = this->peer_addresses->create_enumerator(
|
||||
this->peer_addresses);
|
||||
while (enumerator->enumerate(enumerator, &addr))
|
||||
{
|
||||
DBG1(DBG_IKE, "looking for a route to %H ...", addr);
|
||||
@@ -2136,8 +2136,8 @@ METHOD(ike_sa_t, destroy, void,
|
||||
}
|
||||
this->other_virtual_ip->destroy(this->other_virtual_ip);
|
||||
}
|
||||
this->additional_addresses->destroy_offset(this->additional_addresses,
|
||||
offsetof(host_t, destroy));
|
||||
this->peer_addresses->destroy_offset(this->peer_addresses,
|
||||
offsetof(host_t, destroy));
|
||||
#ifdef ME
|
||||
if (this->is_mediation_server)
|
||||
{
|
||||
@@ -2214,9 +2214,9 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
|
||||
.has_condition = _has_condition,
|
||||
.set_pending_updates = _set_pending_updates,
|
||||
.get_pending_updates = _get_pending_updates,
|
||||
.create_additional_address_enumerator = _create_additional_address_enumerator,
|
||||
.add_additional_address = _add_additional_address,
|
||||
.remove_additional_addresses = _remove_additional_addresses,
|
||||
.create_peer_address_enumerator = _create_peer_address_enumerator,
|
||||
.add_peer_address = _add_peer_address,
|
||||
.clear_peer_addresses = _clear_peer_addresses,
|
||||
.has_mapping_changed = _has_mapping_changed,
|
||||
.retransmit = _retransmit,
|
||||
.delete = _delete_,
|
||||
@@ -2273,7 +2273,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
|
||||
.my_auths = linked_list_create(),
|
||||
.other_auths = linked_list_create(),
|
||||
.unique_id = ++unique_id,
|
||||
.additional_addresses = linked_list_create(),
|
||||
.peer_addresses = linked_list_create(),
|
||||
.attributes = linked_list_create(),
|
||||
.keepalive_interval = lib->settings->get_time(lib->settings,
|
||||
"charon.keep_alive", KEEPALIVE_INTERVAL),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2011 Tobias Brunner
|
||||
* Copyright (C) 2006-2012 Tobias Brunner
|
||||
* Copyright (C) 2006 Daniel Roethlisberger
|
||||
* Copyright (C) 2005-2009 Martin Willi
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
@@ -474,19 +474,19 @@ struct ike_sa_t {
|
||||
*
|
||||
* @param host host to add to list
|
||||
*/
|
||||
void (*add_additional_address)(ike_sa_t *this, host_t *host);
|
||||
void (*add_peer_address)(ike_sa_t *this, host_t *host);
|
||||
|
||||
/**
|
||||
* Create an enumerator over all additional addresses of the peer.
|
||||
* Create an enumerator over all known addresses of the peer.
|
||||
*
|
||||
* @return enumerator over addresses
|
||||
*/
|
||||
enumerator_t* (*create_additional_address_enumerator)(ike_sa_t *this);
|
||||
enumerator_t* (*create_peer_address_enumerator)(ike_sa_t *this);
|
||||
|
||||
/**
|
||||
* Remove all additional addresses of the peer.
|
||||
* Remove all known addresses of the peer.
|
||||
*/
|
||||
void (*remove_additional_addresses)(ike_sa_t *this);
|
||||
void (*clear_peer_addresses)(ike_sa_t *this);
|
||||
|
||||
/**
|
||||
* Check if mappings have changed on a NAT for our source address.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2012 Tobias Brunner
|
||||
* Copyright (C) 2007 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
@@ -134,17 +135,17 @@ static void process_payloads(private_ike_mobike_t *this, message_t *message)
|
||||
{
|
||||
if (first)
|
||||
{ /* an ADDITIONAL_*_ADDRESS means replace, so flush once */
|
||||
this->ike_sa->remove_additional_addresses(this->ike_sa);
|
||||
this->ike_sa->clear_peer_addresses(this->ike_sa);
|
||||
first = FALSE;
|
||||
/* add the peer's current address to the list */
|
||||
host = this->ike_sa->get_other_host(this->ike_sa);
|
||||
this->ike_sa->add_additional_address(this->ike_sa,
|
||||
host->clone(host));
|
||||
this->ike_sa->add_peer_address(this->ike_sa,
|
||||
host->clone(host));
|
||||
}
|
||||
data = notify->get_notification_data(notify);
|
||||
host = host_create_from_chunk(family, data, 0);
|
||||
DBG2(DBG_IKE, "got additional MOBIKE peer address: %H", host);
|
||||
this->ike_sa->add_additional_address(this->ike_sa, host);
|
||||
this->ike_sa->add_peer_address(this->ike_sa, host);
|
||||
this->addresses_updated = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -155,11 +156,10 @@ static void process_payloads(private_ike_mobike_t *this, message_t *message)
|
||||
}
|
||||
case NO_ADDITIONAL_ADDRESSES:
|
||||
{
|
||||
this->ike_sa->remove_additional_addresses(this->ike_sa);
|
||||
this->ike_sa->clear_peer_addresses(this->ike_sa);
|
||||
/* add the peer's current address to the list */
|
||||
host = this->ike_sa->get_other_host(this->ike_sa);
|
||||
this->ike_sa->add_additional_address(this->ike_sa,
|
||||
host->clone(host));
|
||||
this->ike_sa->add_peer_address(this->ike_sa, host->clone(host));
|
||||
this->addresses_updated = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ METHOD(ike_mobike_t, transmit, void,
|
||||
charon->sender->send(charon->sender, copy);
|
||||
}
|
||||
|
||||
enumerator = this->ike_sa->create_additional_address_enumerator(this->ike_sa);
|
||||
enumerator = this->ike_sa->create_peer_address_enumerator(this->ike_sa);
|
||||
while (enumerator->enumerate(enumerator, (void**)&other))
|
||||
{
|
||||
me = hydra->kernel_interface->get_source_addr(
|
||||
|
||||
Reference in New Issue
Block a user