[bfdsyncd] BFD hardware offload for BGP sessions (patched #4253) - #4676
Open
sridhartalari wants to merge 17 commits into
Open
[bfdsyncd] BFD hardware offload for BGP sessions (patched #4253)#4676sridhartalari wants to merge 17 commits into
sridhartalari wants to merge 17 commits into
Conversation
Signed-off-by: Baorong Liu <96146196+baorliu@users.noreply.github.com>
Signed-off-by: Baorong Liu <baorliu@cisco.com>
Signed-off-by: Baorong Liu <baorliu@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/easycla |
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Merge PR sonic-net#4253 and address review feedback: fix GCC 14 pclose deleter build failure, validate STATE_DB numeric fields, correct BFDDP header byte order, link-local detection, resource cleanup, and master merge conflicts in mock_tests Makefile. Use ephemeral port 0 in unit tests to avoid CI bind conflicts on the default BFDDP port. Signed-off-by: Sridhar talari <stalarir@cisco.com>
sridhartalari
force-pushed
the
bfd-hw-offload-patched
branch
from
June 17, 2026 18:59
5cbf1e8 to
041ce33
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
Link mock_redisreply.cpp so RedisReply::checkReplyType is stubbed in the mock Redis environment, and reset the mock DB in SetUp like other mock test suites. Signed-off-by: Sridhar talari <stalarir@cisco.com>
|
Azure Pipelines successfully started running 1 pipeline(s). |
sridhartalari
force-pushed
the
bfd-hw-offload-patched
branch
from
June 25, 2026 18:59
964c013 to
be5068b
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
/azp run |
|
Commenter does not have sufficient privileges for PR 4676 in repo sonic-net/sonic-swss |
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
sridhartalari
force-pushed
the
bfd-hw-offload-patched
branch
from
June 29, 2026 23:27
fd7dc81 to
e914be2
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Extend bfdsyncd mock tests for IPv4 sessions, duplicate handling, state updates, and invalid messages; add pytest cases for src_mac and unknown BFD session state notifications in bfdorch. Signed-off-by: Sridhar talari <stalarir@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
addDefaultIpv6Session() referenced MockBfdLink before the class was declared, breaking the amd64 build. Signed-off-by: Sridhar talari <stalarir@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
handleBfdStateUpdate returns sendmsg()'s bool result; without WillOnce(Return(true)) the gmock default false fails ASSERT_TRUE. Signed-off-by: Sridhar talari <stalarir@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the new bfdsyncd daemon to integrate FRR bfdd (BFDDP) with SONiC’s hardware-offloaded BFD sessions managed by BfdOrch, and extends BFD session handling/tests to cover additional state and MAC address behaviors.
Changes:
- Introduces
bfdsyncd(new subdir, build integration, BFDDP protocol header, link implementation, daemon main loop). - Enhances
BfdOrchto publish remote-session parameters on state changes and to honor an optionalsrc_macwhen creating hardware-lookup-invalid BFD sessions. - Adds/extends unit and VS tests for
bfdsyncd,src_mac, and unknown session notifications.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Makefile.am | Adds bfdsyncd to build subdirectories. |
| configure.ac | Adds bfdsyncd/Makefile to autoconf outputs. |
| orchagent/bfdorch.cpp | Updates state-change handling and supports optional src_mac in BFD session creation. |
| bfdsyncd/Makefile.am | Defines build rules for the new bfdsyncd binary. |
| bfdsyncd/bfdsyncd.cpp | Implements the bfdsyncd daemon main loop and CLI parsing. |
| bfdsyncd/bfdlink.h | Declares the BFDDP link class used by the daemon/tests. |
| bfdsyncd/bfdlink.cpp | Implements BFDDP message handling, APP_DB session programming, and STATE_DB-driven state updates back to bfdd. |
| bfdsyncd/bfdd/bfddp_packet.h | Adds BFDDP wire structures/enums used by bfdsyncd. |
| tests/mock_tests/Makefile.am | Adds tests_bfdsyncd to mock-test build and runner lists. |
| tests/mock_tests/bfdsyncd/test_bfdlink.cpp | Adds unit tests for BFDDP parsing/state updates and IPv4 link-local rejection. |
| tests/test_bfd.py | Adds VS tests for src_mac handling and unknown-session notifications. |
Comment on lines
+1
to
+2
| #include <iostream> | ||
| #include <inttypes.h> |
Comment on lines
+409
to
+410
| ifindex = ntohl(bm.data.session.ifindex); | ||
| memcpy(&ifname, bm.data.session.ifname, IFNAME_LEN); |
Comment on lines
+644
to
+650
| size_t pos = s.find("|"); | ||
| std::string vrf = s.substr(0, pos); | ||
| s.erase(0, pos+1); | ||
| pos = s.find("|"); | ||
| std::string intf = s.substr(0, pos); | ||
| s.erase(0, pos+1); | ||
| std::string ip = s; |
Fix bfdorch state update to avoid duplicate STATE_DB fields, harden bfdsyncd/bfdlink key parsing and invalid-message handling, validate port and remote_multiplier inputs, and add unit/VS tests for malformed keys, overflow values, unsupported message types, and IPv4 paths. Signed-off-by: Sridhar talari <stalarir@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…sage Remove link-local address detection, interface-based key construction, MAC address resolution (ping/ARP/NDP), and dst_mac/src_mac fields from APP_DB entries. HW offload now handles multihop sessions only. Signed-off-by: stalarir <stalarir@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: stalarir <stalarir@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: stalarir <stalarir@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is a patched continuation of #4253, adding
bfdsyncdto bridge FRRbfddwith hardware-offloaded BFD sessions managed byBfdOrch.Review feedback from #4253 and Copilot has been addressed:
std::unique_ptr<FILE, decltype(&pclose)>(-Werror=ignored-attributes) by using a custom pipe deleterremote_discriminator,remote_min_rx,remote_min_tx, andremote_multiplierSTATE_DB fields withswss::to_uint<uint32_t>()and reject corrupt rows before sending BFDDP frameshtons()instead of incorrectntohs()forlengthandtype)169.254.0.0/16) using host-order comparisonm_sendBufferleak and setm_connectedafteraccept()for proper socket cleanup-husage flag__BFDLINK__header guard withSWSS_BFDLINK_Hbfddp_packet.hmasterintests/mock_tests/Makefile.am(keep bothtests_fdbsyncdandtests_bfdsyncd)The delete/recreate approach for timer parameter changes is retained for vendor compatibility, as discussed in #4253.
For background and design details, see the original PR #4253 and HLD sonic-net/SONiC#1599.
Test plan
make checktargettests_bfdsyncd