You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.8 KiB

  1. From 627f870ee6256b4b2e36e9ca768fc578febbccef Mon Sep 17 00:00:00 2001
  2. From: Tobias Brunner <tobias@strongswan.org>
  3. Date: Tue, 10 Feb 2015 19:03:44 +0100
  4. Subject: [PATCH] ikev1: Set protocol ID and SPIs in INITIAL-CONTACT
  5. notification payloads
  6. The payload we sent before is not compliant with RFC 2407 and thus some
  7. peers might abort negotiation (e.g. with an INVALID-PROTOCOL-ID error).
  8. ---
  9. src/libcharon/sa/ikev1/tasks/main_mode.c | 15 +++++++++++++--
  10. 1 file changed, 13 insertions(+), 2 deletions(-)
  11. diff --git a/src/libcharon/sa/ikev1/tasks/main_mode.c b/src/libcharon/sa/ikev1/tasks/main_mode.c
  12. index 5065e70ffc25..3ea4a2a85e4f 100644
  13. --- a/src/libcharon/sa/ikev1/tasks/main_mode.c
  14. +++ b/src/libcharon/sa/ikev1/tasks/main_mode.c
  15. @@ -213,6 +213,10 @@ static void add_initial_contact(private_main_mode_t *this, message_t *message,
  16. {
  17. identification_t *idr;
  18. host_t *host;
  19. + notify_payload_t *notify;
  20. + ike_sa_id_t *ike_sa_id;
  21. + u_int64_t spi_i, spi_r;
  22. + chunk_t spi;
  23. idr = this->ph1->get_id(this->ph1, this->peer_cfg, FALSE);
  24. if (idr && !idr->contains_wildcards(idr))
  25. @@ -224,8 +228,15 @@ static void add_initial_contact(private_main_mode_t *this, message_t *message,
  26. if (!charon->ike_sa_manager->has_contact(charon->ike_sa_manager,
  27. idi, idr, host->get_family(host)))
  28. {
  29. - message->add_notify(message, FALSE, INITIAL_CONTACT_IKEV1,
  30. - chunk_empty);
  31. + notify = notify_payload_create_from_protocol_and_type(
  32. + PLV1_NOTIFY, PROTO_IKE, INITIAL_CONTACT_IKEV1);
  33. + ike_sa_id = this->ike_sa->get_id(this->ike_sa);
  34. + spi_i = ike_sa_id->get_initiator_spi(ike_sa_id);
  35. + spi_r = ike_sa_id->get_responder_spi(ike_sa_id);
  36. + spi = chunk_cata("cc", chunk_from_thing(spi_i),
  37. + chunk_from_thing(spi_r));
  38. + notify->set_spi_data(notify, spi);
  39. + message->add_payload(message, (payload_t*)notify);
  40. }
  41. }
  42. }
  43. --
  44. 1.9.1