410 likes | 634 Views
Geometric Solutions for the IP-Lookup and Packet Classification Problem. (Lecture 12: The IP-LookUp & Packet Classification Problem, Part II) Advanced Algorithms & Data Structures. Prof. Dr. Th. Ottmann Albert-Ludwigs-Universität Freiburg, Germany ottmann@informatik.uni-freiburg.de. Overview.
E N D
Geometric Solutions for theIP-Lookup and Packet Classification Problem (Lecture 12: The IP-LookUp & Packet Classification Problem, Part II) Advanced Algorithms & Data Structures Prof. Dr. Th. Ottmann Albert-Ludwigs-Universität Freiburg, Germany ottmann@informatik.uni-freiburg.de
Overview • The IP-table lookup problem • Geometric interpretation of the problem • Solution using Priority Search Trees • Solution using augmented range trees
Lookup in an IP Router HEADER Forwarding Engine Dstn Addr Next-Hop-Computation Forwarding Table Dstn-prefix Next Hop ---- ---- ---- ---- ---- ----
Example Forwarding Table IP prefix: 0-32 bits 142.12.0.0/19 128.9.0.0/16 65.0.0.0/8 224 128.9.16.14 0 232-1 65.0.0.0 65.255.255.255
Nested intervalls 128.9.176.0/24 128.9.16.0/21 128.9.172.0/21 142.12.0.0/19 128.9.0.0/16 65.0.0.0/8 0 232-1 Sets of intervalls corresponding to sets of prefixes of IP-addresses are nested: Any two intervalls are either disjoint or one is contained in the other! Overlaps are impossible!
LMP-Matching 128.9.176.0/24 128.9.16.0/21 128.9.172.0/21 142.12.0.0/19 128.9.0.0/16 65.0.0.0/8 0 232-1 128.9.16.14 Routing lookup:Find the longest matching prefix (the most specific route) among all prefixes that match the destination address. Geometric view: For a given point p, find the smallest interval stabbed by p.
Overview • The IP-table lookup problem • Geometric interpretation of the problem • Solution using Priority Search Trees • Solution using augmented range trees
Geometric view of IP-table lookup Find a representation of a (dynamic) set of intervals such that the following operations can be carried out efficiently: • Insertion of an interval • Deletion of an interval • For a given point p: Find the smallest interval stabbed by p (LMP-query) Assumptions: Set of intervals is a nested set. Every newly inserted interval does not overlap with any interval in the set. Conflict test: For a given interval test whether or not it overlaps (is in conflict) with any interval already in the set.
Representation of intervals by points B C A D B D C A Interval (l, r) is mapped to point (r, l) below the main diagonal.
Stabbing queries B C p A D B D C A p lies in (l, r) ⇔ (l, r) is stabbed by p ⇔ ( l ≤ p und p ≤ r ) All points representing intervals stabbed by p lie to the right and below point (p, p)
Geometric interpretation of interval-inclusion A B B A A ⊒ B Interval A = (lA, rA) includes interval B = (lB, rB) iff. point A is right below point B A ⋟ B B ⊑ A ⇔ A ⊒B ⇔ point B left above point A ⇔ B ≼ A
Disjoint intervals B B A A X and Y represent disjoint intervals ⇔ There is no point p on the diagonal, s.t. p ≼ X und p ≼ Y
Overlapping intervals p D D C C X and Y represent overlapping intervals ⇔ There is a point p on the diagonal, s.t. p ≼ X and p ≼ Y , but X and Y are incomparable with resp. to ≼
Nested intervals A p D B D B C A C X is smallest intervall, that contains point p ⇔ p ≼ X and for all Y with p ≼ Y : X ≼ Y Observation: Sets of nested intervals stabbed by a point are totally ordered with resp. to ≼ Points closer to the diagonal represent smaller intervals.
LMP-Queries A p D B D B C A C The smallest interval containing a given point p is represented by the point closest to the diagonal in the region right below p. (This is the topmost leftmost point in the region!)
Overview • The IP-table lookup problem • Geometric interpretation of the problem • Solution using Priority Search Trees • Solution using augmented range trees
Priority Search Trees Priority Search trees are a 1.5-dim structure for the storage of points, they support the following operations: Insertion ofa point Deletion of a point South-grounded range queries
LMP-Query p x x x´ = ∞ x x Find topmost leftmost (or leftmost topmost) point in the range (x, ∞ , x) Well defined, if intervalls are nested, otherwise not! Executable inO(log n)time.
Pairwise distinct search keys B C A D C B D A (x, y) ↦ (2W x + 2W – 1 – y, y) = ((x, -y), y) All points have pairwise distinct x-coordinates. Points corresponding to intervals with equal left endpoint are l.t.r. sorted according to increasing lengths. LMP: Find point with smallest x-coordinate in a given x-range below a threshold!
Dynamic PST Possibilities for the full dynamization of priority search trees: No rigid skeleton, but growing or shrinking with the point set. Insertion (5,3)
3 1 1 2 2 3 Balanced trees as skeletons of PSTs Rotation preserves the x-order, but may destroy the y-order of points.
3 1 1 2 2 3 Balanced trees as skeletons of PSTs px occurs in subtree 1: Insert p into subtree 1; Pull up a point from subtree 2 or 3. 2 log n steps for the trickle down process!
3 1 1 2 2 3 Balanced trees as skeletons of PSTs px occurs in subtree 2: Compare py with the priorities stored at the roots of subtree 1 and 2; Insert a point into subtree 2 or 3; Pull up a point from subtree 2 or 3. 2 log n steps for the trickle down process!
Conflict detection (Insertion) x y new (query) interval u v (1) There is an interval (x, y) stabbed by u that has a right endpoint y < v x y u v (2) The range (u, v) contains a left endpoint x of an interval (x, y) that has a right endpoint not in this range, i.e. y > v
Conflict detection (Insertion) x y new (query) interval u v (1) There is an interval (x, y) stabbed by u that has a right endpoint y < v (u, u) (y, x) u v Points represent intervals sorted according to their right endpoints
Conflict detection (Insertion) x y u v (2) The range (u, v) contains a left endpoint x of an interval (x, y) that has a right endpoint not in this range, i.e. y > v Map interval (x, y) to point (x, -y). Store points in PST -y < -v ⇔ y > v -v (x, -y) u v
Overview • The IP-table lookup problem • Geometric interpretation of the problem • Solution using Priority Search Trees • Solution using augmented range trees
1-dim Range Tree: Summary Let P be a set of n points in 1-dim space. P can be stored in a balanced binary leaf-search tree such that the following holds: Construction time: O(n log n) Space requirement: O(n) Insertion of a point: O(log n) time Deletion of a point: O(log n) time 1-dim-range-query: Reporting all k points falling into a given query range can be carried out in time O(long n + k). The performance of 1-dim range trees does not depend on the chosen balancing scheme!
MinXinRectangle Queries Problem:Given a set P of points that changes under insertions and deletions, construct a data structure to store P that can be updated in O(lg n) time and that can find the point with minimal x-coordinate in a given range below a given threshold in O(log n) time. y0 MinXinRectangle(l, r, y0) l r Assumption: All points have pairwise different x-coordinates
MinXinRectangle Queries MinXinRectangle(l, r, y0) y0 l r Assumption: All points have pairwise different x-coordinates
Min-augmented Range Tree Two data structures in one: 11 2 Leaf-search tree on x-coordinates of points 3 14 Min-tournament tree on y-coordinates of points 3 2 2 4 17 (14, 7) 4 3 2 8 15 21 (2, 12) (3, 4) (4, 11) 3 2 8 5 (11, 21) (15, 2) (17, 30) (21, 8) 3 (5, 3) (8, 5)
MinXinRectangle(l, r, y0) Search for the boundary values l, r. Find the leftmost umbrella node with a min-field ≤ y0. Split node l r
MinXinRectangle(l, r, y0) Search for the boundary values l, r. Find the leftmost umbrella node with a min-field ≤ y0. Proceed to the left son of the current node, if its min-field is ≤ y0, and to the right son, otherwise. Return the point at the leaf. Split node l r MinXinRectangle(l, r, y0) can be found in time O(height of tree).
Updates Insert operation Insert node as into a standard binary leaf search tree. Adjust min-fields of every ancestor of the new node by playing a min tournament for each node and its sibling along the search path. Delete operation: Similar
s4 s3 s5 Maintaining min-fields Under Rotations s1 s1 min{s5, s3} s3 s2 s4 s5
Min-augmented Range Trees–Summary • Theorem:There exists a data structure to represent a dynamic set S of n points in the plane with the following properties:The data structure allows updates and to answer MinXinRectangle(l, r, y0) queries in O(log n) time. The data structure occupies O(n) space. • Note: The datastructure can be based on an arbitrary scheme of balanced binary leaf search trees. • Min-augmented range trees can be used (instaed of PSTs) to solve the dynamic version of the IP lookup problem without changing the time complexity of the lookup and update operations.
Conflict detection (Insertion) x y new (query) interval u v (1) There is an interval (x, y) stabbed by u that has a right endpoint y < v (u, u) Choose a min-augmented range tree and check whether there is at least one point in the range [u,v] below the threshold u. (y, x) u v Points represent intervals sorted according to their right endpoints
Conflict detection (Insertion) x y u v (2) The range (u, v) contains a left endpoint x of an interval (x, y) that has a right endpoint not in this range, i.e. y > v Map interval [x, y] to point (x, y). Store points in max-augmented range tree and check whether there is a point (x, y) in the range [u, v] with a right endpoint y > v. v (x, y) u v
Open problems • Implement and test new solutions with real (benchmark) data. • Find a simple, efficient solution for the general, higher-dimensional case. • Consider the case of bursty and clustered updates. • Investigate the effect of using other data structures, like • fully dynamic segment trees, • relaxed balanced search trees, relaxed balanced PST, …. • Find an efficient method for conflict detection in 2 (or more) dimensions.