Subject: misc/33330: Errors in recvmsg(2) man page
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <noselasd@asgaard.homelinux.org>
List: netbsd-bugs
Date: 04/21/2006 21:20:00
>Number:         33330
>Category:       misc
>Synopsis:       recvmsg(2) manpage is wrong about the msg_name memeber of struct msghdr
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 21 21:20:00 +0000 2006
>Originator:     Nils O. SelÄsdal
>Release:        NetBSD 2.0.3
>Organization:
None
>Environment:
System: NetBSD daemon.fiane.intra 2.0.3 NetBSD 2.0.3 (MYKERNEL) #0: Thu Feb 23 20:31:51 CET 2006 root@daemon.fiane.intra:/usr/src/sys/arch/i386/compile/MYKERNEL i386
Architecture: i386
Machine: i386
>Description:
The manpage for recvmsg(2) states:
"Here msg_name and msg_namelen specify the destination address if the
socket is unconnected;"
While true for sendmsg it is simply incorrect for recvmsg.
msg_name of struct msghdr is filled in with the source address of a 
received message - atleast when receiving from an unconnected UDP socket.

>How-To-Repeat:
Read man 2 recvmsg , compare with reality and/or the Opengroup manpage 
at http://www.opengroup.org/onlinepubs/000095399/functions/recvmsg.html

>Fix:
Change 
"Here msg_name and msg_namelen specify the destination address if the
socket is unconnected;"
to
"Here msg_name and msg_namelen specify the source address if the
socket is unconnected;"

And even better - hint that the msg_name is filled in with the source address
of the received message.