qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Ciprian Dorin, Craciun" <ciprian.craciun@gmail.com>
To: Laurent Vivier <Laurent.Vivier@bull.net>
Cc: nbd-general@lists.sourceforge.net, linux-newbie@vger.kernel.org,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [Nbd] Transforming stdin and stdout pair into a socket
Date: Mon, 11 May 2009 16:28:11 +0300	[thread overview]
Message-ID: <8e04b5820905110628u3b8ac9ecm8f433e80f400508@mail.gmail.com> (raw)
In-Reply-To: <1242029023.4638.3.camel@frecb07144>

On Mon, May 11, 2009 at 11:03 AM, Laurent Vivier
<Laurent.Vivier@bull.net> wrote:
> Le dimanche 10 mai 2009 à 21:19 +0300, Ciprian Dorin, Craciun a écrit :
>> Hello all!
>
> Hi,
>
> perhaps the attached patch I wrote last year (november) is what you
> want...
>
> I didn't try to apply it to an up-to-date qemu-nbd.
>
> Regards,
> Laurent
>
>>     Today I've played around with NBD (Network Block Disk), and
>> qemu-nbd (a NBD client that exports QEMU disks as NBD's).
>>
>>     My problem is the following: both NBD kernel module and qemu-nbd
>> implementation expect to use a socket in order to communicate.
>>     This means that in order to securely tunnel the connection over
>> SSH (OpenSSH), I need an intermediary process that creates a socket
>> and forwards all input / output between this socket and stdin / stdout
>> (which are in fact pipes received from OpenSSH).
>>
>>     My question is: can I somehow make the pair of stdin / stdout seem
>> as a socket to the Linux syscalls (read and write)? (I would have to
>> make stdin / stdout pair look like a single file descriptor.) (This
>> would eliminate the intermediate process that just pipes data, and
>> thus reduce the overhead.)
>>
>>     Just to be clear: I know how to trick an application to have it's
>> stdin and stdout be an opened socket (by using dup syscall). But in
>> this case I need to trick the Linux kernel into thinking that stdin /
>> stdout pair is a socket (or a single file descriptor).
>>
>>     Thank you,
>>     Ciprian Craciun.
>>
>> ------------------------------------------------------------------------------
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
>> Series Scanner you'll get full speed at 300 dpi even with all image
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> _______________________________________________
>> Nbd-general mailing list
>> Nbd-general@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/nbd-general
>>
> --
> ------------------ Laurent.Vivier@bull.net  ------------------
> "Tout ce qui est impossible reste à accomplir"    Jules Verne
> "Things are only impossible until they're not" Jean-Luc Picard

    Well, very clever! :) From what I've seen you are actually using
the stdin as the socket descriptor, knowing that if qemu-nbd was
started with the -i flag it means that inetd has already set both
stdin and stdout to a real socket, and thus everything works Ok.

    Unfortunately this works only with inetd (or compatible system)
without any SSL/TLS wrapping. My problem is that if the stdin and
stdout are instead pipes (as it would happen in case of sshd?, or
socat with SSL connector?) this would not work...

    Thank you for the idea. I could use if I don't find another solution.

    Ciprian.

  reply	other threads:[~2009-05-11 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-10 18:19 [Qemu-devel] Transforming stdin and stdout pair into a socket Ciprian Dorin, Craciun
2009-05-11  8:03 ` [Qemu-devel] Re: [Nbd] " Laurent Vivier
2009-05-11 13:28   ` Ciprian Dorin, Craciun [this message]
2009-05-11 12:02 ` [Qemu-devel] " Anthony Liguori
2009-05-11 13:32   ` Ciprian Dorin, Craciun
2009-05-11 19:31     ` [Nbd] " Wouter Verhelst
2009-05-11 23:07     ` Paul Brook
2009-05-12  2:24       ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e04b5820905110628u3b8ac9ecm8f433e80f400508@mail.gmail.com \
    --to=ciprian.craciun@gmail.com \
    --cc=Laurent.Vivier@bull.net \
    --cc=linux-newbie@vger.kernel.org \
    --cc=nbd-general@lists.sourceforge.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).