-
Notifications
You must be signed in to change notification settings - Fork 980
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
Unbreak building for FreeBSD #103
Conversation
I can likely spin a VM up shortly and push this along. My initial thoughts are that this is pushing ethernet frames ( |
@nbrownus that's great! I'm happy to help if any assistance is needed. :-) |
@mateuszkwiatkowski neat keep me posted on progress! |
@nbrownus Did you have a chance to take a look into this? |
Sorry, I got pulled in another direction. I'll re-review this PR and merge as a stop gap. |
Mind rebasing on master? |
eb43467
to
3f42be1
Compare
@nbrownus rebased and force-pushed. :-) |
tun_freebsd.go
Outdated
c.Device = c.Interface.Name() | ||
|
||
// TODO use syscalls instead of exec.Command | ||
fmt.Println("command: ifconfig", c.Device, c.Cidr.String(), c.Cidr.IP.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this fmt.Println and the one below, or change it to use the logger that the rest of Nebula uses (search the repository for l.Debug(…)
etc). Debug level would be correct here I believe.
Does it look like nebula is going to get FreeBSD support? that would be perfect. i dont understand much of the code but i would love to help testing it. |
I set up a FreeBSD VM to mess around with this. I was able to reproduce the behavior you saw, it looks like the issue is that it is creating a tap device instead of a tun device. This is because the water implementation for bsd is a bit confusing. I will try to work on this some more when I have time now that I have the VM set up. |
The yggdrasil-network/water patch to make water work on bsd does some confusing things. One thing is that unless you set `Name`, it will create a tap device. Fix this by requiring the user set `tun.dev` in their config file to a name like `tun0` or `tun1` (the naming required by freebsd). We also need to add the `route` command back now that we are using a tun device.
ok, I pushed a fix to this PR which makes it work on freebsd. You have to specify |
@wadey Many thanks for pushing it further. You rock! |
Glad to help. When you have a chance can you test again with the latest? Or if anyone else is watching this issue do you mind testing? Thanks! |
I set up 3 FreeBSD machines. I have not tried nebula on Linux so i don`t know that the differences is. |
Did some tests now. `anders@X1_bsd:~/devel/nebula/build/freebsd-amd64 % iperf -c 192.168.100.9 && iperf -c 10.100.100.12 && iperf -c 134.209.204.190Client connecting to 192.168.100.9, TCP port 5001
|
The only thing the library is doing for freebsd is calling OpenFile.
The only thing the library is doing for freebsd is calling OpenFile.
The only thing the library is doing for freebsd is calling OpenFile.
Ok I fixed this up a bit more and removed the dependency on The second pass of this would be to remove the exec calls and use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cant read the code but it builds and runs for me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, let's merge it and we can improve it more in the future.
I naively copied darwin files to unbreak building FreeBSD binaries. The other thing is that upstream version of water library doesn't support FreeBSD. There is a fork with added FreeBSD support https://github.com/yggdrasil-network/water and work in progress pull request to upstream: songgao/water#37
After these dirty hacks I'm able to start nebula on FreeBSD hosts but no traffic is passed between them:
tap0 interface is configured correctly:
There's no response for who-has requests:
Dropping it here with hope that someone would be willing to pick-up and continue this effort.
I was testing on few weeks old CURRENT:
FreeBSD monster-1 13.0-CURRENT FreeBSD 13.0-CURRENT #5 1b501770dd3-c264495(master): Wed Nov 27 01:35:34 CET 2019 root@monster-1:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64