[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] offloading lwip stack, again !
From: |
Adam Dunkels |
Subject: |
[lwip-users] Re: [lwip] offloading lwip stack, again ! |
Date: |
Wed, 08 Jan 2003 22:02:22 -0000 |
On Monday 03 December 2001 10.19, you wrote:
> I was hoping that someone in the list will help me with this.
> Having used lwip in unix simulation, i quite understand (but perhaps not as
> many others in the list would) the way it uses the tap/tun device drivers
> to communicate with the host native tcp/ip stack . Iam trying to extend
> this test bench a bit further - make lwip as an *offloaded* stack on a
> linux or freebsd system. I want to modify the socket layer in linux or
> freebsd to bypass their native stack and exchange data directly with the
> tap/tun device, so that lwip appears as an tcp offloaded stack. The changes
> in the socket layer should not affect existing applications on the linux or
> freebsd.
>
> The existing applications on linux/freebsd would now use the lwip stack
> Can someone tell me if this is possible ? If so, I would like to know, how
> coupled is the socket layer in the freebsd/linux system with its native
> tcpip stack and which os would be better to use.
It is possible to replace te TCP/IP stack in both BSD and Linux, but takes
quite some work to get it working properly. BSD has a structure called
protosw (see /sys/sys/protosw.h on a FreeBSD machine) which defines a
protocol. This structure controls which functions that should be called both
when a new socket is created for the protocol (or operations are done on the
socket) and when new packets arrive. It should be possible to write some glue
code for translating the BSD mbufs into pbufs and vice versa. It should also
be possible to write code to handle the socket operations from the
application programs. But it would require *a lot* of work to get it working,
I think.
Both the Linux and BSD stack is rather tightly coupled with the kernel, but
atleast in BSD it is possible to configure the kernel so that the TCP/IP code
isn't compiled in at all (the INET config option). In either case, go with
Frederico's suggestion and do it as a module - it is probably easier and
doesn't require recompilation of the kernel every time it should be tested.
I don't know which is the best way to go (Linux or BSD). There are user space
ports of both systems so it should be possible to develop this in user space
(as opposed to kernel space). Look for ALPINE and User Space Linux on google.
A good book to read in any case is "TCP/IP Illustrated volume 2 - the
implementation" by W. Richard Stevens. It is a complete walk-through of the
BSD TCP/IP stack.
/adam
--
Adam Dunkels <address@hidden>
http://www.sics.se/~adam
[This message was sent through the lwip discussion list.]
- [lwip-users] Re: [lwip] offloading lwip stack, again !,
Adam Dunkels <=