From: Philippe Antoine Date: Fri, 1 Jul 2022 19:28:12 +0000 (+0200) Subject: ike: do not log empty notify array X-Git-Tag: suricata-7.0.0-beta1~367 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=632581ac957ec578d6cec677f2949716d762597d;p=thirdparty%2Fsuricata.git ike: do not log empty notify array Ticket: #5167 --- diff --git a/rust/src/ike/logger.rs b/rust/src/ike/logger.rs index 0a1263b150..a0e8cd6a03 100644 --- a/rust/src/ike/logger.rs +++ b/rust/src/ike/logger.rs @@ -214,12 +214,14 @@ fn log_ikev2(tx: &IKETransaction, jb: &mut JsonBuilder) -> Result<(), JsonError> jb.open_object("ikev2")?; jb.set_uint("errors", tx.errors as u64)?; - jb.open_array("notify")?; - for notify in tx.notify_types.iter() { - jb.append_string(&format!("{:?}", notify))?; + if !tx.notify_types.is_empty() { + jb.open_array("notify")?; + for notify in tx.notify_types.iter() { + jb.append_string(&format!("{:?}", notify))?; + } + jb.close()?; } jb.close()?; - jb.close()?; Ok(()) }