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