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

[static route] 'STATIC_ROUTE|1.1.1.0/24' and 'STATIC_ROUTE|default|1.1.1.0/24' should not exist at the same time in CONFIG DB #11803

Closed
Junchao-Mellanox opened this issue Aug 22, 2022 · 3 comments
Assignees
Labels
Issue for 202205 MSFT Triaged this issue has been triaged

Comments

@Junchao-Mellanox
Copy link
Collaborator

Junchao-Mellanox commented Aug 22, 2022

Description

config route add prefix vrf default 1.1.1.0/24 ... adds entry STATIC_ROUTE|default|1.1.1.0/24 to CONFIG DB; config route add prefix 1.1.1.0/24 ... adds entry STATIC_ROUTE|1.1.1.0/24 to CONFIG DB.

For bgpcfgd, STATIC_ROUTE|default|1.1.1.0/24 and STATIC_ROUTE|1.1.1.0/24 are the same route entry. See

:

    @staticmethod
    def split_key(key):
        """
        Split key into vrf name and prefix.
        :param key: key to split
        :return: vrf name extracted from the key, ip prefix extracted from the key
        """
        if '|' not in key:
            return 'default', key
        else:
            return tuple(key.split('|', 1))

It causes a few problems:

  1. We could have two entries in CONFIG DB which point to the same static route. The two entries may have different next hop which could confuse user
  2. config route del prefix vrf default 1.1.1.0/24 cannot remove entry STATIC_ROUTE|1.1.1.0/24; config route del prefix 1.1.1.0/24 cannot remove entry STATIC_ROUTE|default|1.1.1.0/24

Steps to reproduce the issue:

  1. config route add prefix vrf default 1.1.1.0/24 ...
  2. config route add prefix 1.1.1.0/24 ...

Describe the results you received:

See two route entries in CONFIG DB which point to the same static route

Describe the results you expected:

Only one route entry should exist in CONFIG DB for the same route

Output of show version:

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

Workaround:

  1. Don't use config route add prefix vrf default <ip_prefix> and config route add prefix vrf <ip_prefix> for the same ip_prefix together
  2. Use config route del prefix vrf default <ip_prefix> to remove static routes created by config route add prefix vrf default <ip_prefix>
  3. Use config route del prefix vrf <ip_prefix> to remove static routes created by config route add prefix vrf <ip_prefix>
@prsunny
Copy link
Contributor

prsunny commented Aug 24, 2022

I think the 2nd command should also append 'default' as key to the STATIC_ROUTE table. What do you think?

@Junchao-Mellanox
Copy link
Collaborator Author

That's true. But we should not allow user configuring same route entry to different redis DB entry.

STATIC_ROUTE|default|1.1.1.0/24
STATIC_ROUTE|1.1.1.0/24

@prsunny
Copy link
Contributor

prsunny commented Sep 8, 2022

ETA 9/16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue for 202205 MSFT Triaged this issue has been triaged
Projects
None yet
Development

No branches or pull requests

5 participants