ipvs: properly update the overload flag on dest edit
authorJulian Anastasov <ja@ssi.bg>
Fri, 31 Jul 2026 14:27:42 +0000 (22:27 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 10 Aug 2026 18:14:54 +0000 (20:14 +0200)
commit8f843441c4e7eae8ea83491e8c203c2b192edcf5
treeacd6773a14116540b449f6ecc0c8fac6aae66589
parent04d2feaed8d0103c498727191ba04001d5100e67
ipvs: properly update the overload flag on dest edit

The upper/lower connection thresholds for dest can be changed,
so use ip_vs_dest_update_overload() to properly update the
dest overload flag.

The thresholds were not limited, fit them in the 0 .. INT_MAX
range as already done in ipvsadm.

As the thresholds are also read when connections are created
and expired, use WRITE_ONCE/READ_ONCE to access them.

As the lower threshold is optional, use (u - (u >> 2)) to
calculate the 75% default value based on the upper threshold
by preserving the integer rounding, as suggested by Yizhou Zhao.

Trigger flag update when totalconns reaches one of the
thresholds and use dst_lock to serialize the updating.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/ip_vs.h
net/netfilter/ipvs/ip_vs_conn.c
net/netfilter/ipvs/ip_vs_ctl.c