(pp *packet.Parsed, t *tstun.Wrapper)
| 146 | } |
| 147 | |
| 148 | func (e *userspaceEngine) trackOpenPostFilterOut(pp *packet.Parsed, t *tstun.Wrapper) (res filter.Response) { |
| 149 | res = filter.Accept // always |
| 150 | |
| 151 | if pp.IPVersion == 0 || |
| 152 | pp.IPProto != ipproto.TCP || |
| 153 | pp.TCPFlags&packet.TCPAck != 0 || |
| 154 | pp.TCPFlags&packet.TCPSyn == 0 { |
| 155 | return |
| 156 | } |
| 157 | if e.isOSNetworkProbe(pp.Dst) { |
| 158 | return |
| 159 | } |
| 160 | |
| 161 | flow := flowtrack.MakeTuple(pp.IPProto, pp.Src, pp.Dst) |
| 162 | |
| 163 | e.mu.Lock() |
| 164 | defer e.mu.Unlock() |
| 165 | if _, dup := e.pendOpen[flow]; dup { |
| 166 | // Duplicates are expected when the OS retransmits. Ignore. |
| 167 | return |
| 168 | } |
| 169 | |
| 170 | timer := time.AfterFunc(tcpTimeoutBeforeDebug, func() { |
| 171 | e.onOpenTimeout(flow) |
| 172 | }) |
| 173 | mak.Set(&e.pendOpen, flow, &pendingOpenFlow{timer: timer}) |
| 174 | |
| 175 | return filter.Accept |
| 176 | } |
| 177 | |
| 178 | func (e *userspaceEngine) onOpenTimeout(flow flowtrack.Tuple) { |
| 179 | e.mu.Lock() |
nothing calls this directly
no test coverage detected