Skip to content

EPERM with device creation on Darwin #137

@cvengler

Description

@cvengler

Host: Darwin Kernel Version 25.1.0

The code is as follows:

fn main() -> anyhow::Result<()> {
    let mut config = tun::Configuration::default();
    config
        .address((10, 0, 0, 9))
        .netmask((255, 255, 255, 0))
        .destination((10, 0, 0, 1))
        .up();

    let mut dev = tun::create(&config)?;
    let mut buf = [0; 4096];

    loop {
        let amount = dev.recv(&mut buf)?;
        println!("{:?}", &buf[0..amount]);
    }
    Ok(())
}

Executing as a normal user results in the following error:

Error: Operation not permitted (os error 1)

I could imagine it might work when running as root but I am a bit scared of doing so; however, the documentation is not making any statements about the required privileges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions