Merge pull request #10543 from FRRouting/mergify/bp/dev/8.2/pr-10511

ospfd: fix loss of mixed form in "range" command (backport #10511)
This commit is contained in:
Donald Sharp 2022-02-09 10:19:25 -05:00 committed by GitHub
commit d992107a44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -652,20 +652,22 @@ DEFUN (ospf_area_range,
DEFUN (ospf_area_range_cost,
ospf_area_range_cost_cmd,
"area <A.B.C.D|(0-4294967295)> range A.B.C.D/M cost (0-16777215)",
"area <A.B.C.D|(0-4294967295)> range A.B.C.D/M {cost (0-16777215)|substitute A.B.C.D/M}",
"OSPF area parameters\n"
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n"
"Summarize routes matching address/mask (border routers only)\n"
"Area range prefix\n"
"User specified metric for this range\n"
"Advertised metric for this range\n")
"Advertised metric for this range\n"
"Announce area range as another prefix\n"
"Network prefix to be announced instead of range\n")
{
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
int idx_ipv4_number = 1;
int idx_ipv4_prefixlen = 3;
int idx_cost = 5;
struct prefix_ipv4 p;
int idx = 4;
struct prefix_ipv4 p, s;
struct in_addr area_id;
int format;
uint32_t cost;
@ -677,8 +679,16 @@ DEFUN (ospf_area_range_cost,
ospf_area_display_format_set(ospf, ospf_area_get(ospf, area_id),
format);
cost = strtoul(argv[idx_cost]->arg, NULL, 10);
ospf_area_range_cost_set(ospf, area_id, &p, cost);
if (argv_find(argv, argc, "cost", &idx)) {
cost = strtoul(argv[idx + 1]->arg, NULL, 10);
ospf_area_range_cost_set(ospf, area_id, &p, cost);
}
idx = 4;
if (argv_find(argv, argc, "substitute", &idx)) {
str2prefix_ipv4(argv[idx + 1]->arg, &s);
ospf_area_range_substitute_set(ospf, area_id, &p, &s);
}
return CMD_SUCCESS;
}
@ -742,36 +752,6 @@ DEFUN (no_ospf_area_range,
return CMD_SUCCESS;
}
DEFUN (ospf_area_range_substitute,
ospf_area_range_substitute_cmd,
"area <A.B.C.D|(0-4294967295)> range A.B.C.D/M substitute A.B.C.D/M",
"OSPF area parameters\n"
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n"
"Summarize routes matching address/mask (border routers only)\n"
"Area range prefix\n"
"Announce area range as another prefix\n"
"Network prefix to be announced instead of range\n")
{
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
int idx_ipv4_number = 1;
int idx_ipv4_prefixlen = 3;
int idx_ipv4_prefixlen_2 = 5;
struct prefix_ipv4 p, s;
struct in_addr area_id;
int format;
VTY_GET_OSPF_AREA_ID(area_id, format, argv[idx_ipv4_number]->arg);
str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
str2prefix_ipv4(argv[idx_ipv4_prefixlen_2]->arg, &s);
ospf_area_range_substitute_set(ospf, area_id, &p, &s);
ospf_area_display_format_set(ospf, ospf_area_get(ospf, area_id),
format);
return CMD_SUCCESS;
}
DEFUN (no_ospf_area_range_substitute,
no_ospf_area_range_substitute_cmd,
"no area <A.B.C.D|(0-4294967295)> range A.B.C.D/M substitute A.B.C.D/M",
@ -12769,7 +12749,6 @@ void ospf_vty_init(void)
install_element(OSPF_NODE, &ospf_area_range_cost_cmd);
install_element(OSPF_NODE, &ospf_area_range_not_advertise_cmd);
install_element(OSPF_NODE, &no_ospf_area_range_cmd);
install_element(OSPF_NODE, &ospf_area_range_substitute_cmd);
install_element(OSPF_NODE, &no_ospf_area_range_substitute_cmd);
/* "area virtual-link" commands. */