nix icon indicating copy to clipboard operation
nix copied to clipboard

Add `From<libc::sockaddr_ll> for LinkAddr`

Open jonatanzeidler opened this issue 9 months ago • 3 comments

What does this PR do

This PR adds a impl From<libc::sockaddr_ll> for LinkAddr to help users of nix avoid unsafe code. See https://github.com/nix-rust/nix/issues/2059#issuecomment-1878463448 for reference.

Checklist:

  • [x] I have read CONTRIBUTING.md
  • ~~[ ] I have written necessary tests and rustdoc comments~~
  • ~~[ ] A change log has been added if this PR modifies nix's API~~

jonatanzeidler avatar May 06 '24 12:05 jonatanzeidler

Do you consider the From implementation a change to the API that should be noted in the changelog?

jonatanzeidler avatar May 06 '24 12:05 jonatanzeidler

My current concert of this kind of conversion is that it can be unsafe since we have no guarantee from the values set in those raw libc types, see https://github.com/nix-rust/nix/issues/2327#issuecomment-2053587739

Do you consider the From implementation a change to the API that should be noted in the changelog?

No since they are newly-added things

SteveLauC avatar May 06 '24 12:05 SteveLauC

I filed an alternative PR (#2397) to address the concern of invalid data.

jonatanzeidler avatar May 06 '24 15:05 jonatanzeidler