Skip to content

Validate transit IPs on network interface update#7559

Merged
FelixMcFelix merged 5 commits intomainfrom
felixmcfelix/transit-ip-verify
Feb 26, 2025
Merged

Validate transit IPs on network interface update#7559
FelixMcFelix merged 5 commits intomainfrom
felixmcfelix/transit-ip-verify

Conversation

@FelixMcFelix
Copy link
Copy Markdown
Contributor

@FelixMcFelix FelixMcFelix commented Feb 19, 2025

This PR adds in some checks when setting transit IPs on a NIC to ensure that we have:

  • Only unicast addresses.
  • No loopback addresses.
  • No duplicates.

As discussed in the ticket, violation of any of these isn't going to leave OPTE or CRDB in a broken state -- just a confusing one for end users. This should make things unambiguous in terms of what how the transit IPs will be handled.

Closes #7530.

This PR adds in some checks when setting transit IPs on a NIC to ensure
that we have:
* Only unicast addresses.
* No loopback addresses.
* No duplicates.

As discussed in the ticket, violation of any of these isn't going to
leave OPTE or CRDB in a broken state -- just a confusing one for end
users.

Closes #7530.
@taspelund
Copy link
Copy Markdown
Contributor

Just one question about potentially making this logic more reusable, but it's not a blocker IMO.

LGTM!

@FelixMcFelix
Copy link
Copy Markdown
Contributor Author

Just one question about potentially making this logic more reusable, but it's not a blocker IMO.

LGTM!

Thanks -- since this isn't time critical, we'll see what we can upstream into oxnet first then. Overlap/contains would probably be uncontroversial, I think this definition of valid unicast isn't overly restrictive either but it might just be application-dependent.

FelixMcFelix added a commit to oxidecomputer/oxnet that referenced this pull request Feb 24, 2025
This PR brings in a few methods which would have been useful in writing
oxidecomputer/omicron#7559 :

* `is_subnet_of`/`is_supernet_of`/`overlaps`, for verifying disjoint
  ranges. Previously this was only on IPv6.
* `is_network_address`, for checking that none of the host bits are set
  (and ensuring we have a canonical form). I'm open for bikeshedding on
  the name here, given /31s and /32s return a `None` from `.network()`.
* Forwarding `is_multicast`, `is_loopback` from std/core.
FelixMcFelix added a commit to oxidecomputer/oxnet that referenced this pull request Feb 24, 2025
…#45)

This PR brings in a few methods which would have been useful in writing
oxidecomputer/omicron#7559 :

* `is_subnet_of`/`is_supernet_of`/`overlaps`, for verifying disjoint
  ranges. Previously this was only on IPv6.
* `is_network_address`, for checking that none of the host bits are set
  (and ensuring we have a canonical form). I'm open for bikeshedding on
  the name here, given /31s and /32s return a `None` from `.network()`.
* Forwarding `is_multicast`, `is_loopback` from std/core.
@FelixMcFelix FelixMcFelix merged commit 71da009 into main Feb 26, 2025
18 checks passed
@FelixMcFelix FelixMcFelix deleted the felixmcfelix/transit-ip-verify branch February 26, 2025 18:51
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.

API doesn't enforce valid unicast IPs for NIC transit_ips

2 participants