Skip to content

Rename static route local_pref to rib_priority#6693

Merged
taspelund merged 5 commits into
mainfrom
trey/disabuse_local_pref
Oct 7, 2024
Merged

Rename static route local_pref to rib_priority#6693
taspelund merged 5 commits into
mainfrom
trey/disabuse_local_pref

Conversation

@taspelund

@taspelund taspelund commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

This is the omicron half of maghemite#359. This renames the local_pref
field of static routes to rib_priority to avoid overloading the name
of a standardized and well-known BGP attribute (Local Preference). This
change shrinks the size of the field from u32 -> u8 and unwraps the
Option before shipping routes to mgd, aligning with the updated API.
This also brings omicron back into sync with maghemite.

Fixes: #6711

Signed-off-by: Trey Aspelund trey@oxidecomputer.com

@taspelund taspelund added the networking Related to the networking. label Sep 26, 2024
ahl added a commit that referenced this pull request Sep 27, 2024
This is kind of gross.

Omicron currently is out of sync with maghemite, see #6693 and the two
maghemite pushes that require synchronization:
oxidecomputer/maghemite#359 and
oxidecomputer/maghemite#360. I'd like to make
forward progress with the hyper v1 migration, and that's blocked on
updating the omicron dependency of maghemite which pulls in old hyper
(reqwest, progenitor, etc). This gets pull into other repos via
omicron-common.

It's worth noting that this circular arrangement seems lousy. The
"vassal crates" (crucible, propolis, maghemite, (and dendrite to a
lesser degree)) depend on omicron-common, but omicron-common pulls in
maghemite's `mg-admin-client` which in turn pulls in... lots...
including progenitor, hyper, reqwest, etc.

My goal here is to have a temporary dependency on a branch of maghemite
(oxidecomputer/maghemite#378); once #6693 is
integrated, we can then pin the dependency on maghemite's HEAD rev.
@ahl

ahl commented Sep 27, 2024

Copy link
Copy Markdown
Contributor

Can you please address #6711 in this PR as well?

@taspelund taspelund force-pushed the trey/disabuse_local_pref branch 2 times, most recently from e7f332a to 0febb35 Compare October 1, 2024 20:16
@taspelund taspelund marked this pull request as ready for review October 1, 2024 20:16
@taspelund taspelund force-pushed the trey/disabuse_local_pref branch 6 times, most recently from 6061aa0 to 870f76a Compare October 2, 2024 19:40
@rcgoodfellow

Copy link
Copy Markdown
Contributor

Something potentially helpful here is this script

taspelund and others added 4 commits October 4, 2024 00:14
This is the omicron half of maghemite#359. This renames the `local_pref`
field of static routes to `rib_priority` to avoid overloading the name
of a standardized and well-known BGP attribute (Local Preference). This
change shrinks the size of the field from u32 -> u8 and unwraps the
Option<T> before shipping routes to mgd, aligning with the updated API.
This also brings omicron back into sync with maghemite.

Fixes: #6711

Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
@taspelund taspelund force-pushed the trey/disabuse_local_pref branch from 7b69cd9 to 2c8e046 Compare October 4, 2024 06:14
@rcgoodfellow

Copy link
Copy Markdown
Contributor

Noting that because this is changing the external API, there will need to be a corresponding update to oxide.rs

@zeeshanlakhani zeeshanlakhani left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly looks straightforward and good, but I had just one comment/Q.


// This is the default RIB Priority used for static routes. This mirrors
// the const defined in maghemite in rdb/src/lib.rs.
const DEFAULT_RIB_PRIORITY_STATIC: u8 = 1;

@zeeshanlakhani zeeshanlakhani Oct 7, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be imported from the rdb lib (where it's pub), where then priorities don't conflict at some point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, definitely. I'll address this in a follow-up PR, so we can get this merged + omicron/maghemite back in sync for R11.

@zeeshanlakhani zeeshanlakhani left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, with one, minor, outstanding Q.

@taspelund taspelund merged commit f3ab338 into main Oct 7, 2024
@taspelund taspelund deleted the trey/disabuse_local_pref branch October 7, 2024 18:08
Comment on lines 1696 to 1697
/// Local preference for route. Higher preference indictes precedence
/// within and across protocols.

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.

@taspelund should this have been updated?

Comment on lines +326 to +327
/// RIB Priority
pub rib_priority: Option<u8>,

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.

I see that this struct was deprecated; was updating it the right thing to do?

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.

Good catch. @internet-diglett can you take a look at this PR from the perspective of bootstore compatibility?

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.

In theory it should be harmless at this point, but ahl is correct that it probably shouldn't have been updated.

sudomateo added a commit that referenced this pull request Jul 12, 2025
I renamed the `local_pref` column to `rib_priority` to complete the
rename in #6693.

I also changed the type of the renamed column from `INT8` to
`INT2`, clamping existing values to `0` or `255`. This was missed
in #6693 and led to the
following error when reading the value from the database.

```
{"msg":"request completed","v":0,"name":"omicron-dev","level":30,"time":"2025-07-11T13:57:48.670343242Z","hostname":"ms-ox01","pid":3113,"uri":"/v1/system/networking/switch-port-settings","method":"POST","req_id":"12b35f5a-2255-4244-a5aa-f9c84032fb81","remote_addr":"127.0.0.1:41766","local_addr":"127.0.0.1:12220","component":"dropshot_external","name":"e6bff1ff-24fb-49dc-a54e-c6a350cd4d6c","error_message_external":"Internal Server Error","error_message_internal":"Unknown diesel error creating SwitchPortSettings called \"example\": Error deserializing field 'local_pref': Received more than 2 bytes while decoding an i16. Was an Integer expression accidentally marked as SmallInt?","latency_us":133766,"response_code":500}
```

The error occurred because the Rust type was `SqlU8` and the database
type was `INT8`. Reads would fail because `INT8` columns could not be
read into `SqlU8` types without loss of precision.

This was caught in
oxidecomputer/terraform-provider-oxide#426
when implementing a Terraform provider resource for switch
port settings. It's likely that this has been broken since
#6693 and any user that
attempted to set `rib_priority` in their Rack Setup Service (RSS) would
have encountered this error. However, `rib_priority` is an uncommon
configuration option and none of our customer's RSS configurations show
this as being set.

Given this information, it seems safe to assume that no customer has the
`rib_priority` column set so the clamping logic implemented here should
work well for customer installations.
sudomateo added a commit that referenced this pull request Jul 12, 2025
I renamed the `local_pref` column to `rib_priority` to complete the
rename in #6693.

I also changed the type of the renamed column from `INT8` to
`INT2`, clamping existing values to `0` or `255`. This was missed
in #6693 and led to the
following error when reading the value from the database.

```
{"msg":"request completed","v":0,"name":"omicron-dev","level":30,"time":"2025-07-11T13:57:48.670343242Z","hostname":"ms-ox01","pid":3113,"uri":"/v1/system/networking/switch-port-settings","method":"POST","req_id":"12b35f5a-2255-4244-a5aa-f9c84032fb81","remote_addr":"127.0.0.1:41766","local_addr":"127.0.0.1:12220","component":"dropshot_external","name":"e6bff1ff-24fb-49dc-a54e-c6a350cd4d6c","error_message_external":"Internal Server Error","error_message_internal":"Unknown diesel error creating SwitchPortSettings called \"example\": Error deserializing field 'local_pref': Received more than 2 bytes while decoding an i16. Was an Integer expression accidentally marked as SmallInt?","latency_us":133766,"response_code":500}
```

The error occurred because the Rust type was `SqlU8` and the database
type was `INT8`. Reads would fail because `INT8` columns could not be
read into `SqlU8` types without loss of precision.

This was caught in
oxidecomputer/terraform-provider-oxide#426
when implementing a Terraform provider resource for switch
port settings. It's likely that this has been broken since
#6693 and any user that
attempted to set `rib_priority` in their Rack Setup Service (RSS) would
have encountered this error. However, `rib_priority` is an uncommon
configuration option and none of our customer's RSS configurations show
this as being set.

Given this information, it seems safe to assume that no customer has the
`rib_priority` column set so the clamping logic implemented here should
work well for customer installations.
sudomateo added a commit that referenced this pull request Jul 17, 2025
I renamed the `local_pref` column to `rib_priority` to complete the
rename in #6693.

I also changed the type of the renamed column from `INT8` to
`INT2`, clamping existing values to `0` or `255`. This was missed
in #6693 and led to the
following error when reading the value from the database.

```
{"msg":"request completed","v":0,"name":"omicron-dev","level":30,"time":"2025-07-11T13:57:48.670343242Z","hostname":"ms-ox01","pid":3113,"uri":"/v1/system/networking/switch-port-settings","method":"POST","req_id":"12b35f5a-2255-4244-a5aa-f9c84032fb81","remote_addr":"127.0.0.1:41766","local_addr":"127.0.0.1:12220","component":"dropshot_external","name":"e6bff1ff-24fb-49dc-a54e-c6a350cd4d6c","error_message_external":"Internal Server Error","error_message_internal":"Unknown diesel error creating SwitchPortSettings called \"example\": Error deserializing field 'local_pref': Received more than 2 bytes while decoding an i16. Was an Integer expression accidentally marked as SmallInt?","latency_us":133766,"response_code":500}
```

The error occurred because the Rust type was `SqlU8` and the database
type was `INT8`. Reads would fail because `INT8` columns could not be
read into `SqlU8` types without loss of precision.

This was caught in
oxidecomputer/terraform-provider-oxide#426
when implementing a Terraform provider resource for switch
port settings. It's likely that this has been broken since
#6693 and any user that
attempted to set `rib_priority` in their Rack Setup Service (RSS) would
have encountered this error. However, `rib_priority` is an uncommon
configuration option and none of our customer's RSS configurations show
this as being set.

Given this information, it seems safe to assume that no customer has the
`rib_priority` column set so the clamping logic implemented here should
work well for customer installations.
sudomateo added a commit that referenced this pull request Jul 18, 2025
I renamed the `local_pref` column to `rib_priority` to complete the
rename in #6693.

I also changed the type of the renamed column from `INT8` to `INT2`,
clamping existing values to `0` or `255`. This was missed in
#6693 and led to the
following error when reading the value from the database.

```
{"msg":"request completed","v":0,"name":"omicron-dev","level":30,"time":"2025-07-11T13:57:48.670343242Z","hostname":"ms-ox01","pid":3113,"uri":"/v1/system/networking/switch-port-settings","method":"POST","req_id":"12b35f5a-2255-4244-a5aa-f9c84032fb81","remote_addr":"127.0.0.1:41766","local_addr":"127.0.0.1:12220","component":"dropshot_external","name":"e6bff1ff-24fb-49dc-a54e-c6a350cd4d6c","error_message_external":"Internal Server Error","error_message_internal":"Unknown diesel error creating SwitchPortSettings called \"example\": Error deserializing field 'local_pref': Received more than 2 bytes while decoding an i16. Was an Integer expression accidentally marked as SmallInt?","latency_us":133766,"response_code":500}
```

The error occurred because the Rust type was `SqlU8` and the database
type was `INT8`. Reads would fail because `INT8` columns could not be
read into `SqlU8` types without loss of precision.

This was caught in
oxidecomputer/terraform-provider-oxide#426 when
implementing a Terraform provider resource for switch port settings.
It's likely that this has been broken since
#6693 and any user that
attempted to set `rib_priority` in their Rack Setup Service (RSS) would
have encountered this error. However, `rib_priority` is an uncommon
configuration option and none of our customer's RSS configurations show
this as being set.

Given this information, it seems safe to assume that no customer has the
`rib_priority` column set so the clamping logic implemented here should
work well for customer installations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

networking Related to the networking.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unwind the hyper / maghemite work-around

5 participants