Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
General idea
Extensible toolkit for writing packet processors Architecture centered on elements
Small building blocks Perform simple operations e.g. decrease TTL Written in C++ Directed graphs of elements Text files Runs on Linux, Mac OS X, BSD and partially in Windows
PATS Research Group
Click routers
Open source
9/27/10 2
Click graph
Elements connected by edges
9/27/10
Elements
Class
element type (reuse!) initializes this instance Interface where packets arrive Triangles Interface where packets leave Squares myTee :: Tee
PATS Research Group
Configuration string
Input port(s)
Output port(s)
9/27/10
Filled square or triangle Source initiates packet transfer Event based packet flow Empty square or triangle Destination initiates packet transfer Used with polling, scheduling, Square-in-square or triangle-in-triangle Becomes push or pull (inner square or triangle filled or empty)
Pull port
Agnostic port
9/27/10
Pull port
9/27/10
Compound elements
Group elements in larger elements Configuration with variables
9/27/10
Pass configuration to the internal elements Can be anything (constant, integer, elements, IP address, ) Motivates reuse
PATS Research Group
Packets
Packet consists of
Payload
char* Access with struct*
Annotations Payload
9/27/10
Click scripts
Text files describing the Click graph
src :: FromDevice(eth0); ctr :: Counter; sink :: Discard; src -> ctr; ctr -> sink; FromDevice(eth0) -> Counter -> Discard;!
9/27/10
PATS Research Group
Input port: -> [nr1]Element Output port: -> Element[nr2] Both: -> [nr1]Element[nr2] Only one port: number can be omitted Motivates instance naming
mypackets::IPClassifier(dst host $myaddr,-); FromDevice(eth0) -> mypackets; mypackets[0] -> Print(mine) -> [0]Discard; mypackets[1] -> Print(the others) -> Discard;
9/27/10
PATS Research Group
10
9/27/10
11
Element configurations
Listed in click script
First required arguments Then optional arguments Then arguments by keyword (after keyword) Integers Strings e.g. data IP addresses 143.129.77.30 Elements
PATS Research Group
12
9/27/10
13
Running Click
Kernel module
Completely overrides Linux routing High speed, requires root permissions Crashing Click = crashing kernel = crashing system
Userlevel
Runs as a daemon on a Linux system Easy to install and still fast Recommended
nsclick
Runs as a routing agent within the ns-2 network simulator Multiple routers on 1 system Difficult to install but less hardware needed
9/27/10
14
Userlevel
Send packets to and receive packets from the network
Connects to the network interface Delivered to Click at FromDevice(ethX) Sent to system by ToDevice(ethX)
With a virtual tun/tap interface Set the default route to the tun/tap device to make sure traffic passes through the Click route
9/27/10
15
Userlevel (ctd.)
Warning: Linux routing is still working
Addresses (IP and MAC) must be correct Make sure IPs from Click are different from system Ips
9/27/10
16
Handlers: basics
Like function calls to an element ReadHandler
Request a value from an element Pass a string to an element You can parse the string with cp_va_parse! You cant call a ReadHandler with arguments Take a look at Pokehandlers!
PATS Research Group
Or WriteHandler
There is no ReadWriteHandler
9/27/10 17
Handlers: calling
Start click
read <elementname>.<handlername>
read rt.table
9/27/10
18
Why so hard?
Ill just code it as a daemon.
9/27/10
19
So have linked lists been implemented before Did you do it before? Do you know how ARP really works? Neither is Oberon It works at layer 3, it is in the network There are links with large companies e.g. Google
PATS Research Group
9/27/10
20
References
Click website: http://www.read.cs.ucla.edu/click/
Element documentation (by name or category) Programming Concepts Doxygen documentation (Internals documentation) Comprehensive documentation of every concept Interesting chapters
Introduction Architecture: elements, packets, connections, push and pull, element implementation Language: syntax, configuration strings, compound elements
9/27/10
21