diff options
author | Tobias Brunner <tobias@strongswan.org> | 2015-11-09 17:07:25 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2015-11-11 11:01:56 +0100 |
commit | 7b5dcc9f2778ab4b1e726fb95f1ff72b866343c0 (patch) | |
tree | 457771c1aa8130fccef3aed25f08448c3d71375c /src/libcharon/sa | |
parent | 019c7c23107895cc77b12c371de710ef6dc29272 (diff) | |
download | strongswan-7b5dcc9f2778ab4b1e726fb95f1ff72b866343c0.tar.bz2 strongswan-7b5dcc9f2778ab4b1e726fb95f1ff72b866343c0.tar.xz |
ikev1: Also use message hashes for Quick Mode for the early retransmission check
We already did so during Phase 1 but because all three Quick Mode
message have the same message ID we occasionally dropped the third
message as retransmit, so we do it there too. For INFORMATIONAL
and TRANSACTION exchanges we don't expect more than one inbound message
with the same message ID so we still use them there.
Fixes #1198.
Diffstat (limited to 'src/libcharon/sa')
-rw-r--r-- | src/libcharon/sa/ike_sa_manager.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libcharon/sa/ike_sa_manager.c b/src/libcharon/sa/ike_sa_manager.c index 24bde31a4..389cbfe3b 100644 --- a/src/libcharon/sa/ike_sa_manager.c +++ b/src/libcharon/sa/ike_sa_manager.c @@ -1188,11 +1188,15 @@ METHOD(ike_sa_manager_t, checkout_new, ike_sa_t*, */ static u_int32_t get_message_id_or_hash(message_t *message) { - /* Use the message ID, or the message hash in IKEv1 Main/Aggressive mode */ - if (message->get_major_version(message) == IKEV1_MAJOR_VERSION && - message->get_message_id(message) == 0) + if (message->get_major_version(message) == IKEV1_MAJOR_VERSION) { - return chunk_hash(message->get_packet_data(message)); + /* Use a hash for IKEv1 Phase 1, where we don't have a MID, and Quick + * Mode, where all three messages use the same message ID */ + if (message->get_message_id(message) == 0 || + message->get_exchange_type(message) == QUICK_MODE) + { + return chunk_hash(message->get_packet_data(message)); + } } return message->get_message_id(message); } |