cvs commit: src/sys/net rtsock.c

Pawel Jakub Dawidek pjd at FreeBSD.org
Mon May 10 08:36:44 PDT 2004


On Mon, May 10, 2004 at 08:07:23AM -0700, Christian S.J. Peron wrote:
+>   Modified files:
+>     sys/net              rtsock.c 
+>   Log:
+>   Zero the un-used portions of the struct sockaddr data before sending
+>   it back to userspace, so it does not break bind(2) on raw sockets in jails.
+>   
+>   Currently some processes, like traceroute(8) construct a routing request
+>   to determine its source address based on the destination. This sockaddr
+>   data is fed directly to bind(2). When bind calls ifa_ifwithaddr(9) to
+>   make sure the address exists on the interface, the comparison will
+>   fail causing bind(2) to return EADDRNOTAVAIL if the data wasnt zero'ed
+>   before initialization.
[...]
+>  					if (jailed(so->so_cred)) {
+> +						memset(&jail, 0, sizeof(jail));
+>  						jail.sin_family = PF_INET;

Why not bzero()?

-- 
Pawel Jakub Dawidek                       http://www.FreeBSD.org
pjd at FreeBSD.org                           http://garage.freebsd.pl
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20040510/197d4910/attachment.bin


More information about the cvs-src mailing list