From: Shawn Routhier Date: Wed, 6 Jun 2012 23:55:01 +0000 (+0000) Subject: The 'no available billing' log line now also logs the name of the last X-Git-Tag: v4_3_0a1~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6980ae03c3b877d07557479b93d2276ab49560ac;p=thirdparty%2Fdhcp.git The 'no available billing' log line now also logs the name of the last matching billing class tried before failing to provide a billing. ISC-Bugs #21759] --- diff --git a/RELNOTES b/RELNOTES index 9bb002213..061a000fc 100644 --- a/RELNOTES +++ b/RELNOTES @@ -39,8 +39,7 @@ The system has only been tested on Linux, FreeBSD, and Solaris, and may not work on other platforms. Please report any problems and suggested fixes to . - Changes since 4.2.x - + Changes since 4.2.0 (new features) - If a client renews before 'dhcp-cache-threshold' percent of its lease has elapsed (default 25%), the server will reuse the allocated lease @@ -49,6 +48,10 @@ work on other platforms. Please report any problems and suggested fixes to to perform an fsync() operation on the lease database before reply, which improves performance. [ISC-Bugs #22228] +- The 'no available billing' log line now also logs the name of the last + matching billing class tried before failing to provide a billing. + [ISC-Bugs #21759] + Changes since 4.2.4 - Correct code to calculate timing values in client to compare diff --git a/server/dhcp.c b/server/dhcp.c index 6ef2e4ada..58072c93c 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -1887,26 +1887,37 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) /* If we don't have an active billing, see if we need one, and if we do, try to do so. */ if (lease->billing_class == NULL) { + char *cname = ""; int bill = 0; + for (i = 0; i < packet->class_count; i++) { - if (packet->classes[i]->lease_limit) { + struct class *billclass, *subclass; + + billclass = packet->classes[i]; + if (billclass->lease_limit) { bill++; - if (bill_class(lease, - packet->classes[i])) + if (bill_class(lease, billclass)) break; + + subclass = billclass->superclass; + if (subclass == NULL) + cname = subclass->name; + else + cname = billclass->name; } } if (bill != 0 && i == packet->class_count) { log_info("%s: no available billing: lease " "limit reached in all matching " - "classes", msg); + "classes (last: '%s')", msg, cname); free_lease_state(state, MDL); if (host) host_dereference(&host, MDL); return; } - /* If this is an offer, undo the billing. We go + /* + * If this is an offer, undo the billing. We go * through all the steps above to bill a class so * we can hit the 'no available billing' mark and * abort without offering. But it just doesn't make