]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/strongswan-5.2.2-issue-819-cd2c30a.patch
Merge remote-tracking branch 'mfischer/iputils' into next
[ipfire-2.x.git] / src / patches / strongswan-5.2.2-issue-819-cd2c30a.patch
1 From cd2c30a56ec9bdab8b3923851509f27a4fd6f537 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
7 The payload we sent before is not compliant with RFC 2407 and thus some
8 peers might abort negotiation (e.g. with an INVALID-PROTOCOL-ID error).
9
10 #819
11 ---
12 src/libcharon/sa/ikev1/tasks/main_mode.c | 15 +++++++++++++--
13 1 file changed, 13 insertions(+), 2 deletions(-)
14
15 diff --git a/src/libcharon/sa/ikev1/tasks/main_mode.c b/src/libcharon/sa/ikev1/tasks/main_mode.c
16 index 5065e70..3ea4a2a 100644
17 --- a/src/libcharon/sa/ikev1/tasks/main_mode.c
18 +++ b/src/libcharon/sa/ikev1/tasks/main_mode.c
19 @@ -213,6 +213,10 @@ static void add_initial_contact(private_main_mode_t *this, message_t *message,
20 {
21 identification_t *idr;
22 host_t *host;
23 + notify_payload_t *notify;
24 + ike_sa_id_t *ike_sa_id;
25 + u_int64_t spi_i, spi_r;
26 + chunk_t spi;
27
28 idr = this->ph1->get_id(this->ph1, this->peer_cfg, FALSE);
29 if (idr && !idr->contains_wildcards(idr))
30 @@ -224,8 +228,15 @@ static void add_initial_contact(private_main_mode_t *this, message_t *message,
31 if (!charon->ike_sa_manager->has_contact(charon->ike_sa_manager,
32 idi, idr, host->get_family(host)))
33 {
34 - message->add_notify(message, FALSE, INITIAL_CONTACT_IKEV1,
35 - chunk_empty);
36 + notify = notify_payload_create_from_protocol_and_type(
37 + PLV1_NOTIFY, PROTO_IKE, INITIAL_CONTACT_IKEV1);
38 + ike_sa_id = this->ike_sa->get_id(this->ike_sa);
39 + spi_i = ike_sa_id->get_initiator_spi(ike_sa_id);
40 + spi_r = ike_sa_id->get_responder_spi(ike_sa_id);
41 + spi = chunk_cata("cc", chunk_from_thing(spi_i),
42 + chunk_from_thing(spi_r));
43 + notify->set_spi_data(notify, spi);
44 + message->add_payload(message, (payload_t*)notify);
45 }
46 }
47 }
48 --
49 1.7.9.5
50