]> git.ipfire.org Git - thirdparty/linux.git/commit
ipvs: adjust double hashing when fwd method changes
authorJulian Anastasov <ja@ssi.bg>
Mon, 13 Jul 2026 11:52:33 +0000 (19:52 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 23 Jul 2026 15:59:20 +0000 (17:59 +0200)
commit712d2993bea555f1f09cd53cbdb25714f28e85db
treed10332b9fe400e7b840c3deb64da742f6e46003d
parenta63d2dbaeb50a85d4c976b15a36e6b0c7113db5b
ipvs: adjust double hashing when fwd method changes

Synced conns can be created with one forwarding method
and later updated with different one after the dest
server is configured. This needs adjusting the hashing
for node hn1 because only MASQ supports double hashing.

Modify conn_tab_lock() to support seeking for hash node
hn0 together with adding for hn1. By this way we can
safely modify the forwarding method and hn1.hash_key
under bucket lock for the first node hn0. The forwarding
method is also protected by cp->lock as it is part of
cp->flags.

Fix the usage of stale idx/idx2 values in conn_tab_lock
after jumping to the retry label. Instead, use idx/idx2
values just to order the locking for the old/new tables.

Reported-by: Zhiling Zou <roxy520tt@gmail.com>
Link: https://patch.msgid.link/1b914f41d725bc064c9ba9830dc8169329737270.1782540466.git.roxy520tt@gmail.com/
Link: https://sashiko.dev/#/patchset/CALMqdkR704S2BG_QD_bgHTFp2%2B1QCi7n0T4zoZyTo8mDZevYSA%40mail.gmail.com
Fixes: f20c73b0460d ("ipvs: use more keys for connection hashing")
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/ipvs/ip_vs_conn.c