Skip to content

[mcast, pt1] multicast address, source, and route key types - #943

Open
zeeshanlakhani wants to merge 11 commits into
mainfrom
zl/mcast-types
Open

zeeshanlakhani wants to merge 11 commits into
mainfrom
zl/mcast-types

Conversation

@zeeshanlakhani

@zeeshanlakhani zeeshanlakhani commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

This is the first of a series of recut PRs split from #675/#696. The validated multicast address types and Vni come from dendrite's dpd-types-versions (oxidecomputer/dendrite#396, stacked through oxidecomputer/dendrite#405). We import the version modules that define them, pinning the rules with the associated version: v14::mcast (validators, unicast sources, is_ssm_address), v8::mcast for the underlay group, and v14::network::Vni.

MRIB route types in mg-api-types-versions are what mg-admin v14 serves. The API version itself is declared in #959 (pt3), and the rest of the split builds on it.

Includes:

  • vni is required on route keys, no auto-defaulting to the multicast VNI (77 is OPTE/omicron policy that must be passed in).
  • Introduction of our own testing feature (built on dendrite's) with Arbitrary for MulticastAddrV4/V6 and MulticastRouteKey, for upcoming omicron proptests (forwarded through mg-api-types/mg-admin-client in [mcast, pt3] mgd admin API + mgadm for the MRIB #959).
  • proptests: address validation specs were moved to dendrite, along with the types. We keep route/key properties here, and execute checks ensuring that our constructors and JSON decoding concur.
  • deps: dendrite -> 563cb147 ([softnpu, mcast] wire up the softnpu backend for multicast table ops dendrite#405), softnpu -> a6a87853
  • falcon-lab's build.rs now pulls the dpd-client rev out of Cargo.lock and makes it the --dendrite-commit default. Otherwise, npuvm installs dendrite from main, which would supply the wrong types.
  • Minor fixin: the rdb/bgp blocks in test-proptest.sh had copied regressions to paths for which the output rule would never match (and skipped that copy on failures). mg-api-types proptests run there now too.

Note: We need to move the dendrite rev back to main when that stack goes in.

@zeeshanlakhani zeeshanlakhani self-assigned this Oct 20, 2026
@zeeshanlakhani zeeshanlakhani added the multicast Multicast-related feature/impl label Oct 20, 2026
This is the first of a series of recut PRs split from
#675/#696. Validated address types now live in client-common (`Vni`,
`OverlayMulticast`, `UnderlayMulticastIpv6`). We'll eventually get to
the great big shared oxnet typed world :)!

MRIB route types in mg-api-types-versions point toward the upcoming v13.
While the API version itself is not declared here, we'll be
working with this version throughout the upcoming split set.

Group validation is essentially ported from dendrite
oxidecomputer/dendrite#396: RFC-based (and flexible) ruleset(s) plus the
internal, Oxide-specific `ff04::/64` underlay reservation.

Proptests can be found in `impls/mrib/` and import `crate::latest::mrib`.
The proptest suite is differential: `spec_*` fns encode the RFC
rules and the Oxide underlay reservation, and the properties check that
the constructors agree, error variant(s) included.

Includes:

- Fixed: in test-proptest.sh, the `rdb`/`bgp` blocks copied regressions to
  paths that the output rule never could match, and copies were skipped
  on failures as well; the output rule is now `**/*` over per-crate subdirs.
- Running client-common unit tests in CI.
@zeeshanlakhani
zeeshanlakhani added this pull request to stack #958 October 22, 2026 07:16
An upcoming stack split-out for the admin API adds MRIB lookups with
`?group=239.1.1.1`. `MulticastAddr` previously serialized as a tagged
object (`{"V4":"239.1.1.1"}`), which the query decoder cannot read.

This update converts the type to use `IpAddr` for serde conversion and
the schema. `TryFrom` keeps the existing multicast validation.
DDM's v4 wire types (pt4, incoming) need the same source checks
as the MRIB (and the DDM admin API will take them through the v4
origin as well). We don't want the ddm-protocol relying on mg-api-types
just for source validation.

We move the source types into client-common, next to the group/underlay ones.
Dendrite's `dpd-types-versions` is now responsible for the validated
multicast types (validator fns, unicast sources, underlay group, etc)
and `Vni`, removing the copies we had in `client-common`. Our
`MulticastAddrV4/V6` wrappers remain and call dendrite's checks, and
we import the pinned version modules (`v14::mcast`, `v8::mcast`, `v14::network`)
directly.

Includes:
- We no longer default to the multicast VNI directly (77 is OPTE/omicron
  policy that must be passed in) -> `vni` is required on route keys.
- Group wrappers drop `#[schemars(transparent)]`, retaining
  their names and docs in generated schemas (like
  `UnicastAddrV4/V6` in dendrite). The wire format is still an IP string.
- Introduction of our own `testing` feature (built on dendrite's) with
  `Arbitrary` for `MulticastAddrV4/V6` and `MulticastRouteKey`, for
  upcoming omicron proptests.
- proptests: address validation specs were moved to dendrite, along with
  the types. We keep route/key properties and targeted IPv6 input
  checking here.
- deps: dendrite -> 563cb147 (oxidecomputer/dendrite#405), softnpu -> a6a87853.
- falcon-lab's build.rs pulls the dpd-client rev out of Cargo.lock and
  makes it the `--dendrite-commit` default. Otherwise, npuvm installs
  dendrite from main, where the types currently differ.

Note: We need to move the dendrite rev back to main when that stack
goes in.

@taspelund taspelund 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.

This PR looks pretty good overall. I left some comments, but most of it is around style / API rather than actual functional problems.

One note on the tests: I think it might be good to confirm constructors for SSM types when passing in ASM groups. It's possible they already do this, but I can't recall off the top of my head what range SSM occupies.

I did also ask 🤖 to take a look and these were the noteworthy items it reported:

Minor findings in #943

  1. A message points to an API mgd doesn't have. Dendrite's ReservedUnderlaySubnet message ends with "must be created via the internal multicast API". It reaches mgd users word for word, because MulticastGroupError is just an alias for dendrite's error type. Either change the wording in dendrite or accept it.
  2. SourceFamilyMismatch can't happen through JSON. Something like {"V4":{"source":"2001:db8::1",…}} fails with a generic invalid IPv4 address syntax. The family-mismatch error only comes from MulticastRouteKey::new(Option, …). The Group variant is also never produced inside this crate; it only exists for ? conversions.
  3. A CI line runs no tests, and the PR description is out of date. test-rdb.sh adds -p client-common. But 45466a1 moved client-common's multicast code into dendrite, so the package has no tests now. The "Running client-common unit tests in CI" bullet should go too.
  4. Two property tests partly check the function against itself. prop_group_v{4,6}_matches_validator compare MulticastAddrV4::new with validate_external_multicast_ipv4, which is the only thing new calls. The checks that JSON decoding and MulticastAddr agree are the useful part. About 90 lines of generators (GroupV6Case, EmbeddedRpCase) mostly exercise dendrite's validator, which dendrite now tests itself. This only costs maintenance: 1M cases ran in about 100 s.

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

Labels

multicast Multicast-related feature/impl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants