In L4-based systems it is quite common to have multiple applications trying to use the same resource in parallel. One might for instance imagine a setup where multiple L4Linux servers run and try to use the computer's physical network interface. In such cases, the physical resource needs to be multiplexed (or virtualized in new-age termini).
ORe (short for Oshkosh Resurrection) is a best-effort ethernet multiplexer for L4. It provides an abstract send/receive interface for network packets and makes sure that every client gets only those packets it wants to receive. This is achieved by assigning each client a virtual MAC address and filtering packets accordingly.
The most fundamental ORe example is a client listening for and replying to ARP-based ping packets (such as those sent by the arping tool). To do so in Qemu, you need a menu.lst such as this:
title ORe kernel /bootstrap -serial -modaddr 0x2000000 module /fiasco -serial_esc -comspeed 115200 -comport 1 -nokdb -jdb_cmd=JH module /sigma0 module /roottask module /names module /dm_phys module /log module /l4io module /ore module /ore_test_arping
Then we run Qemu with a tun/tap network setup:
$> qemu -cdrom image.iso -serial stdio -net nic,model=rtl8139,vlan=0 -net tap,vlan=0 -m 200
image.iso is the image containing your L4 binaries, the net options say that we want to emulate a RealTek RTL8139 network card and connect it to VLAN0, which is also connected to the TAP device. Qemu starts running and we get some output, in the end the arping client comes up:
ore | main(): initialized DDELinux2.6 ore | main(): loopback: 0 ore | <6>device lo entered promiscuous mode ore | <6>device eth0 entered promiscuous mode ore | <6>eth0: link up, 100Mbps, full-duplex, lpa 0x05E1 ore | main(): Initialized 2 network devices. ore | Device = lo, IRQ = 0, MAC = 00:00:00:00:00:00 ore | Device = eth0, IRQ = 11, MAC = 52:54:00:12:34:56 ore | main(): Registering 'ORe' at names... ore | main(): Ready for service. arping | ore_lookup_server(): ORe server ORe = 9.02 arping | ore_do_open(): called ore | __init_mac(): MAC = 04:EA:43:01:96:09 arping | ore_do_open(): opened. worker = 9.08 arping | main(): opened eth0: 0 for 04:EA:43:01:96:09 arping | main(): ORe handle = 0 arping | main(): got send area: 0x00600008
The initial messages from ORe show devices being initialized (loopback lo and the NIC eth0). Arping then finds the ORe server and establishes a connection. The interesting part is the bold one - ORe assigns arping a pseudo-MAC-address 04:EA:43:01:96:09 - this is the one we are going to use now. In another shell, we start arping and tell it to use the tap interface tap0 to ping above MAC:
./arping -i tap0 04:EA:43:01:96:09 -w 100 -c 10000 60 bytes from 255.255.255.255 (04:ea:43:01:96:09): icmp_seq=9914 time=823.021 usec 60 bytes from 255.255.255.255 (04:ea:43:01:96:09): icmp_seq=9915 time=851.154 usec 60 bytes from 255.255.255.255 (04:ea:43:01:96:09): icmp_seq=9916 time=771.046 usec ...
Using ORe from your application
To successfully establish a network connection with ORe, you need the following applications running in addition to the basic L4 stuff you'll be running anyway:
- the ORe server
Optionally you might want to run the Events server so that ORe can obtain termination messages from its clients and can cleanly close connections in that case.
Connecting to the server
Sending and receiving packets
ORe and L4Linux
There is an ORe stub driver for L4Linux.