Skip to content

Commit

Permalink
tc config - make sure sampling happens before ACLs are applied
Browse files Browse the repository at this point in the history
  • Loading branch information
sflow committed Mar 18, 2021
1 parent 0c9a495 commit fe456f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Linux/mod_dent.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ extern "C" {
static bool setRate(EVMod *mod, SFLAdaptor *adaptor, uint32_t logGroup, uint32_t sampling_n, bool egress) {
// examples:
// tc qdisc add dev eth0 clsact
// tc filter add dev eth0 ingress matchall skip_sw action sample rate 1000 group 1
// tc filter add dev eth0 ingress pref 1 matchall skip_sw action sample rate 1000 group 1 trunc 128
HSP *sp = (HSP *)EVROOTDATA(mod);
bool sampling_ok = NO;
UTStringArray *cmdline = strArrayNew();
Expand All @@ -172,6 +172,11 @@ extern "C" {
strArrayAdd(cmdline, "dev");
strArrayAdd(cmdline, adaptor->deviceName);
strArrayAdd(cmdline, egress ? "egress" : "ingress");
// Sampling should happen before ingress ACLs, so ask for preference/priority 1.
// For egress the ACLs have already been applied, but it still seems more stable
// and consistent to request pref 1.
strArrayAdd(cmdline, "pref");
strArrayAdd(cmdline, "1");
strArrayAdd(cmdline, "matchall");
if(sp->dent.sw == NO)
strArrayAdd(cmdline, "skip_sw");
Expand Down

0 comments on commit fe456f4

Please sign in to comment.