2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-01 06:45:27 +00:00

Print failover data if present. Support new struct hardware.

This commit is contained in:
Ted Lemon
2000-01-05 18:15:28 +00:00
parent 892aa61aa4
commit fa674bafa5

View File

@@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: db.c,v 1.37 1999/11/07 20:28:23 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; "$Id: db.c,v 1.38 2000/01/05 18:15:28 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -83,6 +83,36 @@ int write_lease (lease)
++errors; ++errors;
} }
#if defined (FAILOVER_PROTOCOL)
t = gmtime (&lease -> tstp);
errno = 0;
fprintf (db_file, "\ttstp %d %d/%02d/%02d %02d:%02d:%02d;",
t -> tm_wday, t -> tm_year + 1900,
t -> tm_mon + 1, t -> tm_mday,
t -> tm_hour, t -> tm_min, t -> tm_sec);
if (errno) {
++errors;
}
t = gmtime (&lease -> tsfp);
errno = 0;
fprintf (db_file, "\ttsfp %d %d/%02d/%02d %02d:%02d:%02d;",
t -> tm_wday, t -> tm_year + 1900,
t -> tm_mon + 1, t -> tm_mday,
t -> tm_hour, t -> tm_min, t -> tm_sec);
if (errno) {
++errors;
}
if (lease -> flags & PEER_IS_OWNER) {
errno = 0;
fprintf (db_file, "\n\tpeer is owner;");
if (errno) {
++errors;
}
}
#endif /* FAILOVER_PROTOCOL */
/* If this lease is billed to a class and is still valid, /* If this lease is billed to a class and is still valid,
write it out. */ write it out. */
if (lease -> billing_class && lease -> ends > cur_time) if (lease -> billing_class && lease -> ends > cur_time)
@@ -92,10 +122,10 @@ int write_lease (lease)
if (lease -> hardware_addr.hlen) { if (lease -> hardware_addr.hlen) {
errno = 0; errno = 0;
fprintf (db_file, "\n\thardware %s %s;", fprintf (db_file, "\n\thardware %s %s;",
hardware_types [lease -> hardware_addr.htype], hardware_types [lease -> hardware_addr.hbuf [0]],
print_hw_addr (lease -> hardware_addr.htype, print_hw_addr (lease -> hardware_addr.hbuf [0],
lease -> hardware_addr.hlen, lease -> hardware_addr.hlen - 1,
lease -> hardware_addr.haddr)); &lease -> hardware_addr.hbuf [1]));
if (errno) { if (errno) {
++errors; ++errors;
} }
@@ -233,10 +263,10 @@ int write_host (host)
if (host -> interface.hlen) { if (host -> interface.hlen) {
errno = 0; errno = 0;
fprintf (db_file, "\n\thardware %s %s;", fprintf (db_file, "\n\thardware %s %s;",
hardware_types [host -> interface.htype], hardware_types [host -> interface.hbuf [0]],
print_hw_addr (host -> interface.htype, print_hw_addr (host -> interface.hbuf [0],
host -> interface.hlen, host -> interface.hlen - 1,
host -> interface.haddr)); &host -> interface.hbuf [1]));
if (errno) { if (errno) {
++errors; ++errors;
} }