From f40e41cf94de0b9a81696a860958d9712d4cb806 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Fri, 27 Mar 1998 11:44:54 +0000 Subject: [PATCH] warn about adding duplicate/overlapping IP keys for binary trees --- src/acl.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/acl.cc b/src/acl.cc index 22a62d5aea..ed84fc77b9 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -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; } } -- 2.47.3