diff options
author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2019-12-17 07:02:12 +0100 |
---|---|---|
committer | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2019-12-17 22:05:56 +0100 |
commit | 13b01f2f0c079ef11faab894c3843b18827b8a24 (patch) | |
tree | 06afffc21cca301320fcbf0f298ca95a4375da7f /zebra/router-id.c | |
parent | Merge pull request #5502 from ton31337/fix/rr_do_not_show_fqdn (diff) | |
download | frr-13b01f2f0c079ef11faab894c3843b18827b8a24.tar.xz frr-13b01f2f0c079ef11faab894c3843b18827b8a24.zip |
zebra: add 'show router-id'
router-id is buried deep in "show running-config", this new
command makes it easy to retrieve the user configured router-id.
Example:
# configure terminal
(config)# router-id 1.2.3.4
(config)# end
# show router-id
router-id 1.2.3.4
# configure terminal
(config)# no router-id 1.2.3.4
(config)# end
# show router-id
#
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Diffstat (limited to 'zebra/router-id.c')
-rw-r--r-- | zebra/router-id.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/zebra/router-id.c b/zebra/router-id.c index 569ffbab4..b37d4aea7 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -253,6 +253,36 @@ DEFUN (no_router_id, return CMD_SUCCESS; } +DEFUN (show_router_id, + show_router_id_cmd, + "show router-id [vrf NAME]", + SHOW_STR + "Show the configured router-id\n" + VRF_CMD_HELP_STR) +{ + int idx_name = 3; + + vrf_id_t vrf_id = VRF_DEFAULT; + struct zebra_vrf *zvrf; + + if (argc > 2) + VRF_GET_ID(vrf_id, argv[idx_name]->arg, false); + + zvrf = vrf_info_get(vrf_id); + + if ((zvrf != NULL) && (zvrf->rid_user_assigned.u.prefix4.s_addr)) { + vty_out(vty, "zebra:\n"); + if (vrf_id == VRF_DEFAULT) + vty_out(vty, " router-id %s vrf default\n", + inet_ntoa(zvrf->rid_user_assigned.u.prefix4)); + else + vty_out(vty, " router-id %s vrf %s\n", + inet_ntoa(zvrf->rid_user_assigned.u.prefix4), + argv[idx_name]->arg); + } + + return CMD_SUCCESS; +} static int router_id_cmp(void *a, void *b) { @@ -267,6 +297,7 @@ void router_id_cmd_init(void) { install_element(CONFIG_NODE, &router_id_cmd); install_element(CONFIG_NODE, &no_router_id_cmd); + install_element(VIEW_NODE, &show_router_id_cmd); } void router_id_init(struct zebra_vrf *zvrf) |