]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tools: Impprove hash_ipanon to not hash FD-based addresses
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 29 Sep 2022 09:53:07 +0000 (11:53 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 29 Sep 2022 09:53:08 +0000 (11:53 +0200)
"stdout" and "stderr" are not hashed. In the same spirit, "fd@" and
"sockpair@" prefixes are not hashed too. There is no reason to hash such
address and it may be useful to diagnose bugs.

No backport needed, except if anonymization mechanism is backported.

src/tools.c

index 5185204b13861e87710d263882545cd9e271c43e..33bc88e6d449e669b86cf83d4036a977f8779cba 100644 (file)
@@ -5895,7 +5895,11 @@ const char *hash_ipanon(uint32_t scramble, char *ipstring, int hasport)
        if (scramble == 0) {
                return ipstring;
        }
-       if (strcmp(ipstring, "localhost") == 0) {
+       if (strcmp(ipstring, "localhost") == 0 ||
+           strcmp(ipstring, "stdout") == 0 ||
+           strcmp(ipstring, "stderr") == 0 ||
+           strncmp(ipstring, "fd@", 3) == 0 ||
+           strncmp(ipstring, "sockpair@", 9) == 0) {
                return ipstring;
        }
        else {