aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-11-23 14:31:17 +0100
committerMartin Willi <martin@revosec.ch>2012-03-20 17:30:50 +0100
commit3e246c48832795f88f83e69f7c09ee74f9ac6142 (patch)
treeb3b1a42469f528e7a7395b29958f41b072f0039a /src
parenta7910b1c6e59da37f70bb63c39e9c0615b44eeff (diff)
downloadstrongswan-3e246c48832795f88f83e69f7c09ee74f9ac6142.tar.bz2
strongswan-3e246c48832795f88f83e69f7c09ee74f9ac6142.tar.xz
Generate a new mid only after we start a new task (and exchange)
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/sa/task_manager_v1.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libcharon/sa/task_manager_v1.c b/src/libcharon/sa/task_manager_v1.c
index c415b4edb..55bc8b7f9 100644
--- a/src/libcharon/sa/task_manager_v1.c
+++ b/src/libcharon/sa/task_manager_v1.c
@@ -236,6 +236,7 @@ METHOD(task_manager_t, initiate, status_t,
host_t *me, *other;
status_t status;
exchange_type_t exchange = EXCHANGE_TYPE_UNDEFINED;
+ bool new_mid = FALSE;
if (!this->rng)
{
@@ -266,11 +267,14 @@ METHOD(task_manager_t, initiate, status_t,
if (activate_task(this, TASK_QUICK_MODE))
{
exchange = QUICK_MODE;
+ new_mid = TRUE;
+ break;
}
-
if (activate_task(this, TASK_XAUTH_REQUEST))
{
exchange = TRANSACTION;
+ new_mid = TRUE;
+ break;
}
break;
default:
@@ -311,12 +315,12 @@ METHOD(task_manager_t, initiate, status_t,
other = this->ike_sa->get_other_host(this->ike_sa);
message = message_create(IKEV1_MAJOR_VERSION, IKEV1_MINOR_VERSION);
- if (exchange != ID_PROT)
+ if (new_mid)
{
this->rng->get_bytes(this->rng, sizeof(this->initiating.mid),
(void*)&this->initiating.mid);
- message->set_message_id(message, this->initiating.mid);
}
+ message->set_message_id(message, this->initiating.mid);
message->set_source(message, me->clone(me));
message->set_destination(message, other->clone(other));
message->set_exchange_type(message, exchange);