device-mapper-multipath/0139-multipathd-honor-MULTIPATH_SOCKET_NAME-environment-v.patch
Benjamin Marzinski ddfd11c918 device-mapper-multipath-0.8.7-36
Add 0128-multipath-tools-move-DEFAULT_SOCKET-definition-into-.patch
Add 0129-multipath-tools-add-helper-mpath_fill_sockaddr__.patch
Add 0130-libmpathutil-add-support-for-Unix-pathname-sockets.patch
Add 0131-libmpathutil-move-systemd_listen_fds-support-into-mu.patch
Add 0132-multipathd-move-uxsock_trigger-to-uxlsnr.c.patch
Add 0133-multipathd-uxlsnr-use-symbolic-values-for-pollfd-ind.patch
Add 0134-multipathd-make-uxsock_listen-take-a-pointer-to-fd.patch
Add 0135-multipathd-allow-receiving-two-socket-fds-from-syste.patch
Add 0136-multipathd-listen-on-pathname-and-abstract-socket-by.patch
Add 0137-libmpathcmd-try-both-abstract-and-pathname-sockets.patch
Add 0138-libmpathcmd-honor-MULTIPATH_SOCKET_NAME-environment-.patch
Add 0139-multipathd-honor-MULTIPATH_SOCKET_NAME-environment-v.patch
  * Fixes RHEL-78758 ("RFE: Enable multipathd to communicate with a
    process in another network namespace")
Resolves: RHEL-78758
2025-03-05 00:15:17 -05:00

44 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 14 Feb 2025 22:18:06 +0100
Subject: [PATCH] multipathd: honor MULTIPATH_SOCKET_NAME environment variable
If multipathd is started via socket activation, it will obtain
sockets from systemd. The names of these sockets, and whether
the abstract and / or pathname socket is created, is configurable
in the systemd unit file.
Add support for passing a socket name via the environment, so that
it's possible to configure the socket name at runtime even without
socket activation. In this case, only this single socket will be created.
If creating the socket fails, multipathd startup will fail, too.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/multipathd/main.c b/multipathd/main.c
index e44df6b6..820d4e68 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1747,11 +1747,16 @@ uxlsnrloop (void * ap)
{
long ux_sock[2] = {-1, -1};
int num;
+ const char *env_name = getenv("MULTIPATH_SOCKET_NAME");
pthread_cleanup_push(rcu_unregister, NULL);
rcu_register_thread();
num = get_systemd_sockets(ux_sock);
+ if (num < 1 && env_name != NULL) {
+ ux_sock[0] = ux_socket_listen(env_name);
+ num = 1;
+ }
if (num < 1) {
ux_sock[0] = ux_socket_listen(ABSTRACT_SOCKET);
ux_sock[1] = ux_socket_listen(PATHNAME_SOCKET);