mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Rework the packet flow through the IP-based analyzers
This commit is contained in:
parent
c21af39a30
commit
7dc803f7bb
8 changed files with 102 additions and 90 deletions
|
@ -14,25 +14,23 @@ TCPAnalyzer::~TCPAnalyzer()
|
|||
{
|
||||
}
|
||||
|
||||
bool TCPAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
|
||||
bool TCPAnalyzer::BuildConnTuple(size_t len, const uint8_t* data, Packet* packet,
|
||||
ConnTuple& tuple)
|
||||
{
|
||||
uint32_t min_hdr_len = sizeof(struct tcphdr);
|
||||
if ( ! CheckHeaderTrunc(min_hdr_len, len, packet) )
|
||||
return false;
|
||||
|
||||
ConnTuple id;
|
||||
id.src_addr = packet->ip_hdr->SrcAddr();
|
||||
id.dst_addr = packet->ip_hdr->DstAddr();
|
||||
tuple.src_addr = packet->ip_hdr->SrcAddr();
|
||||
tuple.dst_addr = packet->ip_hdr->DstAddr();
|
||||
|
||||
data = packet->ip_hdr->Payload();
|
||||
|
||||
const struct tcphdr* tp = (const struct tcphdr *) data;
|
||||
id.src_port = tp->th_sport;
|
||||
id.dst_port = tp->th_dport;
|
||||
id.is_one_way = false;
|
||||
id.proto = TRANSPORT_TCP;
|
||||
|
||||
ProcessConnection(id, packet, len);
|
||||
tuple.src_port = tp->th_sport;
|
||||
tuple.dst_port = tp->th_dport;
|
||||
tuple.is_one_way = false;
|
||||
tuple.proto = TRANSPORT_TCP;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue