[CRIU] [PATCH 02/11] images: sk-packet -- Reserve data for netlink queue support

Andrey Vagin avagin at virtuozzo.com
Thu Sep 15 05:12:58 PDT 2016


On Thu, Sep 15, 2016 at 02:04:01PM +0300, Pavel Emelyanov wrote:
> On 09/14/2016 03:21 PM, Andrey Vagin wrote:
> > On Tue, Sep 13, 2016 at 07:30:56PM +0300, Cyrill Gorcunov wrote:
> >> On Tue, Sep 13, 2016 at 06:14:56PM +0300, Pavel Emelyanov wrote:
> >>>>
> >>>> Guys, can we merge this patch please? This field is present in vz7
> >>>> release and it may conflict with future vanilla releases, which is
> >>>> unacceptable.
> >>>
> >>> I asked whether the new field identifies the sender and, if it does,
> >>> align this with Kirill Tkhai's patches to add sender id for unix sockets
> >>> as well.
> >>
> >> No, this field doesn't identify the sender, it simply stands for
> >> data to be put for netlink queue. The socket data belongs to is
> >> identified by @id_for entry.
> > 
> > Kirill saves a sender id, here we save a whole address.
> 
> Address of what?

source address of the message

For unix sockets, we need a sender socket to restore a message, because
in kernel a message (skb) has a reference to a sender socket.

static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
		                              size_t size, int flags)
...
        if (msg->msg_name)
                unix_copy_addr(msg, skb->sk);

For netlink sockets, we usualy dump a message without a sender socket
(many of them are kernel sockets). In kernel, netlink messages don't
references to sender sockets.

static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
                           int flags)
....
        if (msg->msg_name) {
                DECLARE_SOCKADDR(struct sockaddr_nl *, addr, msg->msg_name);
                addr->nl_family = AF_NETLINK;
                addr->nl_pad    = 0;
                addr->nl_pid    = NETLINK_CB(skb).portid;
                addr->nl_groups = netlink_group_mask(NETLINK_CB(skb).dst_group);
                msg->msg_namelen = sizeof(*addr);
        }



> 
> > For netlink
> > sockets, we don't need to have a sender to restore a message.
> > .
> > 
> 


More information about the CRIU mailing list