totemconfig: Knet nodeid must be < 65536

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>
This commit is contained in:
Jan Friesse 2021-08-02 17:04:55 +02:00
parent 4e9ce9627f
commit 23db6cba49

View 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);