mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
BIT-788: use DNS QR field to better identify flow direction.
This commit is contained in:
parent
3956df4407
commit
8efaae96cd
9 changed files with 38 additions and 9 deletions
|
@ -19,6 +19,7 @@ using namespace analyzer::dns;
|
|||
DNS_Interpreter::DNS_Interpreter(analyzer::Analyzer* arg_analyzer)
|
||||
{
|
||||
analyzer = arg_analyzer;
|
||||
first_message = true;
|
||||
}
|
||||
|
||||
int DNS_Interpreter::ParseMessage(const u_char* data, int len, int is_query)
|
||||
|
@ -33,6 +34,16 @@ int DNS_Interpreter::ParseMessage(const u_char* data, int len, int is_query)
|
|||
|
||||
DNS_MsgInfo msg((DNS_RawMsgHdr*) data, is_query);
|
||||
|
||||
if ( first_message && msg.QR && is_query == 1 )
|
||||
{
|
||||
is_query = msg.is_query = 0;
|
||||
|
||||
if ( ! analyzer->Conn()->RespAddr().IsMulticast() )
|
||||
analyzer->Conn()->FlipRoles();
|
||||
}
|
||||
|
||||
first_message = false;
|
||||
|
||||
if ( dns_message )
|
||||
{
|
||||
val_list* vl = new val_list();
|
||||
|
@ -1064,7 +1075,8 @@ void Contents_DNS::Flush()
|
|||
{
|
||||
if ( buf_n > 0 )
|
||||
{ // Deliver partial message.
|
||||
interp->ParseMessage(msg_buf, buf_n, true);
|
||||
// '2' here means whether it's a query is unknown.
|
||||
interp->ParseMessage(msg_buf, buf_n, 2);
|
||||
msg_size = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue