diff options
author | Thomas Markwalder <tmark@isc.org> | 2019-11-22 13:39:45 -0500 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2019-11-22 13:39:45 -0500 |
commit | 0cd94b5ef4a078097fc2bd1dc72f5e80c2cf1844 (patch) | |
tree | e4dfe9a92d676a49b18ab547d781fb3fb10c8e6a /client/clparse.c | |
parent | 97c155273c0df0c8518f226e2b5e338e3ad63e87 (diff) | |
download | isc-dhcp-0cd94b5ef4a078097fc2bd1dc72f5e80c2cf1844.tar.gz |
[#64,!35] Restored work
Restored cummulative work.
Diffstat (limited to 'client/clparse.c')
-rw-r--r-- | client/clparse.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/client/clparse.c b/client/clparse.c index eaf48a8f..35e2d164 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -3,7 +3,7 @@ Parser for dhclient config and lease files... */ /* - * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2019 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * This Source Code Form is subject to the terms of the Mozilla Public @@ -47,6 +47,9 @@ static struct dhc6_addr *parse_client6_iaprefix_statement(struct parse *cfile); static void parse_lease_id_format (struct parse *cfile); +extern void discard_duplicate (struct client_lease** lease_list, + struct client_lease* lease); + /* client-conf-file :== client-declarations END_OF_FILE client-declarations :== <nil> | client-declaration @@ -1096,7 +1099,7 @@ void parse_client_lease_statement (cfile, is_static) struct parse *cfile; int is_static; { - struct client_lease *lease, *lp, *pl, *next; + struct client_lease *lease; struct interface_info *ip = (struct interface_info *)0; int token; const char *val; @@ -1154,22 +1157,11 @@ void parse_client_lease_statement (cfile, is_static) /* The new lease may supersede a lease that's not the active lease but is still on the lease list, so scan the lease list looking for a lease with the same address, and - if we find it, toss it. */ - pl = (struct client_lease *)0; - for (lp = client -> leases; lp; lp = next) { - next = lp -> next; - if (lp -> address.len == lease -> address.len && - !memcmp (lp -> address.iabuf, lease -> address.iabuf, - lease -> address.len)) { - if (pl) - pl -> next = next; - else - client -> leases = next; - destroy_client_lease (lp); - break; - } else - pl = lp; - } + if we find it, toss it. We only allow supercession if + the leases originated from the same source. In other words, + either both are from the config file or both are from the lease + file. This keeps us from discarding fallback leases */ + discard_duplicate (&client->leases, lease); /* If this is a preloaded lease, just put it on the list of recorded leases - don't make it the active lease. */ |