Skip to content

Commit

Permalink
Merge pull request #17898 from Pdoijode/pdoijode/fix-ip-route-cmd
Browse files Browse the repository at this point in the history
zebra: Return error if v6 prefix is passed to show ip route
  • Loading branch information
ton31337 authored Jan 23, 2025
2 parents f19b843 + 8c6489b commit 44c6bbe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions zebra/zebra_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,9 +1789,24 @@ DEFPY (show_route_detail,
rib_dest_t *dest;
bool network_found = false;
bool show_ng = !!ng;
int idx = 0;

/*
* Return error if V6 address/prefix is passed as an argument to
* "show ip route" cmd.
*
* When "show ip route <X:X::X:X|X:X::X:X/M>" is queried,
* argv[idx]->text will be set to "ipv6" but argv[idx]->arg will be set
* to "ip".
*/
if (argv_find(argv, argc, "ipv6", &idx) && !strcmp(argv[idx]->arg, "ip")) {
vty_out(vty, "%% Cannot specify IPv6 address/prefix for IPv4 table\n");
return CMD_WARNING;
}

if (address_str)
prefix_str = address_str;

if (str2prefix(prefix_str, &p) < 0) {
vty_out(vty, "%% Malformed address\n");
return CMD_WARNING;
Expand Down

0 comments on commit 44c6bbe

Please sign in to comment.