msgb: Also copy msgb {dst, lchan, cb} during msgb_copy_*

It wasn't really specified if those fields are supposed to be copied.
But after all, a copy is supposed to behave exactly like the original,
not just in terms of the data but all aspects.

Change-Id: I68328adb952ca8833ba047cb3b49ccc6f8a1f1b5
This commit is contained in:
Harald Welte 2024-03-18 11:21:34 +01:00
parent 0a24e9140d
commit c673eee4f4
1 changed files with 5 additions and 0 deletions

View File

@ -356,6 +356,11 @@ struct msgb *msgb_copy_resize_c(const void *ctx, const struct msgb *msg, uint16_
if (msg->l4h)
new_msg->l4h = new_msg->_data + (msg->l4h - msg->_data);
/* copy other metadata like cb */
new_msg->dst = msg->dst;
new_msg->lchan = msg->lchan;
memcpy(new_msg->cb, msg->cb, sizeof(new_msg->cb));
return new_msg;
}