Renamed list of additional peer addresses as it now stores all known addresses.

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