From: Ted Lemon Date: Tue, 24 Nov 1998 23:02:54 +0000 (+0000) Subject: Sort a subnet in before an inner subnet of that subnet, for subnets one of which... X-Git-Tag: V2-BETA-1-PATCH-7~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77158687cfd69cc05f56a497be59469834aca752;p=thirdparty%2Fdhcp.git Sort a subnet in before an inner subnet of that subnet, for subnets one of which is a superset of the other. --- diff --git a/server/confpars.c b/server/confpars.c index 432e5a27a..a938fbcb8 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: confpars.c,v 1.45.2.3 1998/07/07 17:50:29 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: confpars.c,v 1.45.2.4 1998/11/24 23:02:54 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -658,7 +658,7 @@ void parse_subnet_declaration (cfile, share) { char *val; int token; - struct subnet *subnet, *t; + struct subnet *subnet, *t, *u; struct iaddr iaddr; unsigned char addr [4]; int len = sizeof addr; @@ -725,9 +725,19 @@ void parse_subnet_declaration (cfile, share) if (!share -> subnets) share -> subnets = subnet; else { + u = (struct subnet *)0; for (t = share -> subnets; - t -> next_sibling; t = t -> next_sibling) - ; + t -> next_sibling; t = t -> next_sibling) { + if (subnet_inner_than (subnet, t, 0)) { + if (u) + u -> next_sibling = subnet; + else + share -> subnets = subnet; + subnet -> next_sibling = t; + return; + } + u = t; + } t -> next_sibling = subnet; } }