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: add an approach to keep the NHG ID unchanged for recursive rou… #16693

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

Conversation

xingrenwai
Copy link

…tes and to quickly fix involved NHGs in the dataplanes when recursive routes converge

This modification requirements comes from the HLD
https://github.com/eddieruan-alibaba/SONiC/blob/eruan-recursive/doc/recursive/recursive_route.md

For achieving this quick fixup, we need the following changes

  1. change NHG ID hash method, preserve the NHG ID
  2. add a new function zebra_rnh_fixup_depends() to make a quick fixup on involved recursive NHGs in dataplanes

Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before reviewing it further please fix all the styling issues and the commit requirements, as required here: https://github.com/FRRouting/frr/pull/16693/checks?check_run_id=29454500908.


r1 = tgen.routers()["r1"]

r1.vtysh_cmd("conf t\nip route 1.1.1.1/24 100.0.0.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid using public IP ranges. See here: https://github.com/FRRouting/frr/blob/master/doc/developer/topotests.rst#writing-tests:

Always use IPv4 RFC 5737 (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24) and IPv6 RFC 3849 (2001:db8::/32) ranges reserved for documentation.

r1.vtysh_cmd("conf t\nip route 200.0.0.1/24 10.4.4.2")
r1.vtysh_cmd("conf t\nip route 200.0.0.1/24 10.4.4.2")

text1 = r1.vtysh_cmd("show ip route 200.0.0.0/24 nexthop-group")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use just show ip route ... json. It has installedNexthopGroupId. And we can avoid comparing plain-text, instead of JSON.

struct nhg_hash_entry *zebra_presvd_nhg_lookup(struct nhg_hash_entry *lookup)
{
if (lookup == NULL)
return lookup;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hash_lookup() returns NULL itself, no need to check here. We can just use return hash_lookup(...).

if (hash_lookup(zrouter.nhgs_presvd, nhe)) {
if (IS_ZEBRA_DEBUG_NHG)
zlog_debug("%s: NHG %pNG already exists", __func__, nhe);
return -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anywhere in the code for the return code being checked or am I missing it?

@@ -282,12 +282,17 @@ extern bool zebra_nhg_dependents_is_empty(const struct nhg_hash_entry *nhe);
/* Lookup ID, doesn't create */
extern struct nhg_hash_entry *zebra_nhg_lookup_id(uint32_t id);

/* Lookup preserved, doesn't create */
extern struct nhg_hash_entry *zebra_presvd_nhg_lookup(struct nhg_hash_entry *lookup);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you name this function without shortening it with something like presvd? I don't see any reason to shorten and then guess what it means.

Copy link
Member

@donaldsharp donaldsharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the approach I would like to take for this problem. This needs to be discussed at a higher level before this can continue hence putting request changes o nthis to prevent it from going in without that

@xingrenwai
Copy link
Author

xingrenwai commented Sep 3, 2024

This is not the approach I would like to take for this problem. This needs to be discussed at a higher level before this can continue hence putting request changes o nthis to prevent it from going in without that

After discussing with Eddie, we’ve decided not to change the original recursive NHG creation logic for now. Instead of keeping the NHG unchanged, we’ll just update the FPM in zebra_rnh_fixup_depends() using the old NHG ID with the new path. This should help with fast traffic convergence. Do you think this approach could work? Any other suggestions?

Copy link

github-actions bot commented Sep 9, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

…ecursive routes converge

This modification requirements comes from the HLD
https://github.com/eddieruan-alibaba/SONiC/blob/eruan-recursive/doc/recursive/recursive_route.md

Add a new function zebra_rnh_fixup_depends() to make a quick fixup on involved NHGs in FPM
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.

3 participants