lkml.org 
[lkml]   [2002]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: Unix-domain sockets - abstract addresses
Date
Hello!

> According to the man page 'unix(7)':
> When a socket is connected and it doesn't already have a local address a
> unique address in the abstract namespace will be generated automatically.

This is wrong. The address is not autogenerated unless SO_PASSCRED
is requested by security&compatibility reasons.
So, if the socket is SOCK_DGRAM it is anounymous and "send-only",
it is impossible to reply to it.


> but I have seen 0x0BA5, 0x7FA8, 0x1FA8 and others).

Yes, this is bug. The fix is enclosed. It should return nil address.

> So, the question is: which is right? The man page, or af_unix.c?

Both of them are wrong.

Alexey


--- af_unix.c.orig Thu Aug 8 22:23:56 2002
+++ af_unix.c Thu Aug 8 22:34:58 2002
@@ -1432,7 +1432,7 @@

static void unix_copy_addr(struct msghdr *msg, struct sock *sk)
{
- msg->msg_namelen = sizeof(short);
+ msg->msg_namelen = 0;
if (sk->protinfo.af_unix.addr) {
msg->msg_namelen=sk->protinfo.af_unix.addr->len;
memcpy(msg->msg_name,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:27    [W:0.044 / U:2.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site