Commit 04dae50
authored
Introduce stronger types for link-local addresses and unnumbered peers (#10082)
This is a big chunk of #9832. Stealing from the doc comments in
`sled-agent/types/versions/src/stronger_bgp_unnumbered_types/early_networking.rs`,
the primary changes in this PR are:
* Introduce `SpecifiedIpNet`, a newtype wrapper around `IpNet` that does
not allow unspecified IP addresses.
* Introduce `SpecifiedIpAddr`, a newtype wrapper around `IpAddr` that
does not allow unspecified IP addresses.
* Introduce `UplinkAddress`, a stronger type for specifying
possibly-link-local IP nets. This is the new type of
`UplinkAddressConfig::address`, which was previously an `Option<IpNet>`
where both `None` and `Some(UNSPECIFIED)` were treated as link-local.
* Introduce `RouterPeerAddress`, a stronger type for specifying
possibly-unnumbered BGP peer addresses. This is the new type of
`BgpPeerConfig::addr`, which was previously an `IpAddr` where an
unspecified address was treated as unnumbered.
The rest of the changes are fallout from those: adding new types for any
the that contains `UplinkAddressConfig` or `BgpPeerConfig`, since those
changed, and updating all the places that create or consume any of those
types. I'm hoping this PR is pretty straightforward to review despite
its size, because much of the size is either tests or all the noise of
redefining a bunch of big structs with a single field changed.
The two main things I'd consider part of #9832 that are NOT addressed in
this PR:
* Database representation; the columns where we store these values still
allow `NULL`, `0.0.0.0`, or `::`. Fixing this will require a db
migration, so I want to do that separately.
* External API - coming in a subsequent PR.
A third thing we could consider is whether to push this stronger typing
down to maghemite too.
For now, in all these cases we convert to or from the stronger types
primarily through obnoxiously-long method names that should stick out
like sore thumbs
(`RouterPeerAddress::from_optional_ip_treating_unspecified_as_unnumbered()`
and friends). This should make it obvious where we're switching from
strong types to weaker or vice versa.1 parent f6d8dbe commit 04dae50
43 files changed
Lines changed: 2759 additions & 509 deletions
File tree
- .github/buildomat/jobs
- clients
- bootstrap-agent-client
- bootstrap-agent-lockstep-client/src
- nexus-lockstep-client/src
- nexus
- db-model/src
- mgs-updates/src/test_util
- src/app
- background/tasks
- openapi
- sled-agent
- sled-agent
- api/src
- src
- bootstrap
- rack_setup
- sim
- tests
- data
- integration_tests
- types
- src/early_networking
- versions
- src
- bgp_v6
- impls
- stronger_bgp_unnumbered_types
- smf/sled-agent
- gimlet-standalone
- non-gimlet
- wicket-common
- src
- wicketd/src
- preflight_check
- wicket
- src
- cli/rack_setup
- ui/panes
- tests/output
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
| 39 | + | |
| 40 | + | |
31 | 41 | | |
32 | 42 | | |
33 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | | - | |
24 | | - | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| 177 | + | |
| 178 | + | |
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
180 | 184 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 185 | + | |
188 | 186 | | |
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
192 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
193 | 223 | | |
194 | 224 | | |
195 | 225 | | |
| |||
203 | 233 | | |
204 | 234 | | |
205 | 235 | | |
206 | | - | |
| 236 | + | |
207 | 237 | | |
208 | 238 | | |
209 | 239 | | |
| |||
212 | 242 | | |
213 | 243 | | |
214 | 244 | | |
215 | | - | |
216 | 245 | | |
217 | 246 | | |
218 | 247 | | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
| |||
771 | 772 | | |
772 | 773 | | |
773 | 774 | | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
774 | 782 | | |
775 | 783 | | |
776 | 784 | | |
| |||
Lines changed: 70 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
468 | 471 | | |
469 | 472 | | |
470 | 473 | | |
471 | | - | |
| 474 | + | |
472 | 475 | | |
473 | 476 | | |
474 | 477 | | |
| |||
1097 | 1100 | | |
1098 | 1101 | | |
1099 | 1102 | | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
1100 | 1131 | | |
1101 | 1132 | | |
1102 | 1133 | | |
1103 | 1134 | | |
1104 | 1135 | | |
1105 | 1136 | | |
1106 | 1137 | | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
| 1138 | + | |
1116 | 1139 | | |
1117 | 1140 | | |
1118 | 1141 | | |
| |||
1162 | 1185 | | |
1163 | 1186 | | |
1164 | 1187 | | |
1165 | | - | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
1170 | 1197 | | |
1171 | 1198 | | |
1172 | 1199 | | |
| |||
1679 | 1706 | | |
1680 | 1707 | | |
1681 | 1708 | | |
| 1709 | + | |
1682 | 1710 | | |
1683 | 1711 | | |
1684 | 1712 | | |
| |||
1720 | 1748 | | |
1721 | 1749 | | |
1722 | 1750 | | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
1723 | 1777 | | |
1724 | 1778 | | |
1725 | | - | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
1736 | | - | |
| 1779 | + | |
1737 | 1780 | | |
1738 | 1781 | | |
1739 | 1782 | | |
| |||
0 commit comments