device-mapper-multipath/0022-multipathd-make-uxsock_listen-take-a-pointer-to-fd.patch
Benjamin Marzinski 5b86fc9dcf device-mapper-multipath-0.9.9-7
Add 0018-multipath-tools-move-DEFAULT_SOCKET-definition-into-.patch
Add 0019-multipath-tools-add-helper-mpath_fill_sockaddr__.patch
Add 0020-libmpathutil-add-support-for-Unix-pathname-sockets.patch
Add 0021-libmpathutil-move-systemd_listen_fds-support-into-mu.patch
Add 0022-multipathd-make-uxsock_listen-take-a-pointer-to-fd.patch
Add 0023-multipathd-allow-receiving-two-socket-fds-from-syste.patch
Add 0024-multipathd-listen-on-pathname-and-abstract-socket-by.patch
Add 0025-libmpathcmd-try-both-abstract-and-pathname-sockets.patch
Add 0026-libmpathcmd-honor-MULTIPATH_SOCKET_NAME-environment-.patch
Add 0027-multipathd-honor-MULTIPATH_SOCKET_NAME-environment-v.patch
Add 0028-multipath-clean-up-find_multipaths-documentation.patch
Add 0029-multipathd-Add-multipathd-man-page-section-about-soc.patch
  * Fixes RHEL-82180 ("RFE: Enable multipathd to communicate with a
    process in another network namespace")
Resolves: RHEL-82180
2025-03-11 16:40:30 -04: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 24048408..9f15d2f7 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1920,7 +1920,7 @@ uxlsnrloop (void * ap)
== DAEMON_CONFIGURE)
handle_signals(false);
- 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 185e0a0a..51b5e51d 100644
--- a/multipathd/uxlsnr.c
+++ b/multipathd/uxlsnr.c
@@ -614,7 +614,7 @@ static void handle_client(struct client *c, struct vectors *vecs, short revents)
/*
* entry point
*/
-void *uxsock_listen(long ux_sock, void *trigger_data)
+void *uxsock_listen(int n_socks, long *ux_sock, void *trigger_data)
{
sigset_t mask;
int max_pfds = MIN_POLLS + POLLFDS_BASE;
@@ -623,6 +623,11 @@ void *uxsock_listen(long ux_sock, void *trigger_data)
struct watch_descriptors wds = { .conf_wd = -1, .dir_wd = -1, .mp_wd = -1, };
struct vectors *vecs = trigger_data;
+ if (n_socks != 1) {
+ condlog(0, "uxsock: no socket fds");
+ exit_daemon();
+ return NULL;
+ }
condlog(3, "uxsock: startup listener");
polls = calloc(1, max_pfds * sizeof(*polls));
if (!polls) {
@@ -673,7 +678,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 {
/*
@@ -767,7 +772,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 3e45930b..f07b1f8b 100644
--- a/multipathd/uxlsnr.h
+++ b/multipathd/uxlsnr.h
@@ -5,7 +5,6 @@
bool waiting_clients(void);
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