free a lease via omshell

Christof Chen christof at chen.de
Wed Feb 25 19:08:27 UTC 2009


> I've noticed we should update also btw, it might be related although I
> can't play around with that at will.
> 
>> dhcpd -v
> Internet Systems Consortium DHCP Server V3.0.4

"OMAPI writable lease end time" appeares officially first in 4.1.0.

My patch against 3.0.5 looked like this - probably it applies to 3.0.7
without change:

Index: current/server/omapi.c
===================================================================
--- current/server/omapi.c	(revision 28)
+++ current/server/omapi.c	(revision 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")) {




Best regards,
	Christof Chen



More information about the dhcp-users mailing list