Manual

Synthetic Target Ethernet Driver
}
It is not possible for an ethernet device to be shared by both the eCos TCP/IP stack and the Linux one: there would
be no simple way to work out which stack incoming packets are intended for. In theory it might be possible to do
some demultiplexing using distinct IP addresses, but it would be impossible to support some functionality such
as DHCP. Therefore the rawether program will refuse to access any ethernet device already in use. On a typical
Linux system eth0 will be used for Linux networking, and the PC will have to be equipped with additional ethernet
devices for use by eCos.
The rawether program will access the hardware via the appropriate Linux device driver, so it is important that the
system is set up such that the relevant module will be automatically loaded or is already loaded. The details of this
will depend on the installed distribution and version, but typically it will involve an entry in /etc/modules.conf.
Ethertap
The Linux kernel’s ethertap facility provides a virtual network interface. A Linux application, for example the
rawether program, can open a special character device /dev/net/tun, perform various ioctl calls, and then
write and read ethernet packets. When the device is opened the Linux kernel automatically creates a new network
interface, for example tap0. The Linux TCP/IP stack can be made to use this network interface like any other
interface, receiving and transmitting ethernet packets. The net effect is a virtual network connecting just the Linux
and eCos TCP/IP stacks, with no other nodes attached. By default all traffic remains inside this virtual network and
is never forwarded to a real network.
Support for the ethertap facility may or may not be provided automatically, depending on your
Linux distribution and version. If your system does not have a device /dev/net/tun or a
module tun.o then the appropriate kernel documentation should be consulted, for example
/usr/src/linux-2.4/Documentation/networking/tuntap.txt. If you are using an old Linux kernel then
the ethertap functionality may be missing completely. When the rawether program is configured and built, the
configure script will check for a file /usr/include/linux/if_tun.h. If that file is missing then rawether will
be built without ethertap functionality, and only real ethernet interfaces will be supported.
The target definition file is used to map eCos network devices on to ethertap devices. The simplest usage is:
synth_device ethernet {
eth0 ethertap
...
}
The Linux kernel will automatically allocate the next available tap network interface. Usually this will be tap0 but
if other software is using the ethertap facility, for example to implement a VPN, then a different number may be
allocated. Usually it will be better to specify the particular tap device that should be used for each eCos device, for
example:
synth_device ethernet {
eth0 ethertap tap3
eth1 ethertap tap4
...
}
The user now knows exactly which eCos device is mapped onto which Linux device, avoiding much potential
confusion. Because the virtual devices are emulated ethernet devices, they require MAC addresses. There is no
701