mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
More code cleanup
This commit is contained in:
parent
6eb9f63e17
commit
9d1e51a91e
3 changed files with 12 additions and 11 deletions
15
src/ICMP.cc
15
src/ICMP.cc
|
@ -67,6 +67,7 @@ void ICMP_Analyzer::DeliverPacket(int len, const u_char* data,
|
|||
|
||||
default:
|
||||
reporter->InternalError("unexpected IP proto in ICMP analyzer");
|
||||
break;
|
||||
}
|
||||
|
||||
if ( chksum != 0xffff )
|
||||
|
@ -108,7 +109,7 @@ void ICMP_Analyzer::DeliverPacket(int len, const u_char* data,
|
|||
|
||||
void ICMP_Analyzer::NextICMP4(double t, const struct icmp* icmpp, int len, int caplen,
|
||||
const u_char*& data, const IP_Hdr* ip_hdr )
|
||||
{
|
||||
{
|
||||
switch ( icmpp->icmp_type )
|
||||
{
|
||||
case ICMP_ECHO:
|
||||
|
@ -119,10 +120,11 @@ void ICMP_Analyzer::NextICMP4(double t, const struct icmp* icmpp, int len, int c
|
|||
case ICMP_UNREACH:
|
||||
case ICMP_TIMXCEED:
|
||||
Context4(t, icmpp, len, caplen, data, ip_hdr);
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
ICMPEvent(icmp_sent, icmpp, len, 0); break;
|
||||
ICMPEvent(icmp_sent, icmpp, len, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,6 +259,7 @@ TransportProto ICMP_Analyzer::GetContextProtocol(const IP_Hdr* ip_hdr, uint32* s
|
|||
|
||||
default:
|
||||
*src_port = *dst_port = ntohs(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return proto;
|
||||
|
@ -350,7 +353,6 @@ RecordVal* ICMP_Analyzer::ExtractICMP6Context(int len, const u_char*& data)
|
|||
src_addr = dst_addr = 0;
|
||||
src_port = dst_port = 0;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ip_len = ip_hdr->TotalLen();
|
||||
|
@ -394,7 +396,6 @@ RecordVal* ICMP_Analyzer::ExtractICMP6Context(int len, const u_char*& data)
|
|||
return iprec;
|
||||
}
|
||||
|
||||
|
||||
bool ICMP_Analyzer::IsReuse(double /* t */, const u_char* /* pkt */)
|
||||
{
|
||||
return 0;
|
||||
|
@ -534,11 +535,11 @@ void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
|||
{
|
||||
case ICMP_UNREACH:
|
||||
f = icmp_unreachable;
|
||||
break;
|
||||
break;
|
||||
|
||||
case ICMP_TIMXCEED:
|
||||
f = icmp_error_message;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( f )
|
||||
|
|
|
@ -509,9 +509,9 @@ protected:
|
|||
#define NUM_PORT_SPACES 4
|
||||
#define PORT_SPACE_MASK 0x30000
|
||||
|
||||
#define TCP_PORT_MASK 0x10000
|
||||
#define UDP_PORT_MASK 0x20000
|
||||
#define ICMP_PORT_MASK 0x30000
|
||||
#define TCP_PORT_MASK 0x10000
|
||||
#define UDP_PORT_MASK 0x20000
|
||||
#define ICMP_PORT_MASK 0x30000
|
||||
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -122,7 +122,7 @@ int icmp6_checksum(const struct icmp* icmpp, const struct ip6_hdr* ip6, int len)
|
|||
|
||||
if ( len % 2 == 1 )
|
||||
// Add in pad byte.
|
||||
sum += htons(((const u_char*) icmpp)[len - 1] << 8);
|
||||
sum = htons(((const u_char*) icmpp)[len - 1] << 8);
|
||||
else
|
||||
sum = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue