|
|
45d60a |
diff --git a/client/dhclient.c b/client/dhclient.c
|
|
|
45d60a |
index 1992467..364fd08 100644
|
|
|
45d60a |
--- a/client/dhclient.c
|
|
|
45d60a |
+++ b/client/dhclient.c
|
|
|
45d60a |
@@ -4463,6 +4463,10 @@ isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
|
|
|
45d60a |
case server_awaken:
|
|
|
45d60a |
state_reboot (client);
|
|
|
45d60a |
break;
|
|
|
45d60a |
+ case server_time_changed:
|
|
|
45d60a |
+ if (client->active)
|
|
|
45d60a |
+ state_reboot (client);
|
|
|
45d60a |
+ break;
|
|
|
45d60a |
}
|
|
|
45d60a |
}
|
|
|
45d60a |
}
|
|
|
45d60a |
diff --git a/common/dispatch.c b/common/dispatch.c
|
|
|
45d60a |
index af8a5b5..c1d558f 100644
|
|
|
45d60a |
--- a/common/dispatch.c
|
|
|
45d60a |
+++ b/common/dispatch.c
|
|
|
45d60a |
@@ -110,10 +110,20 @@ dispatch(void)
|
|
|
45d60a |
{
|
|
|
45d60a |
isc_result_t status;
|
|
|
45d60a |
|
|
|
45d60a |
- status = isc_app_ctxrun(dhcp_gbl_ctx.actx);
|
|
|
45d60a |
-
|
|
|
45d60a |
- log_fatal ("Dispatch routine failed: %s -- exiting",
|
|
|
45d60a |
- isc_result_totext (status));
|
|
|
45d60a |
+ do{
|
|
|
45d60a |
+ status = isc_app_ctxrun(dhcp_gbl_ctx.actx);
|
|
|
45d60a |
+
|
|
|
45d60a |
+ if (status == ISC_R_TIMESHIFTED){
|
|
|
45d60a |
+ status = dhcp_set_control_state(server_time_changed,
|
|
|
45d60a |
+ server_time_changed);
|
|
|
45d60a |
+ status = ISC_R_RELOAD;
|
|
|
45d60a |
+ log_info ("System time has been changed. Unable to use existing leases. Restarting");
|
|
|
45d60a |
+ // do nothing, restart context
|
|
|
45d60a |
+ };
|
|
|
45d60a |
+ } while (status == ISC_R_RELOAD);
|
|
|
45d60a |
+
|
|
|
45d60a |
+ log_fatal ("Dispatch routine failed: %s -- exiting",
|
|
|
45d60a |
+ isc_result_totext (status));
|
|
|
45d60a |
}
|
|
|
45d60a |
|
|
|
45d60a |
void
|
|
|
45d60a |
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
|
|
|
45d60a |
index deea2a7..d60a03c 100644
|
|
|
45d60a |
--- a/includes/dhcpd.h
|
|
|
45d60a |
+++ b/includes/dhcpd.h
|
|
|
45d60a |
@@ -479,7 +479,8 @@ typedef enum {
|
|
|
45d60a |
server_running = 1,
|
|
|
45d60a |
server_shutdown = 2,
|
|
|
45d60a |
server_hibernate = 3,
|
|
|
45d60a |
- server_awaken = 4
|
|
|
45d60a |
+ server_awaken = 4,
|
|
|
45d60a |
+ server_time_changed = 5
|
|
|
45d60a |
} control_object_state_t;
|
|
|
45d60a |
|
|
|
45d60a |
typedef struct {
|
|
|
45d60a |
diff --git a/server/dhcpd.c b/server/dhcpd.c
|
|
|
45d60a |
index 9617d75..9add7e4 100644
|
|
|
45d60a |
--- a/server/dhcpd.c
|
|
|
45d60a |
+++ b/server/dhcpd.c
|
|
|
45d60a |
@@ -1392,6 +1392,10 @@ static isc_result_t dhcp_io_shutdown_countdown (void *vlp)
|
|
|
45d60a |
isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
|
|
|
45d60a |
control_object_state_t newstate)
|
|
|
45d60a |
{
|
|
|
45d60a |
+ if (newstate == server_time_changed){
|
|
|
45d60a |
+ log_error ("System time has been changed. Leases information unreliable!");
|
|
|
45d60a |
+ return ISC_R_SUCCESS;
|
|
|
45d60a |
+ }
|
|
|
45d60a |
if (newstate == server_shutdown) {
|
|
|
45d60a |
shutdown_time = cur_time;
|
|
|
45d60a |
shutdown_state = shutdown_listeners;
|