Skip to content

Commit cdb02a2

Browse files
jasonishvictorjulien
authored andcommitted
rust/dns: rustfmt
1 parent 7d66eb5 commit cdb02a2

5 files changed

Lines changed: 10 additions & 13 deletions

File tree

.github/workflows/builds.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ jobs:
383383
working-directory: rust/sys
384384
- run: cargo fmt --check
385385
working-directory: rust/derive
386+
- run: rustfmt --check rust/src/dns/*.rs
386387
- name: Check if Cargo.lock.in is up to date
387388
run: |
388389
cp rust/Cargo.lock rust/Cargo.lock.in

rust/src/dns/detect.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ unsafe extern "C" fn dns_opcode_free(_de: *mut DetectEngineCtx, ctx: *mut c_void
173173
SCDetectU8Free(ctx);
174174
}
175175

176-
unsafe extern "C" fn dns_rcode_parse(ustr: *const std::os::raw::c_char) -> *mut DetectUintData<u16> {
176+
unsafe extern "C" fn dns_rcode_parse(
177+
ustr: *const std::os::raw::c_char,
178+
) -> *mut DetectUintData<u16> {
177179
let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe
178180
if let Ok(s) = ft_name.to_str() {
179181
if let Some(ctx) = detect_parse_uint_enum::<u16, DNSRcode>(s) {

rust/src/dns/dns.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,7 @@ impl DNSState {
637637
}
638638
}
639639

640-
pub(crate) fn parse_request_udp(
641-
&mut self, flow: *mut Flow, stream_slice: StreamSlice,
642-
) -> bool {
640+
pub(crate) fn parse_request_udp(&mut self, flow: *mut Flow, stream_slice: StreamSlice) -> bool {
643641
let input = stream_slice.as_slice();
644642
let frame = Frame::new(
645643
flow,
@@ -701,9 +699,7 @@ impl DNSState {
701699
/// prefix.
702700
///
703701
/// Returns the number of messages parsed.
704-
fn parse_request_tcp(
705-
&mut self, flow: *mut Flow, stream_slice: StreamSlice,
706-
) -> AppLayerResult {
702+
fn parse_request_tcp(&mut self, flow: *mut Flow, stream_slice: StreamSlice) -> AppLayerResult {
707703
let input = stream_slice.as_slice();
708704
if self.gap {
709705
let (is_dns, _, is_incomplete) = probe_tcp(input);
@@ -765,9 +761,7 @@ impl DNSState {
765761
/// prefix.
766762
///
767763
/// Returns the number of messages parsed.
768-
fn parse_response_tcp(
769-
&mut self, flow: *mut Flow, stream_slice: StreamSlice,
770-
) -> AppLayerResult {
764+
fn parse_response_tcp(&mut self, flow: *mut Flow, stream_slice: StreamSlice) -> AppLayerResult {
771765
let input = stream_slice.as_slice();
772766
if self.gap {
773767
let (is_dns, _, is_incomplete) = probe_tcp(input);

rust/src/dns/lua.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ pub extern "C" fn SCDnsLuaGetAnswerTable(clua: &mut CLuaState, tx: &mut DNSTrans
174174
lua.settable(-3);
175175
}
176176
}
177-
DNSRData::NULL(ref bytes)
178-
| DNSRData::Unknown(ref bytes) => {
177+
DNSRData::NULL(ref bytes) | DNSRData::Unknown(ref bytes) => {
179178
if !bytes.is_empty() {
180179
lua.pushstring("addr");
181180
lua.pushstring(&String::from_utf8_lossy(bytes));

rust/src/dns/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ pub fn dns_parse_body<'a>(
440440
let (i, queries) = count(
441441
|b| dns_parse_query(b, message, &mut flags),
442442
header.questions as usize,
443-
).parse(i)?;
443+
)
444+
.parse(i)?;
444445
let (i, answers) = dns_parse_answer(i, message, header.answer_rr as usize, &mut flags)?;
445446

446447
let mut invalid_authorities = false;

0 commit comments

Comments
 (0)