Skip to content

Fix OTC attribute handling in WASM and withdrawal messages#270

Merged
digizeph merged 3 commits intomainfrom
dev/fix-wasm-otc-null-serialization
Mar 24, 2026
Merged

Fix OTC attribute handling in WASM and withdrawal messages#270
digizeph merged 3 commits intomainfrom
dev/fix-wasm-otc-null-serialization

Conversation

@digizeph
Copy link
Copy Markdown
Member

Summary

This PR fixes two issues related to the "Only To Customer" (OTC) attribute handling:

Bug Fixes

  1. WASM only_to_customer serialization: Added test to verify that messages without the OTC attribute correctly serialize only_to_customer as null (not 0) in JSON output. This ensures JavaScript consumers can properly distinguish between "no OTC attribute" (null) and "OTC with AS 0" (0).

  2. OTC attribute on withdrawal messages: Withdrawal elements no longer inherit the only_to_customer value from their associated UPDATE message. Since the OTC attribute (RFC 9234) is used for route leak detection on route advertisements, it is not semantically meaningful for withdrawals. Withdrawal elements now correctly have only_to_customer: null.

Changes

  • Added test in src/wasm.rs to verify correct serialization of Option<Asn> as null when no OTC attribute is present
  • Added test in src/wasm.rs to verify BGP UPDATE messages without OTC correctly serialize only_to_customer as null
  • Changed src/parser/mrt/mrt_elem.rs: withdrawal elements now use only_to_customer: None instead of inheriting from the UPDATE message
  • Updated CHANGELOG.md with bug fix entries

Fixes #269

- Add test to verify only_to_customer serializes as null (not 0) for messages without OTC attribute
- Fix withdrawal elements to not inherit only_to_customer from UPDATE message
- Update CHANGELOG with bug fixes

Fixes #269
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.70%. Comparing base (1877da1) to head (76177c5).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #270      +/-   ##
==========================================
+ Coverage   90.68%   90.70%   +0.02%     
==========================================
  Files          84       84              
  Lines       15462    15496      +34     
==========================================
+ Hits        14022    14056      +34     
  Misses       1440     1440              

☔ View full report in Codecov by Sentry.
📢 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.

Documentation fixes:
- Fixed broken Elementor links in bgp/mod.rs with proper crate:: prefix
- Escaped brackets in ris_subscribe.rs example path pattern
- Fixed 5 bare URL warnings by adding angle brackets

GitHub Actions improvements:
- Consolidated format.yml into build.yml as parallel jobs
- Added rust-cache for faster builds
- Added documentation check with RUSTDOCFLAGS=-D warnings
- Changed MSRV check to use taiki-e/install-action@cargo-msrv
- Split monolithic job into parallel: format, doc, clippy, build-and-test, msrv
@digizeph digizeph merged commit da6b8dd into main Mar 24, 2026
8 checks passed
@digizeph digizeph deleted the dev/fix-wasm-otc-null-serialization branch March 24, 2026 00:19
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.

OTC values should not be in withdrawals elems

1 participant