[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ4BwwFYKYOJoP34cGqWyE_AzxMwDNqFG-XDjLB6ZdO4nQmY4w@mail.gmail.com>
Date: Wed, 23 Jan 2013 11:41:16 -0500
From: Yannick Koehler <yannick@...hler.name>
To: netdev@...r.kernel.org
Subject: Re: Unix Socket buffer attribution
I did some more research, I found out that netlink and
sock_queue_err_skb does the same trick that I claim to be missing
under the net/unix/af_unix.c. After adding the code, I got a problem
since af_unix.c "_recvmsg()" functions assume that the skb->sk is
holding the peer socket not the current one related to the receive
skb. It extract the sun_path name from it. Since with UDP each
packet may have a different peer, the only solution I found was to use
the skb control block to hold the peer name. The problem is that this
cb member is 48 bytes in length and sun_path is 108 bytes in size. So
I had to increase it from 48 to 160 bytes.
This obviously increase the cost of an SKB struct, so I do not really
like this solution. But at least it seems to prove my point and now,
with this I can have my clients working except the one mis-behaving.
I am attaching a patch.
I also saw this thread that would be somehow related:
http://www.mail-archive.com/netdev@vger.kernel.org/msg20195.html
Basically since we now count the buffer size into the socket who
receives it we can safely use this check instead of looking at the
receive queue size:
if (atomic_read(&other->sk_rmem_alloc) + skb->truesize >=
(unsigned)other->sk_rcvbuf) {
So anyway I sent my patch, and I am awaiting for comments on how to improve it.
--
Yannick Koehler
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists