BUG/MEDIUM: peers: Fix update message parsing during a full resync

The commit 590c5ff2e ("MEDIUM: peers: No longer ack updates during a full
resync") introduced a regression. During a full resync, the ID of an update
message is not parsed at all. Thus, the parsing of the whole message in
desynchronized.

On full resync the update id itself is ignored, to not be acked, but it must
be parsed. It is now fixed.

It is a 3.3-specific bug, no backport needed.
This commit is contained in:
Christopher Faulet 2025-11-07 12:47:31 +01:00
parent ecc2c3a35d
commit f12252c7a5

View file

@ -1811,21 +1811,20 @@ int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt, int ex
expire = MS_TO_TICKS(table->expire);
if (p->learnstate != PEER_LR_ST_PROCESSING) {
if (updt) {
if (msg_len < sizeof(update)) {
TRACE_ERROR("malformed update message: message too small", PEERS_EV_SESS_IO|PEERS_EV_RX_MSG|PEERS_EV_PROTO_ERR, appctx, p, st);
goto malformed_exit;
}
if (updt) {
if (msg_len < sizeof(update)) {
TRACE_ERROR("malformed update message: message too small", PEERS_EV_SESS_IO|PEERS_EV_RX_MSG|PEERS_EV_PROTO_ERR, appctx, p, st);
goto malformed_exit;
}
memcpy(&update, *msg_cur, sizeof(update));
*msg_cur += sizeof(update);
st->last_get = htonl(update);
}
else {
st->last_get++;
}
memcpy(&update, *msg_cur, sizeof(update));
*msg_cur += sizeof(update);
}
else
update = st->last_get + 1;
if (p->learnstate != PEER_LR_ST_PROCESSING)
st->last_get = htonl(update);
if (exp) {
size_t expire_sz = sizeof expire;