Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: Return error if v6 prefix is passed to show ip route #17898

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Pdoijode
Copy link
Contributor

Return error if IPv6 address or prefix is passed as an argument to "show ip route" command.

UT:

Before fix:

r1# 
r1# show ipv6 route 200.0.20.1/32
% Unknown command: show ipv6 route 200.0.20.1/32
r1# 
r1# show ip route 2::3/128 ===> v4  CMD accepts v6 prefix
Routing entry for 2::3/128
  Known via "bgp", distance 20, metric 0, best
  Last update 00:02:30 ago
  * fe80::5493:4ff:fe30:55fd, via r1-r2-eth0, weight 1

r1# show ip route 2::3 ===> v4  CMD accepts v6 address
Routing entry for 2::3/128
  Known via "bgp", distance 20, metric 0, best
  Last update 00:15:16 ago
  * fe80::5493:4ff:fe30:55fd, via r1-r2-eth0, weight 1

r1# show ip route 2::
r1# show ip route 2:
% Unknown command: show ip route 2:
r1# 

After fix:

r1# show ip route 2::3/128
% Cannot specify IPv6 address or prefix with IPv4 AFI ===> Returned error
r1# 
r1# show ip route 2::3
% Cannot specify IPv6 address or prefix with IPv4 AFI ===> Returned error
r1# 
r1# 
r1# show ipv6 route 2::3
Routing entry for 2::3/128
  Known via "bgp", distance 20, metric 0, best
  Last update 00:01:17 ago
  * fe80::859:d5ff:feab:c1a4, via r1-r2-eth0, weight 1

r1# show ipv6 route 2::3/128
Routing entry for 2::3/128
  Known via "bgp", distance 20, metric 0, best
  Last update 00:01:23 ago
  * fe80::859:d5ff:feab:c1a4, via r1-r2-eth0, weight 1

r1# show ipv6 route 200.0.20.1/32
% Unknown command: show ipv6 route 200.0.20.1/32
r1# 

@frrbot frrbot bot added the zebra label Jan 21, 2025
@Pdoijode Pdoijode force-pushed the pdoijode/fix-ip-route-cmd branch from 47d2063 to c0dbbca Compare January 21, 2025 23:30
@ton31337
Copy link
Member

This error message looks odd to me:

r1# show ip route 2::3/128
% Cannot specify IPv6 address or prefix with IPv4 AFI ===> Returned error
r1# 
r1# show ip route 2::3
% Cannot specify IPv6 address or prefix with IPv4 AFI ===> Returned error
r1# 

I read it as "Cannot specify IPv6 address or IPv4 prefix" :) Shouldn't be better changing the wording a bit to?

% Cannot specify IPv6 address/prefix for IPv4 table

Return error if IPv6 address or prefix is passed as an argument
to "show ip route" command.

UT:
r1# show ip route 2::3/128
% Cannot specify IPv6 address/prefix for IPv4 table
r1#
r1# show ip route 2::3
% Cannot specify IPv6 address/prefix for IPv4 table
r1#

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
@Pdoijode Pdoijode force-pushed the pdoijode/fix-ip-route-cmd branch from c0dbbca to 8c6489b Compare January 22, 2025 18:10
@Pdoijode
Copy link
Contributor Author

With updated error message:

r1# show ip route 2::3/128
% Cannot specify IPv6 address/prefix for IPv4 table
r1# 
r1# 
r1# show ip route 2::3
% Cannot specify IPv6 address/prefix for IPv4 table
r1# 

@Pdoijode
Copy link
Contributor Author

ci:rerun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants