diff options
Diffstat (limited to 'ospfd/ospf_ri.c')
| -rw-r--r-- | ospfd/ospf_ri.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index b85287197f..87d8f596f9 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1176,11 +1176,14 @@ ospf_router_info_config_write_router (struct vty *vty) DEFUN (router_info, router_info_area_cmd, - "router-info area A.B.C.D", + "router-info <as|area A.B.C.D>", OSPF_RI_STR + "Enable the Router Information functionality with AS flooding scope\n" "Enable the Router Information functionality with Area flooding scope\n" "OSPF area ID in IP format") { + int idx_ipv4 = 2; + char *area = (argc == 3) ? argv[idx_ipv4]->arg : NULL; u_int8_t scope; @@ -1188,14 +1191,9 @@ DEFUN (router_info, return CMD_SUCCESS; /* Check and get Area value if present */ - if (argc == 1) + if (area) { - if (!inet_aton (argv[0], &OspfRI.area_id)) - { - vty_out (vty, "Please specify Router Info Area by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } + inet_aton (area, &OspfRI.area_id); scope = OSPF_OPAQUE_AREA_LSA; } else @@ -1236,11 +1234,6 @@ DEFUN (router_info, } -ALIAS (router_info, - router_info_as_cmd, - "router-info as", - OSPF_RI_STR - "Enable the Router Information functionality with AS flooding scope\n") DEFUN (no_router_info, no_router_info_cmd, @@ -1285,13 +1278,14 @@ DEFUN (pce_address, "Stable IP address of the PCE\n" "PCE address in IPv4 address format\n") { + int idx_ipv4 = 2; struct in_addr value; struct ospf_pce_info *pi = &OspfRI.pce_info; if (!ospf_ri_enabled (vty)) return CMD_WARNING; - if (!inet_aton (argv[0], &value)) + if (!inet_aton (argv[idx_ipv4]->arg, &value)) { vty_out (vty, "Please specify PCE Address by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1335,13 +1329,14 @@ DEFUN (pce_path_scope, "Path scope visibilities of the PCE for path computation\n" "32-bit Hexadecimal value\n") { + int idx_bitpattern = 2; uint32_t scope; struct ospf_pce_info *pi = &OspfRI.pce_info; if (!ospf_ri_enabled (vty)) return CMD_WARNING; - if (sscanf (argv[0], "0x%x", &scope) != 1) + if (sscanf (argv[idx_bitpattern]->arg, "0x%x", &scope) != 1) { vty_out (vty, "pce_path_scope: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1379,12 +1374,13 @@ DEFUN (no_pce_path_scope, DEFUN (pce_domain, pce_domain_cmd, - "pce domain as <0-65535>", + "pce domain as (0-65535)", PCE_STR "Configure PCE domain AS number\n" "AS number where the PCE as visibilities for path computation\n" "AS number in decimal <0-65535>\n") { + int idx_number = 3; uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; @@ -1394,7 +1390,7 @@ DEFUN (pce_domain, if (!ospf_ri_enabled (vty)) return CMD_WARNING; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &as) != 1) { vty_out (vty, "pce_domain: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1420,18 +1416,19 @@ DEFUN (pce_domain, DEFUN (no_pce_domain, no_pce_domain_cmd, - "no pce domain as <0-65535>", + "no pce domain as (0-65535)", NO_STR PCE_STR "Disable PCE domain AS number\n" "AS number where the PCE as visibilities for path computation\n" "AS number in decimal <0-65535>\n") { + int idx_number = 4; uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &as) != 1) { vty_out (vty, "no_pce_domain: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1450,12 +1447,13 @@ DEFUN (no_pce_domain, DEFUN (pce_neigbhor, pce_neighbor_cmd, - "pce neighbor as <0-65535>", + "pce neighbor as (0-65535)", PCE_STR "Configure PCE neighbor domain AS number\n" "AS number of PCE neighbors\n" "AS number in decimal <0-65535>\n") { + int idx_number = 3; uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; @@ -1465,7 +1463,7 @@ DEFUN (pce_neigbhor, if (!ospf_ri_enabled (vty)) return CMD_WARNING; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &as) != 1) { vty_out (vty, "pce_neighbor: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1491,18 +1489,19 @@ DEFUN (pce_neigbhor, DEFUN (no_pce_neighbor, no_pce_neighbor_cmd, - "no pce neighbor as <0-65535>", + "no pce neighbor as (0-65535)", NO_STR PCE_STR "Disable PCE neighbor AS number\n" "AS number of PCE neighbor\n" "AS number in decimal <0-65535>\n") { + int idx_number = 4; uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &as) != 1) { vty_out (vty, "no_pce_neighbor: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1526,6 +1525,7 @@ DEFUN (pce_cap_flag, "Capabilities of the PCE for path computation\n" "32-bit Hexadecimal value\n") { + int idx_bitpattern = 2; uint32_t cap; struct ospf_pce_info *pce = &OspfRI.pce_info; @@ -1533,7 +1533,7 @@ DEFUN (pce_cap_flag, if (!ospf_ri_enabled (vty)) return CMD_WARNING; - if (sscanf (argv[0], "0x%x", &cap) != 1) + if (sscanf (argv[idx_bitpattern]->arg, "0x%x", &cap) != 1) { vty_out (vty, "pce_cap_flag: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1650,7 +1650,6 @@ ospf_router_info_register_vty (void) install_element (VIEW_NODE, &show_ip_ospf_router_info_pce_cmd); install_element (OSPF_NODE, &router_info_area_cmd); - install_element (OSPF_NODE, &router_info_as_cmd); install_element (OSPF_NODE, &no_router_info_cmd); install_element (OSPF_NODE, &pce_address_cmd); install_element (OSPF_NODE, &pce_path_scope_cmd); |
