Fast classless inter-domain routing (CIDR) lookups
First Claim
1. A method of performing a longest match search comprising:
- receiving a search key;
determining a set of masks that when applied to the search key are known to have a potential for matching an entry in a routing table;
forming a routing table query based upon the search key and a longest mask of the set of masks; and
applying the routing table query to the routing table.
1 Assignment
0 Petitions
Accused Products
Abstract
A method and apparatus for efficiently performing a longest match search are provided. According to one embodiment of the present invention, a longest match search of a routing table is initiated in response to receiving a search key (typically a destination IP address of a received packet). To avoid performing fruitless searches, a set of masks are determined that are known to have a potential for matching an entry in the routing table when applied to the search key. A routing table query is formed based upon the search key and the longest mask of the set of masks. Then, the routing table query is applied to the routing table. If subsequent iterations are required, the longest mask is removed from the set of masks and the next routing table query is formed based upon the search key and the longest mask of the updated set of masks.
-
Citations
18 Claims
-
1. A method of performing a longest match search comprising:
-
receiving a search key;
determining a set of masks that when applied to the search key are known to have a potential for matching an entry in a routing table;
forming a routing table query based upon the search key and a longest mask of the set of masks; and
applying the routing table query to the routing table. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A packet forwarding device comprising:
-
a plurality of ports upon which packets are received and transmitted;
a routing processor coupled to the plurality of ports to determine an egress port of the plurality of ports for a packet received on an ingress port of the plurality of ports by performing a longest match search comprising one or more routing table queries;
a routing table, coupled to the routing processor, to provide the routing processor with a match indication and information regarding a matching routing table entry, if any, of a plurality of routing table entries stored therein in response to a routing table query; and
a mask table, coupled to the routing processor, to maintain encoded mask vectors identifying mask lengths of the plurality of routing table entries. - View Dependent Claims (9, 10, 11, 13, 14, 15, 17, 18)
-
-
12. A method of forwarding a packet comprising:
-
receiving a packet on an ingress port of a plurality of ports;
extracting a destination Internet Protocol (IP) address from a header of the packet;
using a portion of the destination IP address to index into a mask table to retrieve an encoded mask vector that identifies a series of masks to be applied to the destination IP address during a longest match search of a routing table, the series of masks representing those masks that are known to have a potential for matching an entry in the routing table when applied to the destination IP address;
identifying a longest matching entry in the routing table by performing the longest match search based upon the destination IP address and one or more of the series of masks; and
forwarding the packet to a network device associated with the destination IP address via an egress port of the plurality of ports identified by the longest matching entry.
-
-
16. A machine-readable medium having stored thereon data representing sequences of instructions, the sequences of instructions which, when executed by a processor, cause the processor to:
-
receive a search key;
determine a set of masks that when applied to the search key are known to have a potential for matching an entry in a routing table;
form a routing table query based upon the search key and a longest mask of the set of masks; and
apply the routing table query to the routing table.
-
Specification