On Thu, Feb 10, 2000 at 08:36:13AM -0600, Dave Grothe wrote:
> To amplify a bit on what Ole said: The Linux STREAMS code (LiS) does a
> good job in being able to interpose complex and flexible protocol
> stacks below IP -- the _standard_ Linux IP.
>
> What it _cannot_ do, and would require some assistance from the kernel
> networking folks, is to run protocol stacks _above_ TCP or _above_ UDP.
> Every once in awhile I get a question from a potential customer about
> tunneling our SNA over a TCP connection in Linux. Without making a
> trip up to user space the answer always has to be "can't be done." The
> reason being that we can't configure our SNA code (STREAMS based) above
> TCP while keeping the messages in the kernel.
Yes you can. You can "simulate" user dataspace in kernel
by doing:
(from mm/filemap.c)
static int file_send_actor(read_descriptor_t * desc, struct page *page,
unsigned long offset , unsigned long size)
{
unsigned long kaddr;
ssize_t written;
unsigned long count = desc->count;
struct file *file = (struct file *) desc->buf;
mm_segment_t old_fs;
if (size > count)
size = count;
old_fs = get_fs();
set_fs(KERNEL_DS);
kaddr = kmap(page);
written = file->f_op->write(file, (char *)kaddr + offset,
size, &file->f_pos);
kunmap(page);
set_fs(old_fs);
if (written < 0) {
desc->error = written;
written = 0;
}
desc->count = count - written;
desc->written += written;
return written;
}
Sure it isn't too pretty, but it does work quite well.
(And "worst" of all, it involves data copy...)
> (Having contributed this two-cents worth to this discussion, I feel somewhat
> embarassed in that I am leaving for a two-week vacation on Saturday and will
> not
> have an opportunity to read responses or comment further.)
>
> -- Dave (author of LiS)
/Matti Aarnio <matti.aarnio@xxxxxxxxx>
|