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] Check zebra is ready to connect when starting bgpd #6478

Merged
merged 4 commits into from
Jan 19, 2021

Conversation

shi-su
Copy link
Contributor

@shi-su shi-su commented Jan 18, 2021

- Why I did it
There is a race condition between zebra server accepts connections and bgpd tries to connect. Bgpd has a chance to try to connect before zebra is ready. In this scenario, bgpd will try again after 10 seconds and operate as normal within these 10 seconds. As a consequence, whatever bgpd tries to sent to zebra will be missing in the 10 seconds. To avoid such a scenario, bgpd should start after zebra is ready to accept connections.

Fix #5026

- How I did it
Check and wait until zebra is ready to accept connections before starting bgpd.

- How to verify it

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@shi-su shi-su marked this pull request as ready for review January 18, 2021 20:06
@shi-su
Copy link
Contributor Author

shi-su commented Jan 19, 2021

retest vsimage please

@lguohan
Copy link
Collaborator

lguohan commented Jan 19, 2021

azure pipeline kvmtest passed.

@lguohan lguohan merged commit afee1a8 into sonic-net:master Jan 19, 2021
lguohan pushed a commit that referenced this pull request Jan 21, 2021
Fix #5026

There is a race condition between zebra server accepts connections and bgpd tries to connect. Bgpd has a chance to try to connect before zebra is ready. In this scenario, bgpd will try again after 10 seconds and operate as normal within these 10 seconds. As a consequence, whatever bgpd tries to sent to zebra will be missing in the 10 seconds. To avoid such a scenario, bgpd should start after zebra is ready to accept connections.
StormLiangMS pushed a commit that referenced this pull request Sep 25, 2023
Why I did it
Back port #6478 and #6519 to 201911 branch.

Work item tracking
Microsoft ADO (number only):
24978836
How I did it
Add checking the connection between zebra and bgp during bgpd start.

How to verify it
Modify start.h, add debug log and check the syslog

  _Sep 22 02:41:29.716356 str-a7060cx-acs-10 INFO bgp#root: ####: start zebra
  Sep 22 02:41:30.815341 str-a7060cx-acs-10 INFO bgp#root: ####: start check connection
  Sep 22 02:41:30.868784 str-a7060cx-acs-10 INFO bgp#root: ####: It took 0.029979 seconds to wait for zebra to be ready to accept connections
  Sep 22 02:41:30.873685 str-a7060cx-acs-10 INFO bgp#root: ####: start bgpd
  Sep 22 02:41:35.270569 str-a7060cx-acs-10 INFO bgp#root: ####: done_

  _Sep 22 03:28:02.423438 str-a7060cx-acs-10 INFO bgp#root: ####: start zebra
  Sep 22 03:28:03.731320 str-a7060cx-acs-10 INFO bgp#root: ####: start check connection
  Sep 22 03:28:33.749152 str-a7060cx-acs-10 INFO bgp#root: ####: Error: zebra is not ready to accept connections
  Sep 22 03:28:33.752490 str-a7060cx-acs-10 INFO bgp#root: ####: start bgpd
  Sep 22 03:28:34.259735 str-a7060cx-acs-10 INFO bgp#root: ####: start bgpd done
  Sep 22 03:28:34.755538 str-a7060cx-acs-10 INFO bgp#root: ####: start bgpcfgd
  Sep 22 03:28:35.800906 str-a7060cx-acs-10 INFO bgp#root: ####: done_
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.

ip route in the kernel does not match routes in bgp
3 participants