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.
This commit is contained in:
Emeric Brun 2022-11-18 14:52:54 +01:00 committed by Willy Tarreau
parent cdad1c3365
commit 0909f62266

View File

@ -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 */