Skip to content

Commit

Permalink
Do not use extern, but if_nametoindex from libc instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbr committed Jan 27, 2016
1 parent f3d1030 commit 8972270
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/net/if_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Uses Linux and/or POSIX functions to resolve interface names like "eth0"
//! or "socan1" into device numbers.
use libc::{c_char, c_uint};
use libc::{c_uint, if_nametoindex};
use std::ffi::{CString, NulError};
use std::io;

Expand All @@ -27,10 +27,6 @@ impl From<io::Error> for NameToIndexError {
}
}

extern {
fn if_nametoindex(ifname: *const c_char) -> c_uint;
}

/// Resolve an interface into a interface number.
pub fn name_to_index(name: &str) -> Result<c_uint, NameToIndexError> {
let name = try!(CString::new(name));
Expand Down

0 comments on commit 8972270

Please sign in to comment.