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

Error message when key/nonkey configuration doesn't match actual behaviour #114

Merged
merged 1 commit into from
Sep 10, 2018
Merged
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
9 changes: 9 additions & 0 deletions src/modules/ipfix/aggregator/AggregatorBaseCfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "Rules.hpp"
#include "core/XMLElement.h"
#include "core/InfoElementCfg.h"
#include "BaseHashtable.h"

AggregatorBaseCfg::AggregatorBaseCfg(XMLElement* elem)
: CfgBase(elem), pollInterval(0)
Expand Down Expand Up @@ -140,6 +141,10 @@ Rule::Field* AggregatorBaseCfg::readNonFlowKeyRule(XMLElement* e)
ruleField->semantic = ie.getSemantic();
ruleField->fieldIe = ie.getFieldIe();

if (!BaseHashtable::isToBeAggregated(ruleField->type)) {
msg(LOG_ERR, "Field %s configured as nonFlowKey will not be aggregated", ie.getIeName().c_str());
}

if (ie.getAutoAddV4PrefixLength() &&
(ruleField->type == InformationElement::IeInfo(IPFIX_TYPEID_sourceIPv4Address, 0) ||
ruleField->type == InformationElement::IeInfo(IPFIX_TYPEID_destinationIPv4Address, 0))) {
Expand Down Expand Up @@ -178,6 +183,10 @@ Rule::Field* AggregatorBaseCfg::readFlowKeyRule(XMLElement* e) {
ruleField->type.enterprise = ie.getEnterpriseNumber();
ruleField->type.length = ie.getIeLength();

if (BaseHashtable::isToBeAggregated(ruleField->type)) {
msg(LOG_ERR, "Field %s configured as FlowKey will be aggregated", ie.getIeName().c_str());
}

if (ie.getAutoAddV4PrefixLength() &&
(ruleField->type.id == IPFIX_TYPEID_sourceIPv4Address || ruleField->type.id == IPFIX_TYPEID_destinationIPv4Address)) {
ruleField->type.length++; // for additional mask field
Expand Down
3 changes: 2 additions & 1 deletion src/modules/ipfix/aggregator/BaseHashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class BaseHashtable : public Sensor
*/
void postReconfiguration();

static int isToBeAggregated(InformationElement::IeInfo& type);

protected:
/**
* contains needed data elements when FPA or DPA is performed for PacketHashtable
Expand Down Expand Up @@ -153,7 +155,6 @@ class BaseHashtable : public Sensor

alock_t aggInProgress; /** indicates if currently an element is aggregated in the hashtable, used for atomic lock for preReconfiguration */

int isToBeAggregated(InformationElement::IeInfo& type);
HashtableBucket* createBucket(boost::shared_array<IpfixRecord::Data> data, uint32_t obsdomainid,
HashtableBucket* next, HashtableBucket* prev, uint32_t hash, time_t now);
void exportBucket(HashtableBucket* bucket);
Expand Down