ikev1: Fix calculation of the number of fragments
The old code resulted in too few fragments in some cases.
This commit is contained in:
parent
c81a6ff907
commit
f853e7bcc0
|
@ -448,7 +448,7 @@ static bool send_packet(private_task_manager_t *this, bool request,
|
||||||
{ /* reduce size due to non-ESP marker */
|
{ /* reduce size due to non-ESP marker */
|
||||||
frag_size -= 4;
|
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 "
|
DBG1(DBG_IKE, "sending IKE message with length of %zu bytes in "
|
||||||
"%hhu fragments", data.len, count);
|
"%hhu fragments", data.len, count);
|
||||||
|
|
Loading…
Reference in New Issue