tech-net archive


Re: kernel networking stack in userspace

On Sat, 18 Oct 2008, Antti Kantee wrote:

8< snip >8

On the contrary, option 2 runs the entire kernel networking stack in
userspace.  This means that it must have raw ethernet access and
accomplishes this through the use of tap(4) (similar to e.g. qemu).
Contrasting the other option, this brings:

 * full networking stack in userspace
 * the interface and routing table must be configured before use
 * /dev/tap and interface configuration priviledges are required

To configure the interface from your code, you must emulate what
ifconfig(8) and route(8) do on a normal system.  There is an
example in src/sys/rump/net/rumptest/rumptest_net.c on how to do
this.  I'll probably move that stuff to a library lateron.

Currently, tap must be configured manually as tap0.  To do this, execute
(with appropriate priviledges):
golem> ifconfig tap0 create
golem> ifconfig tap0 up

Can we assume that if you want yet another virtual networking domain, you create a tap1, tap2, etc.?

Optionally, if wanting to bridge to a real network, execute:
golem> ifconfig bridge0 create
golem> brconfig bridge0 add tap0 add yourrealif0
golem> brconfig bridge0 up
(yes, the first command really is ifconfig, not brconfig)

What about _routing_ between domains?  :)

Apart from that, both options require threading, which can be enabled by
setting the RUMP_THREADS environment variable to 1.  Then it's just a
matter of running the application.  If all goes well, running
rumptest_net should dump out the html on the main page

Enjoy (if you're into this sort of stuff ;)
 - antti

pie-in-the-sky: barring interfacing with tap(4), the userspace kernel
networking stack is likely to be highly portable.  So if you don't like
networking on $OS, by all means use the NetBSD TCP/IP stack linked
against your application ;)

| Customer Service | FA29 0E3B 35AF E8AE 6651 |   |
| Network Engineer | 0786 F758 55DE 53BA 7731 | |

Home | Main Index | Thread Index | Old Index