Skip to content

Commit e3c9673

Browse files
tammeladavem330
authored andcommitted
net/sched: act_pedit: rate limit datapath messages
Unbounded info messages in the pedit datapath can flood the printk ring buffer quite easily depending on the action created. As these messages are informational, usually printing some, not all, is enough to bring attention to the real issue. Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5771401 commit e3c9673

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

net/sched/act_pedit.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb,
396396
u8 *d, _d;
397397

398398
if (!offset_valid(skb, hoffset + tkey->at)) {
399-
pr_info("tc action pedit 'at' offset %d out of bounds\n",
400-
hoffset + tkey->at);
399+
pr_info_ratelimited("tc action pedit 'at' offset %d out of bounds\n",
400+
hoffset + tkey->at);
401401
goto bad;
402402
}
403403
d = skb_header_pointer(skb, hoffset + tkey->at,
@@ -407,14 +407,13 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb,
407407

408408
offset += (*d & tkey->offmask) >> tkey->shift;
409409
if (offset % 4) {
410-
pr_info("tc action pedit offset must be on 32 bit boundaries\n");
410+
pr_info_ratelimited("tc action pedit offset must be on 32 bit boundaries\n");
411411
goto bad;
412412
}
413413
}
414414

415415
if (!offset_valid(skb, hoffset + offset)) {
416-
pr_info("tc action pedit offset %d out of bounds\n",
417-
hoffset + offset);
416+
pr_info_ratelimited("tc action pedit offset %d out of bounds\n", hoffset + offset);
418417
goto bad;
419418
}
420419

@@ -431,8 +430,7 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb,
431430
val = (*ptr + tkey->val) & ~tkey->mask;
432431
break;
433432
default:
434-
pr_info("tc action pedit bad command (%d)\n",
435-
cmd);
433+
pr_info_ratelimited("tc action pedit bad command (%d)\n", cmd);
436434
goto bad;
437435
}
438436

0 commit comments

Comments
 (0)