tcp for omnet++ -...

21
Bless/Doll WSC 2004 1 TCP for OMNeT++ Roland Bless Mark Doll Institute of Telematics University of Karlsruhe, Germany

Upload: lamxuyen

Post on 08-May-2018

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

Bless/Doll WSC 2004 1

TCP for OMNeT++Roland Bless

Mark Doll

Institute of TelematicsUniversity of Karlsruhe, Germany

Page 2: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 2/21

OverviewMotivation

Introduction OMNeT++ & TCP

Concept for integration

Implementation problems

Evaluation results

Summary & Outlook

Page 3: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 3/21

Motivation IInvestigation of Network Protocols

Different parameter settingsExtreme conditionsScaling propertiesDifficult in testbedsSimulation

Expressive simulation resultsRequire good emulation of real world behaviorProtocols we design use or modify TCP/IP stackEmulation of network oriented layers

Transport (TCP)Internet (IP)Network Access (Ethernet)

Need TCP/IP stack implementation for simulation

Page 4: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 4/21

Motivation IIProblem

no validated (tested to be compliant to the standard) TCP/IP implementation for OMNeT++

Possible solutionsChoose other simulator

ns-2OPNET

New implementationRevision of the existing implementation (i. e. from Communications Engineering Institute, Karlsruhe)

full featured?validated?

Re-use an existing real world implementationLinuxFreeBSD

Page 5: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 5/21

OMNeT++Discrete event simulator

hierarchically nested modulescommunicate with messages through channels

Written in C++Complete source code publicly available

Free for academic useCommercial version OMNESTTM

AdvantagesVery well structuredHighly modularNot limited to network protocol simulations (i. e. like ns-2)

DisadvantagesRelatively young: 1997 first public releaseFew simulation models

Page 6: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 6/21

system moduletop level module

simple modulesC++NED description of interface: parameters and gates

compound modulesNED only: parameters, gates and connectionsunlimited nesting

OMNeT++

NED

system module

compound modulesimple modules

input gates output gates

C++ C++ C++

NED

Hierarchical nested modules

channels

Page 7: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

Transmission Control ProtocolTCP

Transport layer protocol (layer 4)connection-oriented, reliable, stream-orientedflow control, congestion control

Influenced by round trip time, packet lossMost of today’s internet traffic via TCP

TCP behavior influences behavior of many protocols & applicationsAPI: BSD socket interface (socket type: stream)

FreeBSD‘s TCP/IP implementationsource code freely availablewell 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, …

Page 8: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 8/21

FreeBSD vs. OMNeT++

Function Call

One TCP stackper host

Multi-tasking, threads, functions are interruptible

Messages

Many TCP stacksper simulation

Messages must be processed in one pass

Page 9: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 9/21

Protocol stack of FreeBSD

device driver

RX interrupt

ether_input()

swi_net()

ip_input()

tcp_input()

application

rcv_buff snd_buff

tcp_output()

ip_output()

device driver

ip_forward()

ether_output()

TX interrupt

TransportLayer

NetworkLayer

Network AccessLayer

ApplicationLayer

Page 10: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 10/21

cHost concept IGates to Applications (cAppl)

Multiplexer

In/Out Gate

SimpleModule

Gates to LANs or other Hosts (cMedium or cHost)

Page 11: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 11/21

cHost concept II

Gerätetreiber

RX-Interrupt

ether_input()

swi_net()

ip_input()

tcp_input()

Applikation

rcv_buff snd_buff

tcp_output()

ip_output()

Gerätetreiber

ip_forward()

ether_output()

TX-Interrupt

+ = ?Multiplexer

Page 12: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 12/21

cHost concept III

Multiplexer

In/Out Gate

SimpleModule

Gerätetreiber

RX-Interrupt

ether_input()

swi_net()

ip_input()

tcp_input()

Applikation

rcv_buff snd_buff

tcp_output()

ip_output()

Gerätetreiber

ip_forward()

ether_output()

TX-Interrupt

Page 13: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 13/21

OMNeT++ classescHost

Simulated host with TCP/IP

cMediumEmulates broadcast medium (Ethernet LAN)

Allows for cHost address autoconfiguration

cApplSource/sink (sample application)

cRouteGenerates routing tables

Page 14: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 14/21

cAppl & cRoutecAppl

Uses socket interface to cHostDemonstrates usage of message based socket interface

Can accept and initiate connectionsFull duplex

cRouteManual routing table set up

Time consumingConfiguration ErrorsOften routing table details unimportant

Use cRoute class to generate routing tables for FreeBSDUtilizes standard OMNeT++ class cTopologyComputes shortest path (Dijkstra)

Page 15: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 15/21

cHost <-> FreeBSD ITCP stacks must be independentNo global and static variables possibleAccess via C macro

#define D ( (struct private_data*)bsd_data)

Usage: replace xyz with D->xyz

FreeBSD: same identifier for types and variablesi. e. ifnet

Simple substitution of xyz with macro impossible

However changes to FreeBSD source minimalAvoid bugs

Allow for easier re-porting of future FreeBSD releases

Page 16: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 16/21

cHost <-> FreeBSD IISwitch 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 BSDOMNeT++ function exported with C calling conventionsFunction then uses host_class to access instance data

Page 17: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 17/21

Technical ProblemsInclude files

FreeBSD and OMNeT++ (host OS) need their own include filesi. e. struct sockaddr and struct sockaddr_in

Socket interfaceFunction calls replaced by OMNeT++ messages

read(), write(), listen(), connect(), ...

Blocking functions emulated by non-blocking + self messageMemory (shared)

Differences between libc of FreeBSD and host OS running OMNeT++mbufs & mclusters mapped on malloc

TimersAccess to BSD ticks variable redirected to gettick_toomnet() which uses OMNeT++’s simtime()startup added individually per cHost to prevent synchronizationOne timer for all hosts where appropriate, i. e. ip_slowtimo

Page 18: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 18/21

EvaluationMemory 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

Time consuming insertion/removal of timer events in OMNeT++’sevent queue (heap)

59.63830.5753.361100

823.019434.72464.2331000

4.1962.1990.46710

210Hosts/Conn.

Page 19: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 19/21

SummaryFirst 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

Page 20: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 20/21

OutlookPerformance

hide certain messages in OMNeT++

dedicated timer module for OMNeT++

Improve adaption processPerl script/parser for (semi)automatic global variable replacement

Support further protocolsIPv6

System call interface for routing deamons

Mobile IPv6 patches

Page 21: TCP for OMNeT++ - telematics.tm.kit.edutelematics.tm.kit.edu/.../56/bless-doll-omnettcp-wsc2004-slides.pdf · OPNET New implementation ... Bless/Doll WSC 2004 TCP for OMNeT++ 7/21

www.tm.uka.de Bless/Doll WSC 2004 TCP for OMNeT++ 21/21

Thanks to Jérôme Freilinger(diploma student)

Thank You for your attention!