Skip to content

Commit

Permalink
* fix, nfprobe: serialize_bin() introduced for custom primitives with…
Browse files Browse the repository at this point in the history
… 'raw' semantics.
  • Loading branch information
paololucente committed Dec 20, 2018
1 parent c3d6ebc commit e1206a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
26 changes: 20 additions & 6 deletions src/nfprobe_plugin/netflow9.c
Expand Up @@ -544,10 +544,17 @@ flow_to_flowset_cp_handler(char *flowset, const struct FLOW *flow, int idx, int

if (!cp_entry->ptr->pen) {
if (cp_entry->ptr->len != PM_VARIABLE_LENGTH) {
if (flow->pcust[idx] && cp_entry->ptr->field_type)
memcpy(flowset, (flow->pcust[idx]+cp_entry->off), cp_entry->ptr->len);
else
if (flow->pcust[idx] && cp_entry->ptr->field_type) {
if (cp_entry->ptr->semantics == CUSTOM_PRIMITIVE_TYPE_RAW) {
serialize_bin((flow->pcust[idx] + cp_entry->off), flowset, strlen((flow->pcust[idx] + cp_entry->off)));
}
else {
memcpy(flowset, (flow->pcust[idx] + cp_entry->off), cp_entry->ptr->len);
}
}
else {
memset(flowset, 0, cp_entry->ptr->len);
}

flowset += cp_entry->ptr->len;
}
Expand Down Expand Up @@ -589,10 +596,17 @@ flow_to_flowset_cp_pen_handler(char *flowset, const struct FLOW *flow, int idx,

if (config.nfprobe_version == 10 && cp_entry->ptr->pen) {
if (cp_entry->ptr->len != PM_VARIABLE_LENGTH) {
if (flow->pcust[idx] && cp_entry->ptr->field_type)
memcpy(flowset, (flow->pcust[idx]+cp_entry->off), cp_entry->ptr->len);
else
if (flow->pcust[idx] && cp_entry->ptr->field_type) {
if (cp_entry->ptr->semantics == CUSTOM_PRIMITIVE_TYPE_RAW) {
serialize_bin((flow->pcust[idx] + cp_entry->off), flowset, strlen((flow->pcust[idx] + cp_entry->off)));
}
else {
memcpy(flowset, (flow->pcust[idx] + cp_entry->off), cp_entry->ptr->len);
}
}
else {
memset(flowset, 0, cp_entry->ptr->len);
}

flowset += cp_entry->ptr->len;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pmacct-build.h
@@ -1 +1 @@
#define PMACCT_BUILD "20181219-00"
#define PMACCT_BUILD "20181220-00"

0 comments on commit e1206a5

Please sign in to comment.