]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: log/ring: broken syslog octet counting
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 7 May 2024 14:46:35 +0000 (16:46 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 7 May 2024 17:23:01 +0000 (19:23 +0200)
commitfbbc2925d403dd558ea254d9f57e7e46d39f37aa
tree7113baa1d84fb1802e7448bde54d5e848d14e3b3
parentbd47e344b86f35e828f18ace14027e37ee68e88b
BUG/MEDIUM: log/ring: broken syslog octet counting

As reported by Tristan in GH #2561, syslog messages sent over rings are
malformed since commit 01aa0a05 ("MEDIUM: ring: change the ring reader
to use the new vector-based API now").

Indeed, take a look at the following log message produced prior to
01aa0a05:

  181 <134>1 2024-05-07T09:45:21.543263+02:00 - haproxy 113700 - - 127.0.0.1:56136 [07/May/2024:09:45:21.491] front front/s1 0/0/21/30/51 404 369 - - ---- 1/1/0/0/0 0/0   "GET / HTTP/1.1"

Starting with 01aa0a05, here's the equivalent log message:

  <134>1 2024-05-07T09:45:21.543263+02:00 - haproxy 112729 - - 127.0.0.1:56136 [07/May/2024:09:45:21.491] front front/s1 0/0/66/39/105 404 369 - - ---- 1/1/0/0/0 0/0   "GET / HTTP/1.1"-fwr

-> Message is missing octet counting header, and garbage bytes are found
at the end of the payload.

This bug is caused by a small mistake in syslog_applet_append_event():
when the function was refactored to use vector API instead of buffer
API, we used 'trash.area' as starting pointer to write the event instead
of 'trash.area + trash.data', causing existing octet counting prefix
(already written in trash) to be overwritten and trash.data to be
wrongly incremented.

No backport needed (01aa0a05 was introduced during 3.0 development)
src/log.c