MINOR: log-forward: use str2receiver() to parse the dgram-bind address
Thanks to this we don't need to specify "udp@" as it's implicitly a
datagram type listener that is expected, so any AF_INET/AF_INET4 address
will work.
diff --git a/doc/configuration.txt b/doc/configuration.txt
index ce7bdf1..3757a50 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -2752,10 +2752,10 @@
dgram-bind <addr> [param*]
Used to configure a UDP log listener to receive messages to forward. Only UDP
- listeners are allowed, the address must be prefixed using "udp@", "udp4@" or
- "udp6@". This supports for some of the "bind" parameters found in 5.1
- paragraph among which "interface", "namespace" or "transparent", the other
- ones being silently ignored as irrelevant for UDP/syslog case.
+ listeners are allowed. Addresses must be in IPv4 or IPv6 form,followed by a
+ port. This supports for some of the "bind" parameters found in 5.1 paragraph
+ among which "interface", "namespace" or "transparent", the other ones being
+ silently ignored as irrelevant for UDP/syslog case.
log global
log <address> [len <length>] [format <format>] [sample <ranges>:<smp_size>]
diff --git a/src/log.c b/src/log.c
index 8e4606a..ee99870 100644
--- a/src/log.c
+++ b/src/log.c
@@ -3625,7 +3625,7 @@
bind_conf = bind_conf_alloc(cfg_log_forward, file, linenum,
NULL, xprt_get(XPRT_RAW));
- if (!str2listener(args[1], cfg_log_forward, bind_conf, file, linenum, &errmsg)) {
+ if (!str2receiver(args[1], cfg_log_forward, bind_conf, file, linenum, &errmsg)) {
if (errmsg && *errmsg) {
indent_msg(&errmsg, 2);
ha_alert("parsing [%s:%d] : '%s %s' : %s\n", file, linenum, args[0], args[1], errmsg);
@@ -3638,13 +3638,7 @@
goto out;
}
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- /* Currently, only UDP handlers are allowed */
- if (l->rx.proto->sock_domain != AF_CUST_UDP4 && l->rx.proto->sock_domain != AF_CUST_UDP6) {
- ha_alert("parsing [%s:%d] : '%s %s' : error, listening address must be prefixed using 'udp@', 'udp4@' or 'udp6@' %s.\n",
- file, linenum, args[0], args[1], args[2]);
- err_code |= ERR_ALERT | ERR_FATAL;
- goto out;
- }
+ /* the fact that the sockets are of type dgram is guaranteed by str2receiver() */
l->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : 64;
global.maxsock++;
}