mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-03 15:56:00 +00:00
A few tweaks to make lease-time more correct.
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: tree.c,v 1.34 1999/07/19 01:15:11 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: tree.c,v 1.35 1999/07/19 01:17:23 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -1200,22 +1200,22 @@ int evaluate_data_expression (result, packet, options, lease, expr)
|
|||||||
log_error ("data: leased_lease_time: not available");
|
log_error ("data: leased_lease_time: not available");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
i = lease -> ends - lease -> starts;
|
i = lease -> ends - cur_time;
|
||||||
if (buffer_allocate (&result -> buffer, 11, "lease-time")) {
|
if (buffer_allocate (&result -> buffer, 11, "lease-time")) {
|
||||||
result -> data = &result -> buffer -> data [0];
|
result -> data = &result -> buffer -> data [0];
|
||||||
#if defined (NO_SNPRINTF)
|
#if defined (NO_SNPRINTF)
|
||||||
snprintf(result -> data, 11, "%lu", i);
|
sprintf (result -> data, 11, "%lu", i);
|
||||||
#else
|
#else
|
||||||
snprintf(result -> data, 11, "%lu", i);
|
snprintf (result -> data, 11, "%lu", i);
|
||||||
#endif
|
#endif
|
||||||
result -> len = strlen(result -> data);
|
result -> len = strlen (result -> data);
|
||||||
result -> terminated = 0;
|
result -> terminated = 0;
|
||||||
} else {
|
} else {
|
||||||
log_error ("data: leased-lease-time: no memory.");
|
log_error ("data: leased-lease-time: no memory.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if defined (DEBUG_EXPRESSIONS)
|
#if defined (DEBUG_EXPRESSIONS)
|
||||||
log_info ("data: leased-lease-time = %s",
|
log_info ("data: lease-time = %s",
|
||||||
print_hex_1 (result -> len, result -> data, 60));
|
print_hex_1 (result -> len, result -> data, 60));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user