mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 18:06:52 +01:00
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:
1 parent
4782c5da9c
commit
b93c3bfed6
7 files changed
+138
-37
No files matched your search
+8
-5
@@ -186,7 +186,9 @@ func (f *Interface) readOutsidePackets(via ViaSender, packet []byte, rxc *rxCont
|
||||
if lane == 0 {
|
||||
f.handleHostRoaming(hostinfo, via)
|
||||
}
|
||||
f.connectionManager.In(hostinfo)
|
||||
if !isLaneProbe(h.Type, h.Subtype) {
|
||||
f.connectionManager.In(hostinfo)
|
||||
}
|
||||
|
||||
switch h.Type {
|
||||
case header.Message:
|
||||
@@ -552,9 +554,10 @@ func (f *Interface) maybeSendRecvError(endpoint netip.AddrPort, index uint32, q
|
||||
}
|
||||
}
|
||||
|
||||
// sendRecvError replies from the socket the offending packet arrived on (q).
|
||||
// A lane peer's spoof guard compares our source addr against the lane's
|
||||
// remote, so a reply from the base port would be discarded.
|
||||
// sendRecvError replies from the socket the offending packet arrived on (q), so
|
||||
// the reply to lane traffic rides the reverse of the lane's own 4-tuple: the
|
||||
// only one the peer's NAT and stateful firewalls are known to let through. The
|
||||
// peer's handleRecvError accepts it from that lane's target.
|
||||
func (f *Interface) sendRecvError(endpoint netip.AddrPort, index uint32, q int) {
|
||||
f.messageMetrics.Tx(header.RecvError, 0, 1)
|
||||
|
||||
@@ -591,7 +594,7 @@ func (f *Interface) handleRecvError(addr netip.AddrPort, h *header.H) {
|
||||
}
|
||||
|
||||
hr := hostinfo.GetRemote()
|
||||
if hr.IsValid() && hr != addr {
|
||||
if hr.IsValid() && hr != addr && !hostinfo.lanes.isLaneRemote(addr) {
|
||||
f.l.Info("Someone spoofing recv_errors?",
|
||||
"addr", addr,
|
||||
"hostinfoRemote", hr,
|
||||
|
||||
Reference in new issue
Block a user