datasets: accept standard IPv4 notation for ip type

The internal type set for datasets of type IP is IPv6, however, the
expectation is that it'll support IPv6, standard IPv4 as well as IPv4 in
IPv6 notation. A regression happened during the conversion of datasets
parsing to rust wherein standard IPv4 was rejected with IP type. Fix
that by handling IPv4 standard notation in IPv6 handler.

Fixes: bc79300dfa ("datasets: move initial file reading to rust")

Ticket: 9006
(cherry picked from commit 8b379a3b04)
pull/16367/head
Shivani Bhardwaj 1 month ago committed by Victor Julien
parent 943ad0a531
commit b502742db7

@ -247,10 +247,13 @@ unsafe fn process_ipv6_set(
) -> i32 {
let ipv6 = match Ipv6Addr::from_str(v[0]) {
Ok(a) => a,
Err(_) => {
SCFatalErrorOnInit!("invalid Ipv6 value {} in {}", set_name, filename.display());
return -1;
}
Err(_) => match Ipv4Addr::from_str(v[0]) {
Ok(a) => a.to_ipv6_mapped(),
Err(_) => {
SCFatalErrorOnInit!("invalid Ipv6 value {} in {}", set_name, filename.display());
return -1;
}
},
};
let mut fin_ipv6 = ipv6;

Loading…
Cancel
Save