Skip to content

api: return next hops in ListPath paths - #630

Merged
fujita merged 1 commit into
osrg:masterfrom
nuclearcat:fix/listpath-nexthop-parity
Sep 29, 2026
Merged

fujita merged 1 commit into
osrg:masterfrom
nuclearcat:fix/listpath-nexthop-parity

Conversation

@nuclearcat

@nuclearcat nuclearcat commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

While benchmarking rustybgp with gobgp i noticed cli output mismatch, nexthop is missing (v4 and v6).
This patch restore feature parity.
Validated by same benchmarks and further real and synthetic testing.

Did you use an AI tool?

Assisted-by: OpenAI Codex
Fixes: #628

A full-table comparison with GoBGP turned up a visible CLI mismatch:
`gobgp neighbor 172.30.77.2 adj-in 1.0.0.0/24` showed NEXT_HOP
with GoBGP, but not RustyBGP. The binary API response was missing
the same attribute.

PathEntry's old comment said the next hop was already in the
attributes used for API output. It isn't: UPDATE parsing extracts
NEXT_HOP or MP_REACH into a separate value, while ListPath serialized
only the remaining attributes. That split already existed when the
comment was written.

Keep the next hop separate in the RIB, as route distribution already
does. Preserve the received value alongside the original attributes
so Adj-RIB-In stays correct after import policy, then rebuild
NEXT_HOP or MP_REACH when producing ListPath. Putting it back into
stored attributes would create two sources of truth and risk encoding
it twice.

IPv4 and IPv6 tests cover structured and binary responses. With the
same full table, GoBGP and RustyBGP now return matching route counts,
binary attribute byte totals, and client byte checksums.

Assisted-by: OpenAI Codex
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@fujita
fujita merged commit 783d6df into osrg:master Sep 29, 2026
15 checks passed
@fujita

fujita commented Sep 29, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NEXT_HOP missing in gobgp neighbor x.x.x.x adj-in y.y.y.y/z

2 participants