Skip to content

Commit

Permalink
net/sched: act_ct: Fix byte count on fragmented packets
Browse files Browse the repository at this point in the history
First fragmented packets (frag offset = 0) byte len is zeroed
when stolen by ip_defrag(). And since act_ct update the stats
only afterwards (at end of execute), bytes aren't correctly
accounted for such packets.

To fix this, move stats update to start of action execute.

Fixes: b57dc7c ("net/sched: Introduce action ct")
Signed-off-by: Paul Blakey <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Paul Blakey authored and davem330 committed Oct 18, 2021
1 parent 342afce commit 2dc4e9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sched/act_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a,
tmpl = p->tmpl;

tcf_lastuse_update(&c->tcf_tm);
tcf_action_update_bstats(&c->common, skb);

if (clear) {
qdisc_skb_cb(skb)->post_ct = false;
Expand Down Expand Up @@ -1049,7 +1050,6 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a,

qdisc_skb_cb(skb)->post_ct = true;
out_clear:
tcf_action_update_bstats(&c->common, skb);
if (defrag)
qdisc_skb_cb(skb)->pkt_len = skb->len;
return retval;
Expand Down

0 comments on commit 2dc4e9e

Please sign in to comment.