Skip to content

Commit

Permalink
bugfix: reading PSAMPLE header length
Browse files Browse the repository at this point in the history
  • Loading branch information
sflow committed Sep 27, 2024
1 parent b5a7ef1 commit a2824f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Linux/mod_psample.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ extern "C" {
myLog(LOG_ERR, "processNetlink_PSAMPLE attr parse error");
break;
}
u_char *datap = msg + offset + NLA_HDRLEN;
u_char *datap = UTNLA_DATA(ps_attr);
int datalen = UTNLA_PAYLOAD(ps_attr);

switch(ps_attr->nla_type) {
// TODO: interpret PSAMPLE_ATTR_PROTO
case PSAMPLE_ATTR_IIFINDEX: psmp.ifin = *(uint16_t *)datap; break;
Expand All @@ -255,7 +257,7 @@ extern "C" {
case PSAMPLE_ATTR_SAMPLE_RATE: psmp.sample_n = *(uint32_t *)datap; break;
case PSAMPLE_ATTR_DATA:
psmp.hdr = datap;
psmp.hdr_len = ps_attr->nla_len;
psmp.hdr_len = datalen;
break;
case HSP_PSAMPLE_ATTR_OUT_TC:
{
Expand Down

0 comments on commit a2824f3

Please sign in to comment.