From: Emeric Brun Date: Mon, 16 Mar 2020 09:51:01 +0000 (+0100) Subject: BUG/MEDIUM: peers: resync ended with RESYNC_PARTIAL in wrong cases. X-Git-Tag: v2.2-dev5~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70de43b77b10c6868b1ed42ac5439731ae6fa911;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: peers: resync ended with RESYNC_PARTIAL in wrong cases. This bug was introduced with peers.c code re-work (7d0ceeec80): "struct peer" flags are mistakenly checked instead of "struct peers" flags to check the resync status of the local peer. The issue was reported here: https://github.com/haproxy/haproxy/issues/545 This bug affects all branches >= 2.0 and should be backported. --- diff --git a/src/peers.c b/src/peers.c index 640a99f5e9..3bed8a6221 100644 --- a/src/peers.c +++ b/src/peers.c @@ -1027,13 +1027,13 @@ static inline int peer_send_resync_confirmsg(struct appctx *appctx) * any other negative returned value must be considered as an error with an appctx st0 * returned value equal to PEER_SESS_ST_END. */ -static inline int peer_send_resync_finishedmsg(struct appctx *appctx, struct peer *peer) +static inline int peer_send_resync_finishedmsg(struct appctx *appctx, struct peers *peers) { struct peer_prep_params p = { .control.head = { PEER_MSG_CLASS_CONTROL, }, }; - p.control.head[1] = (peer->flags & PEERS_RESYNC_STATEMASK) == PEERS_RESYNC_FINISHED ? + p.control.head[1] = (peers->flags & PEERS_RESYNC_STATEMASK) == PEERS_RESYNC_FINISHED ? PEER_MSG_CTRL_RESYNCFINISHED : PEER_MSG_CTRL_RESYNCPARTIAL; return peer_send_msg(appctx, peer_prepare_control_msg, &p); @@ -1950,7 +1950,7 @@ static inline int peer_send_msgs(struct appctx *appctx, struct peer *peer) } if ((peer->flags & PEER_F_TEACH_PROCESS) && !(peer->flags & PEER_F_TEACH_FINISHED)) { - repl = peer_send_resync_finishedmsg(appctx, peer); + repl = peer_send_resync_finishedmsg(appctx, peers); if (repl <= 0) return repl;