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

bgpd: Advertise only routes that are programmed in FIB to bgp peers #3147

Closed
wants to merge 4 commits into from

Conversation

kssoman
Copy link
Contributor

@kssoman kssoman commented Oct 8, 2018

  • Added bgp global configuration command "suppress-fib-pending"
    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

@kssoman
Copy link
Contributor Author

kssoman commented Oct 8, 2018

Test logs
fib_logs.txt

@LabN-CI
Copy link
Collaborator

LabN-CI commented Oct 8, 2018

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/3147 b3068fa
Date 10/08/2018
Start 13:11:28
Finish 13:34:32
Run-Time 23:04
Total 1816
Pass 1816
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2018-10-08-13:11:28.txt
Log autoscript-2018-10-08-13:12:04.log.bz2

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;
Copy link
Member

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))
Copy link
Member

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

@@ -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;
Copy link
Member

Choose a reason for hiding this comment

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

As before

/* 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))
Copy link
Member

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);
Copy link
Member

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;
Copy link
Member

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);
Copy link
Member

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,
Copy link
Member

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.

Copy link
Contributor

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 :)

@NetDEF-CI

This comment has been minimized.

@donaldsharp
Copy link
Member

This needs to be broken up into at least 4 commits:

  1. Change to add afi/safi to ZAPI messages
  2. Addition of new ZAPI message
  3. Usage of new zapi message in bgp

@donaldsharp
Copy link
Member

default behavior should be to wait for rib/fib install notification.

@donaldsharp
Copy link
Member

views and when zebra is not used, this is not true.

@kssoman
Copy link
Contributor Author

kssoman commented Oct 9, 2018

default behavior should be to wait for rib/fib install notification.

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

@rwestphal
Copy link
Member

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 no bgp network import-check is configured, then the bgp suppress-fib-pending command becomes irrelevant. Maybe a new option like bgp network import-check [suppress-fib-pending] would do the job.

@kssoman
Copy link
Contributor Author

kssoman commented Oct 9, 2018

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 no bgp network import-check is configured, then the bgp suppress-fib-pending command becomes irrelevant. Maybe a new option like bgp network import-check [suppress-fib-pending] would do the job.

The routes considered for suppress-fib are peer learnt routes

A -------------------- B ---------------------- C

A sends routes to B and B sends to C
If B does not install all routes learnt from router A in the FIB, the routes are currently advertised to C
therefore traffic to these prefixes which are not installed reach router B and then discarded
The fix provides option to suppress advertisement of the routes which are not installed

The import check command is for routes added to BGP table from RIB

@rwestphal
Copy link
Member

@kssoman indeed, those are two completely different things. Sorry for my confusion ^^

zebra/rib.h Outdated

/* AFI, SAFI */
afi_t afi;
safi_t safi;
Copy link
Member

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.

@NetDEF-CI

This comment has been minimized.

@LabN-CI

This comment has been minimized.

@LabN-CI

This comment has been minimized.

@NetDEF-CI

This comment has been minimized.

@LabN-CI

This comment has been minimized.

@NetDEF-CI

This comment has been minimized.

@kssoman
Copy link
Contributor Author

kssoman commented Oct 13, 2018

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

kssoman added 4 commits October 12, 2018 23:29
      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
@LabN-CI
Copy link
Collaborator

LabN-CI commented Oct 13, 2018

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/3147 a25f8a3
Date 10/13/2018
Start 03:11:34
Finish 03:34:37
Run-Time 23:03
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2018-10-13-03:11:34.txt
Log autoscript-2018-10-13-03:12:11.log.bz2

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


CLANG Static Analyzer Summary

  • Github Pull Request 3147, comparing to Git base SHA 97dc689

New warnings:

Static Analysis warning summary compared to base:

  • Fixed warnings: 0
  • New warnings: 4

4 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-5630/artifact/shared/static_analysis/index.html

@louberger louberger dismissed their stale review October 16, 2018 13:36

issue addressed

@kssoman
Copy link
Contributor Author

kssoman commented Oct 23, 2018

code changes to be tested for large scale test scenario (larger number of peers and routes)

@eqvinox eqvinox added the review & merge me look at me! label Oct 23, 2018
@eqvinox
Copy link
Contributor

eqvinox commented Oct 23, 2018

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

Copy link
Member

@rwestphal rwestphal left a 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.

@eqvinox eqvinox added submitter action required The author/submitter needs to do something (fix, rebase, add info, etc.) and removed review & merge me look at me! labels Oct 26, 2018
@eqvinox
Copy link
Contributor

eqvinox commented Oct 26, 2018

Flagged submitter action required due to SA warnings

Copy link
Contributor

@mjstapp mjstapp left a 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.

@kssoman
Copy link
Contributor Author

kssoman commented Nov 2, 2018

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
Therefore looks like the new dataplane changes will not have an impact for this PR

@mjstapp
Copy link
Contributor

mjstapp commented Nov 2, 2018

Therefore looks like the new dataplane changes will not have an impact for this PR

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.

@kssoman kssoman closed this Jan 29, 2019
@kssoman kssoman deleted the fib_test branch January 29, 2019 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
submitter action required The author/submitter needs to do something (fix, rebase, add info, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants