@@ -77,7 +77,8 @@ pub enum CloseType {
77
77
ClientEstablishReset = 18 , // 18: 建连-客户端其他重置
78
78
ServerEstablishReset = 19 , // 19: 建连-服务端其他重置
79
79
TcpFinClientRst = 20 , // 20: 正常结束-客户端重置
80
- Max = 21 ,
80
+ IcmpUnknown = 21 , // 21: TODO
81
+ Max = 22 ,
81
82
}
82
83
83
84
impl CloseType {
@@ -87,6 +88,7 @@ impl CloseType {
87
88
|| self == CloseType :: ClientHalfClose
88
89
|| self == CloseType :: ClientSourcePortReuse
89
90
|| self == CloseType :: ClientEstablishReset
91
+ || self == CloseType :: IcmpUnknown
90
92
}
91
93
92
94
pub fn is_server_error ( self ) -> bool {
@@ -1070,7 +1072,21 @@ impl Flow {
1070
1072
FlowState :: Exception => CloseType :: Unknown ,
1071
1073
FlowState :: Opening1 => CloseType :: ClientSynRepeat ,
1072
1074
FlowState :: Opening2 => CloseType :: ServerSynAckRepeat ,
1073
- FlowState :: Established => CloseType :: Timeout ,
1075
+ FlowState :: Established => {
1076
+ if self . flow_key . proto == IpProtocol :: ICMPV4
1077
+ || self . flow_key . proto == IpProtocol :: ICMPV6
1078
+ {
1079
+ if self . flow_metrics_peers [ 0 ] . total_packet_count
1080
+ != self . flow_metrics_peers [ 1 ] . total_packet_count
1081
+ {
1082
+ CloseType :: IcmpUnknown
1083
+ } else {
1084
+ CloseType :: Timeout
1085
+ }
1086
+ } else {
1087
+ CloseType :: Timeout
1088
+ }
1089
+ }
1074
1090
FlowState :: ClosingTx1 => CloseType :: ServerHalfClose ,
1075
1091
FlowState :: ClosingRx1 => CloseType :: ClientHalfClose ,
1076
1092
FlowState :: ClosingTx2 | FlowState :: ClosingRx2 | FlowState :: Closed => CloseType :: TcpFin ,
0 commit comments