aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/charon/sa/transactions/ike_sa_init.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/charon/sa/transactions/ike_sa_init.c b/src/charon/sa/transactions/ike_sa_init.c
index 89d0c33c5..34e7f7053 100644
--- a/src/charon/sa/transactions/ike_sa_init.c
+++ b/src/charon/sa/transactions/ike_sa_init.c
@@ -369,17 +369,27 @@ static status_t get_request(private_ike_sa_init_t *this, message_t **result)
linked_list_t *list;
host_t *host;
- /* N(NAT_DETECTION_SOURCE_IP)+ */
- list = charon->socket->create_local_address_list(charon->socket);
- while (list->remove_first(list, (void**)&host) == SUCCESS)
+ /* N(NAT_DETECTION_SOURCE_IP)+
+ * we include only one notify if our address is defined, but all
+ * possible if not */
+ host = this->connection->get_my_host(this->connection);
+ if (host->is_anyaddr(host))
+ {
+ /* TODO: we could get the src address from netlink */
+ list = charon->socket->create_local_address_list(charon->socket);
+ while (list->remove_first(list, (void**)&host) == SUCCESS)
+ {
+ notify = build_natd_payload(this, NAT_DETECTION_SOURCE_IP, host);
+ host->destroy(host);
+ request->add_payload(request, (payload_t*)notify);
+ }
+ list->destroy(list);
+ }
+ else
{
- /* TODO: should we only include NAT payloads for addresses
- * of used address family? */
notify = build_natd_payload(this, NAT_DETECTION_SOURCE_IP, host);
- host->destroy(host);
request->add_payload(request, (payload_t*)notify);
}
- list->destroy(list);
/* N(NAT_DETECTION_DESTINATION_IP) */
notify = build_natd_payload(this, NAT_DETECTION_DESTINATION_IP, other);