Packet Sender Package for Linux and RT-Linux The four main blocks in this package are: 1. Packet Sender applications ----------------------------- rtps.o - Real Time Packet Sender RT-Linux kernel module rtps.c - rtps.o source code linuxps - Linux Packet Sender - linuxps linux executable linuxps.c - linuxps source code startrtps - shell script installing the rtps.o module converting and passing it's parameters to the kernel module Usage: startrtps Note: If you try to insmod this module twice without removing it first, you might get the wrong error message: symbol for parameter addr not found stoprtps - shell script removing the rtps.o module 2. Time Series Generating applications -------------------------------------- sendAppl.c - application source code linuxSend - Linux executable rtSend - Linux executable to be run under RT-Linux 3. Matlab files --------------- (in ~/matlab on wallaby) pswrite.m - creates a binary file for sendAppl.c (linuxSend and rtSend) from a matrix of inter departure times psload.m - loads a binary file of inter departure times dag_ts.m - generates loss, real-time loss, consecutive loss, consecutive arrivals and delay time series from the dat file outputs of dag_filter application 4. Other files -------------- pscomm.h - common header file for the above applications includes the communication interface definition and the definition of PS_RT_LINUX flag indicating the currently used OS pscomm.c - the communication interface implementation based on shared memory, in case of RT-Linux using mbuff, in case of Linux using shm pscomm.o - communication interface object compiled for the OS according to the definition of PS_RT_LINUX flag in pscomm.h addr2i - an application converting ipaddress from a string or numbers and dots format to a network byte order number (it is used to convert the address passed to the rtps.o module as a parameter, because RTNET does not support this type of a conversion) addr2i.c - addr2i source code complinux - a shell script compiling the Linux application comprtlinux- a shell script compiling the RT-Linux application startup.txt- a shell script to initialize RT-Linux and set up RTNet this script is executed automatically from ~/.ssh/rc file (in root's ~) rtnetsetup.txt- contains the commands to configure an ethernet interface to be a RTNet device (in root's ~) dag_filter - an application to postprocess binary DAG dump files (*.d3h), filtering based on source and destination ip addreses and port numbers (in /usr/local/emudag on shapshot) dag_filter.c- dag_filter source code (in /usr/local/emudag on shapshot) Note: the files are located in the /usr/src/rtnet-0.9.0/examples/rtnet directory unless otherwise specified To switch the PC configuration between Linux and RT-Linux --------------------------------------------------------- 1. /etc/conf.modules When booting RT-Linux the network driver for the interface configured for RTNET should be a real-time driver. Before booting the workstation for Linux the configuration should be changed back to the original Linux configuraiton. 2. pscomm.h When compiling RT-Linux applications the file should contain the following line: #define PS_RT_LINUX For the Linux applications this line should be removed or changed to a comment. If complinux and comprtlinux scripts are used this is done automatically. RTPS - Real Time Packet Sender ------------------------------ rtps.o is a real-time linux kernel module generating udp packets according to the timing information delivered to it via shared memory from other linux applications. An example timing information generating application is the sendAppl.c. The first four bytes of the sent udp packets contain a sequence number. The numbering starts from 0, when rtps.o is loaded (eg. using the startrtps script) To reset this sequence number the module has to be deleted (stoprtps) and loaded again. RTNET is used for real-time networking (rtnet-0.9.0), the socket.c was modified to allow the reuse of sockets (see attila_rtnet_socket.c, attila_rtnet.h). Routing table handling was modified to allow sending packets to destinations outside the sending hosts network (arp.c, route.c, rtnet_dev.c, rtnet.h and rtifconfig.c was modified). After adding the gateways mac address to the routing table using: rtifconfig route solicit the external destination's ip address is added to the routing table with the following command: rtifconfig route add A message on the console will confirm the success of the route solicit. In our LAN sometimes this command has to be repeated several times because of the unreliability of the LAN switch's MAC address learning process. (Note: the best way to avoid this problem is to ping from a different host the RTNet interface after setting it up - after dropping couple of the first packets the ping should be succesfull and the switch's mac address table should be updated) RTLINUX 2.2 is used with rt-patched linux kernel 2.2.14. The process described below generates traffic from emutest4 (10.0.1.4) RT-Linux host to emutest3 (10.0.1.3) port 7777. On emutest3 the 'sock -u -s 7777' and tcpdump is used to receive and test the generated traffic stream. To run a test experiment the following steps are needed: A. If there is only one NIC in the host: 1. boot emutest4 with rtlinux ( work from the console, ssh will be disabled and make sure that /etc/conf.modules contains the rtnet driver configured for the network card) 2. start up rtlinux modules according to rtlstartup.txt 3. configure the eth0 interface for real-time networking ( this can be done only from the console, emutest4 becomes unreachable using ssh via this interface ) note: the rtifconfig command has to be issued twice - for some strange reason the first one always generates an error message see rtnetsetup.txt: ifconfig eth0 down rtifconfig eth0 up 10.0.1.4 255.255.255.0 rtifconfig eth0 up 10.0.1.4 255.255.255.0 4. to update the routing information on emutest4 ping emutest4 from emutest3 ( a message should confirm this on the emutest4 console) 5. start the udp server on emutest3 with command: sock -u -s 7777 6. start tcpdump on emutest3 (from a second shell): tcpdump host 10.0.1.4 7. Compile executables on emutest4 (if needed). In directory /usr/src/rtnet-0.9.0/examples/rtnet to compile rtps kernel module use command: comprtlinux Note: make sure that the pscomm.h is configured for RT-Linux 8. To send packets: install rtps.o module: startrtps emutest3 7777 to generate and send the timing information: ./rtSend interdeparturetimes.bin to remove rtps.o module and see some statistics: stoprtps 9. To change the timing generate new bin file using pswrite.m, to change the packet size modify the source code in sendAppl.c B. In case of two NIC's (eth0 - Linux eth1 - RTNet) 1. boot emutest4 with rtlinux 2. ssh as root (the rc file automatically loads the RT-Linux modules and configures RTNet) 3. Follow the steps from point 4 in case A (one NIC) LINUXPS - Linux packet sender ----------------------------- The Linux packet sender in principle works in the same way as the rtps. The only difference is that the sending daemon is run as an ordinary Linux application and not as a kernel module. This can be used on workstations running ordinary Linux ( it does NOT require the RT-Linux or RTNet packeges ). To run a test experiment: 1. boot emutest4 with linux ( make sure that /etc/conf.modules contains the Linux configuration and not the the RT-Linux) 2. start the udp server on emutest3 with command: sock -u -s 7777 3. start tcpdump on emutest3 (from a second shell): tcpdump host 10.0.1.4 4. Compile executables on emutest4 (if needed). In directory /usr/src/rtnet-0.9.0/examples/rtnet to compile the linux applications: complinux Note: make sure that pscomm.h is configured for Linux 5. To send packets: start linuxps packet sender application from a shell: linuxps emutest3 7777 (the application will terminate after receiving a character from the stdin) to generate and send the timing information type into a second shell: linuxSend interdeparturetimes.bin 6. To change the timing generate new bin file using pswrite.m, to change the packet size modify the source code in sendAppl.c Last updated: 01.11.2000