Skip to content

Commit 67fc494

Browse files
committed
input: handle_buf: emit an event if the connection was dropped from the table
this happens e.g. on active open (state = Syn_sent) when a reset is received and the connection attempt is discarded
1 parent 66dc4a7 commit 67fc494

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

‎src/input.ml‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,24 +1104,26 @@ let handle_buf t now ~src ~dst data =
11041104
(Cstruct.length seg.payload)
11051105
(Base64.encode_string (Cstruct.to_string data)));
11061106
(* deliver_in_3a deliver_in_4 are done now! *)
1107-
let was_established =
1107+
let was_established, was_present =
11081108
match CM.find_opt id t.connections with
1109-
| None -> false
1110-
| Some s -> s.tcp_state = Established
1109+
| None -> false, false
1110+
| Some s -> s.tcp_state = Established, true
11111111
in
11121112
let t', outs = handle_segment t now id seg in
1113-
let is_established, received =
1113+
let is_established, is_present, received =
11141114
match CM.find_opt id t'.connections with
1115-
| None -> false, false
1115+
| None -> false, false, false
11161116
| Some s ->
11171117
s.tcp_state = Established,
1118+
true,
11181119
Cstruct.lenv s.rcvq > 0
11191120
in
11201121
let ev =
1121-
match was_established, is_established, received with
1122-
| false, true, _ -> Some (`Established id)
1123-
| true, false, _ -> Some (`Drop (id, received))
1124-
| _, _, true -> Some (`Received id)
1122+
match was_established, is_established, received, was_present, is_present with
1123+
| false, true, _, _, _ -> Some (`Established id)
1124+
| true, false, _, _, _
1125+
| _, _, _, true, false -> Some (`Drop (id, received))
1126+
| _, _, true, _, _ -> Some (`Received id)
11251127
| _ -> None
11261128
in
11271129
List.iter (fun (src', dst', _) ->

0 commit comments

Comments
 (0)