]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: unix: Make sure we can transfer abns sockets on seamless reload.
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 6 Jun 2018 16:34:34 +0000 (18:34 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 7 Jun 2018 12:33:44 +0000 (14:33 +0200)
When checking if a socket we got from the parent is suitable for a listener,
we just checked that the path matched sockname.tmp, however this is
unsuitable for abns sockets, where we don't have to create a temporary
file and rename it later.
To detect that, check that the first character of the sun_path is 0 for
both, and if so, that &sun_path[1] is the same too.

This should be backported to 1.8.

src/proto_uxst.c

index 9fc50dff46f62d0df8f4d32f4faf4f2bb68c457e..ab788bde720fa1f1a252b787ce8387f808d2efbe 100644 (file)
@@ -146,7 +146,12 @@ static int uxst_find_compatible_fd(struct listener *l)
                                        after_sockname++;
                                if (!strcmp(after_sockname, ".tmp"))
                                        break;
-                       }
+                       /* abns sockets sun_path starts with a \0 */
+                       } else if (un1->sun_path[0] == 0
+                           && un2->sun_path[0] == 0
+                           && !memcmp(&un1->sun_path[1], &un2->sun_path[1],
+                           sizeof(un1->sun_path) - 1))
+                               break;
                }
                xfer_sock = xfer_sock->next;
        }