Repository navigation
Conversation
Closed
sigttou
force-pushed
the
dragonfly-bsd
branch
from
September 13, 2026 09:55
18f11b5 to
57b8e6d
Compare
In preparation for sharing the BSD TUN implementation with DragonFly BSD. Signed-off-by: David Bidner <david@crap.solutions>
DragonFly shares FreeBSD's TUN implementation and ioctl interface almost entirely; the only difference is the _TUNGIFNAME ioctl value. Add dragonfly to the shared BSD build tags and move the one platform-specific constant into small per-OS files. Tested with GOOS=dragonfly and GOOS=freebsd builds. Signed-off-by: David Bidner <david@crap.solutions>
sigttou
force-pushed
the
dragonfly-bsd
branch
from
September 13, 2026 15:23
57b8e6d to
abe0ea1
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DragonFly BSD shares FreeBSD's TUN implementation and ioctl interface almost
entirely; the only difference is the
_TUNGIFNAMEioctl value(
0x40207462on DragonFly vs0x4020745don FreeBSD).Rather than duplicate the implementation (400+ lines), this change is ~27 lines:
tun_freebsd.gototun_bsd.goand gives it an explicit//go:build freebsd || dragonflyconstraint (it previously relied on the_freebsd.gofilename suffix for its platform constraint), and(
tun_freebsd.go,tun_dragonfly.go).It also adds
dragonflyto the BSD build tags inipc/uapi_bsd.go,ipc/uapi_unix.goandtun/operateonfd.go.Two commits: a pure rename, then the support change.
Testing
GOOS=dragonfly GOARCH=amd64 go build ./tun/... ./ipc/...— OKGOOS=freebsd GOARCH=amd64 go build ./tun/... ./ipc/...— OKRelated
This is a minimal, modern alternative to the stalled DragonFly work (#49, open
since 2021 and based on the older code base).
An equivalent change is being proposed to the Tailscale fork, which Tailscale
depends on (
github.com/tailscale/wireguard-go), so Tailscale can build onDragonFly today: https://github.com/sigttou/tailscale-dragonfly