From 23db6cba49b6bca811e5d08091e000e260649ee5 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 2 Aug 2021 17:04:55 +0200 Subject: [PATCH] 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 Reviewed-by: Christine Caulfield --- exec/totemconfig.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/exec/totemconfig.c b/exec/totemconfig.c index 809ae87e..57a1587a 100644 --- a/exec/totemconfig.c +++ b/exec/totemconfig.c @@ -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);