We finally don't have a need for separately querying for an interface name
from its index, since we don't need to fetch this information every time a
packet arrives, netlink already gives us everything we need.
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
mod datastructs;
-#[cfg(unix)]
-mod unix_helpers;
#[cfg_attr(feature = "xenstore", path = "publisher_xenstore.rs")]
mod publisher;
+++ /dev/null
-use std::ffi::CStr;
-
-// just wraps libc's if_indextoname() - likely suboptimal
-pub fn interface_name(index: u32) -> String {
- let mut c_buf: [libc::c_char; libc::IF_NAMESIZE] = [0; libc::IF_NAMESIZE];
- let ret = unsafe { libc::if_indextoname(index, c_buf.as_mut_ptr()) };
- if ret.is_null() {
- return "".to_string();
- }
- let c_str: &CStr = unsafe { CStr::from_ptr(c_buf.as_ptr()) };
-
- c_str.to_str().unwrap().to_owned()
-}