mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-05 12:16:44 +02:00
net/tstun: simplify code
Unifying the exit paths here is easier than duplicating them. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
ec52760a3d
commit
84b6574fd1
@ -357,13 +357,8 @@ func (t *Wrapper) Read(buf []byte, offset int) (int, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// For injected packets, we return early to bypass filtering.
|
||||
if wasInjectedPacket {
|
||||
t.noteActivity()
|
||||
return n, nil
|
||||
}
|
||||
|
||||
if !t.disableFilter {
|
||||
// Do not filter injected packets.
|
||||
if !wasInjectedPacket && !t.disableFilter {
|
||||
response := t.filterOut(p)
|
||||
if response != filter.Accept {
|
||||
// Wireguard considers read errors fatal; pretend nothing was read
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user