diff --git a/src/Conn.cc b/src/Conn.cc index 97a2564d1a..1092ac1d74 100644 --- a/src/Conn.cc +++ b/src/Conn.cc @@ -42,6 +42,8 @@ Connection::Connection(zeek::IPBasedConnKeyPtr k, const zeek::ConnTuple& ct, dou Init(flow, pkt); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" Connection::Connection(const detail::ConnKey& k, double t, const ConnTuple* id, uint32_t flow, const Packet* pkt) : Session(t, connection_timeout, connection_status_update, detail::connection_status_update_interval) { orig_addr = id->src_addr; @@ -63,6 +65,7 @@ Connection::Connection(const detail::ConnKey& k, double t, const ConnTuple* id, Init(flow, pkt); } +#pragma GCC diagnostic pop Connection::~Connection() { if ( ! finished ) diff --git a/src/Conn.h b/src/Conn.h index ca634a821f..2bff20b240 100644 --- a/src/Conn.h +++ b/src/Conn.h @@ -69,7 +69,10 @@ static inline int addr_port_canon_lt(const IPAddr& addr1, uint32_t p1, const IPA class Connection final : public session::Session { public: Connection(zeek::IPBasedConnKeyPtr k, const zeek::ConnTuple& ct, double t, uint32_t flow, const Packet* pkt); + + [[deprecated("Remove in v8.1. Switch to ConnKey factories and the new zeek::ConnKey tree.")]] Connection(const detail::ConnKey& k, double t, const ConnTuple* id, uint32_t flow, const Packet* pkt); + ~Connection() override; /** @@ -201,7 +204,8 @@ public: bool IsFinished() { return finished; } private: - // Common initialization for the constructors. + // Common initialization for the constructors. This can move back into the + // (sole) constructor when we remove the deprecated one in 8.1. void Init(uint32_t flow, const Packet* pkt); friend class session::detail::Timer; diff --git a/src/IPAddr.cc b/src/IPAddr.cc index c22498b22b..d8a777f59d 100644 --- a/src/IPAddr.cc +++ b/src/IPAddr.cc @@ -27,6 +27,8 @@ ConnKey::ConnKey(const ConnTuple& id) { Init(id.src_addr, id.dst_addr, id.src_port, id.dst_port, id.proto, id.is_one_way); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" ConnKey& ConnKey::operator=(const ConnKey& rhs) { if ( this == &rhs ) return *this; @@ -45,6 +47,7 @@ ConnKey& ConnKey::operator=(const ConnKey& rhs) { return *this; } +#pragma GCC diagnostic pop ConnKey::ConnKey(Val* v) { const auto& vt = v->GetType(); diff --git a/src/IPAddr.h b/src/IPAddr.h index 8e71010e98..341b1cc583 100644 --- a/src/IPAddr.h +++ b/src/IPAddr.h @@ -25,6 +25,7 @@ constexpr uint16_t INVALID_CONN_KEY_IP_PROTO = 65534; class HashKey; +// Deprecated: Remove the whole class in v8.1. Switch usage to the conntuple factories and the new zeek::ConnKey tree. class ConnKey { public: in6_addr ip1; @@ -33,10 +34,12 @@ public: uint16_t port2 = 0; uint16_t transport = INVALID_CONN_KEY_IP_PROTO; - ConnKey(const IPAddr& src, const IPAddr& dst, uint16_t src_port, uint16_t dst_port, uint16_t proto, bool one_way); - ConnKey(const ConnTuple& conn); - ConnKey(const ConnKey& rhs) { *this = rhs; } - ConnKey(Val* v); + [[deprecated("Remove in v8.1: Switch to new conn_key framework")]] ConnKey(const IPAddr& src, const IPAddr& dst, + uint16_t src_port, uint16_t dst_port, + uint16_t proto, bool one_way); + [[deprecated("Remove in v8.1: Switch to new conn_key framework")]] ConnKey(const ConnTuple& conn); + [[deprecated("Remove in v8.1: Switch to new conn_key framework")]] ConnKey(const ConnKey& rhs) { *this = rhs; } + [[deprecated("Remove in v8.1: Switch to new conn_key framework")]] ConnKey(Val* v); // FIXME: This is getting reworked as part of the connection tuple changes. Suppress // the clang-tidy warning for the time being.