Skip to content

Commit e2769f1

Browse files
committed
NetFlow converter: now ignores unknown FlowSets, added more unit tests
1 parent 18693ee commit e2769f1

File tree

4 files changed

+740
-155
lines changed

4 files changed

+740
-155
lines changed

src/core/netflow2ipfix/netflow9.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ conv_process_dset(ipx_nf9_conv_t *conv, const struct ipx_nf9_set_hdr *flowset_hd
10421042
size_t hdr_offset = conv_mem_pos_get(conv);
10431043
conv_mem_commit(conv, FDS_IPFIX_SET_HDR_LEN);
10441044

1045-
// Convert all records in the Template Set
1045+
// Convert all records in the Data Set
10461046
uint16_t rec_processed = 0;
10471047
struct ipx_nf9_dset_iter it;
10481048
ipx_nf9_dset_iter_init(&it, flowset_hdr, tmplt->nf9_drec_len);
@@ -1132,8 +1132,8 @@ conv_process_msg(ipx_nf9_conv_t *conv, const struct ipx_nf9_msg_hdr *nf9_msg, ui
11321132
rc_conv = conv_process_tset(conv, it.set);
11331133
} else {
11341134
// Unknown FlowSet ID // TODO: skip unknown
1135-
CONV_ERROR(conv, "Unknown FlowSet ID %" PRIu16, flowset_id);
1136-
rc_conv = IPX_ERR_FORMAT;
1135+
CONV_INFO(conv, "Ignoring FlowSet with unsupported ID %" PRIu16, flowset_id);
1136+
rc_conv = IPX_OK;
11371137
}
11381138
}
11391139

src/core/netflow2ipfix/netflow9_parsers.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ static const char *err_msg[] = {
4343
[ERR_SETS_LONG] = "Total length of the FlowSet is longer than its enclosing NetFlow v9 "
4444
"Message.",
4545
// Data FlowSet iterator
46-
[ERR_DSET_EMPTY] = "A DataFlow Set must not be empty. At least one record must be present.",
46+
[ERR_DSET_EMPTY] = "A DataFlow Set is empty or contains a malformed record (shorted that "
47+
"described in its particular template). At least one valid record must be present.",
4748
// (Options) Template FlowSet iterator
4849
[ERR_TSET_EMPTY] = "An (Options) Template FlowSet must not be empty. At least one record must "
4950
"be present.",
@@ -137,7 +138,7 @@ ipx_nf9_dset_iter_init(struct ipx_nf9_dset_iter *it, const struct ipx_nf9_set_hd
137138
it->_private.err_msg = err_msg[ERR_OK];
138139

139140
if (it->_private.rec_next + rec_size > it->_private.set_end) {
140-
// Empty set is not valid (see RFC 3954, Section 2, FlowSet)
141+
// Empty set is not valid (see RFC 3954, Section 2, Data FlowSet)
141142
it->_private.flags |= IPX_NF9_DSET_ITER_FAILED;
142143
it->_private.err_msg = err_msg[ERR_DSET_EMPTY];
143144
}

0 commit comments

Comments
 (0)