-
-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compile client under freebsd (#1620)
Compile netbird client under freebsd and now support netstack and userspace modes. Refactoring linux specific code to share same code with FreeBSD, move to *_unix.go files. Not implemented yet: Kernel mode not supported DNS probably does not work yet Routing also probably does not work yet SSH support did not tested yet Lack of test environment for freebsd (dedicated VM for github runners under FreeBSD required) Lack of tests for freebsd specific code info reporting need to review and also implement, for example OS reported as GENERIC instead of FreeBSD (lack of FreeBSD icon in management interface) Lack of proper client setup under FreeBSD Lack of FreeBSD port/package
- Loading branch information
1 parent
521f7dd
commit 4526f33
Showing
44 changed files
with
810 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package dns | ||
|
||
const ( | ||
fileUncleanShutdownResolvConfLocation = "/var/db/netbird/resolv.conf" | ||
fileUncleanShutdownManagerTypeLocation = "/var/db/netbird/manager" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//go:build !android | ||
|
||
package dns | ||
|
||
const ( | ||
fileUncleanShutdownResolvConfLocation = "/var/lib/netbird/resolv.conf" | ||
fileUncleanShutdownManagerTypeLocation = "/var/lib/netbird/manager" | ||
) |
2 changes: 1 addition & 1 deletion
2
client/internal/dns/dbus_linux.go → client/internal/dns/dbus_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
client/internal/dns/file_parser_linux.go → client/internal/dns/file_parser_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...nt/internal/dns/file_parser_linux_test.go → client/internal/dns/file_parser_unix_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
client/internal/dns/file_repair_linux.go → client/internal/dns/file_repair_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...nt/internal/dns/file_repair_linux_test.go → client/internal/dns/file_repair_unix_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
client/internal/dns/file_linux.go → client/internal/dns/file_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
client/internal/dns/file_linux_test.go → client/internal/dns/file_unix_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
client/internal/dns/network_manager_linux.go → client/internal/dns/network_manager_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
client/internal/dns/resolvconf_linux.go → client/internal/dns/resolvconf_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
client/internal/dns/server_linux.go → client/internal/dns/server_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !android | ||
//go:build (linux && !android) || freebsd | ||
|
||
package dns | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package dns | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
) | ||
|
||
var errNotImplemented = errors.New("not implemented") | ||
|
||
func newSystemdDbusConfigurator(wgInterface string) (hostManager, error) { | ||
return nil, fmt.Errorf("systemd dns management: %w on freebsd", errNotImplemented) | ||
} | ||
|
||
func isSystemdResolvedRunning() bool { | ||
return false | ||
} | ||
|
||
func isSystemdResolveConfMode() bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//go:build darwin || dragonfly || netbsd || openbsd | ||
|
||
package routemanager | ||
|
||
import "syscall" | ||
|
||
// filterRoutesByFlags - return true if need to ignore such route message because it consists specific flags. | ||
func filterRoutesByFlags(routeMessageFlags int) bool { | ||
if routeMessageFlags&syscall.RTF_UP == 0 { | ||
return true | ||
} | ||
|
||
if routeMessageFlags&(syscall.RTF_REJECT|syscall.RTF_BLACKHOLE|syscall.RTF_WASCLONED) != 0 { | ||
return true | ||
} | ||
|
||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//go:build: freebsd | ||
package routemanager | ||
|
||
import "syscall" | ||
|
||
// filterRoutesByFlags - return true if need to ignore such route message because it consists specific flags. | ||
func filterRoutesByFlags(routeMessageFlags int) bool { | ||
if routeMessageFlags&syscall.RTF_UP == 0 { | ||
return true | ||
} | ||
|
||
// NOTE: syscall.RTF_WASCLONED deprecated in FreeBSD 8.0 (https://www.freebsd.org/releases/8.0R/relnotes-detailed/) | ||
// a concept of cloned route (a route generated by an entry with RTF_CLONING flag) is deprecated. | ||
if routeMessageFlags&(syscall.RTF_REJECT|syscall.RTF_BLACKHOLE) != 0 { | ||
return true | ||
} | ||
|
||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...internal/routemanager/systemops_darwin.go → ...t/internal/routemanager/systemops_unix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build freebsd | ||
|
||
package ssh | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func setWinSize(file *os.File, width, height int) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build !(linux && 386) | ||
//go:build !(linux && 386) && !freebsd | ||
|
||
package main | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package freebsd | ||
|
||
import "errors" | ||
|
||
var ( | ||
ErrDoesNotExist = errors.New("does not exist") | ||
ErrNameDoesNotMatch = errors.New("name does not match") | ||
) |
Oops, something went wrong.