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

OpenBSD support? #25

Open
neezer opened this issue Mar 31, 2021 · 5 comments
Open

OpenBSD support? #25

neezer opened this issue Mar 31, 2021 · 5 comments
Labels
platform Platform support

Comments

@neezer
Copy link

neezer commented Mar 31, 2021

Any chance for this? I see shared/src/wg.rs only targets macos & linux... thanks!!

@mcginty
Copy link
Collaborator

mcginty commented Apr 2, 2021

We'd love to support OpenBSD - if anyone's interested in trying their hand at adding support in wgctrl-rs, I'm very happy to review and help.

@mcginty mcginty added the platform Platform support label Apr 6, 2021
@mrdomino
Copy link

If I’m not mistaken (and I might be mistaken), it seems like on OpenBSD you want to use wg(4). So you would create a wgN interface using (e.g.) ifconfig wg0 create. Then, everything looks to be implemented with a couple ioctl(2)s: SIOCSWG struct wg_data_io* to set device configuration, and SIOCGWG struct wg_data_io* to get it.

It seems then like there are two possible approaches: one is to basically shell out to ifconfig(8) on OpenBSD, and the other is to reimplement the wg-specific functionality from ifconfig(8) in wgctrl-sys. I don’t have any principled opinions on which is better; if one wanted to do the latter, then the ifconfig(8) source might be a good starting point.

@mrdomino
Copy link

(I would also love to see innernet support OpenBSD.)

@mrdomino
Copy link

Also minor note for anyone getting started on this: the first time I tried to build wgctrl-rs, I saw:

thread 'main' panicked at 'Unable to find libclang: "couldn't find any of ['libclang.so', 'libclang.so.*', 'libclang-*.so'], set the LIBCLANG_PATH environment variable to a path where one of these files can be found (skipped: [])"', /home/burld/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.39.0/src/lib.rs:1605:31

This was easily fixed by doing pkg_add llvm and setting LIBCLANG_PATH=/usr/local/lib.

@mcginty
Copy link
Collaborator

mcginty commented Jan 24, 2022

@mrdomino yep, things have moved around a bit (wgctrl-rs is now wireguard-control, and there is no more wgctrl-sys since we use the netlink crate now instead of an FFI), but the basic need for supporting OpenBSD is adding an wireguard-control/src/backends/openbsd.rs that can communicate with the pseudo-device with the correct ioctls (ideally) or shell out to ifconfig (less ideally since I've found that to be quite brittle, but that's how we do it on macOS currently too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform Platform support
Projects
None yet
Development

No branches or pull requests

3 participants