Skip to content

Commit

Permalink
Cleanup grammar.y with useless rule
Browse files Browse the repository at this point in the history
  • Loading branch information
phaag committed Dec 3, 2023
1 parent 295f514 commit 2fd5df7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/lib/grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -1327,14 +1327,7 @@ term: ANY { /* this is an unconditionally true expression, as a filter applies i
}
$$.self = NewBlock(OffsetPayload, 0, 0, CMP_PAYLOAD, FUNC_NONE, $3);
}

| PAYLOAD CONTENT STRING {
if (strlen($3)>64) {
yyerror("word too long");
YYABORT;
}
$$.self = NewBlock(OffsetPayload, 0, 0, CMP_PAYLOAD, FUNC_NONE, $3);
}


| PAYLOAD REGEX STRING {
if (strlen($3)>64) {
Expand Down
11 changes: 10 additions & 1 deletion src/sflow/sflow_nfdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,16 @@ void StoreSflowRecord(SFSample *sample, FlowSource_t *fs) {
if (printRecord) {
flow_record_short(stdout, recordHeader);
}

#ifdef DEVEL
printf("OffsetToPayload %d\n", sample->offsetToPayload);
void *p = (void *)sample->header + sample->offsetToPayload;
ssize_t len = sample->headerLen - sample->offsetToPayload;
dbg_printf("Payload length: %zd\n", len);
if (len > 0) {
dbg_printf("Payload length: %zd\n", len);
DumpHex(stdout, p, len);
}
#endif
// update file record size ( -> output buffer size )
fs->nffile->block_header->NumRecords++;
fs->nffile->block_header->size += recordHeader->size;
Expand Down
1 change: 1 addition & 0 deletions src/sflow/sflow_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ static void decodeIPLayer4(SFSample *sample, uint8_t *ptr) {
sample->offsetToPayload = ptr - sample->header;
break;
}

} // End of decodeIPLayer4

/*_________________---------------------------__________________
Expand Down

0 comments on commit 2fd5df7

Please sign in to comment.