From: Emeric Brun Date: Fri, 18 Nov 2022 13:52:54 +0000 (+0100) Subject: BUG/MEDIUM: peers: messages about unkown tables not correctly ignored X-Git-Tag: v2.7-dev9~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0909f62266;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: peers: messages about unkown tables not correctly ignored Table defintion's messages and update messages are not correctly ignored if the table is not configured on the local peer. It is a bug because, receiving those messages, the parser returns an error and the upper layer considers that the state of the peer's connection is modified (as it is done in the case of protocol error) and switch immediatly the automate to process the new state. But, even if message is silently ignored because the connection's state doesn't change and we continue to process the next message, some processing remains not performed: for instance the ALIVE flag is not set on the peer's connection as it should be done after receiving any valid messages. This results in a shutdown of the connection when timeout is elapsed as if no message has been received during this delay. This patch fix the behavior, those messages are now silently ignored and the upper layer continue the processing as it is done for any valid messages. This bug appears with the code re-work of the peers on 2.0 so it should be backported until this version. --- diff --git a/src/peers.c b/src/peers.c index f9dabf7c0a..1644728a5c 100644 --- a/src/peers.c +++ b/src/peers.c @@ -2043,14 +2043,10 @@ static int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt, HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock); stktable_touch_remote(st->table, ts, 1); - TRACE_LEAVE(PEERS_EV_UPDTMSG, NULL, p); - return 1; ignore_msg: - /* skip consumed message */ - co_skip(sc_oc(sc), totl); - TRACE_DEVEL("leaving in error", PEERS_EV_UPDTMSG); - return 0; + TRACE_LEAVE(PEERS_EV_UPDTMSG, NULL, p); + return 1; malformed_unlock: /* malformed message */ @@ -2328,11 +2324,9 @@ static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p, p->remote_table->remote_data = table_data; p->remote_table->remote_id = table_id; - return 1; ignore_msg: - co_skip(sc_oc(sc), totl); - return 0; + return 1; malformed_exit: /* malformed message */