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

Bgp nexthop group optimisations #15488

Draft
wants to merge 69 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
79a37d0
Revert "zebra: Attempt to reuse NHG after interface up and route rein…
pguibert6WIND Oct 14, 2024
34b7b5d
Revert "zebra: Reinstall nexthop when interface comes back up"
pguibert6WIND Oct 14, 2024
482815e
Revert "zebra: Properly note that a nhg's nexthop has gone down"
pguibert6WIND Oct 14, 2024
5875425
Revert "zebra: Pass in ZEBRA_ROUTE_MAX instead of true"
pguibert6WIND Oct 14, 2024
3610f69
zebra: rework zebra_nhg_proto_add() parameters
pguibert6WIND Dec 7, 2023
7ad9ee1
zebra, lib: add allow-recursion flag to nexthop-group
pguibert6WIND Jun 5, 2024
11bbd74
zebra: fix submit protocol NHG add/update to nexthop_active() function
pguibert6WIND Jun 5, 2024
e286c4b
sharpd: unlock to create unresolved NHGs
pguibert6WIND Jun 5, 2024
2f25645
lib, doc: add recursive support configuration for nexthop-group
pguibert6WIND Dec 8, 2023
eca92b2
sharpd: add 'use-protocol-nexthop-group' keyword for route install
pguibert6WIND Jun 24, 2024
b9707c4
zebra: extract nhe copy from nexthop_active_update()
pguibert6WIND Jun 12, 2024
12fbdeb
topotests: add nexthop-group allow-recursion test
pguibert6WIND Dec 8, 2023
304274e
lib, zebra, doc: extend ibgp support to nhg in zebra
pguibert6WIND Jun 10, 2024
dac471f
zebra, lib: add message flags to nhg_add zapi
pguibert6WIND Jun 6, 2024
e3cdb45
lib, doc, sharp, zebra: add color support configuration for nexthops …
pguibert6WIND Jun 6, 2024
e252ada
sharpd: add a color option to watch colored nexthop changes
pguibert6WIND Jun 6, 2024
ff23eef
topotests: all_protocol_startup, add color test
pguibert6WIND Jun 6, 2024
8a648c0
lib: rename nexthop_group hook framework function calls
pguibert6WIND Jun 7, 2024
33f4f32
lib, doc: add group command under nexthop-group sub node
pguibert6WIND Jun 7, 2024
6544e4e
lib, zebra: add NHG_CHILD_ADD message support
pguibert6WIND Jun 7, 2024
1f37e0b
sharpd, lib: add nexthop-group child group support
pguibert6WIND Jun 7, 2024
8584256
topotests: all_protocol_startup, add nexthop-group test for child groups
pguibert6WIND Nov 28, 2023
9229863
zebra: fix update protocol nexthop-group fib flag value
pguibert6WIND Jul 2, 2024
5ccb711
zebra: do not set FIB flag on nhg's duplicated nexthops
pguibert6WIND Jul 2, 2024
6bca5a3
zebra: fix update nhg's nexthop FIB flag when skipping route install
pguibert6WIND Jul 3, 2024
601e9e3
zebra: update nexthop flags values when route with nhg is added
pguibert6WIND Jul 5, 2024
984a24b
zebra: update nexthop flags values when route with nhg is updated
pguibert6WIND Jul 3, 2024
581358b
topotests: all_protocol_startup, add duplicate nexthop-group test
pguibert6WIND Jul 2, 2024
fddafc7
zebra: add list of prefixes attached to protocol nhg
pguibert6WIND Mar 21, 2024
b0cca6a
zebra: add prefix evaluation at NHG updates
pguibert6WIND Mar 20, 2024
4d3c66b
zebra: add nexthop-group prefix-list in show command
pguibert6WIND Sep 30, 2024
459095e
zebra: mark the active flag of nexthop in a separate function
pguibert6WIND Oct 10, 2024
4a84a5c
zebra: create nhg_hash_entry on a separate function
pguibert6WIND Oct 10, 2024
1cf1157
zebra: reuse old nhe when only recursive nexthops changed
pguibert6WIND Sep 27, 2024
4a48a5a
topotests: add nexthop group common library
pguibert6WIND Dec 13, 2023
d6e9269
topotests: add sharp_recursive_nexthop test
pguibert6WIND Oct 10, 2024
68c68d4
bgpd: add 'debug bgp nexthop-group' command
pguibert6WIND Aug 30, 2023
3fd2ca7
bgpd: add 'bgp nexthop-group' command
pguibert6WIND Aug 25, 2023
a8cdd9c
bgpd: rework bgp_debug_zebra_nh() function
pguibert6WIND Feb 26, 2024
2053ce9
bgpd: add nexthop group framework for l3 routes.
pguibert6WIND Jul 8, 2024
b941e93
bgpd: add zapi messaging for bgp nexthop groups.
pguibert6WIND Jul 8, 2024
3129743
bgpd: add nexthop group identifier to each bgp path
pguibert6WIND Dec 11, 2023
7a1bcf1
bgpd: add nexthop tracking support for nexthop-groups
pguibert6WIND Dec 11, 2023
d288f8e
bgpd: do not use nhg when prefix resolves over default route or itself
pguibert6WIND Dec 11, 2023
0fb01c6
topotests: add bgp_nhg_topo1 test
pguibert6WIND Jan 5, 2024
4d7c5b4
bgpd: move bgp_path_display code from bgp_nexthop.c to bgpd.c
pguibert6WIND Jan 4, 2024
961dc17
bgpd: add 'show bgp nhg' command
pguibert6WIND Jan 3, 2024
e997ba3
bgpd: add the bgp_nhg_connected structure and API
pguibert6WIND Jun 24, 2024
90d4d65
bgpd: move bgp nhg_cache nexthop information into nexthops
pguibert6WIND Jun 25, 2024
fcbba6e
bgpd: rework detail part of show_bgp_nhg_id_helper() function
pguibert6WIND Jun 27, 2024
06dd256
bgpd: add a parent nhg hash-list ordered by id
pguibert6WIND Jun 27, 2024
d005569
bgpd: extend the bgp_nhg_cache parent group API
pguibert6WIND Jul 11, 2024
4f54c0a
bgpd: add bgp_nhg_nexthop attribute in bgp_path_info
pguibert6WIND Jun 28, 2024
395a027
bgpd: add nhg group support for multiple path routes
pguibert6WIND Jan 5, 2024
d844bb4
bgpd: handle the bgp failover events in BGP nexthop-groups
pguibert6WIND Jun 28, 2024
8f64478
bgpd: add display of nexthop-group hierarchy
pguibert6WIND Jan 5, 2024
1b8cfa5
bgpd: link all path entries to parent bgp_nhg
pguibert6WIND Feb 28, 2024
9bb3f46
bgpd: prevent from sending useless ROUTE_ADD messages when NHG is used
pguibert6WIND Feb 29, 2024
b48be53
bgpd: add support for nexthop counter per peer
pguibert6WIND Sep 13, 2024
2c59ac3
doc: add bgp user documentation about nexthop-group
pguibert6WIND Mar 28, 2024
414998c
doc: add technical information about bgp nexthop-groups
pguibert6WIND Jan 29, 2024
54650e2
topotests: bgp_nhg_zapi_scalability, add route update avoidance
pguibert6WIND Feb 29, 2024
a7224b6
topotests: bgp_nhg_topo2, add test to check for bgp nhg cases
pguibert6WIND Mar 29, 2024
b914c94
topotests: bgp_peer_type_multipath, fix test checks 1 active nexthop
pguibert6WIND Mar 6, 2024
85ae24d
topotests: bgp_nhg_zapi_scalability, test recursive routes
pguibert6WIND May 27, 2024
898ec0f
topotests: bgp_nhg_topo1, move utility function to lib part
pguibert6WIND Oct 9, 2024
2f9b4ac
topotests: bgp_nhg_topo1, add multiple path tests
pguibert6WIND Jan 8, 2024
06e4905
topotests: bgp_nhg_topo2, fix 6pe option not present
pguibert6WIND Aug 27, 2024
af27463
topotests: add bgp_nhg_zapi_scalability ebgp test
pguibert6WIND Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ unsigned long conf_bgp_debug_graceful_restart;
unsigned long conf_bgp_debug_evpn_mh;
unsigned long conf_bgp_debug_bfd;
unsigned long conf_bgp_debug_cond_adv;
unsigned long conf_bgp_debug_nexthop_group;

unsigned long term_bgp_debug_as4;
unsigned long term_bgp_debug_neighbor_events;
Expand All @@ -80,6 +81,7 @@ unsigned long term_bgp_debug_graceful_restart;
unsigned long term_bgp_debug_evpn_mh;
unsigned long term_bgp_debug_bfd;
unsigned long term_bgp_debug_cond_adv;
unsigned long term_bgp_debug_nexthop_group;

struct list *bgp_debug_neighbor_events_peers = NULL;
struct list *bgp_debug_keepalive_peers = NULL;
Expand Down Expand Up @@ -2040,6 +2042,40 @@ DEFPY (debug_bgp_evpn_mh,
return CMD_SUCCESS;
}

DEFPY (debug_bgp_nexthop_group,
debug_bgp_nexthop_group_cmd,
"[no$no] debug bgp nexthop-group [detail$detail]",
NO_STR
DEBUG_STR
BGP_STR
"Nexthop Group debugging\n"
"Detailed Nexthop Group debugging\n")
{
if (vty->node == CONFIG_NODE) {
if (no) {
DEBUG_OFF(nexthop_group, NEXTHOP_GROUP);
DEBUG_OFF(nexthop_group, NEXTHOP_GROUP_DETAIL);
} else {
DEBUG_ON(nexthop_group, NEXTHOP_GROUP);
if (detail)
DEBUG_ON(nexthop_group, NEXTHOP_GROUP_DETAIL);
}
} else {
if (no) {
TERM_DEBUG_OFF(nexthop_group, NEXTHOP_GROUP);
TERM_DEBUG_OFF(nexthop_group, NEXTHOP_GROUP_DETAIL);
vty_out(vty, "BGP nexthop group debugging is off\n");
} else {
TERM_DEBUG_ON(nexthop_group, NEXTHOP_GROUP);
if (detail)
TERM_DEBUG_ON(nexthop_group, NEXTHOP_GROUP_DETAIL);
vty_out(vty, "BGP nexthop group %sdebugging is on\n",
detail ? "detailed " : "");
}
}
return CMD_SUCCESS;
}

DEFUN (debug_bgp_labelpool,
debug_bgp_labelpool_cmd,
"debug bgp labelpool",
Expand Down Expand Up @@ -2177,6 +2213,8 @@ DEFUN (no_debug_bgp,
TERM_DEBUG_OFF(evpn_mh, EVPN_MH_RT);
TERM_DEBUG_OFF(bfd, BFD_LIB);
TERM_DEBUG_OFF(cond_adv, COND_ADV);
TERM_DEBUG_OFF(nexthop_group, NEXTHOP_GROUP);
TERM_DEBUG_OFF(nexthop_group, NEXTHOP_GROUP_DETAIL);

vty_out(vty, "All possible debugging has been turned off\n");

Expand Down Expand Up @@ -2270,6 +2308,11 @@ DEFUN_NOSH (show_debugging_bgp,
vty_out(vty,
" BGP conditional advertisement debugging is on\n");

if (BGP_DEBUG(nexthop_group, NEXTHOP_GROUP_DETAIL))
vty_out(vty, " BGP nexthop group detailed debugging is on\n");
else if (BGP_DEBUG(nexthop_group, NEXTHOP_GROUP))
vty_out(vty, " BGP nexthop group debugging is on\n");
Copy link
Member

Choose a reason for hiding this comment

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

Above you print BGP Nexthop Group debugging is on (Nexthop capital first), here not, which one is right?

Copy link
Member Author

Choose a reason for hiding this comment

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

let use lower case


cmd_show_lib_debugs(vty);

hook_call(bgp_hook_config_write_debug, vty, false);
Expand Down Expand Up @@ -2408,6 +2451,14 @@ static int bgp_config_write_debug(struct vty *vty)
write++;
}

if (CONF_BGP_DEBUG(nexthop_group, NEXTHOP_GROUP_DETAIL)) {
vty_out(vty, "debug bgp nexthop-group detail\n");
write++;
} else if (CONF_BGP_DEBUG(nexthop_group, NEXTHOP_GROUP)) {
vty_out(vty, "debug bgp nexthop-group\n");
Copy link
Member

Choose a reason for hiding this comment

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

nit -- should this be BGP rather than bgp? just making certain we're consistent :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

it seems ok to keep bgp as it is

write++;
}

if (hook_call(bgp_hook_config_write_debug, vty, true))
write++;

Expand Down Expand Up @@ -2545,6 +2596,10 @@ void bgp_debug_init(void)
/* debug bgp conditional advertisement */
install_element(ENABLE_NODE, &debug_bgp_cond_adv_cmd);
install_element(CONFIG_NODE, &debug_bgp_cond_adv_cmd);

/* debug bgp nexthop group [detail] */
install_element(ENABLE_NODE, &debug_bgp_nexthop_group_cmd);
install_element(CONFIG_NODE, &debug_bgp_nexthop_group_cmd);
}

/* Return true if this prefix is on the per_prefix_list of prefixes to debug
Expand Down
4 changes: 4 additions & 0 deletions bgpd/bgp_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ extern unsigned long conf_bgp_debug_graceful_restart;
extern unsigned long conf_bgp_debug_evpn_mh;
extern unsigned long conf_bgp_debug_bfd;
extern unsigned long conf_bgp_debug_cond_adv;
extern unsigned long conf_bgp_debug_nexthop_group;

extern unsigned long term_bgp_debug_as4;
extern unsigned long term_bgp_debug_neighbor_events;
Expand All @@ -89,6 +90,7 @@ extern unsigned long term_bgp_debug_graceful_restart;
extern unsigned long term_bgp_debug_evpn_mh;
extern unsigned long term_bgp_debug_bfd;
extern unsigned long term_bgp_debug_cond_adv;
extern unsigned long term_bgp_debug_nexthop_group;

extern struct list *bgp_debug_neighbor_events_peers;
extern struct list *bgp_debug_keepalive_peers;
Expand Down Expand Up @@ -130,6 +132,8 @@ struct bgp_debug_filter {
#define BGP_DEBUG_PBR_ERROR 0x02
#define BGP_DEBUG_EVPN_MH_ES 0x01
#define BGP_DEBUG_EVPN_MH_RT 0x02
#define BGP_DEBUG_NEXTHOP_GROUP 0x01
#define BGP_DEBUG_NEXTHOP_GROUP_DETAIL 0x02

#define BGP_DEBUG_GRACEFUL_RESTART 0x01

Expand Down
7 changes: 7 additions & 0 deletions bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "bgpd/bgp_io.h"
#include "bgpd/bgp_zebra.h"
#include "bgpd/bgp_vty.h"
#include "bgpd/bgp_nhg.h"

DEFINE_HOOK(peer_backward_transition, (struct peer * peer), (peer));
DEFINE_HOOK(peer_status_changed, (struct peer * peer), (peer));
Expand Down Expand Up @@ -1242,6 +1243,12 @@ void bgp_fsm_change_status(struct peer_connection *connection,
if (status >= Clearing && (peer->established || peer == bgp->peer_self)) {
bgp_clear_route_all(peer);

/* do not wait the clear-node thread to be called. otherwise,
* the updated paths may be processed before.
*/
if (bgp_option_check(BGP_OPT_NHG))
bgp_nhg_clear_nhg_nexthop();

/* If no route was queued for the clear-node processing,
* generate the
* completion event here. This is needed because if there are no
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ int main(int argc, char **argv)
if (bgpd_di.graceful_restart)
SET_FLAG(bm->flags, BM_FLAG_GRACEFUL_RESTART);

bgp_nhg_configure_default();
bgp_error_init();
/* Initializations. */
libagentx_init();
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ DEFINE_MTYPE(BGPD, BGP_DEBUG_STR, "BGP debug filter string");

DEFINE_MTYPE(BGPD, BGP_DISTANCE, "BGP distance");
DEFINE_MTYPE(BGPD, BGP_NEXTHOP_CACHE, "BGP nexthop");
DEFINE_MTYPE(BGPD, BGP_NHG_CACHE, "BGP NHG");
DEFINE_MTYPE(BGPD, BGP_CONFED_LIST, "BGP confed list");
DEFINE_MTYPE(BGPD, PEER_UPDATE_SOURCE, "BGP peer update interface");
DEFINE_MTYPE(BGPD, PEER_CONF_IF, "BGP peer config interface");
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ DECLARE_MTYPE(BGP_DEBUG_STR);

DECLARE_MTYPE(BGP_DISTANCE);
DECLARE_MTYPE(BGP_NEXTHOP_CACHE);
DECLARE_MTYPE(BGP_NHG_CACHE);
DECLARE_MTYPE(BGP_CONFED_LIST);
DECLARE_MTYPE(PEER_UPDATE_SOURCE);
DECLARE_MTYPE(PEER_CONF_IF);
Expand Down
89 changes: 3 additions & 86 deletions bgpd/bgp_nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,61 +729,11 @@ bool bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop,
return false;
}

static void bgp_show_bgp_path_info_flags(uint32_t flags, json_object *json)
{
json_object *json_flags = NULL;

if (!json)
return;

json_flags = json_object_new_object();
json_object_boolean_add(json_flags, "igpChanged",
CHECK_FLAG(flags, BGP_PATH_IGP_CHANGED));
json_object_boolean_add(json_flags, "damped",
CHECK_FLAG(flags, BGP_PATH_DAMPED));
json_object_boolean_add(json_flags, "history",
CHECK_FLAG(flags, BGP_PATH_HISTORY));
json_object_boolean_add(json_flags, "bestpath",
CHECK_FLAG(flags, BGP_PATH_SELECTED));
json_object_boolean_add(json_flags, "valid",
CHECK_FLAG(flags, BGP_PATH_VALID));
json_object_boolean_add(json_flags, "attrChanged",
CHECK_FLAG(flags, BGP_PATH_ATTR_CHANGED));
json_object_boolean_add(json_flags, "deterministicMedCheck",
CHECK_FLAG(flags, BGP_PATH_DMED_CHECK));
json_object_boolean_add(json_flags, "deterministicMedSelected",
CHECK_FLAG(flags, BGP_PATH_DMED_SELECTED));
json_object_boolean_add(json_flags, "stale",
CHECK_FLAG(flags, BGP_PATH_STALE));
json_object_boolean_add(json_flags, "removed",
CHECK_FLAG(flags, BGP_PATH_REMOVED));
json_object_boolean_add(json_flags, "counted",
CHECK_FLAG(flags, BGP_PATH_COUNTED));
json_object_boolean_add(json_flags, "multipath",
CHECK_FLAG(flags, BGP_PATH_MULTIPATH));
json_object_boolean_add(json_flags, "multipathChanged",
CHECK_FLAG(flags, BGP_PATH_MULTIPATH_CHG));
json_object_boolean_add(json_flags, "ribAttributeChanged",
CHECK_FLAG(flags, BGP_PATH_RIB_ATTR_CHG));
json_object_boolean_add(json_flags, "nexthopSelf",
CHECK_FLAG(flags, BGP_PATH_ANNC_NH_SELF));
json_object_boolean_add(json_flags, "linkBandwidthChanged",
CHECK_FLAG(flags, BGP_PATH_LINK_BW_CHG));
json_object_boolean_add(json_flags, "acceptOwn",
CHECK_FLAG(flags, BGP_PATH_ACCEPT_OWN));
json_object_object_add(json, "flags", json_flags);
}

static void bgp_show_nexthop_paths(struct vty *vty, struct bgp *bgp,
struct bgp_nexthop_cache *bnc,
json_object *json)
{
struct bgp_dest *dest;
struct bgp_path_info *path;
afi_t afi;
safi_t safi;
struct bgp_table *table;
struct bgp *bgp_path;
json_object *paths = NULL;
json_object *json_path = NULL;

Expand All @@ -792,44 +742,11 @@ static void bgp_show_nexthop_paths(struct vty *vty, struct bgp *bgp,
else
vty_out(vty, " Paths:\n");
LIST_FOREACH (path, &(bnc->paths), nh_thread) {
dest = path->net;
assert(dest && bgp_dest_table(dest));
afi = family2afi(bgp_dest_get_prefix(dest)->family);
table = bgp_dest_table(dest);
safi = table->safi;
bgp_path = table->bgp;


if (json) {
if (json)
json_path = json_object_new_object();
json_object_string_add(json_path, "afi", afi2str(afi));
json_object_string_add(json_path, "safi",
safi2str(safi));
json_object_string_addf(json_path, "prefix", "%pBD",
dest);
if (dest->pdest)
json_object_string_addf(
json_path, "rd",
BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)bgp_dest_get_prefix(
dest->pdest));
json_object_string_add(
json_path, "vrf",
vrf_id_to_name(bgp_path->vrf_id));
bgp_show_bgp_path_info_flags(path->flags, json_path);
bgp_path_info_display(path, vty, json_path);
if (json)
json_object_array_add(paths, json_path);
continue;
}
if (dest->pdest) {
vty_out(vty, " %d/%d %pBD RD ", afi, safi, dest);
vty_out(vty, BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)bgp_dest_get_prefix(
dest->pdest));
vty_out(vty, " %s flags 0x%x\n", bgp_path->name_pretty,
path->flags);
} else
vty_out(vty, " %d/%d %pBD %s flags 0x%x\n",
afi, safi, dest, bgp_path->name_pretty, path->flags);
}
if (json)
json_object_object_add(json, "paths", paths);
Expand Down
Loading
Loading