]> git.proxmox.com Git - mirror_corosync.git/commitdiff
totemconfig: Knet nodeid must be < 65536 v3.1.5
authorJan Friesse <jfriesse@redhat.com>
Mon, 2 Aug 2021 15:04:55 +0000 (17:04 +0200)
committerJan Friesse <jfriesse@redhat.com>
Wed, 4 Aug 2021 08:37:36 +0000 (10:37 +0200)
Knet limits maximum node id to 16-bit type. This was not ensured in
corosync and it was possible to set nodeid to value >= 65536 and
(surprisingly) most of the things were working quite well because of
overflow. corosync-cmapctl -m stats contained knet nodeid in
stats.knet. subtree, so for nodeid 65536 result was:

Can't get value of stats.knet.node0.link0.connected. Error
CS_ERR_NOT_EXIST

Commit implements checking of nodeid and limits it to KNET_MAX_HOST
value when knet is used.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
exec/totemconfig.c

index 809ae87e0c29f6fff5778d5a50b009d187499428..57a1587a0eab4d6eb5deadb7c7a5d32136ce3225 100644 (file)
@@ -1438,6 +1438,15 @@ static int put_nodelist_members_to_config(struct totem_config *totem_config, icm
                                return (-1);
                        }
 
+                       if (totem_config->transport_number == TOTEM_TRANSPORT_KNET && nodeid >= KNET_MAX_HOST) {
+                               sprintf(error_string_response,
+                                   "Knet requires nodeid to be less than %u "
+                                   "for address '%s'.", KNET_MAX_HOST, node_addr_str);
+                               *error_string = error_string_response;
+
+                               return (-1);
+                       }
+
                        member_count = totem_config->interfaces[linknumber].member_count;
                        res = totemip_parse(&totem_config->interfaces[linknumber].member_list[member_count],
                                                node_addr_str, totem_config->ip_version);