9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: cinap_lenrek@gmx.de
To: 9fans@9fans.net
Subject: Re: [9fans] Streaming 9P is out
Date: Sun,  9 Jan 2011 01:31:42 +0100	[thread overview]
Message-ID: <cf7dc7b2bfcb571d91e797d4956f0c01@gmx.de> (raw)
In-Reply-To: <AANLkTik4_kOt7UGvL1=wL=gEOAs6Dmn=ympJ_jiX5pV4@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]

the use of tcp to get flow control is an interesting idea.

some remaks:

the client only gets the dial string of a new tcp connection.  an
attacker could guess the port numbers and take over the stream.  or
the client might be delayed before it makes the dial() causing it to
get the wrong stream or some other random tcp connection at the same
port.

the initial 9p channel might be encrypted (common when you use
cpu), but the stream data excapes as cleartext... compromising security.

on the implementation, the server might give the wrong ip address
(because he is behind some nat gateway) causing the dial to fail. i think
the stream() call should fallback to the original filedescriptor then.

why do we pass the offset and mode in the pstream syscall?  devmnt
should know the current offset and mode from the Chan structure right?

i think you could simplify the userspace interface a little bit
further.  for example, i see no use for the Stream structure and
sread/swrite as they never fall back on the old filedescriptor and all
the decisions are already made in the stream() call (except the
isread check).

what about this:

newfd = stream(oldfd, ....);

int
stream(int fd, vlong offset, char isread)
{
	for(;;){
		char addr[Maxstring];
		int r;

		if((r = pstream(fd, addr, offset, isread)) < 0)
			break;
		if(addr[0] == 0)
			break;
		if((r = dial(addr, 0, 0, 0)) < 0)
			break;

		return r;
	}

	/* server doesnt support Tstream */
	if((fd = dup(fd, -1)) >= 0)
		seek(fd, offset, 0);
	return fd;
}

--
cinap

[-- Attachment #2: Type: message/rfc822, Size: 3964 bytes --]

From: John Floren <slawmaster@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] Streaming 9P is out
Date: Fri, 7 Jan 2011 23:24:37 -0800
Message-ID: <AANLkTik4_kOt7UGvL1=wL=gEOAs6Dmn=ympJ_jiX5pV4@mail.gmail.com>

Ok, now that the thesis is signed, I feel ready to release my work on
streaming for 9P, as outlined in my talk at IWP9; things have changed
a lot since that talk, but the general idea remains the same. The
repository at https://bitbucket.org/floren/tstream/ contains my code
and the thesis documents. I used divergefs to keep my root clean, so
that's what's distributed--use divergefs to mount the sys/ in my repo
over the /sys on your fs, and you'll probably also want to set up a
/386 divergefs mount too.

I forgot to add my modified cp, and I'd add it but I'm on a bad wifi
connection that seems to be giving hg a bad time. There is a modified
exportfs in /sys/src/cmd/exportfs, and really it's not that hard to
modify user programs like cp to do streaming, it's all explained in
the thesis document. When I get a better connection I'll add the
streaming cp to the repo anyway.

Anyway, it's far from perfect, but any comments, patches, or
suggestions are appreciated.


John

  parent reply	other threads:[~2011-01-09  0:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-08  7:24 John Floren
2011-01-08 10:45 ` Seed
2011-01-08 13:11   ` Bruce Ellis
2011-01-08 15:16 ` David Leimbach
2011-01-09  0:31 ` cinap_lenrek [this message]
2011-01-09  0:46   ` John Floren
2011-01-09  1:05     ` erik quanstrom
2011-01-09  1:53     ` cinap_lenrek
2011-01-09  2:24       ` Lyndon Nerenberg (VE6BBM/VE7TFX)
2011-01-09  2:42         ` ron minnich
2011-01-09  1:58     ` cinap_lenrek

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=cf7dc7b2bfcb571d91e797d4956f0c01@gmx.de \
    --to=cinap_lenrek@gmx.de \
    --cc=9fans@9fans.net \
    /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).