Skip to content

Reject invalid static-route nexthops#760

Open
MorganaFuture wants to merge 1 commit into
oxidecomputer:mainfrom
MorganaFuture:reject-invalid-nexthop
Open

Reject invalid static-route nexthops#760
MorganaFuture wants to merge 1 commit into
oxidecomputer:mainfrom
MorganaFuture:reject-invalid-nexthop

Conversation

@MorganaFuture
Copy link
Copy Markdown

The mgd static routing API accepted any nexthop, including 127.0.0.1 (as a property test found). This adds a RouterIpAddr newtype in rdb that validates an IpAddr as a forwarding address - rejecting the unspecified, loopback, multicast, and IPv4 broadcast addresses and IPv4-mapped IPv6 addresses - and validates nexthops in the static-route add handlers, returning HTTP 400 on a bad one. IPv6 link-local is allowed, since the lower half resolves it to an egress interface.

RouterIpAddr is modeled on omicron's RouterPeerIpAddr. Since oxnet is an external crate it lives in maghemite for now, but it's structured (serde + schemars) to be lifted into oxnet and shared, as the issue suggests.

Tested with unit tests for the newtype and the handler validation; ran the rdb and mgd suites. Didn't exercise it against a live switch.

Closes #738

Static route requests accepted any nexthop, including 127.0.0.1.
Add a RouterIpAddr newtype in rdb that validates an IpAddr as a
forwarding address (rejecting unspecified, loopback, multicast,
IPv4 broadcast, and IPv4-mapped IPv6; link-local is allowed since
the lower half resolves it to an interface) and validate nexthops
in the static route add handlers, returning HTTP 400 on failure.

RouterIpAddr is modeled on omicron's RouterPeerIpAddr and is a
candidate to lift into oxnet for cross-repo reuse.

Closes oxidecomputer#738
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.

Reject invalid nexthop addresses

1 participant