mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Cosmetics in preparation for merge.
This commit is contained in:
parent
4321f635ac
commit
30014ac920
7 changed files with 23 additions and 13 deletions
|
@ -945,7 +945,7 @@ const IPPROTO_RAW = 255; ##< Raw IP packet.
|
||||||
# Definitions for IPv6 extension headers.
|
# Definitions for IPv6 extension headers.
|
||||||
const IPPROTO_HOPOPTS = 0; ##< IPv6 hop-by-hop-options header.
|
const IPPROTO_HOPOPTS = 0; ##< IPv6 hop-by-hop-options header.
|
||||||
const IPPROTO_ROUTING = 43; ##< IPv6 routing header.
|
const IPPROTO_ROUTING = 43; ##< IPv6 routing header.
|
||||||
const IPPROTO_FRAGMENT = 44; ##< IPv6 fragment header.
|
const IPPROTO_FRAGMENT = 44; ##< IPv6 fragment header.
|
||||||
const IPPROTO_ESP = 50; ##< IPv6 encapsulating security payload header.
|
const IPPROTO_ESP = 50; ##< IPv6 encapsulating security payload header.
|
||||||
const IPPROTO_AH = 51; ##< IPv6 authentication header.
|
const IPPROTO_AH = 51; ##< IPv6 authentication header.
|
||||||
const IPPROTO_NONE = 59; ##< IPv6 no next header.
|
const IPPROTO_NONE = 59; ##< IPv6 no next header.
|
||||||
|
@ -1081,14 +1081,14 @@ type ip6_ext_hdr: record {
|
||||||
type ip6_hdr: record {
|
type ip6_hdr: record {
|
||||||
class: count; ##< Traffic class.
|
class: count; ##< Traffic class.
|
||||||
flow: count; ##< Flow label.
|
flow: count; ##< Flow label.
|
||||||
len: count; ##< Payload length.
|
len: count; ##< Payload length.
|
||||||
nxt: count; ##< Protocol number of the next header
|
nxt: count; ##< Protocol number of the next header
|
||||||
##< (RFC 1700 et seq., IANA assigned number)
|
##< (RFC 1700 et seq., IANA assigned number)
|
||||||
##< e.g. :bro:id:`IPPROTO_ICMP`.
|
##< e.g. :bro:id:`IPPROTO_ICMP`.
|
||||||
hlim: count; ##< Hop limit.
|
hlim: count; ##< Hop limit.
|
||||||
src: addr; ##< Source address.
|
src: addr; ##< Source address.
|
||||||
dst: addr; ##< Destination address.
|
dst: addr; ##< Destination address.
|
||||||
exts: vector of ip6_ext_hdr; ##< Extension header chain.
|
exts: vector of ip6_ext_hdr; ##< Extension header chain.
|
||||||
};
|
};
|
||||||
|
|
||||||
## Values extracted from an IPv4 header.
|
## Values extracted from an IPv4 header.
|
||||||
|
|
|
@ -90,7 +90,7 @@ void FragReassembler::AddFragment(double t, const IP_Hdr* ip, const u_char* pkt)
|
||||||
if ( ip->NextProto() != next_proto ||
|
if ( ip->NextProto() != next_proto ||
|
||||||
ip->HdrLen() - 8 != proto_hdr_len )
|
ip->HdrLen() - 8 != proto_hdr_len )
|
||||||
s->Weird("fragment_protocol_inconsistency", ip);
|
s->Weird("fragment_protocol_inconsistency", ip);
|
||||||
//TODO: more detailed unfrag header consistency checks?
|
// TODO: more detailed unfrag header consistency checks?
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ip->DF() )
|
if ( ip->DF() )
|
||||||
|
|
|
@ -18,7 +18,9 @@ static RecordType* ip6_esp_type = 0;
|
||||||
|
|
||||||
static inline RecordType* hdrType(RecordType*& type, const char* name)
|
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;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +56,7 @@ static VectorVal* BuildOptionsVal(const u_char* data, uint16 len)
|
||||||
|
|
||||||
vv->Assign(vv->Size(), rv, 0);
|
vv->Assign(vv->Size(), rv, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return vv;
|
return vv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
src/IP.h
4
src/IP.h
|
@ -229,7 +229,9 @@ public:
|
||||||
|
|
||||||
~IP_Hdr()
|
~IP_Hdr()
|
||||||
{
|
{
|
||||||
if ( ip6 ) delete ip6_hdrs;
|
if ( ip6 )
|
||||||
|
delete ip6_hdrs;
|
||||||
|
|
||||||
if ( del )
|
if ( del )
|
||||||
{
|
{
|
||||||
if ( ip4 )
|
if ( ip4 )
|
||||||
|
|
|
@ -31,7 +31,7 @@ PacketSortElement::PacketSortElement(PktSrc* arg_src,
|
||||||
else if ( ip->ip_v == 6 )
|
else if ( ip->ip_v == 6 )
|
||||||
ip_hdr = new IP_Hdr((const struct ip6_hdr*) ip, false);
|
ip_hdr = new IP_Hdr((const struct ip6_hdr*) ip, false);
|
||||||
else
|
else
|
||||||
// weird will be generated later in NetSessions::NextPacket
|
// Weird will be generated later in NetSessions::NextPacket.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ip_hdr->NextProto() == IPPROTO_TCP &&
|
if ( ip_hdr->NextProto() == IPPROTO_TCP &&
|
||||||
|
|
|
@ -640,20 +640,24 @@ bool NetSessions::CheckHeaderTrunc(int proto, uint32 len, uint32 caplen,
|
||||||
min_hdr_len = sizeof(struct udphdr);
|
min_hdr_len = sizeof(struct udphdr);
|
||||||
break;
|
break;
|
||||||
case IPPROTO_ICMP:
|
case IPPROTO_ICMP:
|
||||||
default:
|
|
||||||
min_hdr_len = ICMP_MINLEN;
|
min_hdr_len = ICMP_MINLEN;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
internal_error("unknown protocol");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( len < min_hdr_len )
|
if ( len < min_hdr_len )
|
||||||
{
|
{
|
||||||
Weird("truncated_header", h, p);
|
Weird("truncated_header", h, p);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( caplen < min_hdr_len )
|
if ( caplen < min_hdr_len )
|
||||||
{
|
{
|
||||||
Weird("internally_truncated_header", h, p);
|
Weird("internally_truncated_header", h, p);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2067,6 +2067,7 @@ function routing0_data_to_addrs%(s: string%): addr_set
|
||||||
const u_char* bytes = s->Bytes();
|
const u_char* bytes = s->Bytes();
|
||||||
bytes += 4; // go past 32-bit reserved field
|
bytes += 4; // go past 32-bit reserved field
|
||||||
len -= 4;
|
len -= 4;
|
||||||
|
|
||||||
if ( ( len % 16 ) != 0 )
|
if ( ( len % 16 ) != 0 )
|
||||||
reporter->Warning("Bad ip6_routing data length: %d", s->Len());
|
reporter->Warning("Bad ip6_routing data length: %d", s->Len());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue