device-mapper-multipath/0134-multipathd-make-uxsock_listen-take-a-pointer-to-fd.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

86 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 12 Feb 2025 20:08:28 +0100
Subject: [PATCH] multipathd: make uxsock_listen() take a pointer to fd
This prepares being able to pass multiple socket fds.
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 | 2 +-
multipathd/uxlsnr.c | 11 ++++++++---
multipathd/uxlsnr.h | 3 +--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 21f16b8f..6afb7154 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1824,7 +1824,7 @@ uxlsnrloop (void * ap)
set_handler_callback(UNSETMARGINAL|MAP, cli_unset_all_marginal);
umask(077);
- uxsock_listen(ux_sock, ap);
+ uxsock_listen(1, &ux_sock, ap);
out_sock:
pthread_cleanup_pop(1); /* uxsock_cleanup */
diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
index 7c081799..7599291a 100644
--- a/multipathd/uxlsnr.c
+++ b/multipathd/uxlsnr.c
@@ -332,7 +332,7 @@ static int uxsock_trigger(char *str, char **reply, int *len,
/*
* entry point
*/
-void *uxsock_listen(long ux_sock, void *trigger_data)
+void *uxsock_listen(int n_socks, long *ux_sock, void *trigger_data)
{
int rlen;
char *inbuf;
@@ -343,6 +343,11 @@ void *uxsock_listen(long ux_sock, void *trigger_data)
unsigned int sequence_nr = 0;
struct watch_descriptors wds = { .conf_wd = -1, .dir_wd = -1 };
+ if (n_socks != 1) {
+ condlog(0, "uxsock: no socket fds");
+ exit_daemon();
+ return NULL;
+ }
condlog(3, "uxsock: startup listener");
polls = MALLOC(max_pfds * sizeof(*polls));
if (!polls) {
@@ -384,7 +389,7 @@ void *uxsock_listen(long ux_sock, void *trigger_data)
}
}
if (num_clients < MAX_CLIENTS) {
- polls[POLLFD_UX].fd = ux_sock;
+ polls[POLLFD_UX].fd = ux_sock[0];
polls[POLLFD_UX].events = POLLIN;
} else {
/*
@@ -506,7 +511,7 @@ void *uxsock_listen(long ux_sock, void *trigger_data)
/* see if we got a new client */
if (polls[POLLFD_UX].revents & POLLIN) {
- new_client(ux_sock);
+ new_client(ux_sock[0]);
}
/* handle inotify events on config files */
diff --git a/multipathd/uxlsnr.h b/multipathd/uxlsnr.h
index 60c3a2c7..dc3857c4 100644
--- a/multipathd/uxlsnr.h
+++ b/multipathd/uxlsnr.h
@@ -4,7 +4,6 @@
#include <stdbool.h>
void uxsock_cleanup(void *arg);
-void *uxsock_listen(long ux_sock,
- void * trigger_data);
+void *uxsock_listen(int n_socks, long *ux_sock, void *trigger_data);
#endif