BUG/MEDIUM: ring: fix too lax 'size' parser

It took me a while to figure why a ring declared with "size 1M" was causing
strange effects in a ring, it's just because it's parsed as "1", which is
smaller than the default 16384 size and errors are silently ignored.

This commit tries to address this the best possible way without breaking
existing configs that would work by accident, by warning that the size is
ignored if it's smaller than the current one, and by printing the parsed
size instead of the input string in warnings and errors. This way if some
users have "size 10000" or "size 100k" it will continue to work as 16kB
like today but they will now be aware of it.

In addition the error messages were a bit poor in context in that they
only provided line numbers. The ring name was added to ease locating the
problem.

As the issue was present since day one and was introduced in 2.2 with
commit 99c453df9d ("MEDIUM: ring: new section ring to declare custom ring
buffers."), it could make sense to backport this as far as 2.2, but with
2.2 being quite old now it doesn't seem very reasonable to start emitting
new config warnings in config that apparently worked well.

Thus it looks more reasonable to backport this as far as 2.4.

(cherry picked from commit 18d1306abd6578f2d955f67578ff2458795bba95)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 7bba3fa3083bc588bb5db4cbfde4475145984edc)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 830445f66bed05884647dcdc2192789b26274f61)
Signed-off-by: Willy Tarreau <w@1wt.eu>
1 file changed