Skip to content

Commit 44c6bbe

Browse files
authored
Merge pull request FRRouting#17898 from Pdoijode/pdoijode/fix-ip-route-cmd
zebra: Return error if v6 prefix is passed to show ip route
2 parents f19b843 + 8c6489b commit 44c6bbe

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

zebra/zebra_vty.c

+15
Original file line numberDiff line numberDiff line change
@@ -1789,9 +1789,24 @@ DEFPY (show_route_detail,
17891789
rib_dest_t *dest;
17901790
bool network_found = false;
17911791
bool show_ng = !!ng;
1792+
int idx = 0;
1793+
1794+
/*
1795+
* Return error if V6 address/prefix is passed as an argument to
1796+
* "show ip route" cmd.
1797+
*
1798+
* When "show ip route <X:X::X:X|X:X::X:X/M>" is queried,
1799+
* argv[idx]->text will be set to "ipv6" but argv[idx]->arg will be set
1800+
* to "ip".
1801+
*/
1802+
if (argv_find(argv, argc, "ipv6", &idx) && !strcmp(argv[idx]->arg, "ip")) {
1803+
vty_out(vty, "%% Cannot specify IPv6 address/prefix for IPv4 table\n");
1804+
return CMD_WARNING;
1805+
}
17921806

17931807
if (address_str)
17941808
prefix_str = address_str;
1809+
17951810
if (str2prefix(prefix_str, &p) < 0) {
17961811
vty_out(vty, "%% Malformed address\n");
17971812
return CMD_WARNING;

0 commit comments

Comments
 (0)