]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make home servers unique by source IP, too
authorAlan T. DeKok <aland@freeradius.org>
Wed, 15 Jun 2011 08:00:29 +0000 (10:00 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 15 Jun 2011 08:00:29 +0000 (10:00 +0200)
src/main/realms.c

index 6ca664bce3af9f87630b87688f5ef70bd7307bcc..30fc25a3b2191b907c00835a2c0319729e0fb246 100644 (file)
@@ -149,26 +149,24 @@ static int home_server_name_cmp(const void *one, const void *two)
 
 static int home_server_addr_cmp(const void *one, const void *two)
 {
+       int rcode;
        const home_server *a = one;
        const home_server *b = two;
 
        if (a->server && !b->server) return -1;
        if (!a->server && b->server) return +1;
-
        if (a->server && b->server) {
-               int rcode = a->type - b->type;
+               rcode = a->type - b->type;
                if (rcode != 0) return rcode;
                return strcmp(a->server, b->server);
        }
 
-#ifdef WITH_TCP
-       if (a->proto < b->proto) return -1;
-       if (a->proto > b->proto) return +1;
-#endif
-
        if (a->port < b->port) return -1;
        if (a->port > b->port) return +1;
 
+       rcode = fr_ipaddr_cmp(&a->src_ipaddr, &b->src_ipaddr);
+       if (rcode != 0) return rcode;
+
        return fr_ipaddr_cmp(&a->ipaddr, &b->ipaddr);
 }