From 8b74ea86797a96216f8d015aa7f5f2d19a0efdad Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Wed, 15 Nov 2023 12:31:12 -0600 Subject: [PATCH] dns: replace usage of rs_dns_tx_get_query_name with SCDnsTxGetQueryName SCDnsTxGetQueryName was introduced to allow for getting the query name in responses as well as requests, so covers the functionality of rs_dns_tx_get_query_name. --- rust/src/dns/dns.rs | 17 ----------------- src/detect-dns-query.c | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/rust/src/dns/dns.rs b/rust/src/dns/dns.rs index e8558828d5d0..57f66c0f73df 100644 --- a/rust/src/dns/dns.rs +++ b/rust/src/dns/dns.rs @@ -853,23 +853,6 @@ pub unsafe extern "C" fn rs_dns_state_get_tx_data( export_state_data_get!(rs_dns_get_state_data, DNSState); -#[no_mangle] -pub unsafe extern "C" fn rs_dns_tx_get_query_name( - tx: &mut DNSTransaction, i: u32, buf: *mut *const u8, len: *mut u32, -) -> u8 { - if let Some(request) = &tx.request { - if (i as usize) < request.queries.len() { - let query = &request.queries[i as usize]; - if !query.name.is_empty() { - *len = query.name.len() as u32; - *buf = query.name.as_ptr(); - return 1; - } - } - } - return 0; -} - /// Get the DNS query name at index i. #[no_mangle] pub unsafe extern "C" fn SCDnsTxGetQueryName( diff --git a/src/detect-dns-query.c b/src/detect-dns-query.c index 6b4f450ea257..7b435319ba90 100644 --- a/src/detect-dns-query.c +++ b/src/detect-dns-query.c @@ -87,7 +87,7 @@ static InspectionBuffer *DnsQueryGetData(DetectEngineThreadCtx *det_ctx, const uint8_t *data; uint32_t data_len; - if (rs_dns_tx_get_query_name(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) { + if (SCDnsTxGetQueryName(cbdata->txv, false, cbdata->local_id, &data, &data_len) == 0) { InspectionBufferSetupMultiEmpty(buffer); return NULL; }