Cosmetics in preparation for merge.

This commit is contained in:
Robin Sommer 2012-03-23 16:49:29 -07:00
parent 4321f635ac
commit 30014ac920
7 changed files with 23 additions and 13 deletions

View file

@ -18,7 +18,9 @@ static RecordType* ip6_esp_type = 0;
static inline RecordType* hdrType(RecordType*& type, const char* name)
{
if ( ! type ) type = internal_type(name)->AsRecordType();
if ( ! type )
type = internal_type(name)->AsRecordType();
return type;
}
@ -54,6 +56,7 @@ static VectorVal* BuildOptionsVal(const u_char* data, uint16 len)
vv->Assign(vv->Size(), rv, 0);
}
return vv;
}

View file

@ -229,7 +229,9 @@ public:
~IP_Hdr()
{
if ( ip6 ) delete ip6_hdrs;
if ( ip6 )
delete ip6_hdrs;
if ( del )
{
if ( ip4 )

View file

@ -31,7 +31,7 @@ PacketSortElement::PacketSortElement(PktSrc* arg_src,
else if ( ip->ip_v == 6 )
ip_hdr = new IP_Hdr((const struct ip6_hdr*) ip, false);
else
// weird will be generated later in NetSessions::NextPacket
// Weird will be generated later in NetSessions::NextPacket.
return;
if ( ip_hdr->NextProto() == IPPROTO_TCP &&

View file

@ -640,20 +640,24 @@ bool NetSessions::CheckHeaderTrunc(int proto, uint32 len, uint32 caplen,
min_hdr_len = sizeof(struct udphdr);
break;
case IPPROTO_ICMP:
default:
min_hdr_len = ICMP_MINLEN;
break;
default:
internal_error("unknown protocol");
}
if ( len < min_hdr_len )
{
Weird("truncated_header", h, p);
return true;
}
if ( caplen < min_hdr_len )
{
Weird("internally_truncated_header", h, p);
return true;
}
return false;
}

View file

@ -2067,6 +2067,7 @@ function routing0_data_to_addrs%(s: string%): addr_set
const u_char* bytes = s->Bytes();
bytes += 4; // go past 32-bit reserved field
len -= 4;
if ( ( len % 16 ) != 0 )
reporter->Warning("Bad ip6_routing data length: %d", s->Len());