Description
For a UDP server program, it is very useful to use sendmmsg()
and recvmmsg()
to improve the performance by reducing syscalls.
And it is not a uncommon setup that a single socket can receive IP packets with difference destination addresses. In this type of setup, we obtain the real destination addresses of messages from the Ipv4PacketInfo
/Ipv6PacketInfo
control message when using recvmmsg()
. Corresponding to that, Ipv4PacketInfo
/Ipv6PacketInfo
control messages are used to set source addresss when sending out multiple messages at once via sendmmsg()
.
In the breaking change introduced by 0.26 about sendmmsg()
api (#1744), it seems it was assumed that control messages are shared/same across all the messages in the batch, I think this is a false assumption.
Did I read the code wrong? If so, is there any example of how to use the new API correctly in this use case.