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

zebra/fpm: fix shutdown and add more documentation #6253

Merged
merged 3 commits into from
Apr 21, 2020

Conversation

rzalamena
Copy link
Member

Summary

Changes:

  • doc: add documentation about FPM protocol (developer's manual).
  • doc: document all FPM commands (user's manual).
  • zebra data plane: call providers shutdown function.
  • fpm: properly shutdown when we have an active connection.

Copy link

@polychaeta polychaeta left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution to FRR!

Click for style suggestions

To apply these suggestions:

curl -s https://gist.githubusercontent.com/polychaeta/8f12886fa15c66c61cfe28d22d2406b7/raw/d3e1b5e78de971828505be2c614e99f61a58c364/cr_6253_1587140461.diff | git apply

diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 143354b16..78dfedf3f 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -3565,7 +3565,7 @@ void zebra_dplane_pre_finish(void)
 	zdplane_info.dg_is_shutdown = true;
 
 	/* Notify provider(s) of pending shutdown. */
-	TAILQ_FOREACH(dp, &zdplane_info.dg_providers_q, dp_prov_link) {
+	TAILQ_FOREACH (dp, &zdplane_info.dg_providers_q, dp_prov_link) {
 		if (dp->dp_fini == NULL)
 			continue;
 
@@ -3892,7 +3892,7 @@ void zebra_dplane_shutdown(void)
 	zdplane_info.dg_master = NULL;
 
 	/* Notify provider(s) of final shutdown. */
-	TAILQ_FOREACH(dp, &zdplane_info.dg_providers_q, dp_prov_link) {
+	TAILQ_FOREACH (dp, &zdplane_info.dg_providers_q, dp_prov_link) {
 		if (dp->dp_fini == NULL)
 			continue;
 

If you are a new contributor to FRR, please see our contributing guidelines.

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.

Had one question about the fpm callback?

close(fnc->socket);

/* This is the late call: stop the thread. */
if (early == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm - maybe it's just a style nit, but I find the flow a little hard to follow. couldn't it be:

if (early) {
    do early stuff
    return 0;
} else {
    /* it's the real end */
    do final stuff
    return 0;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO that looks the same to me... I think my initial code looks cleaner since it avoids an extra indentation level. If this bothers too much, maybe I'll split it into two functions.

Copy link
Member

Choose a reason for hiding this comment

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

another nit, please don't compare bools to true / false, just test them directly; I did a mass conversion to fix all of these a while back and would like to keep it that way

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in last push.

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 17, 2020

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/6253 86bb8ee
Date 04/17/2020
Start 12:25:32
Finish 12:51:24
Run-Time 25:52
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2020-04-17-12:25:32.txt
Log autoscript-2020-04-17-12:26:30.log.bz2
Memory 499 497 425

For details, please contact louberger

FPM
===

FPM stands for Forwarding Plane Manager and it's a ``zebra``'s daemon module.
Copy link
Member

Choose a reason for hiding this comment

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

"it's a module for use with Zebra" or something

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed!

doc/user/zebra.rst Show resolved Hide resolved
close(fnc->socket);

/* This is the late call: stop the thread. */
if (early == false) {
Copy link
Member

Choose a reason for hiding this comment

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

another nit, please don't compare bools to true / false, just test them directly; I did a mass conversion to fix all of these a while back and would like to keep it that way

THREAD_OFF(fnc->t_ribwalk);
THREAD_OFF(fnc->t_rmacreset);
THREAD_OFF(fnc->t_rmacwalk);
if (fnc->t_read)
Copy link
Member

Choose a reason for hiding this comment

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

You can't test these like this, it's a race condition, just call the async cancel directly

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed!

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 17, 2020

Continuous Integration Result: FAILED

Continuous Integration Result: FAILED

See below for issues.
CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11930/

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.

Get source / Pull Request: Successful

Building Stage: Successful

Basic Tests: Failed

Topology tests on Ubuntu 16.04 amd64: Failed (click for details)

Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPOU1604-11930/test

Topology Tests failed for Topology tests on Ubuntu 16.04 amd64:

2020-04-17 18:51:03,791 ERROR: 'router_json_cmp' failed after 10.01 seconds
2020-04-17 18:51:03,793 ERROR: assert failed at "test_bfd_bgp_cbit_topo3/test_bfd_comes_back_again": "r1" JSON output mismatches
assert json value is different (
  --- Expected value
  +++ Current value
  @@ -2,0 +3 @@
  +        "detect-multiplier": 3, 
  @@ -3,0 +5 @@
  +        "downtime": 2, 
  @@ -4,0 +7 @@
  +        "id": 3260389220, 
  @@ -8,0 +12 @@
  +        "remote-detect-multiplier": 3, 
  @@ -10,5 +14,7 @@
  -        "remote-echo-interval": 50, 
  -        "remote-receive-interval": 300, 
  -        "remote-transmit-interval": 300, 
  -        "status": "up", 
  -        "transmit-interval": 300
  +        "remote-echo-interval": 0, 
  +        "remote-id": 0, 
  +        "remote-receive-interval": 1000, 
  +        "remote-transmit-interval": 1000, 
  +        "status": "down", 
  +        "transmit-interval": 300, 
  +        "vrf": "default")
2020-04-17 18:53:18,272 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/bgp.py", line 159, in create_router_bgp
    tgen, router, data_all_bgp, "bgp", build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 240, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 397, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 4: % Unknown command[27]: neighbor 10.0.0.13 remote-as 0 


2020-04-17 18:53:18,519 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/bgp.py", line 159, in create_router_bgp
    tgen, router, data_all_bgp, "bgp", build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 240, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 397, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: % No BGP process is configured
line 2: Failure to communicate[13] to bgpd, line: no router bgp 



*** defaultIntf: warning: r1 has no interfaces
2020-04-17 19:20:19,623 ERROR: '_bgp_has_routes' failed after 37.61 seconds
2020-04-17 19:26:47,282 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 1509, in create_bgp_community_lists
    tgen, router, config_data, "bgp_community_list", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 240, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 397, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: % Malformed community-list value
line 2: Failure to communicate[13] to bgpd, line: bgp community-list standard ANY permit 0:-1 



2020-04-17 19:26:47,403 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 1509, in create_bgp_community_lists
    tgen, router, config_data, "bgp_community_list", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 240, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 397, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: % Malformed community-list value
line 2: Failure to communicate[13] to bgpd, line: bgp community-list standard ANY permit 0:65536 



2020-04-17 19:26:47,523 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 1509, in create_bgp_community_lists
    tgen, router, config_data, "bgp_community_list", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 240, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 397, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: % Malformed community-list value
line 2: Failure to communicate[13] to bgpd, line: bgp large-community-list standard ANY permit 0:4294967296 



2020-04-17 19:26:47,643 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 1509, in create_bgp_community_lists
    tgen, router, config_data, "bgp_community_list", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 240, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 397, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: % Malformed community-list value
line 2: Failure to communicate[13] to bgpd, line: bgp large-community-list standard ANY permit 0:-1:1 



2020-04-17 19:28:45,363 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 1509, in create_bgp_community_lists
    tgen, router, config_data, "bgp_community_list", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 240, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPOU1604/topotests/lib/common_config.py", line 397, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 2: % Command incomplete[4]: bgp large-community-list standard Test1 permit  



2020-04-17 19:35:32,109 ERROR: PIMd StdErr Log:% No Path to RP address specified: 192.168.100.1

2020-04-17 19:35:34,161 ERROR: PIMd StdErr Log:% No Path to RP address specified: 192.168.100.1

2020-04-17 19:35:40,311 ERROR: PIMd StdErr Log:% No Path to RP address specified: 192.168.100.1

see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11930/artifact/TOPOU1604/ErrorLog/log_topotests.txt

Successful on other platforms/tests
  • Static analyzer (clang)
  • IPv6 protocols on Ubuntu 14.04
  • Topology tests on Ubuntu 18.04 amd64
  • Ubuntu 16.04 deb pkg check
  • Fedora 29 rpm pkg check
  • Ubuntu 12.04 deb pkg check
  • Addresssanitizer topotests part 1
  • Ubuntu 14.04 deb pkg check
  • IPv4 ldp protocol on Ubuntu 16.04
  • Addresssanitizer topotests part 2
  • Debian 8 deb pkg check
  • Debian 9 deb pkg check
  • IPv4 protocols on Ubuntu 14.04
  • CentOS 7 rpm pkg check
  • Debian 10 deb pkg check
  • Addresssanitizer topotests part 3
  • Topotest tests on Ubuntu 16.04 i386

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-11930/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)
W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)
W: frr-rpki-rtrlib: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-01-g86bb8ee36-0 (missing) -> 7.4-dev-20200417-01-g86bb8ee36-0~deb10u1
W: frr-snmp: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-01-g86bb8ee36-0 (missing) -> 7.4-dev-20200417-01-g86bb8ee36-0~deb10u1
W: frr-doc: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-01-g86bb8ee36-0 (missing) -> 7.4-dev-20200417-01-g86bb8ee36-0~deb10u1
W: frr-pythontools: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-01-g86bb8ee36-0 (missing) -> 7.4-dev-20200417-01-g86bb8ee36-0~deb10u1
W: frr: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-01-g86bb8ee36-0 (missing) -> 7.4-dev-20200417-01-g86bb8ee36-0~deb10u1

Tell users about new FPM implementation and add more documentation about
it.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Call the `dp_fini` callback twice: once at the beginning of the shutdown
and then again right before `exit()`ing zebra.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Lets stop and free all resources before shutting down.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 17, 2020

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/6253 98a8750
Date 04/17/2020
Start 19:20:33
Finish 19:46:23
Run-Time 25:50
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2020-04-17-19:20:33.txt
Log autoscript-2020-04-17-19:21:30.log.bz2
Memory 479 498 425

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

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-11935/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)
W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)
W: frr-pythontools: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-02-g98a875048-0 (missing) -> 7.4-dev-20200417-02-g98a875048-0~deb10u1
W: frr-rpki-rtrlib: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-02-g98a875048-0 (missing) -> 7.4-dev-20200417-02-g98a875048-0~deb10u1
W: frr: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-02-g98a875048-0 (missing) -> 7.4-dev-20200417-02-g98a875048-0~deb10u1
W: frr-snmp: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-02-g98a875048-0 (missing) -> 7.4-dev-20200417-02-g98a875048-0~deb10u1
W: frr-doc: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200417-02-g98a875048-0 (missing) -> 7.4-dev-20200417-02-g98a875048-0~deb10u1

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.

Looks good to me

@qlyoung qlyoung self-requested a review April 21, 2020 15:22
@qlyoung qlyoung merged commit e15361b into FRRouting:master Apr 21, 2020
@rzalamena rzalamena deleted the fpm-extra branch June 10, 2020 12:15
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.

6 participants