show ip route: a legend that covers the table, and a default you can tell apart (#1234) #1236
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1236
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/show-ip-route-legibility"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
show ip route: a legend that covers the table, and a default you can tell apartFixes #1234.
The routing table was correct and unreadable at the same time. Three things in what the command says:
CandSwhileroutesTable()also emitsO(OSPF) andB(BGP) rows — so an OSPF-learned route printed as a code the legend never defined.
S, the same as a static route. It is not one:routeTo()treats it as a separate source with administrative distance 254, while a static route has distance 1.
On a device with both, the table printed two identical-looking
S 0.0.0.0/0rows and gave no cluewhich was installed.
installed route (longest prefix first, then lowest distance).
Connected rows also printed
via -, which reads as "no next hop" rather than "directly connected".Now
[distance/metric]per row, from a singledistanceOf()rule — connected 0, static 1, eBGP asconfigured (20 here), iBGP 200, OSPF 110, configured gateway 254;
S*(candidate default), so it can be told apart fromip route 0.0.0.0 0.0.0.0 …;Gateway of last resort is …names the default that is installed, not merely the configured one.This matters: with a static default present, the gateway at 254 is not installed, and printing it
would send the reader after a next hop no packet ever uses. My first version of this patch did exactly
that, and the test caught it;
is directly connected, <iface>.Evidence
test/show-ip-route.test.js— 30 checks:C,S,OandB, and every code that appears in the body is defined (soa new route source cannot arrive without a legend entry);
via -;S*vsS,[254/0]vs[1/0]— and they are no longer identical-looking;it is the only one;
S*row;routeTo()on anaddress inside that prefix returns the type of the row that wins under "longest prefix, then lowest
distance". That is the property that makes printing distances worth doing.
Reverting
engine/cli.jsfails 9 of them.docs/CLI.mdgains a "Readingshow ip route" section with the two default forms and whyS*is notthe installed default.
Suite: 133 suites, 5,810 assertions, 0 failed.
show ip route: a legend that covers the table, and a default you can tell apartb5d38a7942fbe3eb0636