TCP for OMNeT+ + Roland Bless Mark Doll Institute of Telematics University of Karlsruhe, Germany Bless/Doll WSC 2004 1
Overview Motivation Introduction OMNeT+ + & TCP Concept for integration Implementation problems Evaluation results Summary & Outlook www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 2/21
Motivation I Investigation of Network Protocols � Different parameter settings � Extreme conditions � Scaling properties � Difficult in testbeds � Simulation Expressive simulation results � Require good emulation of real world behavior � Protocols we design use or modify TCP/IP stack � Emulation of network oriented layers � Transport (TCP) � Internet (IP) � Network Access (Ethernet) � Need TCP/IP stack implementation for simulation www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 3/21
Motivation II Problem � no validated (tested to be compliant to the standard) TCP/IP implementation for OMNeT+ + Possible solutions � Choose other simulator � ns-2 � OPNET � New implementation � Revision of the existing implementation (i. e. from Communications Engineering Institute, Karlsruhe) � full featured? � validated? � Re-use an existing real world implementation � Linux � FreeBSD www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 4/21
OMNeT+ + Discrete event simulator � hierarchically nested modules � communicate with messages through channels Written in C+ + � Complete source code publicly available Free for academic use � Commercial version OMNEST TM Advantages � Very well structured � Highly modular � Not limited to network protocol simulations (i. e. like ns-2) Disadvantages � Relatively young: 1997 first public release � Few simulation models www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 5/21
OMNeT+ + Hierarchical nested modules system module NED channels simple modules compound module NED C++ C++ C++ output gates input gates system module � � top level module simple modules � � C+ + � NED description of interface: parameters and gates compound modules � � NED only: parameters, gates and connections � unlimited nesting www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 6/21
Transmission Control Protocol TCP � Transport layer protocol (layer 4) � connection-oriented, reliable, stream-oriented � flow control, congestion control � Influenced by round trip time, packet loss � Most of today’s internet traffic via TCP � TCP behavior influences behavior of many protocols & applications � API: BSD socket interface (socket type: stream) FreeBSD‘s TCP/IP implementation � source code freely available � well structured code (not as optimized as Linux) � 4.x BSD was starting point for many other implementations � MAC OS X essentially is FreeBSD (with additions like Aqua) � Network research was and still is based on (Free)BSD � Mobile IPv6, Protocol Independent Multicast, … www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 7/21
FreeBSD vs. OMNeT+ + Function Call Messages One TCP stack Many TCP stacks per host per simulation Multi-tasking, threads, Messages must be functions are interruptible processed in one pass www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 8/21
Protocol stack of FreeBSD Application application Layer rcv_buff snd_buff Transport Layer tcp_input() tcp_output() ip_input() ip_forward() ip_output() Network swi_net() Layer ether_input() ether_output() Network Access Layer TX interrupt device driver device driver RX interrupt www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 9/21
cHost concept I Gates to Applications (cAppl) Multiplexer In/Out Gate SimpleModule Gates to LANs or other Hosts (cMedium or cHost) www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 10/21
cHost concept II Applikation rcv_buff snd_buff Multiplexer tcp_output() tcp_input() + = ? ip_input() ip_output() ip_forward() swi_net() ether_input() ether_output() TX-Interrupt Gerätetreiber Gerätetreiber RX-Interrupt www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 11/21
cHost concept III Multiplexer Applikation rcv_buff snd_buff tcp_input() tcp_output() ip_input() ip_output() ip_forward() swi_net() ether_input() ether_output() TX-Interrupt Gerätetreiber In/Out Gate Gerätetreiber RX-Interrupt SimpleModule www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 12/21
OMNeT+ + classes cHost � Simulated host with TCP/IP cMedium � Emulates broadcast medium (Ethernet LAN) � Allows for cHost address autoconfiguration cAppl � Source/sink (sample application) cRoute � Generates routing tables www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 13/21
cAppl & cRoute cAppl Uses socket interface to cHost � Demonstrates usage of message based socket interface Can accept and initiate connections Full duplex cRoute Manual routing table set up � Time consuming � Configuration Errors � Often routing table details unimportant Use cRoute class to generate routing tables for FreeBSD � Utilizes standard OMNeT+ + class cTopology � Computes shortest path (Dijkstra) www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 14/21
cHost < -> FreeBSD I TCP stacks must be independent No global and static variables possible Access via C macro #define D ( (struct private_data*)bsd_data) � Usage: replace xyz with D->xyz FreeBSD: same identifier for types and variables � i. e. ifnet � Simple substitution of xyz with macro impossible � However changes to FreeBSD source minimal � Avoid bugs � Allow for easier re-porting of future FreeBSD releases www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 15/21
cHost < -> FreeBSD II Switch to BSD via C macro (simplified) #define ENTER_BSD() { \ bsd_data=data; \ host_class=this; \ host_id=id(); \ } Calling BSD functions from OMNeT+ + � Enclose call by ENTER_BSD and LEAVE_BSD Calling OMNeT+ + functions from BSD � OMNeT+ + function exported with C calling conventions � Function then uses host_class to access instance data www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 16/21
Technical Problems Include files FreeBSD and OMNeT+ + (host OS) need their own include files � i. e. struct sockaddr and struct sockaddr_in � Socket interface Function calls replaced by OMNeT+ + messages � � read(), write(), listen(), connect(), ... Blocking functions emulated by non-blocking + self message � Memory (shared) Differences between libc of FreeBSD and host OS running � OMNeT+ + mbufs & mclusters mapped on malloc � Timers Access to BSD ticks variable redirected to � gettick_toomnet() which uses OMNeT+ + ’s simtime() � startup added individually per cHost to prevent synchronization One timer for all hosts where appropriate, i. e. ip_slowtimo � www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 17/21
Evaluation Memory usage per Host FreeBSD: 19 KiB � + cHost class � + Receive-/Send buffer 64 KiB (default) per connection � Run time in seconds for 1 hour of simulated time Hosts/Conn. 0 1 2 10 0.467 2.199 4.196 100 3.361 30.575 59.638 1000 64.233 434.724 823.019 Time consuming insertion/removal of timer events in OMNeT+ + ’s � event queue (heap) www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 18/21
Summary First validated and complete TCP implementation for OMNeT+ + Realized by adapting FreeBSD‘s TCP/IP stack Message-based implementation of the BSD socket interface Routing module automates routing table setup www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 19/21
Outlook Performance � hide certain messages in OMNeT+ + � dedicated timer module for OMNeT+ + Improve adaption process � Perl script/parser for (semi)automatic global variable replacement Support further protocols � IPv6 � System call interface for routing deamons � Mobile IPv6 patches www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 20/21
Thanks to Jérôme Freilinger (diploma student) Thank You for your attention! www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT+ + 21/21
Recommend
More recommend