Problems with settings ends statement (was: Remove Lease via omshell)

Marc Perea marccp at srttel.com
Mon Jan 25 16:48:47 UTC 2010


I don't know if this was finally patched into any of the current releases, but I had to patch in the ability to modify the ends time on my version and then recompile dhcpd. Again, I do an ends = 0 just to make less calculations by scripting (instead of find out what value is in starts, parse that out and apply it to ends), but this patch makes it writable. HTH!
 
--Marc
 
Christof Chen provided the patch. Details should be available here: 
https://lists.isc.org/pipermail/dhcp-users/2008-September/007103.html 
http://osdir.com/ml/network.dhcp.isc.dhcp-client/2006-11/msg00031.html ( http://osdir.com/ml/network.dhcp.isc.dhcp-client/2006-11/msg00030.html )
 
Modified: trunk/current/server/omapi.c
===================================================================
--- trunk/current/server/omapi.c        2006-07-27 11:28:37 UTC (rev 28)
+++ trunk/current/server/omapi.c        2006-10-27 15:40:36 UTC (rev 29)
@@ -261,7 +261,20 @@
        } else if (!omapi_ds_strcmp (name, "starts")) {
            return ISC_R_NOPERM;
        } else if (!omapi_ds_strcmp (name, "ends")) {
-           return ISC_R_NOPERM;
+           unsigned long bar,ole;
+           status = omapi_get_int_value (&bar, value);
+           if (status != ISC_R_SUCCESS)
+               return status;
+           ole = lease -> ends;
+           lease -> ends = bar;   /* CC test */
+           if (supersede_lease (lease, 0, 1, 1, 1)) {
+                       log_info ("lease %s end changed from %lu to %lu",
+                                 piaddr(lease->ip_addr), ole, bar);
+                       return ISC_R_SUCCESS;
+           }
+           log_info ("lease %s end changed from %lu to %lu failed",
+                                 piaddr(lease->ip_addr), ole, bar);
+           return ISC_R_IOERROR;
        } else if (!omapi_ds_strcmp (name, "billing-class")) {
            return ISC_R_UNCHANGED;     /* XXX carefully allow change. */
        } else if (!omapi_ds_strcmp (name, "hardware-address")) {


This makes "ends" writable for a lease via OMAPI. I have not tried anything 
beyond ends = starts, but this made the lease immediately available for a
new 
client.

-- 
Christof Chen
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20100125/e8fba675/attachment.html>


More information about the dhcp-users mailing list