multiport: fix review findings in lane probing and recv_error

- Don't probe lanes on a tunnel idle in both directions, and don't count lane
  probes or their acks as tunnel traffic. A lane's own keepalive was keeping
  idle tunnels from ever being dropped by tunnels.drop_inactive.
- Accept a recv_error from an up lane's target. The peer answers lane traffic
  from the lane socket it arrived on, and the spoof guard only accepted the
  base remote, so recv_errors for lane traffic were ignored.
- Keep the probe generation across a lane reset, so an ack for a probe sent
  before a roam can't promote the lane on the new path.
- Bring handshake.proto in line with payload.go: field 3 is reserved and
  TxLanes is field 4.
This commit is contained in:
Wade Simmons committed 2026-10-01 16:50:45 -05:00
1 parent 4782c5da9c
commit b93c3bfed6
7 files changed
+138 -37

No files matched your search

+7 -15
View File
@@ -197,26 +197,18 @@ func (cm *connectionManager) doTrafficCheck(localIndex uint32, p, nb, out []byte
}
cm.resetRelayTrafficCheck(hostinfo)
cm.maintainLanes(localIndex, decision, hostinfo, now, nb, out)
cm.maintainLanes(decision, hostinfo, now, nb, out)
}
// maintainLanes piggybacks multiport lane probing on the per-tunnel traffic
// tick. This tick is the right place for it precisely because lanes are
// demand-driven: a tunnel only lands here when it has traffic, which is the
// same condition that raises lane demand.
//
// makeTrafficDecision returns a nil hostinfo on some keep-alive paths, so
// re-resolve the index in that case.
func (cm *connectionManager) maintainLanes(localIndex uint32, decision trafficDecision, hostinfo *HostInfo, now time.Time, nb, out []byte) {
if decision == deleteTunnel || decision == closeTunnel {
// tick. makeTrafficDecision returns a nil hostinfo for a tunnel that is idle in
// both directions, and that tunnel is skipped: probing it would cost a probe per
// lane per keepalive for a tunnel nothing is using. Its lanes are probed again
// on the first tick after traffic resumes.
func (cm *connectionManager) maintainLanes(decision trafficDecision, hostinfo *HostInfo, now time.Time, nb, out []byte) {
if hostinfo == nil || decision == deleteTunnel || decision == closeTunnel {
return
}
if hostinfo == nil {
hostinfo = cm.hostMap.QueryIndex(localIndex)
if hostinfo == nil {
return
}
}
cm.intf.probeLanes(hostinfo, now, nb, out)
}