]> git.proxmox.com Git - mirror_corosync.git/commitdiff
config: Make sure user doesn't mix IPv6 and IPv4
authorJan Friesse <jfriesse@redhat.com>
Mon, 24 Nov 2014 09:25:05 +0000 (10:25 +0100)
committerJan Friesse <jfriesse@redhat.com>
Mon, 24 Nov 2014 10:55:37 +0000 (11:55 +0100)
Checking code was there, sadly not correct, so it was possible to enter
one bindnet addr as IPv4 and second as IPv6. Fix is trivial.

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

index daf071936571eec33f7fe13b4339e5f62a3328d8..3bcf49dd149ee47c57469ba157854d6366643ed3 100644 (file)
@@ -1055,21 +1055,22 @@ int totem_config_validate (
                        goto parse_error;
                }
 
-               if (totem_config->broadcast_use == 0 && totem_config->transport_number == 0) {
+               if (totem_config->broadcast_use == 0 && totem_config->transport_number == TOTEM_TRANSPORT_UDP) {
                        if (totem_config->interfaces[i].mcast_addr.family != totem_config->interfaces[i].bindnet.family) {
                                error_reason = "Multicast address family does not match bind address family";
                                goto parse_error;
                        }
 
-                       if (totem_config->interfaces[i].mcast_addr.family != totem_config->interfaces[i].bindnet.family) {
-                               error_reason =  "Not all bind address belong to the same IP family";
-                               goto parse_error;
-                       }
                        if (totemip_is_mcast (&totem_config->interfaces[i].mcast_addr) != 0) {
                                error_reason = "mcastaddr is not a correct multicast address.";
                                goto parse_error;
                        }
                }
+
+               if (totem_config->interfaces[0].bindnet.family != totem_config->interfaces[i].bindnet.family) {
+                       error_reason =  "Not all bind address belong to the same IP family";
+                       goto parse_error;
+               }
        }
 
        if (totem_config->version != 2) {