mirror of
https://github.com/OISF/suricata.git
synced 2026-05-28 04:32:12 -04:00
rust/dns: rustfmt
This commit is contained in:
parent
7d66eb5f04
commit
cdb02a2779
5 changed files with 10 additions and 13 deletions
1
.github/workflows/builds.yml
vendored
1
.github/workflows/builds.yml
vendored
|
|
@ -383,6 +383,7 @@ jobs:
|
|||
working-directory: rust/sys
|
||||
- run: cargo fmt --check
|
||||
working-directory: rust/derive
|
||||
- run: rustfmt --check rust/src/dns/*.rs
|
||||
- name: Check if Cargo.lock.in is up to date
|
||||
run: |
|
||||
cp rust/Cargo.lock rust/Cargo.lock.in
|
||||
|
|
|
|||
|
|
@ -173,7 +173,9 @@ unsafe extern "C" fn dns_opcode_free(_de: *mut DetectEngineCtx, ctx: *mut c_void
|
|||
SCDetectU8Free(ctx);
|
||||
}
|
||||
|
||||
unsafe extern "C" fn dns_rcode_parse(ustr: *const std::os::raw::c_char) -> *mut DetectUintData<u16> {
|
||||
unsafe extern "C" fn dns_rcode_parse(
|
||||
ustr: *const std::os::raw::c_char,
|
||||
) -> *mut DetectUintData<u16> {
|
||||
let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe
|
||||
if let Ok(s) = ft_name.to_str() {
|
||||
if let Some(ctx) = detect_parse_uint_enum::<u16, DNSRcode>(s) {
|
||||
|
|
|
|||
|
|
@ -637,9 +637,7 @@ impl DNSState {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn parse_request_udp(
|
||||
&mut self, flow: *mut Flow, stream_slice: StreamSlice,
|
||||
) -> bool {
|
||||
pub(crate) fn parse_request_udp(&mut self, flow: *mut Flow, stream_slice: StreamSlice) -> bool {
|
||||
let input = stream_slice.as_slice();
|
||||
let frame = Frame::new(
|
||||
flow,
|
||||
|
|
@ -701,9 +699,7 @@ impl DNSState {
|
|||
/// prefix.
|
||||
///
|
||||
/// Returns the number of messages parsed.
|
||||
fn parse_request_tcp(
|
||||
&mut self, flow: *mut Flow, stream_slice: StreamSlice,
|
||||
) -> AppLayerResult {
|
||||
fn parse_request_tcp(&mut self, flow: *mut Flow, stream_slice: StreamSlice) -> AppLayerResult {
|
||||
let input = stream_slice.as_slice();
|
||||
if self.gap {
|
||||
let (is_dns, _, is_incomplete) = probe_tcp(input);
|
||||
|
|
@ -765,9 +761,7 @@ impl DNSState {
|
|||
/// prefix.
|
||||
///
|
||||
/// Returns the number of messages parsed.
|
||||
fn parse_response_tcp(
|
||||
&mut self, flow: *mut Flow, stream_slice: StreamSlice,
|
||||
) -> AppLayerResult {
|
||||
fn parse_response_tcp(&mut self, flow: *mut Flow, stream_slice: StreamSlice) -> AppLayerResult {
|
||||
let input = stream_slice.as_slice();
|
||||
if self.gap {
|
||||
let (is_dns, _, is_incomplete) = probe_tcp(input);
|
||||
|
|
|
|||
|
|
@ -174,8 +174,7 @@ pub extern "C" fn SCDnsLuaGetAnswerTable(clua: &mut CLuaState, tx: &mut DNSTrans
|
|||
lua.settable(-3);
|
||||
}
|
||||
}
|
||||
DNSRData::NULL(ref bytes)
|
||||
| DNSRData::Unknown(ref bytes) => {
|
||||
DNSRData::NULL(ref bytes) | DNSRData::Unknown(ref bytes) => {
|
||||
if !bytes.is_empty() {
|
||||
lua.pushstring("addr");
|
||||
lua.pushstring(&String::from_utf8_lossy(bytes));
|
||||
|
|
|
|||
|
|
@ -440,7 +440,8 @@ pub fn dns_parse_body<'a>(
|
|||
let (i, queries) = count(
|
||||
|b| dns_parse_query(b, message, &mut flags),
|
||||
header.questions as usize,
|
||||
).parse(i)?;
|
||||
)
|
||||
.parse(i)?;
|
||||
let (i, answers) = dns_parse_answer(i, message, header.answer_rr as usize, &mut flags)?;
|
||||
|
||||
let mut invalid_authorities = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue