Two interfaces (in RRP mode) shouldn't have equal unicast or
multicast addresses.

Signed-off-by: Jan Friesse <[email protected]>
---
 exec/totemconfig.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index 80ca182..86cafad 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -449,7 +449,7 @@ int totem_config_validate (
        static char local_error_reason[512];
        char parse_error[512];
        const char *error_reason = local_error_reason;
-       int i;
+       int i, j;
        unsigned int interface_max = INTERFACE_MAX;
 
        if (totem_config->interface_count == 0) {
@@ -511,6 +511,28 @@ int totem_config_validate (
                }
        }
 
+       for (i = 0; i < totem_config->interface_count; i++) {
+               for (j = 0; j < totem_config->interface_count; j++) {
+                       if (i == j) {
+                               continue;
+                       }
+
+                       if (memcmp (&totem_config->interfaces[i].mcast_addr,
+                           &totem_config->interfaces[j].mcast_addr,
+                           sizeof (struct totem_ip_address)) == 0) {
+                               error_reason = "Multiple multicast address are 
equal";
+                               goto parse_error;
+                       }
+
+                       if (memcmp (&totem_config->interfaces[i].bindnet,
+                           &totem_config->interfaces[j].bindnet,
+                           sizeof (struct totem_ip_address)) == 0) {
+                               error_reason = "Multiple unicast address are 
equal";
+                               goto parse_error;
+                       }
+               }
+       }
+
        if (totem_config->version != 2) {
                error_reason = "This totem parser can only parse version 2 
configurations.";
                goto parse_error;
-- 
1.7.1

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to