Skip to content

fix(ris-live)!: parse comma-joined IPv6 global + link-local next hops - #339

Merged
digizeph merged 1 commit into
bgpkit:mainfrom
ties:ris-live-ipv6-nexthop
Sep 10, 2026
Merged

fix(ris-live)!: parse comma-joined IPv6 global + link-local next hops#339
digizeph merged 1 commit into
bgpkit:mainfrom
ties:ris-live-ipv6-nexthop

Conversation

@ties

@ties ties commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

RIS Live projects MP_REACH_NLRI verbatim, so an RFC 2545 pair arrives as one string ("2001:db8::1,fe80::1"). Announcement::next_hop (IpAddr) failed to deserialise it, and the flattened RisMessage::msg Option turned that into msg: None — the frame's routes silently dropped (~20% of UPDATE frames: 15,706 of 77,075 in a 20s full-feed capture).

Work done with Claude Code. Commit message consciously verbose so it describes the workaround and breaking change.

RIS Live projects MP_REACH_NLRI verbatim, so an RFC 2545 pair arrives
as one string ("2001:db8::1,fe80::1"). Announcement::next_hop (IpAddr)
failed to deserialise it, and the flattened RisMessage::msg Option
turned that into msg: None — the frame's routes silently dropped
(~20% of UPDATE frames: 15,706 of 77,075 in a 20s full-feed capture).

Behaviour changes in parse_ris_live_message:
- Comma-joined frames now yield elems, with the pair's global address
  chosen by scope (a reversed pair still yields the global one).
- Unparseable next hops are Err(ElemIncorrectIp), not Ok(vec![]).
- The raw-bytes path and Nlri::next_hop_addr() share the same scope
  resolution, so JSON and raw parsers agree.

Internals: NextHopAddress gains FromStr, global_addr(),
link_local_addr(), comma-joined Display for pairs. Regression fixtures
from captured frames in tests/fixtures/rislive/ (tests/rislive_frames.rs).

BREAKING CHANGE: Announcement::next_hop is now the verbatim wire String
(was IpAddr): deserialisation cannot fail, frames re-serialise
byte-for-byte. To recover the typed value:

    let nh: NextHopAddress = announcement.next_hop.parse()?;
    nh.global_addr()      // the routable next hop (old field's value)
    nh.link_local_addr()  // Some(_) for a pair

Only affects code reading Announcement directly; the parse functions
and BgpElem are unchanged.

Assisted-by: Claude Code
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.86096% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.41%. Comparing base (52f70bd) to head (aa4a4ea).

Files with missing lines Patch % Lines
src/parser/rislive/messages/server/ris_message.rs 93.75% 2 Missing ⚠️
src/models/bgp/attributes/nlri.rs 0.00% 1 Missing ⚠️
src/parser/rislive/mod.rs 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #339      +/-   ##
==========================================
+ Coverage   91.37%   91.41%   +0.04%     
==========================================
  Files         103      103              
  Lines       26237    26412     +175     
==========================================
+ Hits        23973    24145     +172     
- Misses       2264     2267       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The behavior is consistently implemented, documented, and covered by unit and captured-frame regression tests.

Pull request overview

Fixes silent RIS Live route loss when IPv6 next hops contain RFC 2545 global/link-local pairs.

Changes:

  • Preserves verbatim RIS Live next-hop strings and resolves pairs by scope.
  • Adds shared NextHopAddress parsing/accessors and updates MRT/NLRI conversion.
  • Adds captured-frame regression and JSON/raw parity tests.
File summaries
File Description
src/models/bgp/attributes/nlri.rs Uses scope-aware next-hop resolution.
src/models/err.rs Adds next-hop parsing errors.
src/models/network/nexthop.rs Adds pair parsing, rendering, and accessors.
src/parser/mrt/mrt_elem.rs Resolves paired MRT next hops by scope.
src/parser/rislive/messages/server/mod.rs Exports Announcement.
src/parser/rislive/messages/server/ris_message.rs Stores next hops verbatim.
src/parser/rislive/mod.rs Parses next hops during elem conversion.
tests/fixtures/rislive/ris-live-frames.jsonl Adds captured RIS Live fixtures.
tests/rislive_frames.rs Adds end-to-end regression coverage.
CHANGELOG.md Documents fixes and breaking APIs.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@digizeph
digizeph merged commit bd74701 into bgpkit:main Sep 10, 2026
9 checks passed
digizeph added a commit that referenced this pull request Sep 10, 2026
Bump Cargo.toml and src/wasm/js/package.json to 0.22.0 and date the
changelog section.

Changelog sweep for the cycle: cite #333, #334 and #339 on their entries,
add the missing #335 (ts-rs 11 -> 12) dependency entry, and credit @ties
for #338 and #339 in a Contributors section.

The cycle carries breaking changes (MSRV 1.88, Announcement::next_hop as
the verbatim string, non-exhaustive error enums, parse_ris_live_message
erroring on an unparsed body), so the cut is a minor bump: 0.21.0 to
0.22.0.
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.

3 participants