Re: [PATCH] BUG/???: lua: Add missing call to RESET_SAFE_LJMP in hlua_filter_new()

2021-09-11 Thread Willy Tarreau
On Sat, Sep 11, 2021 at 11:17:25PM +0200, Tim Duesterhus wrote:
> In one case before exiting leaving the function the panic handler was not
> reset.
> 
> Introduced in 69c581a09271e91d306e7b9080502a36abdc415e, which is 2.5+.
> No backport required.

Good catch, applied as medium since it seems none of us can clearly
predict the effect :-)

Thanks!
Willy



Re: [PATCH 2/4] BUG/MINOR: opentracing: enable the use of http headers without a set value

2021-09-11 Thread Willy Tarreau
On Sat, Sep 11, 2021 at 12:27:30AM +0200, Miroslav Zagorac wrote:
> On 09/11/2021 12:05 AM, Miroslav Zagorac wrote:
> > Hello all,
> > 
> > the second patch from the last series of patches has been redesigned
> > here, the ist() function is used to set an empty string instead of
> > working directly with the string pointer.
> > 
> > I thank Tim Düsterhus for his advice.
> 
> The operation comment has been slightly corrected.
> Sorry to bother you.  :)

Bah, I discovered that one after merging the first series :-/ I've
applied it on top as a cleanup with your description above as the
commit message since it's really what it's about.

Thanks,
Willy



Re: [PATCH] BUILD: opentracing: excluded use of haproxy variables for, OpenTracing context

2021-09-11 Thread Willy Tarreau
Hi guys,

thanks for working on fixing this, it's now merged. I've added a
tiny change to make sure that text_map is always initialized in
flt_ot_scope_run() because that made clang rightfully upset,
re-enabled OT in the CI since it's now OK.

Cheers,
Willy



[PATCH] BUG/???: lua: Add missing call to RESET_SAFE_LJMP in hlua_filter_new()

2021-09-11 Thread Tim Duesterhus
In one case before exiting leaving the function the panic handler was not
reset.

Introduced in 69c581a09271e91d306e7b9080502a36abdc415e, which is 2.5+.
No backport required.
---
 src/hlua.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/hlua.c b/src/hlua.c
index 72d232491..915356c09 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -10005,6 +10005,7 @@ static int hlua_filter_new(struct stream *s, struct 
filter *filter)
/* Check stack size. */
if (!lua_checkstack(s->hlua->T, 1)) {
SEND_ERR(s->be, "Lua filter '%s': full stack.\n", 
conf->reg->name);
+   RESET_SAFE_LJMP(s->hlua);
ret = 0;
goto end;
}
-- 
2.33.0




[PATCH] CLEANUP: Move XXH3 macro from haproxy/compat.h to haproxy/xxhash.h

2021-09-11 Thread Tim Duesterhus
This moves all the xxhash functionality into a single location.

see d5fc8fcb86eb99831626051b3055bea7ca93a074
---
 include/haproxy/compat.h | 7 ---
 include/haproxy/xxhash.h | 7 +++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/haproxy/compat.h b/include/haproxy/compat.h
index 72dc3dc4f..886b7a365 100644
--- a/include/haproxy/compat.h
+++ b/include/haproxy/compat.h
@@ -288,13 +288,6 @@ typedef struct { } empty_t;
  */
 #define MAX_SEND_FD 253
 
-/* Make the new complex name for the xxhash function easier to remember
- * and use.
- */
-#ifndef XXH3
-#define XXH3(data, len, seed) XXH3_64bits_withSeed(data, len, seed)
-#endif
-
 #endif /* _HAPROXY_COMPAT_H */
 
 /*
diff --git a/include/haproxy/xxhash.h b/include/haproxy/xxhash.h
index 83a2fb71c..cd333e645 100644
--- a/include/haproxy/xxhash.h
+++ b/include/haproxy/xxhash.h
@@ -42,4 +42,11 @@
 
 #include 
 
+/* Make the new complex name for the xxhash function easier to remember
+ * and use.
+ */
+#ifndef XXH3
+#define XXH3(data, len, seed) XXH3_64bits_withSeed(data, len, seed)
+#endif
+
 #endif
-- 
2.33.0




Re: [PATCH] CLEANUP: Move XXH3 macro from haproxy/compat.h to haproxy/xxhash.h

2021-09-11 Thread Willy Tarreau
On Sat, Sep 11, 2021 at 08:29:46PM +0200, Tim Duesterhus wrote:
> This moves all the xxhash functionality into a single location.

Wow that was fast, now merged, thanks!
Willy



Re: [PATCH] CLEANUP: Add haproxy/xxhash.h to avoid modifying import/xxhash.h

2021-09-11 Thread Willy Tarreau
On Sat, Sep 11, 2021 at 08:06:01PM +0200, Dragan Dosen wrote:
> Hi Tim,
> 
> On 11. 09. 2021. 17:51, Tim Duesterhus wrote:
> > This solves setting XXH_INLINE_ALL in a cleaner way, because the imported
> > header is not modified, easing future updates.
> > 
> > see 6f7cc11e6dd0f01b437fba893da2edd2362660a2
> > ---
> > (...)
> 
> Thanks!
> 
> We might also want to move the "XXH3" defined in include/haproxy/compat.h to
> include/haproxy/xxhash.h; see 967e7e79a ("MEDIUM: xxhash: use the XXH3
> functions to generate 64-bit hashes"). Just to have all of our xxHash
> related defines in a single file.

That would indeed be cleaner now that there's a dedicated file.

Willy



Re: [PATCH] CLEANUP: Add haproxy/xxhash.h to avoid modifying import/xxhash.h

2021-09-11 Thread Dragan Dosen

Hi Tim,

On 11. 09. 2021. 17:51, Tim Duesterhus wrote:

This solves setting XXH_INLINE_ALL in a cleaner way, because the imported
header is not modified, easing future updates.

see 6f7cc11e6dd0f01b437fba893da2edd2362660a2
---
(...)


Thanks!

We might also want to move the "XXH3" defined in 
include/haproxy/compat.h to include/haproxy/xxhash.h; see 967e7e79a 
("MEDIUM: xxhash: use the XXH3 functions to generate 64-bit hashes"). 
Just to have all of our xxHash related defines in a single file.


Best regards,
Dragan Dosen



Re: [PATCH] CLEANUP: Add haproxy/xxhash.h to avoid modifying import/xxhash.h

2021-09-11 Thread Willy Tarreau
Hi Tim,

On Sat, Sep 11, 2021 at 05:51:13PM +0200, Tim Duesterhus wrote:
> This solves setting XXH_INLINE_ALL in a cleaner way, because the imported
> header is not modified, easing future updates.

Excellent idea, I like this. It's indeed much cleaner and more logical
this way. This may also serve as an example of how to better integrate
external components in the future if needed.

Now applied, thanks!
Willy



[PATCH] CLEANUP: Add haproxy/xxhash.h to avoid modifying import/xxhash.h

2021-09-11 Thread Tim Duesterhus
This solves setting XXH_INLINE_ALL in a cleaner way, because the imported
header is not modified, easing future updates.

see 6f7cc11e6dd0f01b437fba893da2edd2362660a2
---
 addons/51degrees/51d.c |  2 +-
 admin/dyncookie/dyncookie.c|  3 ++-
 include/haproxy/activity.h |  2 +-
 include/haproxy/connection-t.h |  2 +-
 include/haproxy/defaults.h |  7 --
 include/haproxy/xxhash.h   | 45 ++
 include/import/xxhash.h|  2 --
 src/pattern.c  |  2 +-
 src/sample.c   |  2 +-
 src/server.c   |  3 +--
 src/server_state.c |  2 +-
 src/ssl_sock.c |  2 +-
 12 files changed, 55 insertions(+), 19 deletions(-)
 create mode 100644 include/haproxy/xxhash.h

diff --git a/addons/51degrees/51d.c b/addons/51degrees/51d.c
index 6dfa578e2..5d686953c 100644
--- a/addons/51degrees/51d.c
+++ b/addons/51degrees/51d.c
@@ -1,7 +1,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -15,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include <51Degrees.h>
 
 struct _51d_property_names {
diff --git a/admin/dyncookie/dyncookie.c b/admin/dyncookie/dyncookie.c
index 0c778eb7a..ddb71a748 100644
--- a/admin/dyncookie/dyncookie.c
+++ b/admin/dyncookie/dyncookie.c
@@ -14,7 +14,8 @@
 #include 
 #include 
 #include 
-#include 
+
+#include 
 
 __attribute__((noreturn)) void die(int code, const char *format, ...)
 {
diff --git a/include/haproxy/activity.h b/include/haproxy/activity.h
index 42569f203..66a5f3be7 100644
--- a/include/haproxy/activity.h
+++ b/include/haproxy/activity.h
@@ -22,11 +22,11 @@
 #ifndef _HAPROXY_ACTIVITY_H
 #define _HAPROXY_ACTIVITY_H
 
-#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 extern unsigned int profiling;
 extern unsigned long task_profiling_mask;
diff --git a/include/haproxy/connection-t.h b/include/haproxy/connection-t.h
index ff8927dba..1afae9624 100644
--- a/include/haproxy/connection-t.h
+++ b/include/haproxy/connection-t.h
@@ -30,7 +30,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -38,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* referenced below */
 struct connection;
diff --git a/include/haproxy/defaults.h b/include/haproxy/defaults.h
index 16058817e..19a9cb623 100644
--- a/include/haproxy/defaults.h
+++ b/include/haproxy/defaults.h
@@ -404,13 +404,6 @@
 #define MAX_POLLERS10
 #endif
 
-/* Make all xxhash functions inline, with implementations being directly
- * included within xxhash.h.
- */
-#ifndef XXH_INLINE_ALL
-#define XXH_INLINE_ALL
-#endif
-
 /* system sysfs directory */
 #define NUMA_DETECT_SYSTEM_SYSFS_PATH "/sys/devices/system"
 
diff --git a/include/haproxy/xxhash.h b/include/haproxy/xxhash.h
new file mode 100644
index 0..83a2fb71c
--- /dev/null
+++ b/include/haproxy/xxhash.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 Dragan Dosen 
+ * Copyright (C) 2021 Tim Duesterhus 
+ *
+ * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ ** Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ ** Redistributions in binary form must reproduce the above
+ *  copyright notice, this list of conditions and the following disclaimer
+ *  in the documentation and/or other materials provided with the
+ *  distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _HAPROXY_XXHASH_H
+#define _HAPROXY_XXHASH_H
+
+/* Make all xxhash functions inline, with implementations being directly
+ * included within xxhash.h.
+ */
+#ifndef XXH_INLINE_ALL
+#define XXH_INLINE_ALL
+#else
+#error "XXH_INLINE_ALL is already defined."
+#endif
+
+#include 
+
+#endif
diff --git a/include/import/xxhash.h b/include/import/xxhash.h
index 24326bc33..d0e3e241e 100644
--- a/include/import/xxhash.h
+++ b/include/import/xxhash.h
@@ -75,8 +75,6 @@ XXH326.8 GB/s6.0 GB/s
 extern "C" {
 #endif
 
-#include 
-
 /* 
  *  IN