Thread (3 messages) 3 messages, 3 authors, 2026-08-27

[PATCH net-next] net/sched: act_sample: reset truncation settings on action replace

flat view
COLD43d

From: Khawar Ahemad <hidden>
Date: 2026-08-25 16:01:52
Also in: lkml
Subsystem: networking [general], tc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

When replacing an existing sample action, if TCA_SAMPLE_TRUNC_SIZE is not
passed in the netlink request, s->truncate and s->trunc_size retain their
previous values from the prior configuration.

As a result, a user cannot disable packet truncation when replacing a
sample action unless the action is fully deleted and recreated. In
addition, the hardware offload state and netlink dump continue to report
truncation as active.

Fix this by explicitly resetting s->truncate to false and s->trunc_size
to 0 when TCA_SAMPLE_TRUNC_SIZE is omitted during tcf_sample_init().

Fixes: 5c56784d852a ("net/sched: act_sample: add support for packet truncation")
Signed-off-by: Khawar Ahemad <redacted>
---
 net/sched/act_sample.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 2ceb4d141b..2bdc7a0eb6 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -116,6 +116,9 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
 	if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
 		s->truncate = true;
 		s->trunc_size = nla_get_u32(tb[TCA_SAMPLE_TRUNC_SIZE]);
+	} else {
+		s->truncate = false;
+		s->trunc_size = 0;
 	}
 	spin_unlock_bh(&s->tcf_lock);
 
-- 
2.54.0 (Apple Git-157)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help