Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expected i16, found i32 in tun_linux.rs #89

Closed
neutronscott opened this issue Jun 29, 2019 · 2 comments · Fixed by #96
Closed

expected i16, found i32 in tun_linux.rs #89

neutronscott opened this issue Jun 29, 2019 · 2 comments · Fixed by #96

Comments

@neutronscott
Copy link

neutronscott commented Jun 29, 2019

I have never used Rust so I am sorry if I am not much use in solving this. I wanted a userspace wireguard in OpenVZ. I apply the CLOCK_BOOTTIME fix #73 but get:

   Compiling boringtun v0.2.0
error[E0308]: mismatched types
  --> /home/mute/.cargo/registry/src/github.com-1ecc6299db9ec823/boringtun-0.2.0/src/device/tun_linux.rs:77:29
   |
77 |                 ifru_flags: IFF_TUN | IFF_NO_PI | IFF_MULTI_QUEUE,
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i16, found i32

I circumvented this by changing the ifru_flags to c_int. It seems to work and didn't look like it was in master branch or covered in an issue.

This may be because changes missing/applied to libc. I have libc-0.2.58:

mute@atl:~/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.58/src/unix/notbsd/linux$ grep -e IFF_TUN -e IFF_NO_PI -e IFF_MULTI_QUEUE *.rs
mod.rs:pub const IFF_TUN: ::c_int = 0x0001;
mod.rs:pub const IFF_NO_PI: ::c_int = 0x1000;
mod.rs:// TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead.
mod.rs:pub const TUN_TUN_DEV: ::c_short   = ::IFF_TUN as ::c_short;
mod.rs:pub const IFF_TUN_EXCL: ::c_int     = 0x8000;
mod.rs:pub const IFF_MULTI_QUEUE: ::c_int  = 0x0100;
mute@atl:~$ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)
@Daniel15
Copy link

Daniel15 commented Jul 4, 2019

I hit this issue too. Thanks for the fix - Changing ifru_flags from c_short to c_int on this line fixed the build for me too:

ifru_flags: c_short,

@vkrasnov
Copy link
Contributor

vkrasnov commented Jul 7, 2019

Thank you, another solution is to do (IFF_TUN | IFF_NO_PI | IFF_MULTI_QUEUE) as _ to keep it compatible with other platforms

vkrasnov added a commit that referenced this issue Jul 19, 2019
vkrasnov added a commit that referenced this issue Jul 19, 2019
* Handle unused Result in an idiomatic way

Fixes #62

* Fix compilation error on OpenVZ

Fixes #89

* Allow --disable-drop-privileges being set using the WG_SUDO env variable

Fixes #86

* Clippy

* Rework stats

* Add tunnel stats for estimated downstream packet loss and handshake rtt
* Use tunnel stats for tx and rx bytes, instead peer stats

* Require read to clear signalfd events

* Implement FromIterator for AllowedIps

* Enable mutable events in epoll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants