From fab3f36b8cd0bf4796d37d4fea91d6a17b59c605 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Sun, 15 Jan 2023 10:05:29 -0600 Subject: [PATCH] dns: never return error on UDP DNS UDP parsers should never return error as it should indicate to Suricata that an unrecoverable error has occurred. UDP being record based for the most part is almost always recoverable, at least for protocols like DNS. --- rust/src/dns/dns.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/rust/src/dns/dns.rs b/rust/src/dns/dns.rs index c21abdd34f..347fbdabd9 100644 --- a/rust/src/dns/dns.rs +++ b/rust/src/dns/dns.rs @@ -767,11 +767,8 @@ pub unsafe extern "C" fn rs_dns_parse_request( stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, DNSState); - if state.parse_request_udp(flow, stream_slice) { - AppLayerResult::ok() - } else { - AppLayerResult::err() - } + state.parse_request_udp(flow, stream_slice); + AppLayerResult::ok() } #[no_mangle] @@ -780,11 +777,8 @@ pub unsafe extern "C" fn rs_dns_parse_response( stream_slice: StreamSlice, _data: *const std::os::raw::c_void, ) -> AppLayerResult { let state = cast_pointer!(state, DNSState); - if state.parse_response_udp(flow, stream_slice) { - AppLayerResult::ok() - } else { - AppLayerResult::err() - } + state.parse_response_udp(flow, stream_slice); + AppLayerResult::ok() } /// C binding parse a DNS request. Returns 1 on success, -1 on failure.