×

Longest prefix match lookup using hash function

  • US 20040236720A1
  • Filed: 06/29/2004
  • Published: 11/25/2004
  • Est. Priority Date: 04/06/2000
  • Status: Active Grant
First Claim
Patent Images

1. A method for determining a longest prefix match for a variable length search key by a computer processing device, comprising the acts of:

  • reading an IP destination address;

    reading a VPN number;

    performing a hash on the N most significant bits of the IP destination address and the VPN number, and concatenating the remaining least significant bits of the IP destination address (unhashed) to the result of the hash operation to form an input key;

    using the hashed portion of the input key as an index into a table representing a plurality of root nodes of search trees wherein each non-empty entry in the table contains a pointer to a next branch in the search tree or a leaf;

    determining if the pointer in a non-empty table entry points to a leaf or a next branch of the corresponding search tree;

    use a next-bit-to-test field in the entry to find a distinguishing bit position in the search key, and determine if that bit is a one or a zero;

    responsive to the state of the identified distinguishing bit, reading either the first half or second half of the next branch contents if the pointer points to a next branch of the corresponding search tree;

    storing intermediate leaf pointers and corresponding prefix length as determined by distinguishing bit position;

    reading a leaf pattern when the leaf of a corresponding search tree is reached and comparing the leaf pattern with the input key to determine if the leaf pattern matches the input key; and

    if leaf pattern matches, identifying the leaf as the longest prefix match;

    if leaf pattern does not match, identifying previously stored leaf pointer with distinguishing bit greater than least significant bit of mismatch as the longest prefix match;

    returning the longest prefix match found for the input key to a requesting application.

View all claims
  • 1 Assignment
Timeline View
Assignment View
    ×
    ×