-
Notifications
You must be signed in to change notification settings - Fork 517
Description
The routing table of nodes is messy and a sorting mechanism should be incorporated to make it more readable. For example look at the routing table of a router:
I think, the routing table should look similar to this:
All the interface routes are at the top, followed by all MANUAL routes (by the network administrator), followed by all routing protocol routes (RIP, OSPF, BGP). This is not only more readable, but also reflects the order that routes are added into the routing table: interface, ipv4configurator, routing protocol.
Edit: After digging further into the code, I found out that the routing entries are actually sorted in order to optimize for 'longest prefix match'.
| bool Ipv4RoutingTable::routeLessThan(const Ipv4Route *a, const Ipv4Route *b) const |
And this:
| bool Ipv4RoutingTable::multicastRouteLessThan(const Ipv4MulticastRoute *a, const Ipv4MulticastRoute *b) |
This kind of sorting, makes sense especially in big routing tables between autonomous systems in BGP. But still the routing table looks ugly! What do you suggest? Is there anyways to separate the search logic (under the hood) from the print/display logic?

