MCPcopy Create free account
hub / github.com/SamNet-dev/snix / handleInbound

Method handleInbound

core/engine/engine.go:230–265  ·  view source on GitHub ↗
(key conntrack.Tuple, parsed pkt, p platform.Packet)

Source from the content-addressed store, hash-verified

228}
229
230func (e *Engine) handleInbound(key conntrack.Tuple, parsed pkt, p platform.Packet) {
231 switch {
232 case parsed.isSYNACK():
233 conn, ok := e.table.Get(key)
234 if !ok {
235 p.Verdict(platform.Accept)
236 return
237 }
238 conn.Mu.Lock()
239 if conn.Stage == conntrack.StageSynSent {
240 conn.SynAckSeq = parsed.seqNum
241 conn.Stage = conntrack.StageSynAckSeen
242 }
243 conn.Mu.Unlock()
244 p.Verdict(platform.Accept)
245 return
246
247 case parsed.isACKOnly() && !parsed.hasPayload():
248 conn, ok := e.table.Get(key)
249 if !ok {
250 p.Verdict(platform.Accept)
251 return
252 }
253 conn.Mu.Lock()
254 if conn.Stage == conntrack.StageFakeSent {
255 conn.Finish(true, "fake_data_ack_recv")
256 e.table.Remove(key)
257 e.flows.Delete(key)
258 }
259 conn.Mu.Unlock()
260 p.Verdict(platform.Accept)
261 return
262 }
263
264 p.Verdict(platform.Accept)
265}
266
267// scheduleInject sleeps the randomizer-chosen delay then emits the spoofed
268// packet. The ACK that triggered us is passed by value so we can build the

Callers 1

dispatchMethod · 0.95

Calls 6

isSYNACKMethod · 0.80
GetMethod · 0.80
isACKOnlyMethod · 0.80
hasPayloadMethod · 0.80
FinishMethod · 0.80
RemoveMethod · 0.80

Tested by

no test coverage detected