From eb4a45ebf5ec4607780950f4df7408ee38bac51b Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Thu, 16 Nov 2000 00:06:38 +0000 Subject: [PATCH] remove sortlist --- lib/lwres/lwres_gabn.c | 73 ++---------------------------------------- 1 file changed, 2 insertions(+), 71 deletions(-) diff --git a/lib/lwres/lwres_gabn.c b/lib/lwres/lwres_gabn.c index 13bf93945a..9612046a67 100644 --- a/lib/lwres/lwres_gabn.c +++ b/lib/lwres/lwres_gabn.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwres_gabn.c,v 1.24 2000/08/01 01:32:25 tale Exp $ */ +/* $Id: lwres_gabn.c,v 1.25 2000/11/16 00:06:38 bwelling Exp $ */ #include @@ -31,71 +31,6 @@ #include "context_p.h" #include "assert_p.h" -static void -lwres_sortlist(lwres_context_t *ctx, lwres_addrlist_t *inlist, - lwres_addrlist_t *outlist) -{ - unsigned int i, x; - lwres_conf_t *confdata; - unsigned char mask[LWRES_ADDR_MAXLEN]; - unsigned char sortaddr[LWRES_ADDR_MAXLEN]; - unsigned char listaddr[LWRES_ADDR_MAXLEN]; - unsigned int length; - lwres_addr_t *addr; - lwres_addr_t *nextaddr; - - confdata = &ctx->confdata; - - /* - * If there is no sortlist, we're done. - */ - if (confdata->sortlistnxt == 0) { - *outlist = *inlist; - return; - } - - LWRES_LIST_INIT(*outlist); - - for (i = 0 ; i < confdata->sortlistnxt ; i++) { - length = confdata->sortlist[i].addr.length; - INSIST(length == confdata->sortlist[i].mask.length); - memcpy(mask, confdata->sortlist[i].mask.address, length); - memcpy(sortaddr, confdata->sortlist[i].addr.address, length); - for (x = 0 ; x < length ; x++) - sortaddr[x] &= mask[x]; - - addr = LWRES_LIST_HEAD(*inlist); - while (addr != NULL) { - nextaddr = LWRES_LIST_NEXT(addr, link); - - if (addr->family != confdata->sortlist[i].addr.family) - goto next; - - memcpy(listaddr, addr->address, length); - for (x = 0 ; x < length ; x++) - listaddr[x] &= mask[x]; - - if (memcmp(listaddr, sortaddr, length) == 0) { - LWRES_LIST_UNLINK(*inlist, addr, link); - LWRES_LIST_APPEND(*outlist, addr, link); - } - - next: - addr = nextaddr; - } - } - - /* - * Get everything that doesn't match any sortlist lines. - */ - addr = LWRES_LIST_HEAD(*inlist); - while (addr != NULL) { - LWRES_LIST_UNLINK(*inlist, addr, link); - LWRES_LIST_APPEND(*outlist, addr, link); - addr = LWRES_LIST_HEAD(*inlist); - } -} - lwres_result_t lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b) @@ -412,11 +347,7 @@ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, goto out; } - /* - * Do the sortlist thing here. After this is done, "addrlist" - * must NOT be used again, since it will be very very bogus. - */ - lwres_sortlist(ctx, &addrlist, &gabn->addrs); + gabn->addrs = addrlist; *structp = gabn; return (LWRES_R_SUCCESS);