diff -C4 -r dhcp-3.0.1rc6/includes/dhcpd.h dhcp-3.0.1rc6_k/includes/dhcpd.h
*** dhcp-3.0.1rc6/includes/dhcpd.h	Thu Jan 17 19:45:57 2002
--- dhcp-3.0.1rc6_k/includes/dhcpd.h	Mon Jan 21 23:30:51 2002
***************
*** 414,421 ****
--- 414,422 ----
  #define SV_UPDATE_OPTIMIZATION		41
  #define SV_PING_CHECKS			42
  #define SV_UPDATE_STATIC_LEASES		43
  #define SV_LOG_FACILITY			44
+ #define SV_MAX_LEASE_REWRITE_DELAY	45
  
  #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
  # define DEFAULT_DEFAULT_LEASE_TIME 43200
  #endif
***************
*** 431,438 ****
--- 432,443 ----
  #if !defined (DEFAULT_DDNS_TTL)
  # define DEFAULT_DDNS_TTL 3600
  #endif
  
+ #if !defined (DEFAULT_MAX_LEASE_REWRITE_DELAY)
+ # define DEFAULT_MAX_LEASE_REWRITE_DELAY 3600
+ #endif
+ 
  /* Client option names */
  
  #define	CL_TIMEOUT		1
  #define	CL_SELECT_INTERVAL	2
***************
*** 1117,1124 ****
--- 1122,1131 ----
  extern const char *path_dhcpd_db;
  extern const char *path_dhcpd_pid;
  
  extern int dhcp_max_agent_option_packet_length;
+ 
+ extern unsigned long max_lease_rewrite_delay ;
  
  int main PROTO ((int, char **, char **));
  void postconf_initialization (int);
  void postdb_startup (void);
diff -C4 -r dhcp-3.0.1rc6/server/db.c dhcp-3.0.1rc6_k/server/db.c
*** dhcp-3.0.1rc6/server/db.c	Sat Jun 23 01:58:08 2001
--- dhcp-3.0.1rc6_k/server/db.c	Mon Jan 21 23:46:38 2002
***************
*** 700,711 ****
  		log_info ("commit_leases: unable to commit: %m");
  		return 0;
  	}
  
! 	/* If we haven't rewritten the lease database in over an
! 	   hour, rewrite it now.  (The length of time should probably
! 	   be configurable. */
! 	if (count && cur_time - write_time > 3600) {
  		count = 0;
  		write_time = cur_time;
  		new_lease_file ();
  	}
--- 700,710 ----
  		log_info ("commit_leases: unable to commit: %m");
  		return 0;
  	}
  
! 	/* If we haven't rewritten the lease database for longer than
! 	   the permissible maximum delay, rewrite it now. */
! 	if (count && cur_time - write_time > max_lease_rewrite_delay) {
  		count = 0;
  		write_time = cur_time;
  		new_lease_file ();
  	}
diff -C4 -r dhcp-3.0.1rc6/server/dhcpd.c dhcp-3.0.1rc6_k/server/dhcpd.c
*** dhcp-3.0.1rc6/server/dhcpd.c	Fri Jun 22 04:12:58 2001
--- dhcp-3.0.1rc6_k/server/dhcpd.c	Mon Jan 21 23:42:04 2002
***************
*** 166,173 ****
--- 166,176 ----
  
  static omapi_auth_key_t *omapi_key = (omapi_auth_key_t *)0;
  int omapi_port;
  
+ /* Maximum number of seconds between lease file rewrites */ 
+ unsigned long max_lease_rewrite_delay = DEFAULT_MAX_LEASE_REWRITE_DELAY;
+ 
  #if defined (TRACING)
  trace_type_t *trace_srandom;
  #endif
  
***************
*** 815,822 ****
--- 818,844 ----
  					log_perror = tmp;
  				}
  			} else
  				log_fatal ("invalid log facility");
+ 			data_string_forget (&db, MDL);
+ 		}
+ 	}
+ 
+ 	oc = lookup_option (&server_universe,
+ 				options, SV_MAX_LEASE_REWRITE_DELAY);
+ 	if (oc) {
+ 		if (evaluate_option_cache (&db, (struct packet *)0,
+ 					   (struct lease *)0,
+ 					   (struct client_state *)0,
+ 					   options,
+ 					   (struct option_state *)0,
+ 					   &global_scope, oc, MDL)) {
+ 			if (db.len == sizeof(u_int32_t))
+ 				max_lease_rewrite_delay = getULong(db.data) ;
+ 			else
+ 				log_fatal ("invalid maximum lease rewrite "
+ 					   "delay data length");
+ 
  			data_string_forget (&db, MDL);
  		}
  	}
  
diff -C4 -r dhcp-3.0.1rc6/server/dhcpd.conf.5 dhcp-3.0.1rc6_k/server/dhcpd.conf.5
*** dhcp-3.0.1rc6/server/dhcpd.conf.5	Thu Jan 17 19:10:29 2002
--- dhcp-3.0.1rc6_k/server/dhcpd.conf.5	Mon Jan 21 23:53:22 2002
***************
*** 1437,1445 ****
  .PP
  The use of this option is now \fIdeprecated\fR.  If you are trying to
  restrict access on your network to known clients, you should use \fBdeny
  unknown clients;\fR inside of your address pool, as described under the
! heading ALLOW AND DENY WITHIN POOL DECLARAIONS.
  .PP
  .B The
  .I bootp
  .B keyword
--- 1437,1445 ----
  .PP
  The use of this option is now \fIdeprecated\fR.  If you are trying to
  restrict access on your network to known clients, you should use \fBdeny
  unknown clients;\fR inside of your address pool, as described under the
! heading ALLOW AND DENY WITHIN POOL DECLARATIONS.
  .PP
  .B The
  .I bootp
  .B keyword
***************
*** 1974,1981 ****
--- 1974,1999 ----
  how to change the default log facility.  When this parameter is used,
  the DHCP server prints its startup message a second time after parsing
  the configuration file, so that the log will be as complete as
  possible.
+ .RE
+ .PP
+ The
+ .I max-lease-rewrite-delay
+ statement
+ .RS 0.25i
+ .PP
+ .B max-lease-rewrite-delay \fItime\fR\fB;\fR
+ .PP
+ .I Time
+ should be the maximum length in seconds that may elapse between 
+ rewrites of the lease file. The larger this value, the greater
+ the risk of lost lease information should the server terminate
+ unexpectedly. Small values may result in the server spending a
+ lot of time writing lease information to disk, especially if the
+ number of leases is large. A practical value is 3600 seconds (one
+ hour); this is the default if this statement is omitted from the
+ configuration file.
  .RE
  .PP
  The
  .I max-lease-time
diff -C4 -r dhcp-3.0.1rc6/server/stables.c dhcp-3.0.1rc6_k/server/stables.c
*** dhcp-3.0.1rc6/server/stables.c	Wed Oct 17 05:32:03 2001
--- dhcp-3.0.1rc6_k/server/stables.c	Mon Jan 21 23:26:18 2002
***************
*** 489,497 ****
  	{ "update-optimization", "f",		&server_universe, 41 },
  	{ "ping-check", "f",			&server_universe, 42 },
  	{ "update-static-leases", "f",		&server_universe, 43 },
  	{ "log-facility", "Nsyslog-facilities.", &server_universe, 44 },
! 	{ "#45", "X",			&server_universe, 45 },
  	{ "#46", "X",			&server_universe, 46 },
  	{ "#47", "X",			&server_universe, 47 },
  	{ "#48", "X",			&server_universe, 48 },
  	{ "#49", "X",			&server_universe, 49 },
--- 489,497 ----
  	{ "update-optimization", "f",		&server_universe, 41 },
  	{ "ping-check", "f",			&server_universe, 42 },
  	{ "update-static-leases", "f",		&server_universe, 43 },
  	{ "log-facility", "Nsyslog-facilities.", &server_universe, 44 },
! 	{ "max_lease_rewrite_delay", "L",	&server_universe, 45 },
  	{ "#46", "X",			&server_universe, 46 },
  	{ "#47", "X",			&server_universe, 47 },
  	{ "#48", "X",			&server_universe, 48 },
  	{ "#49", "X",			&server_universe, 49 },
