Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
nicholasbishop opened this issue Mar 16, 2025 · 2 comments
Open

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

nicholasbishop opened this issue Mar 16, 2025 · 2 comments
Assignees

Comments

@nicholasbishop
Copy link
Member

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).

@phip1611
Copy link
Member

Yep, sounds good! Thanks for the write-up

@phip1611
Copy link
Member

At first, I wanted to outline my ideas here. Then I noticed it is simpler to put it into code to see if it works out. My attempt is here: #1645

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants