You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case of listening on 0.0.0.0 but receiving multicast packets from multiple sources. I'd like to register the destination address (specifically the OS interface ID) the packet was received on.
Normally this can be done using recvmsg. This provides you with msghdr, and it can be queried for those properties.However libvma provides a zero copy function only for recvfrom.
I think the best solution is to provide an implementation of recvmsg_zcopy, which is equivalent to recvmsg.
Another option I see is that vma_packet_t has a void* packet_id member. This is probably a mem_buf_desc_t pointer, but I'm not sure. Either way, the mem_buf_desc_t is not exposed in vma_extra.h, so I wonder if I am discouraged from using it or not.
So to summarize, I'll try to have it as a bug report below.
Steps to reproduce:
Use recvfrom_zcopy to receive a UDP packet that can arrive from multiple sources
Actual results:
Packet cannot be queried for its destination address (interface it was received on)
Expected results:
An API is available to query the packet for its TCP/UDP and IP headers
The text was updated successfully, but these errors were encountered:
This is generally solved with a vma_recvmsg_callback_t function, but I disliked this approach because the callback made it harder to relate this to the packet received later.
My preferred solution was that I added my own function to libvma to do this in socket-redirect.cpp as follows:
extern "C"
int vma_get_rx_packet_info(struct vma_packet_t *pkts, sockaddr_in *src, sockaddr_in *dst, struct timespec hw_timestamp)
{
if (!pkts) return -1;
auto p_mem_buf_desc = reinterpret_cast<const mem_buf_desc_t>(pkts->packet_id);
if (src) *src = p_mem_buf_desc->rx.src;
if (dst) *dst = p_mem_buf_desc->rx.dst;
if (hw_timestamp) *hw_timestamp = p_mem_buf_desc->rx.timestamps.hw;
return 0;
}
I have a use case of listening on
0.0.0.0
but receiving multicast packets from multiple sources. I'd like to register the destination address (specifically the OS interface ID) the packet was received on.Normally this can be done using
recvmsg
. This provides you withmsghdr
, and it can be queried for those properties.However libvma provides a zero copy function only forrecvfrom
.I think the best solution is to provide an implementation of
recvmsg_zcopy
, which is equivalent torecvmsg
.Another option I see is that
vma_packet_t
has avoid* packet_id
member. This is probably amem_buf_desc_t
pointer, but I'm not sure. Either way, themem_buf_desc_t
is not exposed invma_extra.h
, so I wonder if I am discouraged from using it or not.So to summarize, I'll try to have it as a bug report below.
Steps to reproduce:
recvfrom_zcopy
to receive a UDP packet that can arrive from multiple sourcesActual results:
Expected results:
The text was updated successfully, but these errors were encountered: