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

From: Victor Nogueira

Date: Tue Aug 25 2026 - 13:03:42 EST


On 25/08/2026 13:01, Khawar Ahemad wrote:
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().

This would be a behavioural regression. Users are not expecting that
a replace omitting truncation parameters will silently overwrite their
previous truncation settings. Can you instead create a new netlink
attribute? Something like "TCA_SAMPLE_FLAGS" which might have a
flag telling the action to unset this parameter?
Other option is to interpret 0 as "unset", but that might break
some setups.
Your fixes commit doesn't seem to exist and, since this is a fix,
you should target net and not net-next.
Also remember to wait 24 hours before posting a v2.

cheers,
Victor