Skip to content

Commit

Permalink
Core: fix early processing termination of NetFlow/IPFIX Parser when a…
Browse files Browse the repository at this point in the history
… slow stop is triggered by an Input plugin

When a slow stop was triggered by an input plugin (for example, when End-of-file has been reached)
it also immediatelly disabled data processing (i.e. IPFIX, Session) by the following NetFlow/IPFIX
message parser and therefore some messeges in the input queue were unprocessed/ignored.
  • Loading branch information
Lukas955 committed Apr 26, 2020
1 parent 7715585 commit 14d6b6f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
17 changes: 13 additions & 4 deletions src/core/configurator/configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ ipx_configurator::termination_handle(const struct ipx_cpipe_req &req, ipx_contro
// First of all, check if termination process has been completed
if (req.type == IPX_CPIPE_TYPE_TERM_DONE) {
if (m_state != STATUS::STOP_SLOW && m_state != STATUS::STOP_FAST) {
IPX_ERROR(comp_str, "Got a termination done notification, but the termination process "
"is not in progress!", '\0');
IPX_ERROR(comp_str, "[internal] Got a termination done notification, but the "
"termination process is not in progress!", '\0');
return false;
}

Expand Down Expand Up @@ -473,6 +473,7 @@ ipx_configurator::termination_stop_all()
{
for (auto &it : m_running_inputs) {
it->set_processing(false);
it->set_parser_processing(false);
};
for (auto &it : m_running_inter) {
it->set_processing(false);
Expand Down Expand Up @@ -508,8 +509,16 @@ ipx_configurator::termination_stop_partly(const ipx_ctx_t *ctx)
it->set_processing(false);
}

if (ctx_info->type == IPX_PT_INPUT || ctx_info == &ipx_plugin_parser_info) {
// The termination has been invoked by an input plugin or its message parser
if (ctx_info->type == IPX_PT_INPUT) {
return;
}

// Stop all NetFlow/IPFIX message parsers
for (auto &it : m_running_inputs) {
it->set_parser_processing(false);
}

if (ctx_info == &ipx_plugin_parser_info) {
return;
}

Expand Down
6 changes: 6 additions & 0 deletions src/core/configurator/instance_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,11 @@ void
ipx_instance_input::set_processing(bool en)
{
ipx_ctx_processing_set(_ctx, en);

}

void
ipx_instance_input::set_parser_processing(bool en)
{
ipx_ctx_processing_set(_parser_ctx, en);
}
15 changes: 14 additions & 1 deletion src/core/configurator/instance_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,26 @@ class ipx_instance_input : public ipx_instance {
extensions_resolve(ipx_cfg_extensions *ext_mgr) override;

/**
* \brief Enable/disable processing of data messages (IPFIX and Transport Session)
* \brief Enable/disable processing of data messages by the plugin (IPFIX and Transport Session)
*
* \warning This doesn't affect NetFlow/IPFIX Message parser, see set_parser_processing()
* \note By default, data processing is enabled.
* \see ipx_ctx_processing() for more details
* \param[in] en Enable/disable processing
*/
void
set_processing(bool en) override;

/**
* \brief Enable/disable processing of data messages by the parser (IPFIX and Transport Session)
*
* \warning This doesn't affect the input plugin, see set_processing()
* \note By default, data processing is enabled.
* \see ipx_ctx_processing() for more details
* \param[in] en Enable/disable processing
*/
void
set_parser_processing(bool en);
};

#endif //IPFIXCOL_INSTANCE_INPUT_HPP

0 comments on commit 14d6b6f

Please sign in to comment.