-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use libnet crate for grabbing link info. #304
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this cleaned up.
let info = | ||
libnet::get_link(&libnet::LinkHandle::Name(vnic_name.to_string())) | ||
.map_err(|e| { | ||
io::Error::new( | ||
io::ErrorKind::Other, | ||
format!("failed to get link info: {e}"), | ||
) | ||
})?; | ||
|
||
let mtu = if let Some(mtu) = info.mtu { | ||
Some(u16::try_from(mtu).map_err(|_| { | ||
io::Error::new( | ||
io::ErrorKind::Other, | ||
format!("MTU too large: {mtu}"), | ||
) | ||
})?) | ||
} else { | ||
None | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to keep propolis able to build (albeit useless binaries) on non-illumos platforms, perhaps we can wrap the libnet stuff pulled out into a function in cfg
blocks?
Since @rmustacc pointed out that the |
Avoids just shelling out to
dladm
and some vnic-specific methods to work with other link classes.