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

Avoid refreshing redundant OSPFv2 router and AS-external LSAs. #4718

Closed
wants to merge 1 commit into from

Conversation

tomgoff
Copy link

@tomgoff tomgoff commented Jul 22, 2019

In some cases ospfd will refresh router and AS-external LSAs unnecessarily.

This patch checks if LSA content has actually changed and avoids redundant LSA flooding. LSAs are still refreshed due to age when appropriate.

Router and AS-external LSAs can be refreshed without LSA information
actually changing, for example AS-external LSAs are refreshed when a
neighbor transitions to Full (see nsm_change_state() in
ospfd/ospf_nsm.c).

This patch checks if any LSA content has changed in router and
AS-external LSAs and avoids flooding redundant LSAs that would not
otherwise be refreshed due to age.

Signed-off-by: Tom Goff <tgoff0@gmail.com>
@LabN-CI
Copy link
Collaborator

LabN-CI commented Jul 23, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4718 853ea9d
Date 07/22/2019
Start 20:10:21
Finish 20:32:01
Run-Time 21:40
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-07-22-20:10:21.txt
Log autoscript-2019-07-22-20:11:12.log.bz2
Memory 427 436 360

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-8415/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-8415/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: changelog-should-mention-nmu

CLANG Static Analyzer Summary

  • Github Pull Request 4718, comparing to Git base SHA dfd15eb

No Changes in Static Analysis warnings compared to base

1 Static Analyzer issues remaining.

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

@qlyoung qlyoung requested a review from chiragshah6 July 23, 2019 15:40
@chiragshah6
Copy link
Member

ospf_lsa_refresh() refreshes all types of LSAs including router, network, summary, and external LSAs. The refresh mechanism is symmetric for all LSAs. Why only router and external LSAs refresh seen redundant.
I encourage to check force flag and employ for external LSA beasies checking existing and new LSAs header comparison.
RFC-2328 does not state LSA refresh other than if it reasches its LS_AGE

        (1) The LS age field of one of the router's self-originated LSAs
            reaches the value LSRefreshTime. In this case, a new
            instance of the LSA is originated, even though the contents
            of the LSA (apart from the LSA header) will be the same.
            This guarantees periodic originations of all LSAs.  This
            periodic updating of LSAs adds robustness to the link state
            algorithm.  LSAs that solely describe unreachable
            destinations should not be refreshed, but should instead be
            flushed from the routing domain ```

@@ -2339,6 +2371,23 @@ struct ospf_lsa *ospf_external_lsa_refresh(struct ospf *ospf,

new->data->ls_seqnum = lsa_seqnum_increment(lsa);

/* Check if any content actually changed */
if (LS_AGE(lsa) < OSPF_LS_REFRESH_TIME - (2 * OSPF_LS_REFRESH_JITTER) &&
ospf_lsa_same(lsa, new)) {
Copy link
Member

Choose a reason for hiding this comment

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

OSPF external LSA refreshed when new route added or changed values from zebra. ospf_redistribute_check() checks if LSA has changed or not along with routermap filter. There is force flag passed, i guess in that case it is forced to do refresh. Have you checked force flag value LSA_REFRESH_FORCE or LSA_REFRESH_IF_CHANGED can be employed from the caller? Have you exhust the cases where FORCE flag is passed which meant to do force refresh?
Have you done a UT where existing external route added or modified triggers a refresh even tough AGE within refresh window?

Copy link
Member

Choose a reason for hiding this comment

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

LSA_REFRESH_FORCE probably needs to be handled here -- just add a check that if that flag is set, refresh even though ospf_lsa_same returns true, I think

@eqvinox
Copy link
Contributor

eqvinox commented Aug 1, 2019

@tomgoff there was some code in the NSM that caused refreshes whenever a neighbor came up. Is it possible that this is what triggered your unneeded refreshes?

I'm removing that in this commit: 853f542
This is literally a workaround/hack whose origin we can't establish since it dates back to before the git history begins in 2002...

@riw777 riw777 self-requested a review August 6, 2019 15:52
Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

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

one comment on LSA_REFRESH_FORCE -- other than this, the code looks good to me.

@@ -2339,6 +2371,23 @@ struct ospf_lsa *ospf_external_lsa_refresh(struct ospf *ospf,

new->data->ls_seqnum = lsa_seqnum_increment(lsa);

/* Check if any content actually changed */
if (LS_AGE(lsa) < OSPF_LS_REFRESH_TIME - (2 * OSPF_LS_REFRESH_JITTER) &&
ospf_lsa_same(lsa, new)) {
Copy link
Member

Choose a reason for hiding this comment

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

LSA_REFRESH_FORCE probably needs to be handled here -- just add a check that if that flag is set, refresh even though ospf_lsa_same returns true, I think

Copy link
Contributor

@eqvinox eqvinox left a comment

Choose a reason for hiding this comment

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

I'm not OK with accepting this PR without at least 1 described case where this removes redundant flooding. Ideally this would be a test case, but I'll settle for steps to reproduce. Just want to see that it actually fixes something after 853f542.

@donaldsharp
Copy link
Member

Where are we with this PR?

@donaldsharp
Copy link
Member

Closing PR in one week if we do not start seeing action on this one. It's been hanging around forever waiting for discussion/changes

@riw777 riw777 closed this Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants