Use enum instead of sentinel :: for addrconf uplink addresses#10700
Open
jgallagher wants to merge 5 commits into
Open
Use enum instead of sentinel :: for addrconf uplink addresses#10700jgallagher wants to merge 5 commits into
:: for addrconf uplink addresses#10700jgallagher wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a resurrected branch from the post-R18 cleanup work I was doing a few months ago that got sidelined for various reasons, and is a continuation of the work done in #10122, #10155, and related PRs.
This overlaps some with @sunshowers's existing stack of cleanup, and it was specifically #10650 (comment) that reminded me this work wasn't done. :(
Like the other cleanup work, this only tackles the API side of things: a separate PR will be needed to tighten up the database representation.
A correctness concern with this change:
UplinkAddressenforces a bunch of "don't allow special classes of IP addresses", including "no loopback", "no multicast", etc.:omicron/sled-agent/types/versions/src/stronger_bgp_unnumbered_types/early_networking.rs
Lines 258 to 292 in 02ea54c
The comment there is "to be consistent with maghemite", but in this PR, we add this same validation to types that go to dendrite instead. I'm assuming we should do the same validation, but that might be wrong - in particular, it seems a little weird to reject
is_loopback()addresses in a type calledLoopbackAddress, but maybe those are two different meanings of "loopback" (I'm not sure how it would be meaningful for an external API request to tell us to do something on127.0.0.1or::1, but I'm regularly surprised!)? If we should not be doing this validation for the types changed here (LoopbackAddress,Address, andSwitchPortAddressView), I can change these from usingUplinkAddressto... some other new enum that is still anAddrconf/Static { ipnet }pair but which takes a plain vanillaoxnet::IpNetinstead of one that has these restrictions.