Skip to contentSkip to conversation

unix domain sockets bugfix

PATCH Balazs Scheidler 1 participant 1 message Nov 5, 2002

lore
Share & tools
lore
#0 lore raw

2.4.20-rc1, still not working well for recvfrom() of unix-dgram sockets. It doesn't return 0 as the length of the sockaddr, checking out the code again makes me think that this is the problem:

socket.c renamed from socket.c.old +1 -1
@@ -1262,7 +1262,7 @@
 		flags |= MSG_DONTWAIT;
 	err=sock_recvmsg(sock, &msg, size, flags);
 
-	if(err >= 0 && addr != NULL && msg.msg_namelen)
+	if(err >= 0 && addr != NULL)
 	{
 		err2=move_addr_to_user(address, msg.msg_namelen, addr, addr_len);
 		if(err2<0)

---------

strace for the behaviour of the kernel:

Quoted 2 lines

recvfrom(3, "<38>Nov 5 17:53:01 PAM_unix[952"..., 2048, 0, {sin_family=0xf80c /* AF_??? */, {sa_family=63500, sa_data="\377\27 7\6\351\4\10\10\270\5\10\360@\5\10"}, [256]) = 82

you can see that 256 is returned as the length of the sockaddr, and there's garbage in the sa_family field.

Signature · 2 lines
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1