]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: peers: prevent learning expiration too far in futur from unsync node
authorEmeric Brun <ebrun@haproxy.com>
Thu, 3 Apr 2025 08:32:30 +0000 (10:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 3 Apr 2025 09:26:29 +0000 (11:26 +0200)
This patch sets the expire of the entry to the max value in
configuration if the value showed in the peer update message
is too far in futur.

This should be backported an all supported branches.

src/peers.c

index e4ac52b22aabca01fd1de2271a275ca8518ce633..40fc0e53c862d54fec0f0fc0509a8d942b9bd9bc 100644 (file)
@@ -1740,6 +1740,9 @@ static int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt,
                memcpy(&expire, *msg_cur, expire_sz);
                *msg_cur += expire_sz;
                expire = ntohl(expire);
+               /* Protocol contains expire in MS, check if value is less than table config */
+               if (expire > table->expire)
+                       expire = table->expire;
                /* the rest of the code considers expire as ticks and not MS */
                expire = MS_TO_TICKS(expire);
        }