]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: startup: load and parse configs from memory
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 7 Aug 2024 14:53:50 +0000 (16:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Aug 2024 16:41:41 +0000 (18:41 +0200)
commit5b52df4c4d05ddcbcfdec9792520d2495614547c
tree2dcae8516d60e21d404137025843bf869568e334
parent2bb34edb0b17040d6bfc40715f94b7f434c0fdd9
MEDIUM: startup: load and parse configs from memory

Let's call load_cfg_in_ram() helper for each configuration file to load it's
content in some area in memory. Adapt readcfgfile() parser function
respectively. In order to limit changes in its scope we give as an argument a
cfgfile structure, already filled in init_args() and in load_cfg_in_ram() with
file metadata and content.

Parser function (readcfgfile()) uses now fgets_from_mem() instead of standard
fgets from libc implementations.

SPOE filter parses its own configuration file, pointed by 'config' keyword in
the configuration already loaded in memory. So, let's allocate and fill for
this a supplementary cfgfile structure, which is not referenced in cfg_cfgfiles
list. This structure and the memory with content of SPOE filter configuration
are freed immediately in parse_spoe_flt(), when readcfgfile() returns.

HAProxy OpenTracing filter also uses its own configuration file. So, let's
follow the same logic as we do for SPOE filter.
addons/ot/src/parser.c
include/haproxy/cfgparse.h
src/cfgparse.c
src/flt_spoe.c
src/haproxy.c