a data structures´ view at the ip-lookup and packet classification problem

31
1 A Data Structures´ View at the IP-Lookup and Packet Classification Problem Prof. Dr. Th. Ottmann Albert-Ludwigs-Universität Freiburg, Germany [email protected] (Lecture 11: The IP-LookUp & Packet Classification Problem, Part I) Advanced Algorithms & Data Structures

Upload: emmett

Post on 17-Jan-2016

41 views

Category:

Documents


0 download

DESCRIPTION

A Data Structures´ View at the IP-Lookup and Packet Classification Problem. (Lecture 11: The IP-LookUp & Packet Classification Problem, Part I) Advanced Algorithms & Data Structures. Prof. Dr. Th. Ottmann Albert-Ludwigs-Universität Freiburg, Germany [email protected]. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

1

A Data Structures´ View at theIP-Lookup and Packet Classification Problem

Prof. Dr. Th. OttmannAlbert-Ludwigs-Universität Freiburg, Germany

[email protected]

(Lecture 11: The IP-LookUp & Packet Classification Problem, Part I)Advanced Algorithms & Data Structures

Page 2: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

2

Overview

• The IP-Lookup problem• Generalisations of IP-Lookup:

Dynamisation, conflict-free ranges• Packet classification• Category 1 solutions: Structure the universe• Category 2 solutions: Structure the prefix set

Inverted Next Lists

Priority Search Trees

Page 3: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

3

Dstn Addr

--------

---- ----

--------

Dstn-prefix Next Hop

Forwarding Table

Forwarding EngineHEADER

Lookup in an IP Router

Next-Hop-Computation

Page 4: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

4

0 224

232-1

128.9.0.0/16

65.0.0.0

142.12.0.0/19

65.0.0.0/8

65.255.255.255

Destination IP Prefix

Outgoing Port

(Next-Hop)

65.0.0.0/ 8 3

128.9.0.0/16 1

142.12.0.0/19 7

IP prefix: 0-32 bits

128.9.16.14

Example Forwarding Table

Page 5: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

5

128.9.16.0/21128.9.172.0/21

128.9.176.0/24

0 232-1

128.9.0.0/16142.12.0.0/19

65.0.0.0/8

Nested intervalls

Sets of intervalls corresponding to sets of prefixes of IP-addressesare nested:Any two intervalls are either disjoint or one is contained in the other!

Overlaps are impossible!

Page 6: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

6

128.9.16.0/21128.9.172.0/21

128.9.176.0/24

Routing lookup: Find the longest matching prefix (the most specific route) among all prefixes that match the destination address.

0 232-1

128.9.0.0/16142.12.0.0/19

65.0.0.0/8

128.9.16.14

LMP-Matching

Page 7: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

7

Example of an IP-Lookup Table

Prefix Next-hop

P1 111* H1

P2 10* H2

P3 101* H3

P4 10101 H4

P5 * H5

Prefixes may be considered as bitstrings of a maximal length W.

Example: W = 5, p = 10111

Page 8: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

8

Generalisations of the IP-Lookup Problem

• Dynamisation: Insertion, deletion of prefixes (intervalls)

• Conflict free sets of intervalls (not nested)

• Priority matching instead of LMP lookup:

Prefix Next-hop

R1 10* H3

R2 1001* H2

R3 01100 H5

R4 0* H4

R5 010* H1

R6 * H6

Determine the prefix with highestpriority matching a given bitstring

10011

Page 9: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

9

Extension to higher dimensions: Classification

Classify incoming packages into different flows according to different services.

Service Example

Traffic Shaping

Ensure that ISP3 does not inject more than 50Mbps of total traffic on interface X, of which no more than 10Mbps is email traffic

Packet Filtering

Deny all traffic from ISP2 (on interface X) destined to E2

Policy Routing

Send all voice-over-IP traffic arriving from E1 (on interface Y) and destined to E2 via a separate ATM network

PAYLOADL4-SP16b

L4-DP16b

PROTO8b

L3-SA32b

L3-DA32b

L3-Proto8b

L2-SA48b

L2-DA48b

Page 10: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

10

Example Classifier

Rule Destination Address

Source Address

R1 0* 10*

R2 0* 01*

R3 0* 1*

R4 00* 1*

R5 00* 11*

R6 10* 1*

R7 * 00*

Field 1 Field 2

IP-Lookup is a special case of the packet classification problem.

Example: (00101, 11011)

Page 11: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

11

R1

R2

R3R4

2-dim Classifier

Page 12: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

12

R1

R2

R3

{R1, R2}

{R2, R3}

{R1, R2, R3}

7 regions

For a given point p: Find the rule (region) with highest priority containing p.

2-dim Classifier

Page 13: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

13

Solution stategies for IP-Lookup and Packet Classification

• Structure the universe of all bitstrings of length W:

Trie based methods

+ Lookup becomes dependent only on the length of the given prefix

- Updates expensive

• Structure the current set of n prefixes:

Geometry based methods

+ Efficient updates

- Lookup dependent on n

• Hardware-based solutions

• Hybrid methods

Page 14: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

14

Binary Tries

0

0

1

1 10

00

A full binary tree of height W is a possible raster for storing all prefixes and bitstrings of length ≤ W.

LMP: For a given bitstring p find the deepest node representing a prefixon the search path to leaf p!Time: O(W)

{*, 00*, 010*, 10*,100*}

0000 1111

Page 15: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

15

Compression (1)

0

0

1

1 0

00

Page 16: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

16

Compression (2)

0

0

10

10

0

The number of nodes in a contracted binary trie storing n prefixes is ≤ 2n.CBT are similar to Ukkonen‘s implicit suffix trees.Lookup, insertion and deletion of prefixes in time O(W).

Many possible variations:Increase branching factor in order to decrease height.Adapt branching factor on each level to number of prefixes.……

Page 17: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

17

Increasing the branching factor

00 01 10 11

0000 1111

Trie based structures are set- and order-unique, hence,oblivious structures!

Page 18: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

18

1 8 92 3 4 5 6 7 10

A

F

B

G

H

C D E

Structure the set of intervals

Set of n nested intervals, among them the interval *representing the whole universe.

n intervals partition the universe into ≤ 2n fragments.

Fragments

Intervals

Page 19: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

19

1 8 92 3 4 5 6 7 10

A

F

B

G

H

C D E

LMP

For a given point p:Find the fragment f, into which p falls, and determine the smallest interval X containing f.

Fragments

Intervals

Page 20: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

20

LMP and updates

P1 P2 P3 P4 P5 P6

P0

Storing the smallest interval I containing fragment f at the fragments:

LMP in time O(log n)Update: (n)

Page 21: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

21

1 8 92 3 4 5 6 7 10

A

F

B

G

H

C D E

Let x be an arbitrary fragment or interval, define:

next(x) = the smallest interval containing x

For any given set of nested intervals:For each fragment and each interval x (except *) next(x) existsand is well defined!

Fragments

Definition next(x)

Intervals

Page 22: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

22

1 8 92 3 4 5 6 7 10

A

F

B

G

H

C D E

Fragments

Inverted-Next-Lists

Inverted-Next-List of interval X = {Y; next(Y) = X}, sorted in l.t.r.o.

A: B, 3, C, 7, D, 9, EB: 1, FC: 4, HD: 8E: 10F: 2G: 5H: G, 6

Intervals

For each point p in fragment Y:If next(Y) = X, then X is the smallestinterval containing p!

Page 23: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

23

1 8 92 3 4 5 6 7 10

A

F

B

G

H

C D E

Fragments

Inverted-Next-Lists

A: B, 3, C, 7, D, 9, EB: 1, FC: 4, HD: 8E: 10F: 2G: 5H: G, 6

Intervals

Fragment i has direct link to the position,where i occurs in an INL.Each fragment and intervall in an INL is specified by ist start- and endpoint.Sum of lengths of all INL is at most 2 n.

Inverted-Next-List of interval X = {Y; next(Y) = X}, sorted in l.t.r.o.

Page 24: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

24

Longest Prefix Matching for point p

1 8 92 3 4 5 6 7 10

A

F

B

G

H

C D E

Determine fragment Y, into which p falls,follow the link from Y to the INL, in which Y occurs,proceed from Y to the head of this INL, report the interval X at the header of this list!

A: B, 3, C, 7, D, 9, EB: 1, FC: 4, HD: 8E: 10F: 2G: 5H: G, 6

Page 25: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

25

1 8 92 3 4 5 6 7 10

A

F

B

G

H

C D E

Insertion of a new interval without expansion of the fragment raster(2)

A: B, 3, C, 7, D, 9, EB: 1, FC: 4, HD: 8E: 10F: 2G: 5H: G, 6

I

A: B, I, 9. EI: 3, C, 7, D

Page 26: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

26

1 8 92

3a

4 5 6

7a

10

A

F

B

G

H

C D E

Fragments

Insertion of a new interval with expansion of the fragment raster(1)

A: B, 3, C, 7, D, 9, EB: 1, FC: 4, HD: 8E: 10F: 2G: 5H: G, 6

3b7b

I

A: B, 3a, I, 7b, D, 9, EI: 3b, C, 7a

Intervals

Page 27: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

27

1 8 92 3 4 5 6 7 10

A

F

B

G

H

C D E

Fragments

Deletion of an interval without contraction of the fragment raster(1)

A: B, 3, C, 7, D, 9, EB: 1, FC: 4, HD: 8E: 10F: 2G: 5H: G, 6

A: B, 3, 4, H, 7, D, 9, E

Intervals

Page 28: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

28

Implementation

List of fragments: Balanced leaf-search-tree, Operations: Search, insert, deleteInverted Next Lists: Balanced leaf-search-tree Operations: Find root (marking),

splitting a tree according to a given x-value, join of 2 or 3 trees to a new one.

All operations can be carried out in time O(log n), n = #(intervals)

Alternative implementations may use:

Biased Skip Lists (for bursty access patterns): Sahni/Kim 2003Splay Trees (self adjusting to the access pattern)……..

Page 29: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

29

Summary

Trie-based solutions: (1-dim)static: LMP in time O(W)dynamic: insertion, deletion in time O(W) (Doeringer et al, 1996)Dynamic programming algorithm for the construction of space optimal tries of a predetermined height (optimize the strides of tries)(Sahni et al, 2003)

Geometry-based solutions: (dynamic)Dimension: 1-dim, 2-dim, higher …Interval sets: nested, conflict free, generalPriorities: length of intervals (LMP), generalStructures: inverted lists, (balaced) search trees, skip lists

segment trees, interval trees, PSTEfficiency: worst case, amortized w.c., expected case

Page 30: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

30

1-dim, nested intervals, LMP-priority, Sahni et al. 2003search, insertion, deletion in time O(log n), inverted lists, balanced trees, skip lists

1-dim, nested intervals, general priorities, Kaplan et al. 2003search, insertion, deletion in time O(log n) and space O(n)

worst case: balanced dynamic treesamortized: self-adjusting dynamic trees

1-dim, general intervals, general priorities, Kaplan et al. 2003search in worst-case time O(log n)insertion in amortized time O(log n)deletion in amortized time O(log n log log n)space O(n)interval trees, BB[] trees

2-dim, general rectangles, general prioritiessearch, insert, delete in time O(log2 n) and space O(n log n)dynamic segment trees

Page 31: A Data Structures´ View at the IP-Lookup and Packet Classification Problem

31

2-dim, nested rectangles, general priorities, Kaplan et al. 2003search in amortized time O(log n)insertion in amortized time O(log2 n)space O(n log n)splay trees

2-dim, general rectangles over fixed universe U, general priorities, Eppstein et al. 2001

Static case (no updates)search in time O(log |U|)conflict detection in time O(n3/2)k-d-trees,

Open problems:

Simple, efficient solution for the general, higher-dimensional case.Bursty and clustered updates.Using other data structures, like

fully dynamic segment trees,relaxed balanced search trees, relaxed balanced PST, ….