Skip to content

Commit 8972270

Browse files
committed
Do not use extern, but if_nametoindex from libc instead.
1 parent f3d1030 commit 8972270

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/net/if_.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Uses Linux and/or POSIX functions to resolve interface names like "eth0"
44
//! or "socan1" into device numbers.
55
6-
use libc::{c_char, c_uint};
6+
use libc::{c_uint, if_nametoindex};
77
use std::ffi::{CString, NulError};
88
use std::io;
99

@@ -27,10 +27,6 @@ impl From<io::Error> for NameToIndexError {
2727
}
2828
}
2929

30-
extern {
31-
fn if_nametoindex(ifname: *const c_char) -> c_uint;
32-
}
33-
3430
/// Resolve an interface into a interface number.
3531
pub fn name_to_index(name: &str) -> Result<c_uint, NameToIndexError> {
3632
let name = try!(CString::new(name));

0 commit comments

Comments
 (0)