-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dns over http2 5773 v12 #11292
Dns over http2 5773 v12 #11292
Changes from 1 commit
713a6a7
33d7a91
0c422db
2ae7bb7
94c706b
e90afd9
ba994b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
|
||
use super::http2::{HTTP2Frame, HTTP2FrameTypeData, HTTP2Transaction}; | ||
use super::parser; | ||
use crate::dns::log::{SCDnsLogAnswerEnabled, SCDnsLogJsonAnswer, SCDnsLogJsonQuery}; | ||
use crate::jsonbuilder::{JsonBuilder, JsonError}; | ||
use std; | ||
use std::collections::{HashMap, HashSet}; | ||
|
@@ -281,6 +282,35 @@ fn log_http2(tx: &HTTP2Transaction, js: &mut JsonBuilder) -> Result<bool, JsonEr | |
js.close()?; // http2 | ||
js.close()?; // http | ||
|
||
if tx.dns_request_tx.is_some() || tx.dns_response_tx.is_some() { | ||
js.open_object("dns")?; | ||
if let Some(dtx) = &tx.dns_request_tx { | ||
let mark = js.get_mark(); | ||
let mut has_dns_query = false; | ||
js.open_array("query")?; | ||
for i in 0..0xFFFF { | ||
let mut jsa = JsonBuilder::try_new_object()?; | ||
if !SCDnsLogJsonQuery(dtx, i, 0xFFFFFFFFFFFFFFFF, &mut jsa) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are these 0xFFFFFFFFFFFFFFFF uses, looks not very nice There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed not very nice, this PR is still a draft waiting for the dns log overhaul in https://redmine.openinfosecfoundation.org/issues/6281 to do the same thing... |
||
break; | ||
} | ||
jsa.close()?; | ||
js.append_object(&jsa)?; | ||
has_dns_query = true; | ||
} | ||
if has_dns_query { | ||
js.close()?; // query | ||
} else { | ||
js.restore_mark(&mark)?; | ||
} | ||
} | ||
if let Some(dtx) = &tx.dns_response_tx { | ||
if SCDnsLogAnswerEnabled(dtx, 0xFFFFFFFFFFFFFFFF) { | ||
// logging at root of dns object | ||
SCDnsLogJsonAnswer(dtx, 0xFFFFFFFFFFFFFFFF, js); | ||
} | ||
} | ||
js.close()?; // dns | ||
} | ||
return Ok(has_request || has_response || has_headers); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this all be wrapped in an Option? It seems like a large expansion of the http/2 tx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good idea, will try to improve on it