[PATCH 4/4] Handle unconnected DGRAM sockets with buffers in-flight

Oren Laadan orenl at librato.com
Thu Aug 13 13:33:56 PDT 2009

Dan Smith wrote:
> This patch avoids connecting an unconnected DGRAM socket to a fake peer as
> part of the restore process.  Note that it will appear to rewrite all packets
> received as coming from a single unbound sender.

Hmm.. I think this would break recvfrom() syscall:  it eventually calls
unix_dgram_recvmsg(), which grabs the next skb (datagram) in the queue,
and fills in the address of the socket from which the datagram had been
sent (af_unix.c:1672)

	if (msg->msg_name)
		unix_copy_addr(msg, skb->sk);


The more I think about it, it seems better to also checkpoint those
unconnected sockets that are the source of dgrams. IOW, when looping
through the received skb's of an unconnected dgram socket, then check
the skb->sk of each pending packet, and checkpoint that socket too.

And in restore, restore those too, even though they may be orphan
(closed, not referenced by any process anymore), and send each packet
from the correct origin socket.

This, btw, will be another case of sock without sk->sk_socket...


More information about the Containers mailing list