osmo_io: Fix length calculation in iofd_handle_segmentation()

We need to account for the fact that segmentation_cb() could have
changed the length by calling msgb_pull(). Calculate the new len
according to the new tail/data pointers.

Change-Id: I5486ddc0d3345e92b20cbc6e5bcf2cefea3958c8
This commit is contained in:
Daniel Willmann 2023-07-18 09:46:27 +02:00 committed by laforge
parent 4ff5db2839
commit 97d21447f7
1 changed files with 1 additions and 1 deletions

View File

@ -267,8 +267,8 @@ static enum iofd_seg_act iofd_handle_segmentation(struct osmo_io_fd *iofd, struc
/* Trim the original msgb to size. Don't use msgb_trim because we need to reference
* msg->data from before it might have been modified by the segmentation_cb(). */
msg->len = expected_len;
msg->tail = data + expected_len;
msg->len = msg->tail - msg->data;
return IOFD_SEG_ACT_HANDLE_MORE;
defer: