Browse Source

Immediately forward packets from self to self on FreeBSD (#808)

John Maguire 2 years ago
parent
commit
5bd8712946
4 changed files with 11 additions and 7 deletions
  1. 3 2
      inside.go
  2. 6 0
      inside_bsd.go
  3. 0 3
      inside_darwin.go
  4. 2 2
      inside_generic.go

+ 3 - 2
inside.go

@@ -25,8 +25,9 @@ func (f *Interface) consumeInsidePacket(packet []byte, fwPacket *firewall.Packet
 
 	if fwPacket.RemoteIP == f.myVpnIp {
 		// Immediately forward packets from self to self.
-		// This should only happen on Darwin-based hosts, which routes packets from
-		// the Nebula IP to the Nebula IP through the Nebula TUN device.
+		// This should only happen on Darwin-based and FreeBSD hosts, which
+		// routes packets from the Nebula IP to the Nebula IP through the Nebula
+		// TUN device.
 		if immediatelyForwardToSelf {
 			_, err := f.readers[q].Write(packet)
 			if err != nil {

+ 6 - 0
inside_bsd.go

@@ -0,0 +1,6 @@
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
+// +build darwin dragonfly freebsd netbsd openbsd
+
+package nebula
+
+const immediatelyForwardToSelf bool = true

+ 0 - 3
inside_darwin.go

@@ -1,3 +0,0 @@
-package nebula
-
-const immediatelyForwardToSelf bool = true

+ 2 - 2
inside_generic.go

@@ -1,5 +1,5 @@
-//go:build !darwin
-// +build !darwin
+//go:build !darwin && !dragonfly && !freebsd && !netbsd && !openbsd
+// +build !darwin,!dragonfly,!freebsd,!netbsd,!openbsd
 
 package nebula