Commit 75be843c authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

files: Allow to send unix sockets over unix sockets

Everything is ready. Message queue restores are in
the second stage of open for all types of unix sockets.
We just need to make scm wait before restore_unix_queue()
and allow to dump such scm context.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent fdb7bde5
......@@ -100,15 +100,6 @@ static int dump_scm_rights(struct cmsghdr *ch, SkPacketEntry *pe)
if (dump_my_file(fds[i], &scme->rights[i], &ftyp))
return -1;
/*
* Unix sent over Unix are tricky and not supported
* for now. (XXX -- todo).
*/
if (ftyp == FD_TYPES__UNIXSK) {
pr_err("Can't dump send %d (unix/epoll) fd\n", ftyp);
return -1;
}
}
i = pe->n_scm++;
......
......@@ -1123,6 +1123,9 @@ static int post_open_standalone(struct file_desc *d, int fd)
BUG_ON((ui->flags & (USK_PAIR_MASTER | USK_PAIR_SLAVE)) ||
(ui->ue->uflags & (USK_CALLBACK | USK_INHERIT)));
if (chk_restored_scms(ui))
return 1;
peer = ui->peer;
if (!peer || ui->is_connected)
goto restore_sk_common;
......@@ -1292,6 +1295,9 @@ static int post_open_interconnected_master(struct unix_sk_info *ui)
fle_peer = file_master(&peer->d);
BUG_ON(fle->task != fle_peer->task); /* See interconnected_pair() */
if (chk_restored_scms(ui) || chk_restored_scms(peer))
return 0;
if (restore_unix_queue(fle->fe->fd, peer))
return -1;
......@@ -1563,12 +1569,6 @@ static int open_unix_sk(struct file_desc *d, int *new_fd)
ui = container_of(d, struct unix_sk_info, d);
/* FIXME -- only queue restore may be postponed */
if (chk_restored_scms(ui)) {
pr_info("scm: Wait for tgt to restore\n");
return 1;
}
if (inherited_fd(d, new_fd)) {
ui->ue->uflags |= USK_INHERIT;
ret = *new_fd >= 0 ? 0 : -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment