diff options
Diffstat (limited to 'zebra/router-id.c')
| -rw-r--r-- | zebra/router-id.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/zebra/router-id.c b/zebra/router-id.c index d5d9652c59..23b8cc743c 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -216,41 +216,42 @@ router_id_write (struct vty *vty) DEFUN (router_id, router_id_cmd, - "router-id A.B.C.D", + "router-id A.B.C.D [vrf NAME]", "Manually set the router-id\n" - "IP address to use for router-id\n") + "IP address to use for router-id\n" + VRF_CMD_HELP_STR) { + int idx_ipv4 = 1; + int idx_name = 3; + struct prefix rid; vrf_id_t vrf_id = VRF_DEFAULT; - rid.u.prefix4.s_addr = inet_addr (argv[0]); + rid.u.prefix4.s_addr = inet_addr (argv[idx_ipv4]->arg); if (!rid.u.prefix4.s_addr) return CMD_WARNING; rid.prefixlen = 32; rid.family = AF_INET; - if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + if (argc > 2) + VRF_GET_ID (vrf_id, argv[idx_name]->arg); router_id_set (&rid, vrf_id); return CMD_SUCCESS; } -ALIAS (router_id, - router_id_vrf_cmd, - "router-id A.B.C.D " VRF_CMD_STR, - "Manually set the router-id\n" - "IP address to use for router-id\n" - VRF_CMD_HELP_STR) - DEFUN (no_router_id, no_router_id_cmd, - "no router-id", + "no router-id [A.B.C.D [vrf NAME]]", NO_STR - "Remove the manually configured router-id\n") + "Remove the manually configured router-id\n" + "IP address to use for router-id\n" + VRF_CMD_HELP_STR) { + int idx_name = 4; + struct prefix rid; vrf_id_t vrf_id = VRF_DEFAULT; @@ -258,28 +259,15 @@ DEFUN (no_router_id, rid.prefixlen = 0; rid.family = AF_INET; - if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + if (argc > 3) + VRF_GET_ID (vrf_id, argv[idx_name]->arg); router_id_set (&rid, vrf_id); return CMD_SUCCESS; } -ALIAS (no_router_id, - no_router_id_val_cmd, - "no router-id A.B.C.D", - NO_STR - "Remove the manually configured router-id\n" - "IP address to use for router-id\n") -ALIAS (no_router_id, - no_router_id_vrf_cmd, - "no router-id A.B.C.D " VRF_CMD_STR, - NO_STR - "Remove the manually configured router-id\n" - "IP address to use for router-id\n" - VRF_CMD_HELP_STR) static int router_id_cmp (void *a, void *b) @@ -295,9 +283,6 @@ router_id_cmd_init (void) { install_element (CONFIG_NODE, &router_id_cmd); install_element (CONFIG_NODE, &no_router_id_cmd); - install_element (CONFIG_NODE, &router_id_vrf_cmd); - install_element (CONFIG_NODE, &no_router_id_val_cmd); - install_element (CONFIG_NODE, &no_router_id_vrf_cmd); } void |
