mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
net/tstun: add Plan 9 'tun' support
Updates #5794 Change-Id: I8c466cae25ae79be1097450a63e8c25c7b519331 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
e2f7750125
commit
60847128df
@@ -569,6 +569,17 @@ func (e *userspaceEngine) handleLocalPackets(p *packet.Parsed, t *tstun.Wrapper)
|
||||
return filter.Drop
|
||||
}
|
||||
}
|
||||
if runtime.GOOS == "plan9" {
|
||||
isLocalAddr, ok := e.isLocalAddr.LoadOk()
|
||||
if ok {
|
||||
if isLocalAddr(p.Dst.Addr()) {
|
||||
// On Plan9's "tun" equivalent, everything goes back in and out
|
||||
// the tun, even when the kernel's replying to itself.
|
||||
t.InjectInboundCopy(p.Buffer())
|
||||
return filter.Drop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filter.Accept
|
||||
}
|
||||
|
Reference in New Issue
Block a user