[Bug 260055] recvmsg / IP_RECVDSTADDR issue

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 26 Nov 2021 21:51:52 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260055

--- Comment #3 from Konstantin Belousov <kib@FreeBSD.org> ---
> Maybe there is some application logic error if some payload data is discarded,
> but recvmsg() still has control message to return because of IP_RECVDSTADDR
> socket option, hasn't it? So it should not block just after first UDP datagramm
> arrived, I believe.

No, this is completely off how the control messages work.  You do not have
control message 'sit' in the socket buffer.  CMSG is generated _on the packet
insertion into the sockbuf queue_.  On receive, associated cmsg is either
externalized and copied out, if cmsg buffer is provided by userspace, or
simply dropped.

So the behavior you see is probably right (I cannot assert if fully because
I do not know app logic and protocol): you have blocked socket, which sometimes
happens to have empty receive queue, and you call recvmsg(2) on it.  Until
something is received, the syscall is blocked.

-- 
You are receiving this mail because:
You are the assignee for the bug.