From e5357690869bfbeb0b6feb824e0dbe19aaee2144 Mon Sep 17 00:00:00 2001 From: Toby Date: Sat, 30 Mar 2024 14:30:20 -0700 Subject: [PATCH] fix: make sure rx_pkt_cnt & tx_pkt_cnt both always exist --- analyzer/udp/openvpn.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/analyzer/udp/openvpn.go b/analyzer/udp/openvpn.go index 1bb2e8e..3853726 100644 --- a/analyzer/udp/openvpn.go +++ b/analyzer/udp/openvpn.go @@ -206,8 +206,8 @@ func (o *openvpnUDPStream) Feed(rev bool, data []byte) (u *analyzer.PropUpdate, cancelled, o.respDone = o.respLSM.Run() if o.respUpdated { update = &analyzer.PropUpdate{ - Type: analyzer.PropUpdateMerge, - M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt}, + Type: analyzer.PropUpdateReplace, + M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt, "tx_pkt_cnt": o.txPktCnt}, } o.respUpdated = false } @@ -216,8 +216,8 @@ func (o *openvpnUDPStream) Feed(rev bool, data []byte) (u *analyzer.PropUpdate, cancelled, o.reqDone = o.reqLSM.Run() if o.reqUpdated { update = &analyzer.PropUpdate{ - Type: analyzer.PropUpdateMerge, - M: analyzer.PropMap{"tx_pkt_cnt": o.txPktCnt}, + Type: analyzer.PropUpdateReplace, + M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt, "tx_pkt_cnt": o.txPktCnt}, } o.reqUpdated = false } @@ -296,8 +296,8 @@ func (o *openvpnTCPStream) Feed(rev, start, end bool, skip int, data []byte) (u cancelled, o.respDone = o.respLSM.Run() if o.respUpdated { update = &analyzer.PropUpdate{ - Type: analyzer.PropUpdateMerge, - M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt}, + Type: analyzer.PropUpdateReplace, + M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt, "tx_pkt_cnt": o.txPktCnt}, } o.respUpdated = false } @@ -308,7 +308,7 @@ func (o *openvpnTCPStream) Feed(rev, start, end bool, skip int, data []byte) (u if o.reqUpdated { update = &analyzer.PropUpdate{ Type: analyzer.PropUpdateMerge, - M: analyzer.PropMap{"tx_pkt_cnt": o.txPktCnt}, + M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt, "tx_pkt_cnt": o.txPktCnt}, } o.reqUpdated = false }