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
--- Begin Message ---
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

--- End Message ---

Reply via email to