diff --git a/src/ICMP.cc b/src/ICMP.cc index 2fb1a9daab..76b19398fa 100644 --- a/src/ICMP.cc +++ b/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 ) diff --git a/src/Val.h b/src/Val.h index ae8c53308e..64c19b2d92 100644 --- a/src/Val.h +++ b/src/Val.h @@ -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 { diff --git a/src/net_util.cc b/src/net_util.cc index a367429257..856e351138 100644 --- a/src/net_util.cc +++ b/src/net_util.cc @@ -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;