netring 0.9.0

High-performance zero-copy packet I/O for Linux (AF_PACKET TPACKET_V3 + AF_XDP)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Tests for error conditions (no CAP_NET_RAW needed for some).

use netring::{Capture, Error};

#[test]
fn interface_not_found() {
    let err = Capture::open("nonexistent_iface_xyz_42").unwrap_err();
    match err {
        Error::InterfaceNotFound(name) => assert_eq!(name, "nonexistent_iface_xyz_42"),
        Error::PermissionDenied => {} // acceptable if no CAP_NET_RAW
        other => panic!("unexpected error: {other}"),
    }
}