ike-init: Send REDIRECTED_FROM instead of REDIRECT_SUPPORTED if appropriate

This commit is contained in:
Tobias Brunner
2016-03-04 16:02:58 +01:00
parent e4af6e6b7a
commit 6cde9875e1
+19 -1
View File
@@ -332,7 +332,25 @@ static bool build_payloads(private_ike_init_t *this, message_t *message)
/* notify other peer if we support redirection */
if (!this->old_sa && this->initiator && this->follow_redirects)
{
message->add_notify(message, FALSE, REDIRECT_SUPPORTED, chunk_empty);
identification_t *gateway;
host_t *from;
chunk_t data;
from = this->ike_sa->get_redirected_from(this->ike_sa);
if (from)
{
gateway = identification_create_from_sockaddr(
from->get_sockaddr(from));
data = redirect_data_create(gateway, chunk_empty);
message->add_notify(message, FALSE, REDIRECTED_FROM, data);
chunk_free(&data);
gateway->destroy(gateway);
}
else
{
message->add_notify(message, FALSE, REDIRECT_SUPPORTED,
chunk_empty);
}
}
return TRUE;
}