forked from fsweetser/netreg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdhcpd.patch
42 lines (38 loc) · 1.3 KB
/
dhcpd.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- dhcp.c Thu Jan 17 13:11:37 2002
+++ ../../dhcp-3.0.1rc6-km/server/dhcp.c Fri Feb 8 00:30:11 2002
@@ -48,6 +48,7 @@
#include "dhcpd.h"
+#define CMU_STATIC_LEASE_FILE "/var/log/dhcpd.static"
int outstanding_pings;
static char dhcp_message [256];
@@ -1457,6 +1458,10 @@
int val;
int ignorep;
+#ifdef CMU_STATIC_LEASE_FILE
+ FILE* statf;
+#endif
+
/* If we're already acking this lease, don't do it again. */
if (lease -> state)
return;
@@ -2192,6 +2197,20 @@
memcpy (&lease -> hardware_addr.hbuf [1],
packet -> raw -> chaddr,
sizeof packet -> raw -> chaddr); /* XXX */
+#ifdef CMU_STATIC_LEASE_FILE
+ statf = fopen(CMU_STATIC_LEASE_FILE, "a");
+ if (statf) {
+ fprintf(statf, "%s %d %d %s\n",
+ piaddr (lt->ip_addr),
+ (int)lt->starts,
+ (int)lt->ends,
+ print_hw_addr (lease->hardware_addr.hbuf[0],
+ lease->hardware_addr.hlen - 1,
+ &lease->hardware_addr.hbuf[1]));
+ fclose(statf);
+ }
+#endif
+
} else {
/* Install the new information about this lease in the
database. If this is a DHCPACK or a dynamic BOOTREPLY