ikev1: Fix calculation of the number of fragments

The old code resulted in too few fragments in some cases.
This commit is contained in:
Tobias Brunner 2013-08-15 15:15:34 +02:00
parent c81a6ff907
commit f853e7bcc0
1 changed files with 1 additions and 1 deletions

View File

@ -448,7 +448,7 @@ static bool send_packet(private_task_manager_t *this, bool request,
{ /* reduce size due to non-ESP marker */
frag_size -= 4;
}
count = (data.len / (frag_size + 1)) + 1;
count = data.len / frag_size + (data.len % frag_size ? 1 : 0);
DBG1(DBG_IKE, "sending IKE message with length of %zu bytes in "
"%hhu fragments", data.len, count);