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

lib,zebra,sharpd: allow recursive resolution of nexthop-groups #16775

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mjstapp
Copy link
Contributor

@mjstapp mjstapp commented Sep 9, 2024

Add initial support for recursive resolution of nexthop-groups:

  • add a flags field to the nexthop-group zapi message, and assign a RECURSION flag value
  • add a "recursive" config option to the nexthop-group config submode
  • use the config and zapi changes in sharpd
  • in zebra, add code to iterate over a group's nexthops, use the zebra validity-checking logic, and update as necessary. This is driven by daemon-owned nhgs, allowing the use of recursive nexthops in those nhgs.

I'm making this a draft for now, so we can have some discussion. There are still some gaps - sharpd's groups aren't being uninstalled and deleted properly, for example, so I'd like to clean that up. I'm not sure that all necessary changes to a nexthop are being detected in this path. And I haven't exercised these nexthop-group changes in coordination with routes, so there are some questions and TODOs there also.

Mark Stapp and others added 4 commits September 6, 2024 15:16
Re-org/simplify the api used to add nhgs via zapi messages
from daemons, using a temporary nhe so we can convey all nhe
attributes.

Signed-off-by: Mark Stapp <[email protected]>
Add a flags field to the zapi nexthop-group struct; encode
and decode the field.

Signed-off-by: Mark Stapp <[email protected]>
Add a 'recursive' flag field and corresponding config option
for nexthop-groups.

Signed-off-by: Mark Stapp <[email protected]>
Update sharpd's internal api so that we carry more config info
when processing nhg config callbacks. This is used to allow
access to, e.g., the flags field.

Signed-off-by: Mark Stapp <[email protected]>
@frrbot frrbot bot added the documentation label Sep 9, 2024
Copy link
Member

@pguibert6WIND pguibert6WIND left a comment

Choose a reason for hiding this comment

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

it is possible to see how to reuse some commits from #16028 ?
As discussed yesterday, this extension has not wanted to control the zebra NHGs. The recursive keyword has been introduced, along with testing and many other zebra elements.

@@ -91,6 +91,8 @@ struct nexthop_group_cmd {

struct nexthop_group nhg;

uint32_t flags;

Copy link
Member

Choose a reason for hiding this comment

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

very similar to what is proposed 1b743ec

@@ -483,6 +483,7 @@ struct zapi_nexthop {
struct zapi_nhg {
uint16_t proto;
uint32_t id;
uint32_t flags;

Copy link
Member

Choose a reason for hiding this comment

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

uint32 isnot it too much?
wht other fields do you intend to push in there?

Copy link
Member

Choose a reason for hiding this comment

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

frankly I would rather have the bit field be large instead of having a problem 2-3 years down the line when we accidently go beyond the bitfield

@@ -27,3 +27,9 @@ listing of ECMP nexthops used to forward packets.
will be automatically re-assigned. This cli command must be the first
command entered currently. Additionally this command only works with linux 5.19
kernels or newer.

.. clicmd:: recursive

Copy link
Member

Choose a reason for hiding this comment

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

very similar to 2fe3837

* Resolution is going to need some more work.
*/
if (CHECK_FLAG(api_nhg.flags, ZAPI_NHG_FLAG_RECURSIVE))
SET_FLAG(nhe->flags, NEXTHOP_GROUP_RECURSION_REQ);

Copy link
Member

Choose a reason for hiding this comment

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

do you intend to offer this flag for protocol nexthop groups that depend of other protocol nexthop groups (without nexthops) ? Because if it is not the case, the nhe->nhg.nexthop flags can be used to store the ALLOW_RECURSION flag.

If it is the case, do you have a use case in mind to proceed like that ?


flags = nhgc->flags;

if (no)
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to add a topotest like was proposed in e60cd34 ?

@mjstapp
Copy link
Contributor Author

mjstapp commented Sep 10, 2024

What I want to try is to make an incremental change - and avoided "many other ... elements" on purpose. I think it makes most sense to take some careful steps, learn about the issues and impacts as we go. Most of this PR is pretty obvious - we've been talking about this for a long time. But even this small change has raised questions about threshold for nexthop reinstallation, address-family rules, about zapi messaging, about reporting results, about the "contract" that we would expect to exist between zebra and protocol daemons. As we resolve those questions, I think we'll understand better how to take the next step - to use this path to allow zebra to modify an nhg in-place, under some circumstances.

it is possible to see how to reuse some commits from #16028 ? As discussed yesterday, this extension has not wanted to control the zebra NHGs. The recursive keyword has been introduced, along with testing and many other zebra elements.

Mark Stapp added 2 commits September 10, 2024 08:49
Add support for recursive resolution of nexthop-groups: iterate
over a group's nexthops, use the zebra validity-checking logic,
and update as necessary. This is driven by daemon-owned nhgs,
allowing the use of recursive nexthops in those nhgs.

Signed-off-by: Mark Stapp <[email protected]>
Add some words about the recursive nhg config option; clean
up duplicate doc tags.

Signed-off-by: Mark Stapp <[email protected]>
@mjstapp
Copy link
Contributor Author

mjstapp commented Sep 10, 2024

Pushed an update that should help with CI...

@pguibert6WIND
Copy link
Member

What I want to try is to make an incremental change - and avoided "many other ... elements"

I just made what you requested, ie separate BGP from ZEBRA.
If you want to continue splitting, then I can actively pursue on the PR16028, and split again.
really.

learn about the issues and impacts as we go

I just wan to avoid sending non tested code in the upstream.

@@ -2074,6 +2074,9 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS)
nhe->zapi_instance = client->instance;
nhe->zapi_session = client->session_id;

/* TODO -- may need an AFI, so try to derive one */
nhe->afi = zebra_nhg_get_afi(nhg, AF_INET);

Copy link
Member

Choose a reason for hiding this comment

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

Let us separate AFI move from this pull request => #17049

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.

4 participants