]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: config: make str2listener() not accept datagram sockets anymore
authorWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2020 14:28:08 +0000 (16:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2020 20:08:08 +0000 (22:08 +0200)
str2listener() was temporarily hacked to support datagram sockets for
the log-forward listeners. This has has an undesirable side effect that
"bind udp@1.2.3.4:5555" was silently accepted as TCP for a bind line.

We don't need this hack anymore since the only user (log-forward) now
relies on str2receiver(). Now such an address will properly be rejected.

src/cfgparse.c
tests/ports.cfg

index 5451359c4377274a8077d28cd8de0788de52aeb4..23a3695614610ec32f9a9dc3d6579009f3958b4d 100644 (file)
@@ -129,7 +129,7 @@ int str2listener(char *str, struct proxy *curproxy, struct bind_conf *bind_conf,
                ss2 = str2sa_range(str, NULL, &port, &end, &fd, err,
                                   curproxy == global.stats_fe ? NULL : global.unix_bind.prefix,
                                   NULL, PA_O_RESOLVE | PA_O_PORT_OK | PA_O_PORT_MAND | PA_O_PORT_RANGE |
-                                         PA_O_SOCKET_FD | PA_O_DGRAM | PA_O_STREAM | PA_O_XPRT);
+                                         PA_O_SOCKET_FD | PA_O_STREAM | PA_O_XPRT);
                if (!ss2)
                        goto fail;
 
index 7210c3c8567aae5b61e29f0470c7d8e5732d2691..57793487e0c6dd757f9dfb9ec4743c7ff48a6a84 100644 (file)
@@ -14,6 +14,7 @@ frontend f1
         bind :::11003-11010
         bind :::+11011                      # port offset not permitted here in ':::+11011'
         bind :::-11012                      # port offset not permitted here in ':::-11012'
+        bind udp@:11013                     # dgram-type socket not acceptable in 'udp@:11013'
 
 frontend f2
         bind :::0                           # invalid port '0'