11 Networking

FIXME: this subsystem is in flux


11.1 pfinet


11.2 pflocal


11.3 libpipe


11.4 Socket Interface

FIXME: net frobbing stuff may be added to socket.defs


11.5 eth-multiplexer

The eth-multiplexer is a network multiplexer. It creates virtual ethernet interfaces and dispatches packets to the right client that connect to the virtual interface. It also works as a bridge to connect the real ethernet interface and the virtual ones.


11.5.1 Invoking eth-multiplexer

Usage: eth-multiplexer [option…]

--number_device=number
-v

The number of virtual network interfaces to be created.

--interface=device
-i

Network interface to use.

Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options.

Users can create as many virtual devices as they wants. The name of the virtual device follows the rule "veth%d", and the number in the name starts from 0.

eth-multiplexer can only connect to one network interface. If no --interface is specified, the created virtual network is isolated with the real network completely.


11.5.2 Internal

eth-multiplexer implements the server side functions in device.defs, so clients can access the virtual device as kernel devices. All information about the virtual interface is kept in the vether_device structure.

When eth-multiplexer gets a packet from a virtual interface (which happens in ds_device_write) or from the underlying interface where it sit on (in ethernet_demuxer), it sends the packet to all other interfaces. eth-multipexer has BPF filters for each client. The BPF filter decides whether to deliver the packet. The packet delivery is done by deliver_pack. There is no filter for the underlying interface in eth-multiplexer, so every packet from the virtual interface will be sent to the underlying interface.

eth-multiplexer sets the underlying interface into the promiscuous mode if it can, so it can receive the packet with the virtual interface’s hardware address from the underlying interface.