summaryrefslogtreecommitdiff
path: root/ospfd/ospf_ri.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_ri.c')
-rw-r--r--ospfd/ospf_ri.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c
index be06cc0a88..b3d20dca75 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,
@@ -1273,10 +1266,11 @@ 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 (!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;
@@ -1320,10 +1314,11 @@ 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 (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);
@@ -1361,19 +1356,20 @@ 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;
struct listnode *node;
struct ri_pce_subtlv_domain *domain;
- 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);
@@ -1399,18 +1395,19 @@ out:return CMD_SUCCESS;
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);
@@ -1429,19 +1426,20 @@ 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;
struct listnode *node;
struct ri_pce_subtlv_neighbor *neighbor;
- 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);
@@ -1467,18 +1465,19 @@ out:return CMD_SUCCESS;
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);
@@ -1502,11 +1501,12 @@ 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;
- 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);
@@ -1623,7 +1623,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);