Skip to content

RFC: use core::net IP address types in uefi's public API #1575

@nicholasbishop

Description

@nicholasbishop

Currently, we provide the following IP address types:

  • uefi-raw:

  • uefi:

    • struct IpAddress - 16 raw bytes. Compatible with the uefi_raw::IpAddress union, but implemented differently. No way to tell which type of address it is without out-of-band data
  • And these builtin types are in core::net:

The types in uefi-raw correctly match the spec, so there's nothing we need to change there.

In uefi however, I think it might make sense to switch to the core::net types in the public API, and drop our IpAddress. The core::net types are not ABI-compatible with the UEFI types, so internally we'll need to translate between them. This should be a very low-cost operation though.

Using the IpAddr enum provides a better experience than using an untagged enum that requires a separate flag to indicate which type of address it contains. We could define our own enum of course, but using core::net makes it easier to integrate with other Rust code by using a shared type.

This change would be an API break, but it only affects a fairly small part of the library (the SimpleNetwork and pxe::BaseCode protocols).

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions