mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Remove --enable-brov6 flag, IPv6 now supported by default.
Internally, all BROv6 preprocessor switches were removed and addr/subnet representations wrapped in the new IPAddr/IPPrefix classes. Some script-layer changes of note: - dns_AAAA_reply event signature changed: the string representation of an IPv6 addr is easily derived from the addr value, it doesn't need to be another parameter. This event also now generated directly by the DNS analyzer instead of being "faked" into a dns_A_reply event. - removed addr_to_count BIF. It used to return the host-order count representation of IPv4 addresses only. To make it more generic, we might later add a BIF to return a vector of counts in order to support IPv6. - changed the result of enclosing addr variables in vertical pipes (e.g. |my_addr|) to return the bit-width of the address type which is 128 for IPv6 and 32 for IPv4. It used to function the same way as addr_to_count mentioned above. - remove bro_has_ipv6 BIF
This commit is contained in:
parent
2c439fd0a2
commit
b3f1f45082
85 changed files with 1428 additions and 1684 deletions
33
src/Conn.h
33
src/Conn.h
|
@ -12,6 +12,7 @@
|
|||
#include "PersistenceSerializer.h"
|
||||
#include "RuleMatcher.h"
|
||||
#include "AnalyzerTags.h"
|
||||
#include "IPAddr.h"
|
||||
|
||||
class Connection;
|
||||
class ConnectionTimer;
|
||||
|
@ -32,8 +33,8 @@ typedef enum {
|
|||
typedef void (Connection::*timer_func)(double t);
|
||||
|
||||
struct ConnID {
|
||||
const uint32* src_addr;
|
||||
const uint32* dst_addr;
|
||||
IPAddr src_addr;
|
||||
IPAddr dst_addr;
|
||||
uint32 src_port;
|
||||
uint32 dst_port;
|
||||
bool is_one_way; // if true, don't canonicalize
|
||||
|
@ -49,17 +50,20 @@ struct ConnID {
|
|||
|
||||
// The structure used internally for hashing.
|
||||
struct Key {
|
||||
uint32 ip1[NUM_ADDR_WORDS];
|
||||
uint32 ip2[NUM_ADDR_WORDS];
|
||||
IPAddr ip1;
|
||||
IPAddr ip2;
|
||||
uint16 port1;
|
||||
uint16 port2;
|
||||
};
|
||||
};
|
||||
|
||||
static inline int addr_port_canon_lt(const uint32* a1, uint32 p1,
|
||||
const uint32* a2, uint32 p2)
|
||||
static inline int addr_port_canon_lt(const IPAddr& addr1, uint32 p1,
|
||||
const IPAddr& addr2, uint32 p2)
|
||||
{
|
||||
#ifdef BROv6
|
||||
uint32 a1[4];
|
||||
uint32 a2[4];
|
||||
addr1.CopyIPv6(a1);
|
||||
addr2.CopyIPv6(a2);
|
||||
// Because it's a canonical ordering, not a strict ordering,
|
||||
// we can choose to give more weight to the least significant
|
||||
// word than to the most significant word. This matters
|
||||
|
@ -75,9 +79,6 @@ static inline int addr_port_canon_lt(const uint32* a1, uint32 p1,
|
|||
(a1[0] < a2[0] ||
|
||||
(a1[0] == a2[0] &&
|
||||
p1 < p2)))))));
|
||||
#else
|
||||
return *a1 < *a2 || (*a1 == *a2 && p1 < p2);
|
||||
#endif
|
||||
}
|
||||
|
||||
class Analyzer;
|
||||
|
@ -119,8 +120,8 @@ public:
|
|||
double LastTime() const { return last_time; }
|
||||
void SetLastTime(double t) { last_time = t; }
|
||||
|
||||
const uint32* OrigAddr() const { return orig_addr; }
|
||||
const uint32* RespAddr() const { return resp_addr; }
|
||||
const IPAddr& OrigAddr() const { return orig_addr; }
|
||||
const IPAddr& RespAddr() const { return resp_addr; }
|
||||
|
||||
uint32 OrigPort() const { return orig_port; }
|
||||
uint32 RespPort() const { return resp_port; }
|
||||
|
@ -185,11 +186,11 @@ public:
|
|||
|
||||
// Raises a software_version_found event based on the
|
||||
// given string (returns false if it's not parseable).
|
||||
int VersionFoundEvent(const uint32* addr, const char* s, int len,
|
||||
int VersionFoundEvent(const IPAddr& addr, const char* s, int len,
|
||||
Analyzer* analyzer = 0);
|
||||
|
||||
// Raises a software_unparsed_version_found event.
|
||||
int UnparsedVersionFoundEvent(const uint32* addr,
|
||||
int UnparsedVersionFoundEvent(const IPAddr& addr,
|
||||
const char* full_descr, int len, Analyzer* analyzer);
|
||||
|
||||
void Event(EventHandlerPtr f, Analyzer* analyzer, const char* name = 0);
|
||||
|
@ -325,8 +326,8 @@ protected:
|
|||
TimerMgr::Tag* conn_timer_mgr;
|
||||
timer_list timers;
|
||||
|
||||
uint32 orig_addr[NUM_ADDR_WORDS]; // in network order
|
||||
uint32 resp_addr[NUM_ADDR_WORDS]; // in network order
|
||||
IPAddr orig_addr;
|
||||
IPAddr resp_addr;
|
||||
uint32 orig_port, resp_port; // in network order
|
||||
TransportProto proto;
|
||||
double start_time, last_time;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue