mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 16:17:09 +02:00
BUG/MEDIUM: spoe: Resolve the sink if a SPOE logs in a ring buffer
If a SPOE filter is configured to send its logs to a ring buffer, the corresponding sink must be resolved during the configuration post parsing. Otherwise, the sink is undefined when a log message is emitted, crashing HAProxy. This patch must be backported as far as 2.2.
This commit is contained in:
parent
e0724580d3
commit
1d7d0f86b8
@ -28,6 +28,7 @@
|
|||||||
#include <haproxy/sample.h>
|
#include <haproxy/sample.h>
|
||||||
#include <haproxy/session.h>
|
#include <haproxy/session.h>
|
||||||
#include <haproxy/signal.h>
|
#include <haproxy/signal.h>
|
||||||
|
#include <haproxy/sink.h>
|
||||||
#include <haproxy/spoe.h>
|
#include <haproxy/spoe.h>
|
||||||
#include <haproxy/stream.h>
|
#include <haproxy/stream.h>
|
||||||
#include <haproxy/stream_interface.h>
|
#include <haproxy/stream_interface.h>
|
||||||
@ -3021,6 +3022,7 @@ spoe_check(struct proxy *px, struct flt_conf *fconf)
|
|||||||
struct flt_conf *f;
|
struct flt_conf *f;
|
||||||
struct spoe_config *conf = fconf->conf;
|
struct spoe_config *conf = fconf->conf;
|
||||||
struct proxy *target;
|
struct proxy *target;
|
||||||
|
struct logsrv *logsrv;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Check all SPOE filters for proxy <px> to be sure all SPOE agent names
|
/* Check all SPOE filters for proxy <px> to be sure all SPOE agent names
|
||||||
@ -3082,6 +3084,21 @@ spoe_check(struct proxy *px, struct flt_conf *fconf)
|
|||||||
HA_SPIN_INIT(&conf->agent->rt[i].lock);
|
HA_SPIN_INIT(&conf->agent->rt[i].lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_for_each_entry(logsrv, &conf->agent_fe.logsrvs, list) {
|
||||||
|
if (logsrv->type == LOG_TARGET_BUFFER) {
|
||||||
|
struct sink *sink = sink_find(logsrv->ring_name);
|
||||||
|
|
||||||
|
if (!sink || sink->type != SINK_TYPE_BUFFER) {
|
||||||
|
ha_alert("Proxy %s : log server used by SPOE agent '%s' declared"
|
||||||
|
" at %s:%d uses unkown ring named '%s'.\n",
|
||||||
|
px->id, conf->agent->id, conf->agent->conf.file,
|
||||||
|
conf->agent->conf.line, logsrv->ring_name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
logsrv->sink = sink;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(conf->agent->b.name);
|
free(conf->agent->b.name);
|
||||||
conf->agent->b.name = NULL;
|
conf->agent->b.name = NULL;
|
||||||
conf->agent->b.be = target;
|
conf->agent->b.be = target;
|
||||||
|
Loading…
Reference in New Issue
Block a user