-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
bgpd: Advertise only routes that are programmed in FIB to bgp peers #3147
Conversation
Test logs |
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
bgpd/bgp_route.c
Outdated
@@ -2066,10 +2066,13 @@ int subgroup_process_announce_selected(struct update_subgroup *subgrp, | |||
struct attr attr; | |||
afi_t afi; | |||
safi_t safi; | |||
struct bgp *bgp = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to set a value here since you set it on line 2075; if that line is ever removed or incorrectly changed then this will suppress a compiler warning that would otherwise catch an uninitialized value
bgpd/bgp_route.c
Outdated
@@ -2088,12 +2091,19 @@ int subgroup_process_announce_selected(struct update_subgroup *subgrp, | |||
memset(&attr, 0, sizeof(struct attr)); | |||
/* It's initialized in bgp_announce_check() */ | |||
|
|||
/* Do not advertise routes that are not installed in FIB */ | |||
if (bgp && CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING) && | |||
CHECK_FLAG(rn->flags, BGP_NODE_FIB_INSTALL_PENDING)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent alignment needs to be fixed here
bgpd/bgp_updgrp_adv.c
Outdated
@@ -574,10 +574,13 @@ void subgroup_announce_table(struct update_subgroup *subgrp, | |||
afi_t afi; | |||
safi_t safi; | |||
int addpath_capable; | |||
struct bgp *bgp = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before
bgpd/bgp_updgrp_adv.c
Outdated
/* Do not advertise routes that are not installed in FIB */ | ||
if (bgp && | ||
CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING) && | ||
CHECK_FLAG(rn->flags, BGP_NODE_FIB_INSTALL_PENDING)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before
bgpd/bgp_zebra.c
Outdated
if (!bgp) { | ||
flog_err(EC_BGP_INVALID_NODE, | ||
"%s : bgp instance not found vrf %d", | ||
__PRETTY_FUNCTION__, vrf_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation needs to be fixed, here and in most other if
statements and continued function calls
bgpd/bgp_zebra.c
Outdated
safi_t safi; | ||
struct bgp_node *rn = NULL; | ||
struct bgp *bgp = NULL; | ||
struct bgp_info *ri = NULL, *new_select = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rn
, bgp
and ri
should not be set to NULL
lib/zclient.c
Outdated
if (set) | ||
stream_putc(s, 1); | ||
else | ||
stream_putc(s, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stream_putc(s, !!set)
@@ -482,6 +484,9 @@ extern void zclient_send_interface_radv_req(struct zclient *zclient, | |||
extern int zebra_redistribute_send(int command, struct zclient *, afi_t, | |||
int type, unsigned short instance, | |||
vrf_id_t vrf_id); | |||
/* Send route notify request to zebra */ | |||
extern int zebra_route_notify_send(int command, struct zclient *zclient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One space between the type and identifier please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kssoman There is still an extra space here before the zebra_route_notify_send
:)
This comment has been minimized.
This comment has been minimized.
This needs to be broken up into at least 4 commits:
|
default behavior should be to wait for rib/fib install notification. |
views and when zebra is not used, this is not true. |
Using this as default behavior will slow down the advertisement process to peers and also there will be some overhead as zebra needs to send notification to bgp, is it ok |
I think this is an important feature (not going to discuss if this should be enabled by default or not). I'm only wondering if we could merge the two following commands into one: DEFUN (bgp_network_import_check,
bgp_network_import_check_cmd,
"bgp network import-check",
"BGP specific commands\n"
"BGP network command\n"
"Check BGP network route exists in IGP\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) {
bgp_flag_set(bgp, BGP_FLAG_IMPORT_CHECK);
bgp_static_redo_import_check(bgp);
}
return CMD_SUCCESS;
} DEFPY (bgp_suppress_fib_pending,
bgp_suppress_fib_pending_cmd,
"bgp suppress-fib-pending",
BGP_STR
"Advertise only routes that are programmed in hardware to peers\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
bgp_suppress_fib_pending_set(bgp, true);
return CMD_SUCCESS;
} My rationale is this: if |
The routes considered for suppress-fib are peer learnt routes A -------------------- B ---------------------- C A sends routes to B and B sends to C The import check command is for routes added to BGP table from RIB |
@kssoman indeed, those are two completely different things. Sorry for my confusion ^^ |
zebra/rib.h
Outdated
|
||
/* AFI, SAFI */ | ||
afi_t afi; | ||
safi_t safi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary memory overhead. All routes from a routing table share the same AFI and SAFI values. You should obtain these values from there (rib_table_info_t
) when necessary.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
When suppress fib pending is enabled by default, some of the topology tests give error due to timing issues. This is expected since there is delay in route advertisements to peer as it is driven by the FIB install status. When suppress fib is not enabled by default, there are no errors as route are advertised to peer without delay. Therefore this might require changes to tests or not enabling suppress fib option by default We have verified that code changes work correctly on local test setup |
bgp peers (Part 1) * Code changes to add afi/safi to ZAPI messages Added afi, safi in route entry Signed-off-by: kssoman somanks@vmware.com
bgp peers (Part 2) * Addition of new ZAPI message ZEBRA_ROUTE_NOTIFY_REQUEST used by client to request for route notification from RIB Signed-off-by: kssoman somanks@vmware.com
bgp peers (Part 3) * Added CLI command to enable and disable suppress-fib-pending Signed-off-by: kssoman somanks@vmware.com
bgp peers (Part 4) * Process FIB update in bgp_zebra_route_notify_owner() and call group_announce_route() if route is installed * When bgp update is received for new route set flag BGP_NODE_FIB_INSTALL_PENDING and check the flag when advertising routes to peer Signed-off-by: kssoman somanks@vmware.com
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-5630/ This is a comment from an EXPERIMENTAL automated CI system. CLANG Static Analyzer Summary
New warnings:
Static Analysis warning summary compared to base:
4 Static Analyzer issues remaining.See details at |
code changes to be tested for large scale test scenario (larger number of peers and routes) |
Am I interpreting this correctly that the change is OK and we're just waiting on a single space character? If that's the case can someone please just remove the space char and hit merge? :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the SA warnings.
Flagged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the merge of the new dataplane code, the owner notification path in zebra_rib is somewhat different. that'll need to be resolved - please feel free to ping me if you have difficulty figuring out how things are working now. also, you'll see that there's a second path to zapi_msg.c:route_notify_internal() that will need to support the added args.
With the new data plane the call sequence is : rib_process_dplane_results() -> rib_process_after() -> zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_FAIL_INSTALL) -> route_notify_internal() -> Send ZEBRA_ROUTE_NOTIFY_OWNER to client We are only using the status ZAPI_ROUTE_FAIL_INSTALL and ZAPI_ROUTE_INSTALLED sent by RIB |
The issue is that the new path to the common zapi message handler does not have the new added arguments - just pointing out that you need to rebase to pick up that second path and ensure it builds. |
When the command is configured, bgp process sends
ZEBRA_ROUTE_NOTIFY_REQUEST to RIB to register for route notification
from RIB.
The the routes learnt from peer are marked BGP_NODE_FIB_INSTALL_PENDING
When RIB sends route notification and route is installed, the msg is
processed in bgp_zebra_route_notify_owner() which calls
the function group_announce_route() to advertise the route
Signed-off-by: kssoman somanks@vmware.com
Summary
[fill here]
Related Issue
[fill here if applicable]
Components
[bgpd, build, doc, ripd, ospfd, eigrpd, isisd, etc. etc.]
Always remember to follow proper coding style etc. as
described in the FRRouting Dev Guide.
http://docs.frrouting.org/projects/dev-guide/en/latest/workflow.html