DefGuard / wireguard-rs

Rust library providing unified WireGuard interface to native/kernel and userspace implementations
https://github.com/defguard/defguard/
Other
123 stars 10 forks source link

OS Error 19 with defguard_wireguard_rs 0.2.0 from crates.io for the server example #15

Closed Ange-Cesari closed 9 months ago

Ange-Cesari commented 9 months ago

Hey @wojcik91 and @teon ,

For context,

I'm running a Debian 12.1.0 with Cargo 1.72.0 and rustc 1.72.0

Following steps :

I created a new project with :

cargo init rnwireguardrs 

Inside the Cargo.toml :

[dependencies] 
defguard_wireguard_rs = "0.2.0"
x25519-dalek = { version = "2.0", features = [
"get random", 
"static_secrets", 
] } 
base64 = "0.21"
log = "0.4"

I have only one file in /src which is the main.rs.

I did a copy/paste of the wireguard-rs/examples/server.rs Inside the main.rs

No compilation error from the IDE neither from the rust compilator.

At the run time, I got the Following error :

Error : NetlinkError("Netlink payload error: No such device (os error 19)")

At first glance, it could be a problem from the Netlink librairie that can't create the interface and therefore it's impossible to do operations on this interface.

I must clarify that i'm executing with

sudo cargo run

Moreover, the previous version of the library is working fine, I can create the interface and interact correctly.

Do you need more specific informations ?

Best Regards, Ange

wojcik91 commented 9 months ago

Hi. Thank you for pointing this out.

In the previous version we made a call to create_interface within the configure_interface method. We decided against it and made the API more explicit, so now you have to call create_interface yourself. That's why the previous version worked.

I updated the examples and made a patch release to reflect those changes.