Blame SOURCES/0111-multipathd-ignore-duplicated-multipathd-command-keys.patch

91fef3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
91fef3
From: Benjamin Marzinski <bmarzins@redhat.com>
91fef3
Date: Thu, 8 Sep 2022 11:54:49 -0500
91fef3
Subject: [PATCH] multipathd: ignore duplicated multipathd command keys
91fef3
91fef3
multipath adds rather than or-s the values of command keys. Fix this.
91fef3
Also, return an invalid fingerprint if a key is used more than once.
91fef3
91fef3
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
91fef3
---
91fef3
 multipathd/cli.c  |   8 ++--
91fef3
 multipathd/main.c | 106 +++++++++++++++++++++++-----------------------
91fef3
 2 files changed, 58 insertions(+), 56 deletions(-)
91fef3
91fef3
diff --git a/multipathd/cli.c b/multipathd/cli.c
91fef3
index 85d73dfb..45e80197 100644
91fef3
--- a/multipathd/cli.c
91fef3
+++ b/multipathd/cli.c
91fef3
@@ -341,9 +341,11 @@ fingerprint(vector vec)
91fef3
 	if (!vec)
91fef3
 		return 0;
91fef3
 
91fef3
-	vector_foreach_slot(vec, kw, i)
91fef3
-		fp += kw->code;
91fef3
-
91fef3
+	vector_foreach_slot(vec, kw, i) {
91fef3
+		if (fp & kw->code)
91fef3
+			return (uint64_t)-1;
91fef3
+		fp |= kw->code;
91fef3
+	}
91fef3
 	return fp;
91fef3
 }
91fef3
 
91fef3
diff --git a/multipathd/main.c b/multipathd/main.c
91fef3
index a6ffbe32..7cdab5a0 100644
91fef3
--- a/multipathd/main.c
91fef3
+++ b/multipathd/main.c
91fef3
@@ -1626,62 +1626,62 @@ uxlsnrloop (void * ap)
91fef3
 	/* Tell main thread that thread has started */
91fef3
 	post_config_state(DAEMON_CONFIGURE);
91fef3
 
91fef3
-	set_handler_callback(LIST+PATHS, cli_list_paths);
91fef3
-	set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt);
91fef3
-	set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw);
91fef3
-	set_handler_callback(LIST+PATH, cli_list_path);
91fef3
-	set_handler_callback(LIST+MAPS, cli_list_maps);
91fef3
-	set_handler_callback(LIST+STATUS, cli_list_status);
91fef3
-	set_unlocked_handler_callback(LIST+DAEMON, cli_list_daemon);
91fef3
-	set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status);
91fef3
-	set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats);
91fef3
-	set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt);
91fef3
-	set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw);
91fef3
-	set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology);
91fef3
-	set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology);
91fef3
-	set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json);
91fef3
-	set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology);
91fef3
-	set_handler_callback(LIST+MAP+FMT, cli_list_map_fmt);
91fef3
-	set_handler_callback(LIST+MAP+RAW+FMT, cli_list_map_fmt);
91fef3
-	set_handler_callback(LIST+MAP+JSON, cli_list_map_json);
91fef3
-	set_handler_callback(LIST+CONFIG+LOCAL, cli_list_config_local);
91fef3
-	set_handler_callback(LIST+CONFIG, cli_list_config);
91fef3
-	set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
91fef3
-	set_handler_callback(LIST+DEVICES, cli_list_devices);
91fef3
-	set_handler_callback(LIST+WILDCARDS, cli_list_wildcards);
91fef3
-	set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats);
91fef3
-	set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats);
91fef3
-	set_handler_callback(ADD+PATH, cli_add_path);
91fef3
-	set_handler_callback(DEL+PATH, cli_del_path);
91fef3
-	set_handler_callback(ADD+MAP, cli_add_map);
91fef3
-	set_handler_callback(DEL+MAP, cli_del_map);
91fef3
-	set_handler_callback(DEL+MAPS, cli_del_maps);
91fef3
-	set_handler_callback(SWITCH+MAP+GROUP, cli_switch_group);
91fef3
+	set_handler_callback(LIST|PATHS, cli_list_paths);
91fef3
+	set_handler_callback(LIST|PATHS|FMT, cli_list_paths_fmt);
91fef3
+	set_handler_callback(LIST|PATHS|RAW|FMT, cli_list_paths_raw);
91fef3
+	set_handler_callback(LIST|PATH, cli_list_path);
91fef3
+	set_handler_callback(LIST|MAPS, cli_list_maps);
91fef3
+	set_handler_callback(LIST|STATUS, cli_list_status);
91fef3
+	set_unlocked_handler_callback(LIST|DAEMON, cli_list_daemon);
91fef3
+	set_handler_callback(LIST|MAPS|STATUS, cli_list_maps_status);
91fef3
+	set_handler_callback(LIST|MAPS|STATS, cli_list_maps_stats);
91fef3
+	set_handler_callback(LIST|MAPS|FMT, cli_list_maps_fmt);
91fef3
+	set_handler_callback(LIST|MAPS|RAW|FMT, cli_list_maps_raw);
91fef3
+	set_handler_callback(LIST|MAPS|TOPOLOGY, cli_list_maps_topology);
91fef3
+	set_handler_callback(LIST|TOPOLOGY, cli_list_maps_topology);
91fef3
+	set_handler_callback(LIST|MAPS|JSON, cli_list_maps_json);
91fef3
+	set_handler_callback(LIST|MAP|TOPOLOGY, cli_list_map_topology);
91fef3
+	set_handler_callback(LIST|MAP|FMT, cli_list_map_fmt);
91fef3
+	set_handler_callback(LIST|MAP|RAW|FMT, cli_list_map_fmt);
91fef3
+	set_handler_callback(LIST|MAP|JSON, cli_list_map_json);
91fef3
+	set_handler_callback(LIST|CONFIG|LOCAL, cli_list_config_local);
91fef3
+	set_handler_callback(LIST|CONFIG, cli_list_config);
91fef3
+	set_handler_callback(LIST|BLACKLIST, cli_list_blacklist);
91fef3
+	set_handler_callback(LIST|DEVICES, cli_list_devices);
91fef3
+	set_handler_callback(LIST|WILDCARDS, cli_list_wildcards);
91fef3
+	set_handler_callback(RESET|MAPS|STATS, cli_reset_maps_stats);
91fef3
+	set_handler_callback(RESET|MAP|STATS, cli_reset_map_stats);
91fef3
+	set_handler_callback(ADD|PATH, cli_add_path);
91fef3
+	set_handler_callback(DEL|PATH, cli_del_path);
91fef3
+	set_handler_callback(ADD|MAP, cli_add_map);
91fef3
+	set_handler_callback(DEL|MAP, cli_del_map);
91fef3
+	set_handler_callback(DEL|MAPS, cli_del_maps);
91fef3
+	set_handler_callback(SWITCH|MAP|GROUP, cli_switch_group);
91fef3
 	set_unlocked_handler_callback(RECONFIGURE, cli_reconfigure);
91fef3
-	set_handler_callback(SUSPEND+MAP, cli_suspend);
91fef3
-	set_handler_callback(RESUME+MAP, cli_resume);
91fef3
-	set_handler_callback(RESIZE+MAP, cli_resize);
91fef3
-	set_handler_callback(RELOAD+MAP, cli_reload);
91fef3
-	set_handler_callback(RESET+MAP, cli_reassign);
91fef3
-	set_handler_callback(REINSTATE+PATH, cli_reinstate);
91fef3
-	set_handler_callback(FAIL+PATH, cli_fail);
91fef3
-	set_handler_callback(DISABLEQ+MAP, cli_disable_queueing);
91fef3
-	set_handler_callback(RESTOREQ+MAP, cli_restore_queueing);
91fef3
-	set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing);
91fef3
-	set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing);
91fef3
+	set_handler_callback(SUSPEND|MAP, cli_suspend);
91fef3
+	set_handler_callback(RESUME|MAP, cli_resume);
91fef3
+	set_handler_callback(RESIZE|MAP, cli_resize);
91fef3
+	set_handler_callback(RELOAD|MAP, cli_reload);
91fef3
+	set_handler_callback(RESET|MAP, cli_reassign);
91fef3
+	set_handler_callback(REINSTATE|PATH, cli_reinstate);
91fef3
+	set_handler_callback(FAIL|PATH, cli_fail);
91fef3
+	set_handler_callback(DISABLEQ|MAP, cli_disable_queueing);
91fef3
+	set_handler_callback(RESTOREQ|MAP, cli_restore_queueing);
91fef3
+	set_handler_callback(DISABLEQ|MAPS, cli_disable_all_queueing);
91fef3
+	set_handler_callback(RESTOREQ|MAPS, cli_restore_all_queueing);
91fef3
 	set_unlocked_handler_callback(QUIT, cli_quit);
91fef3
 	set_unlocked_handler_callback(SHUTDOWN, cli_shutdown);
91fef3
-	set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus);
91fef3
-	set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus);
91fef3
-	set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus);
91fef3
-	set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q);
91fef3
-	set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q);
91fef3
-	set_handler_callback(GETPRKEY+MAP, cli_getprkey);
91fef3
-	set_handler_callback(SETPRKEY+MAP+KEY, cli_setprkey);
91fef3
-	set_handler_callback(UNSETPRKEY+MAP, cli_unsetprkey);
91fef3
-	set_handler_callback(SETMARGINAL+PATH, cli_set_marginal);
91fef3
-	set_handler_callback(UNSETMARGINAL+PATH, cli_unset_marginal);
91fef3
-	set_handler_callback(UNSETMARGINAL+MAP, cli_unset_all_marginal);
91fef3
+	set_handler_callback(GETPRSTATUS|MAP, cli_getprstatus);
91fef3
+	set_handler_callback(SETPRSTATUS|MAP, cli_setprstatus);
91fef3
+	set_handler_callback(UNSETPRSTATUS|MAP, cli_unsetprstatus);
91fef3
+	set_handler_callback(FORCEQ|DAEMON, cli_force_no_daemon_q);
91fef3
+	set_handler_callback(RESTOREQ|DAEMON, cli_restore_no_daemon_q);
91fef3
+	set_handler_callback(GETPRKEY|MAP, cli_getprkey);
91fef3
+	set_handler_callback(SETPRKEY|MAP|KEY, cli_setprkey);
91fef3
+	set_handler_callback(UNSETPRKEY|MAP, cli_unsetprkey);
91fef3
+	set_handler_callback(SETMARGINAL|PATH, cli_set_marginal);
91fef3
+	set_handler_callback(UNSETMARGINAL|PATH, cli_unset_marginal);
91fef3
+	set_handler_callback(UNSETMARGINAL|MAP, cli_unset_all_marginal);
91fef3
 
91fef3
 	umask(077);
91fef3
 	uxsock_listen(&uxsock_trigger, ux_sock, ap);