mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
BUG/MEDIUM: log: fix config parse error logging on stdout/stderr or any raw fd
The regression was introduced by commit previous commit 94aab06: MEDIUM: log: support tcp or stream addresses on log lines. This previous patch tries to retrieve the used protocol parsing the address using the str2sa_range function but forgets that the raw file descriptor adresses don't specify a protocol and str2sa_range probes an error. This patch re-work the str2sa_range function to stop probing error if an authorized RAW_FD address is parsed whereas the caller request also a protocol. It also modify the code of parse_logsrv to switch on stream logservers only if a protocol was detected.
This commit is contained in:
parent
94aab06e24
commit
26754901e9
@ -1051,7 +1051,7 @@ int parse_logsrv(char **args, struct list *logsrvs, int do_del, const char *file
|
||||
set_host_port(&logsrv->addr, SYSLOG_PORT);
|
||||
}
|
||||
|
||||
if (proto->ctrl_type == SOCK_STREAM) {
|
||||
if (proto && proto->ctrl_type == SOCK_STREAM) {
|
||||
static unsigned long ring_ids;
|
||||
|
||||
/* Implicit sink buffer will be
|
||||
|
@ -1218,7 +1218,8 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int
|
||||
|
||||
if (proto || (opts & PA_O_CONNECT)) {
|
||||
/* Note: if the caller asks for a proto, we must find one,
|
||||
* except if we return with an fqdn that will resolve later,
|
||||
* except if we inherit from a raw FD (family == AF_CUST_EXISTING_FD)
|
||||
* orif we return with an fqdn that will resolve later,
|
||||
* in which case the address is not known yet (this is only
|
||||
* for servers actually).
|
||||
*/
|
||||
@ -1226,7 +1227,7 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int
|
||||
sock_type == SOCK_DGRAM,
|
||||
ctrl_type == SOCK_DGRAM);
|
||||
|
||||
if (!new_proto && (!fqdn || !*fqdn)) {
|
||||
if (!new_proto && (!fqdn || !*fqdn) && (ss.ss_family != AF_CUST_EXISTING_FD)) {
|
||||
memprintf(err, "unsupported protocol family %d for address '%s'", ss.ss_family, str);
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user