mirror_frr/zebra
Christophe Gouault 8277d4b796 zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.

When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...

Normalize the output:

- whatever the case, display the common header at most once, if there
  is at least an entry to dump.

- when using a "vrf all" or "table all" command, prepend a line with
  the VRF and table (even for the default vrf or table).

- when dumping a specific vrf or table, prepend a line with the VRF
  and table.

Example (vrf all)
=================

router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26

VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42

Example (main vrf)
==================

router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58

Example (specific vrf)
======================

router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36

Example (all tables)
====================

router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51

VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51

Example (all vrf, all table)
============================

router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15

VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15

VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18

VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31

Example (specific table)
========================

router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-09-21 10:07:56 +02:00
..
.gitignore *: cleanup .gitignore files 2018-09-08 21:30:42 +02:00
connected.c zebra: When shutting down an interface immediately notify about rnh 2020-08-28 14:45:59 -04:00
connected.h zebra: Do not use connection dest for bcast 2019-08-18 18:54:46 +02:00
debug.c zebra: debug flags for MAC-IP sync 2020-08-05 06:46:13 -07:00
debug.h zebra: debug flags for MAC-IP sync 2020-08-05 06:46:13 -07:00
dplane_fpm_nl.c zebra: extract evpn mac functions from zebra_vxlan.c 2020-08-12 12:39:33 +01:00
if_ioctl_solaris.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
if_ioctl.c Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
if_netlink.c zebra: bridge layer2 information records ns_id where bridge is 2020-08-18 09:25:06 -07:00
if_netlink.h zebra: netlink message batching 2020-08-10 21:42:43 +02:00
if_sysctl.c *: spelchek 2018-10-25 20:10:57 +02:00
interface.c zebra: display interface slave type 2020-08-18 09:25:06 -07:00
interface.h zebra: Ethernet segment management and support for MAC-ECMP 2020-08-05 06:46:12 -07:00
ioctl_solaris.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
ioctl_solaris.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
ioctl.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
ioctl.h zebra: removing old intf address code 2019-04-22 13:49:27 -04:00
ipforward_proc.c zebra: Cleanup set but unused variables 2020-02-27 09:41:58 -05:00
ipforward_solaris.c *: un-split strings across lines 2020-07-14 10:37:25 +02:00
ipforward_sysctl.c *: Replace sizeof something to sizeof(something) 2020-03-08 21:44:53 +02:00
ipforward.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
irdp_interface.c *: un-split strings across lines 2020-07-14 10:37:25 +02:00
irdp_main.c *: replace all random() calls 2020-04-17 20:57:43 -03:00
irdp_packet.c *: Replace sizeof something to sizeof(something) 2020-03-08 21:44:53 +02:00
irdp.h *: strip trailing whitespace 2019-09-30 16:44:43 +00:00
kernel_netlink.c zebra: increase netlink receive buffer size 2020-09-01 11:35:16 +02:00
kernel_netlink.h zebra: remove fuzzing stuff 2020-08-25 17:31:07 +02:00
kernel_socket.c zebra: When shutting down an interface immediately notify about rnh 2020-08-28 14:45:59 -04:00
kernel_socket.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
label_manager.c zebra: Fix selection of label chunks in label manager 2020-08-07 11:08:49 +02:00
label_manager.h zebra,ldpd: use zapi client session id in LM apis 2020-04-16 12:07:54 -04:00
main.c Merge pull request #7089 from pguibert6WIND/netns-refactor 2020-09-18 11:02:30 -04:00
Makefile
redistribute.c zebra: When shutting down an interface immediately notify about rnh 2020-08-28 14:45:59 -04:00
redistribute.h zebra: revise redistribution delete to improve update case 2019-09-12 08:51:05 -04:00
rib.h zebra: When shutting down an interface immediately notify about rnh 2020-08-28 14:45:59 -04:00
router-id.c zebra: add IPv6 router-id 2020-07-17 17:39:05 +02:00
router-id.h zebra: add IPv6 router-id 2020-07-17 17:39:05 +02:00
rt_netlink.c zebra: When shutting down an interface immediately notify about rnh 2020-08-28 14:45:59 -04:00
rt_netlink.h zebra: netlink message batching 2020-08-10 21:42:43 +02:00
rt_socket.c zebra: prepare dplane for batching 2020-08-10 21:32:59 +02:00
rt.h zebra: remove old kernel one-update-at-a-time api 2020-08-10 21:57:04 +02:00
rtadv.c *: un-split strings across lines 2020-07-14 10:37:25 +02:00
rtadv.h zebra: Remove enum around ipv6_nd_suppress_ra_status 2020-05-08 08:08:04 -04:00
rtread_getmsg.c *: un-split strings across lines 2020-07-14 10:37:25 +02:00
rtread_netlink.c zebra: evpn remote delete fetch local entry 2018-12-31 14:40:31 -08:00
rtread_sysctl.c zebra: evpn remote delete fetch local entry 2018-12-31 14:40:31 -08:00
rule_netlink.c bgpd, lib, pbrd, zebra: Pass by ifname 2020-09-11 20:04:45 -04:00
rule_netlink.h zebra: netlink message batching 2020-08-10 21:42:43 +02:00
rule_socket.c zebra: convert ip rule installation to use dplane thread 2020-06-10 16:18:45 +02:00
sample_plugin.c zebra: Add a sample dataplane plugin module 2019-10-31 16:24:16 -04:00
subdir.am zebra: extract core EVPN functions from zebra_vxlan.c 2020-08-12 12:39:34 +01:00
table_manager.c *: list_delete_and_null() -> list_delete() 2018-10-02 11:40:52 +02:00
table_manager.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
testrib.conf
zapi_msg.c bgpd, lib, pbrd, zebra: Pass by ifname 2020-09-11 20:04:45 -04:00
zapi_msg.h Merge pull request #6783 from opensourcerouting/feature/sr-te 2020-08-10 15:31:35 -04:00
zebra_dplane.c bgpd, lib, pbrd, zebra: Pass by ifname 2020-09-11 20:04:45 -04:00
zebra_dplane.h bgpd, lib, pbrd, zebra: Pass by ifname 2020-09-11 20:04:45 -04:00
zebra_errors.c zebra: Prevent awful misconfiguration in vrf's 2020-04-22 10:57:29 -04:00
zebra_errors.h zebra: Ethernet segment management and support for MAC-ECMP 2020-08-05 06:46:12 -07:00
zebra_evpn_mac.c Merge pull request #7089 from pguibert6WIND/netns-refactor 2020-09-18 11:02:30 -04:00
zebra_evpn_mac.h zebra: add ns_id attribute to mac structure 2020-08-18 09:25:06 -07:00
zebra_evpn_mh.c zebra: re-name some mh functions to make the code more readable 2020-09-15 16:24:59 -07:00
zebra_evpn_mh.h zebra: re-name some mh functions to make the code more readable 2020-09-15 16:24:59 -07:00
zebra_evpn_neigh.c zebra: fixup a neigh del bug introduced by a previous commit for MAC-IP sync 2020-09-16 17:32:33 -07:00
zebra_evpn_neigh.h zebra: extract neighbor processing from kernel_neigh_del 2020-08-12 12:39:34 +01:00
zebra_evpn_vxlan.h zebra: extract core EVPN functions from zebra_vxlan.c 2020-08-12 12:39:34 +01:00
zebra_evpn.c Merge pull request #7089 from pguibert6WIND/netns-refactor 2020-09-18 11:02:30 -04:00
zebra_evpn.h zebra: support for macvlan interfaces 2020-09-11 18:26:23 +02:00
zebra_fpm_dt.c zebra: fix nexthop_group conversion in fpm code 2020-02-28 08:45:56 -05:00
zebra_fpm_netlink.c Merge pull request #6698 from deastoe/fpm-netlink-fixes 2020-08-04 15:59:51 -04:00
zebra_fpm_private.h Zebra: Build nelink message for RMAC updates 2019-06-17 12:05:38 -07:00
zebra_fpm_protobuf.c *: Do not cast to the same type 2020-04-08 17:15:06 +03:00
zebra_fpm.c *: un-split strings across lines 2020-07-14 10:37:25 +02:00
zebra_gr.c zebra: avoid using c++ keywords in headers 2020-05-14 16:42:47 +02:00
zebra_l2.c zebra: bridge layer2 information records ns_id where bridge is 2020-08-18 09:25:06 -07:00
zebra_l2.h zebra: bridge layer2 information records ns_id where bridge is 2020-08-18 09:25:06 -07:00
zebra_memory.c zebra: Ethernet segment management and support for MAC-ECMP 2020-08-05 06:46:12 -07:00
zebra_memory.h zebra: use MTYPE_STATIC 2019-06-21 08:54:25 +02:00
zebra_mlag_private.c zebra: SO_PEERCRED is a getsockopt call 2020-03-06 16:03:52 -05:00
zebra_mlag_vty.c zebra: Do not build mlag protobuf support if version 3 is not avail 2019-12-15 09:37:51 -05:00
zebra_mlag_vty.h lib, zebra: add missing extern "C" {} blocks to new header files 2020-04-22 23:49:22 -03:00
zebra_mlag.c build: fix protobuf dependencies 2020-06-19 01:07:58 +02:00
zebra_mlag.h build: fix protobuf dependencies 2020-06-19 01:07:58 +02:00
zebra_mpls_netlink.c zebra: remove old kernel one-update-at-a-time api 2020-08-10 21:57:04 +02:00
zebra_mpls_null.c zebra: convert PW updates to async dataplane 2019-01-25 10:45:57 -05:00
zebra_mpls_openbsd.c *: un-split strings across lines 2020-07-14 10:37:25 +02:00
zebra_mpls_vty.c *: move CLI node names to cmd_node->name 2020-04-16 12:53:59 +02:00
zebra_mpls.c zebra: remove "PENDING" dplane request state 2020-08-10 21:33:00 +02:00
zebra_mpls.h lib, zebra: Add SR-TE policy infrastructure to zebra 2020-08-07 11:08:49 +02:00
zebra_mroute.c zebra: Add some additional vrf debug for retrieving mroute info 2018-09-17 09:22:31 -04:00
zebra_mroute.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_nb_config.c zebra: fix crash in vrf-vni mapping 2020-08-07 15:23:27 -07:00
zebra_nb_rpcs.c *: change the signature of the northbound callbacks to be more flexible 2020-04-23 10:14:32 -03:00
zebra_nb_state.c staticd: add support for SR Policies 2020-08-12 13:28:48 +02:00
zebra_nb.c staticd: add support for SR Policies 2020-08-12 13:28:48 +02:00
zebra_nb.h staticd: add support for SR Policies 2020-08-12 13:28:48 +02:00
zebra_netns_id.c zebra: dynamically detect vxlan link interfaces in other netns 2020-09-11 18:26:23 +02:00
zebra_netns_id.h zebra: dynamically detect vxlan link interfaces in other netns 2020-09-11 18:26:23 +02:00
zebra_netns_notify.c zebra: dynamically detect vxlan link interfaces in other netns 2020-09-11 18:26:23 +02:00
zebra_netns_notify.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_nhg_private.h lib, zebra: add missing extern "C" {} blocks to new header files 2020-04-22 23:49:22 -03:00
zebra_nhg.c lib, zebra: add support for sending ARP requests 2020-08-12 23:19:58 +02:00
zebra_nhg.h zebra: rename 'nhg_copy' to 'nhe_copy' 2020-06-01 14:46:32 -04:00
zebra_ns.c lib, zebra: reuse and adapt ns_list walk functionality 2020-09-11 18:26:23 +02:00
zebra_ns.h lib, zebra: reuse and adapt ns_list walk functionality 2020-09-11 18:26:23 +02:00
zebra_opaque.c sharpd,zebra: unicast support for zapi messages 2020-06-10 15:05:25 -04:00
zebra_opaque.h zebra: add zebra opaque module 2020-06-02 08:20:54 -04:00
zebra_pbr.c bgpd, lib, pbrd, zebra: Pass by ifname 2020-09-11 20:04:45 -04:00
zebra_pbr.h zebra: add icmpv6 table of type / code 2020-08-21 13:37:08 +02:00
zebra_ptm_redistribute.c zebra: Add missing c-bit uint8_t 2020-03-17 16:01:59 -04:00
zebra_ptm_redistribute.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_ptm.c *: un-split strings across lines 2020-07-14 10:37:25 +02:00
zebra_ptm.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_pw.c Merge pull request #6765 from mjstapp/backup_nhg_netlink 2020-07-27 12:49:36 -03:00
zebra_pw.h ldpd: Relay data plane pseudowire status in LDP notification 2020-06-01 13:21:37 -04:00
zebra_rib.c zebra: When we get a rib deletion event be smarter 2020-08-28 14:45:59 -04:00
zebra_rnh.c lib, zebra: Add SR-TE policy infrastructure to zebra 2020-08-07 11:08:49 +02:00
zebra_rnh.h lib, zebra: Add SR-TE policy infrastructure to zebra 2020-08-07 11:08:49 +02:00
zebra_routemap.c *: introduce DEFPY_YANG & friends 2020-08-03 15:17:03 -03:00
zebra_routemap.h zebra: Disable rmap update thread before routemap_finish while shutting down zebra 2020-03-16 23:57:45 -07:00
zebra_router.c zebra: Add table_id to rib_table_info_t 2020-07-08 12:52:13 +01:00
zebra_router.h zebra: Ethernet segment management and support for MAC-ECMP 2020-08-05 06:46:12 -07:00
zebra_snmp.c zebra: in_addr_cmp and struct prefix are not happy 2020-04-16 20:14:55 -04:00
zebra_srte.c lib, zebra: Add SR-TE policy infrastructure to zebra 2020-08-07 11:08:49 +02:00
zebra_srte.h lib, zebra: Add SR-TE policy infrastructure to zebra 2020-08-07 11:08:49 +02:00
zebra_vrf.c zebra: Allow router-id to be part of the vrf sub node 2020-07-09 11:57:22 -04:00
zebra_vrf.h zebra: rename vni to evpn where appropriate 2020-08-12 12:39:33 +01:00
zebra_vty.c zebra: fix show ip route output 2020-09-21 10:07:56 +02:00
zebra_vxlan_private.h zebra: extract evpn mac functions from zebra_vxlan.c 2020-08-12 12:39:33 +01:00
zebra_vxlan.c lib, zebra: reuse and adapt ns_list walk functionality 2020-09-11 18:26:23 +02:00
zebra_vxlan.h zebra: support for MAC-IP sync routes 2020-08-05 06:46:13 -07:00
zebra.conf.sample
zserv.c zebra: remove fuzzing stuff 2020-08-25 17:31:07 +02:00
zserv.h zebra: remove fuzzing stuff 2020-08-25 17:31:07 +02:00