You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Linux, there is no method SockaddrStorage::as_link_addr, so it is not possible to obtain a MAC address for an interface using safe Rust. I cooked up the following, which seems to work, but it feels like this should be possible using only safe code:
fnsockaddr_link(sockaddr:&SockaddrStorage) -> Option<LinkAddr>{ifletSome(AddressFamily::Packet) = sockaddr.family(){// Safety: Checked the address familyunsafe{LinkAddr::from_raw(sockaddr.as_ptr(),None)}}else{None}}
The text was updated successfully, but these errors were encountered:
1729: Enable SockaddrStorage::{as_link_addr, as_link_addr_mut} on Linux. r=rtzoeller a=asomers
This was an oversight from #1684.
Fixes#1728
Co-authored-by: Alan Somers <[email protected]>
On Linux, there is no method
SockaddrStorage::as_link_addr
, so it is not possible to obtain a MAC address for an interface using safe Rust. I cooked up the following, which seems to work, but it feels like this should be possible using only safe code:The text was updated successfully, but these errors were encountered: