]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
warn about adding duplicate/overlapping IP keys for binary trees
authorwessels <>
Fri, 27 Mar 1998 11:44:54 +0000 (11:44 +0000)
committerwessels <>
Fri, 27 Mar 1998 11:44:54 +0000 (11:44 +0000)
src/acl.cc

index 22a62d5aea209a3d3930d1315784e1faf6be5af4..ed84fc77b90f2343fc529bd8334c007ba42583ee 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.cc,v 1.152 1998/03/17 03:59:21 wessels Exp $
+ * $Id: acl.cc,v 1.153 1998/03/27 04:44:54 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -477,13 +477,21 @@ aclParseIpList(void **curtree)
     tree **Tree;
     char *t = NULL;
     acl_ip_data *q;
+    acl_ip_data *x;
     Tree = xmalloc(sizeof(tree *));
     *curtree = Tree;
     tree_init(Tree);
     while ((t = strtokFile())) {
        q = aclParseIpData(t);
        while (q != NULL) {
-           tree_add(Tree, bintreeNetworkCompare, q, NULL);
+           x = tree_srch(Tree, bintreeIpNetworkCompare, &q->addr1);
+           if (NULL != x) {
+               debug(0, 0) ("aclParseIpList: Ignoring duplicate/clashing entry\n");
+               debug(0, 0) ("--> %s already exists\n", inet_ntoa(x->addr1));
+               debug(0, 0) ("--> %s is ignored\n", inet_ntoa(q->addr1));
+           } else {
+               tree_add(Tree, bintreeNetworkCompare, q, NULL);
+           }
            q = q->next;
        }
     }