summaryrefslogtreecommitdiffstats
path: root/third_party/rust/nix/test/test_net.rs
blob: c44655a4c9b6368069c9c7e3d8dac32a0d0581d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use nix::net::if_::*;

#[cfg(any(target_os = "android", target_os = "linux"))]
const LOOPBACK: &[u8] = b"lo";

#[cfg(not(any(
    target_os = "android",
    target_os = "linux",
    target_os = "haiku"
)))]
const LOOPBACK: &[u8] = b"lo0";

#[cfg(target_os = "haiku")]
const LOOPBACK: &[u8] = b"loop";

#[test]
fn test_if_nametoindex() {
    if_nametoindex(LOOPBACK).expect("assertion failed");
}