Kaynağa Gözat

totem: fix check if all nodes have name attrs in multi-link setups

As totem_config->interfaces entries are _all_ possible links and not
only the configured ones we cannot trust that interface[0] is
configured at the time of checking, and thus has a valid
member_count. So set the members variable to the member_count entry
from an actually configured interface and loop over that one.

This fixes a case where the check for the name property on all nodes
for multi links was skipped if link 0 was not configured, as then its
member_count was 0.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Thomas Lamprecht 6 yıl önce
ebeveyn
işleme
7ada508a82
1 değiştirilmiş dosya ile 4 ekleme ve 3 silme
  1. 4 3
      exec/totemconfig.c

+ 4 - 3
exec/totemconfig.c

@@ -449,14 +449,15 @@ static int totem_volatile_config_validate (
 	num_configured = 0;
 	for (i = 0; i < INTERFACE_MAX; i++) {
 		if (totem_config->interfaces[i].configured) {
+			if (num_configured == 0) {
+				members = totem_config->interfaces[i].member_count;
+			}
 			num_configured++;
 		}
 	}
 
 	if (num_configured > 1) {
-		members = totem_config->interfaces[0].member_count;
-
-		for (i=0; i<totem_config->interfaces[0].member_count; i++) {
+		for (i=0; i < members; i++) {
 			snprintf(name_key, sizeof(name_key), "nodelist.node.%d.name", i);
 
 			if (icmap_get_string(name_key, &name_str) != CS_OK) {