feature/conn25: drop returned error from NewFlow signature

The returned error in the signature is left over from previous
implementations and was only returning nil.

If we know NewFlow will succeed we can fire a create hook (implemented
in a future commit) before NewFlow, which will prevent a remove hook for
a flow from firing before the create hook for the same flow.

Updates tailscale/corp#38630

Signed-off-by: Michael Ben-Ami <mzb@tailscale.com>
This commit is contained in:
Michael Ben-Ami
2026-06-12 10:44:42 -04:00
committed by mzbenami
parent da11aa54b7
commit 2a0eafc20f
3 changed files with 20 additions and 33 deletions
+6 -10
View File
@@ -175,13 +175,11 @@ func (dh *datapathHandler) HandlePacketFromWireGuard(p *packet.Parsed, tun *tstu
Tuple: flowtrack.MakeTuple(p.IPProto, netip.AddrPortFrom(realIP, p.Dst.Port()), p.Src),
Action: dh.snatAction(transitIP),
}
if err := dh.connectorFlowTable.NewFlow(FlowData{
dh.connectorFlowTable.NewFlow(FlowData{
FromTun: incoming,
FromWG: outgoing,
}); err != nil {
dh.debugLogf("error installing flow, passing packet unmodified: %v", err)
return filter.Accept
}
})
outgoing.Action(p)
return filter.Accept
}
@@ -244,13 +242,11 @@ func (dh *datapathHandler) HandlePacketFromTunDevice(p *packet.Parsed) filter.Re
Tuple: flowtrack.MakeTuple(p.IPProto, netip.AddrPortFrom(transitIP, p.Dst.Port()), p.Src),
Action: dh.snatAction(magicIP),
}
if err := dh.clientFlowTable.NewFlow(FlowData{
dh.clientFlowTable.NewFlow(FlowData{
FromTun: outgoing,
FromWG: incoming,
}); err != nil {
dh.debugLogf("error installing flow from tun device, passing packet unmodified: %v", err)
return filter.Accept
}
})
outgoing.Action(p)
return filter.Accept
}