Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ctt #245

Open
wants to merge 2 commits into
base: ctt-support
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ ipfixprobe_storage_src=\
storage/fragmentationCache/fragmentationCache.cpp \
storage/cache.cpp \
storage/cache.hpp \
storage/cacheOptParser.hpp \
storage/cacheOptParser.cpp \
storage/flowRecord.hpp \
storage/flowRecord.cpp \
storage/cttController.hpp \
storage/cttController.cpp \
storage/cacheRowSpan.hpp \
storage/cacheRowSpan.cpp \
storage/xxhash.c \
storage/xxhash.h

Expand Down
3 changes: 0 additions & 3 deletions include/ipfixprobe/flowifc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,6 @@ struct Flow : public Record {

#ifdef WITH_CTT
uint64_t flow_hash_ctt; /**< Flow hash for CTT. */
bool record_in_ctt; /**< CTT - offload or not. */
bool is_delayed; /**< Delayed export flag. */
time_t delay_time; /**< Time until export of the flow is delayed. */
#endif

PluginsStatus plugins_status; /**< Statuses of the process plugins for this flow, used to check
Expand Down
15 changes: 9 additions & 6 deletions include/ipfixprobe/packet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ namespace ipxp {
* \brief Structure for storing parsed packet fields
*/
struct Packet : public Record {
#ifdef WITH_CTT
Metadata_CTT cttmeta; /**< Metadata from CTT */
bool cttmeta_valid; /**< True if CTT metadata is valid */
#endif /* WITH_CTT */
struct timeval ts;
timeval ts;

uint8_t dst_mac[6];
uint8_t src_mac[6];
Expand Down Expand Up @@ -106,12 +102,16 @@ struct Packet : public Record {
uint16_t buffer_size; /**< Size of buffer */

bool source_pkt; /**< Direction of packet from flow point of view */
#ifdef WITH_CTT
Metadata_CTT cttmeta; /**< Metadata from CTT */
bool cttmeta_valid; /**< True if CTT metadata is valid */
#endif /* WITH_CTT */

/**
* \brief Constructor.
*/
Packet() :
cttmeta_valid(false), ts({0}),
ts({0}),
dst_mac(), src_mac(), ethertype(0),
ip_len(0), ip_payload_len(0), ip_version(0), ip_ttl(0),
ip_proto(0), ip_tos(0), ip_flags(0), src_ip({0}), dst_ip({0}), vlan_id(0),
Expand All @@ -123,6 +123,9 @@ struct Packet : public Record {
custom(nullptr), custom_len(0),
buffer(nullptr), buffer_size(0),
source_pkt(true)
#ifdef WITH_CTT
,cttmeta_valid(false)
#endif /* WITH_CTT */
{
}
};
Expand Down
13 changes: 5 additions & 8 deletions include/ipfixprobe/storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class StoragePlugin : public Plugin
virtual void export_expired(time_t ts)
{
}

virtual void finish()
{
}
Expand Down Expand Up @@ -133,22 +134,22 @@ class StoragePlugin : public Plugin

/**
* \brief Checks if process plugins require all available data.
* \param [in] rec Stored flow record.
* \param [in] flow Stored flow record.
* \return True if all data required, false otherwise.
*/
bool all_data_required(const Flow& flow) const noexcept
{
return m_plugins_status.get_all_data.any();
return flow.plugins_status.get_all_data.any();
}

/**
* \brief Checks if process plugins don't require any data.
* \param [in] rec Stored flow record.
* \param [in] flow Stored flow record.
* \return True if no data required, false otherwise.
*/
bool no_data_required(const Flow& flow) const noexcept
{
return m_plugins_status.get_no_data.all();
return flow.plugins_status.get_no_data.all();
}

/**
Expand Down Expand Up @@ -189,10 +190,6 @@ class StoragePlugin : public Plugin
*/
int plugins_post_create(Flow& rec, const Packet& pkt)
{
// if metadata are valid, add flow hash ctt to the flow record
if (pkt.cttmeta_valid) {
rec.flow_hash_ctt = pkt.cttmeta.flow_hash;
}
PluginStatusConverter plugin_status_converter(m_plugins_status);
int ret = 0;
for (unsigned int i = 0; i < m_plugin_cnt; i++) {
Expand Down
3 changes: 2 additions & 1 deletion input/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ void parse_packet(parser_opt_t *opt, ParserStats& stats, struct timeval ts, cons
opt->pblock->bytes += len;
}

#ifdef WITH_CTT
int parse_packet_ctt_metadata(parser_opt_t *opt, ParserStats& stats, const Metadata_CTT& metadata, const uint8_t *data, uint16_t len, uint16_t caplen)
{
if (opt->pblock->cnt >= opt->pblock->size) {
Expand Down Expand Up @@ -892,5 +893,5 @@ int parse_packet_ctt_metadata(parser_opt_t *opt, ParserStats& stats, const Metad
opt->pblock->bytes += len;
return 0;
}

#endif /* WITH_CTT */
}
Loading
Loading