(flow flowtrack.Tuple)
| 176 | } |
| 177 | |
| 178 | func (e *userspaceEngine) onOpenTimeout(flow flowtrack.Tuple) { |
| 179 | e.mu.Lock() |
| 180 | of, ok := e.pendOpen[flow] |
| 181 | if !ok { |
| 182 | // Not a tracked flow, or already handled & deleted. |
| 183 | e.mu.Unlock() |
| 184 | return |
| 185 | } |
| 186 | delete(e.pendOpen, flow) |
| 187 | problem := of.problem |
| 188 | e.mu.Unlock() |
| 189 | |
| 190 | if !problem.IsZero() { |
| 191 | e.logf("open-conn-track: timeout opening %v; peer reported problem: %v", flow, problem) |
| 192 | } |
| 193 | |
| 194 | // Diagnose why it might've timed out. |
| 195 | pip, ok := e.PeerForIP(flow.DstAddr()) |
| 196 | if !ok { |
| 197 | e.logf("open-conn-track: timeout opening %v; no associated peer node", flow) |
| 198 | return |
| 199 | } |
| 200 | n := pip.Node |
| 201 | if !n.IsWireGuardOnly() { |
| 202 | if n.DiscoKey().IsZero() { |
| 203 | e.logf("open-conn-track: timeout opening %v; peer node %v running pre-0.100", flow, n.Key().ShortString()) |
| 204 | return |
| 205 | } |
| 206 | if n.HomeDERP() == 0 { |
| 207 | e.logf("open-conn-track: timeout opening %v; peer node %v not connected to any DERP relay", flow, n.Key().ShortString()) |
| 208 | return |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | ps, found := e.getPeerStatusLite(n.Key()) |
| 213 | if !found { |
| 214 | onlyZeroRoute := true // whether peerForIP returned n only because its /0 route matched |
| 215 | for _, r := range n.AllowedIPs().All() { |
| 216 | if r.Bits() != 0 && r.Contains(flow.DstAddr()) { |
| 217 | onlyZeroRoute = false |
| 218 | break |
| 219 | } |
| 220 | } |
| 221 | if onlyZeroRoute { |
| 222 | // This node was returned by peerForIP because |
| 223 | // its exit node /0 route(s) matched, but this |
| 224 | // might not be the exit node that's currently |
| 225 | // selected. Rather than log misleading |
| 226 | // errors, just don't log at all for now. |
| 227 | // TODO(bradfitz): update this code to be |
| 228 | // exit-node-aware and make peerForIP return |
| 229 | // the node of the currently selected exit |
| 230 | // node. |
| 231 | return |
| 232 | } |
| 233 | e.logf("open-conn-track: timeout opening %v; target node %v in netmap but unknown to WireGuard", flow, n.Key().ShortString()) |
| 234 | return |
| 235 | } |
no test coverage detected