On Tue, Jul 03, 2018 at 09:05:41AM +0200, Michael Walle wrote:
> Coming back to this first. We could drop tlv_count and replace it with a
> msg_tlv_count() which iterates over the tlv_extra list. But that doesn't fix
> this bug, because the tlv_extra is still appended twice to the list (eg. its
> not that only tlv_count is incorrect).
Why not simply make msg_post_recv() and msg_pre_send() symmetrical?
We have:
msg_post_recv()
suffix_post_recv()
extra = tlv_extra_alloc();
msg_tlv_attach(msg, extra);
msg_pre_send()
suffix_pre_send()
TAILQ_FOREACH(extra, &msg->tlv_list, list) {
tlv_pre_send(tlv, extra);
}
So all we need is to add this to suffix_pre_send():
while ((extra = TAILQ_FIRST(&msg->tlv_list)) != NULL) {
TAILQ_REMOVE(&msg->tlv_list, extra, list);
tlv_extra_recycle(extra);
}
msg->tlv_count = 0;
Thanks,
Richard
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel