detect/integers: support kibibyte unit

Ticket: 7869
pull/13767/head
Philippe Antoine 2 months ago committed by Victor Julien
parent be9858d3aa
commit d0a513df6a

@ -15,9 +15,9 @@ an hexadecimal value like ``0x64``.
The integer value can also have a unit/multiplier as a
case-insensitive suffix:
* kb : 1024
* mb : 1048576
* gb : 1073741824
* kb/kib : 1024
* mb/mib : 1048576
* gb/gib : 1073741824
The most direct example is to match for equality, but there are
different modes.

@ -104,8 +104,11 @@ impl<T> DetectIntType for T where
pub fn detect_parse_uint_unit(i: &str) -> IResult<&str, u64> {
let (i, unit) = alt((
value(1024, tag_no_case("kib")),
value(1024, tag_no_case("kb")),
value(1024 * 1024, tag_no_case("mib")),
value(1024 * 1024, tag_no_case("mb")),
value(1024 * 1024 * 1024, tag_no_case("gib")),
value(1024 * 1024 * 1024, tag_no_case("gb")),
))(i)?;
return Ok((i, unit));

Loading…
Cancel
Save