]> git.ipfire.org Git - thirdparty/dhcp.git/blob - includes/cf/linux.h
MASSIVE merge from V3-RELEASE-BRANCH into HEAD. HEAD and V3-RELEASE are
[thirdparty/dhcp.git] / includes / cf / linux.h
1 /* linux.h
2
3 System dependencies for Linux.
4
5 Based on a configuration originally supplied by Jonathan Stone. */
6
7 /*
8 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
9 * Copyright (c) 1996-2003 by Internet Software Consortium
10 *
11 * Permission to use, copy, modify, and distribute this software for any
12 * purpose with or without fee is hereby granted, provided that the above
13 * copyright notice and this permission notice appear in all copies.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
16 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
18 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Internet Systems Consortium, Inc.
24 * 950 Charter Street
25 * Redwood City, CA 94063
26 * <info@isc.org>
27 * http://www.isc.org/
28 *
29 * This software has been written for Internet Systems Consortium
30 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
31 * To learn more about Internet Systems Consortium, see
32 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
33 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
34 * ``http://www.nominum.com''.
35 */
36
37 #include <features.h>
38 #ifndef __BIT_TYPES_DEFINED__
39 #define __BIT_TYPES_DEFINED__
40 #undef __USE_BSD
41 typedef char int8_t;
42 typedef short int16_t;
43 typedef long int32_t;
44
45 typedef unsigned char u_int8_t;
46 typedef unsigned short u_int16_t;
47 typedef unsigned long u_int32_t;
48 #endif /* __BIT_TYPES_DEFINED__ */
49
50 typedef u_int8_t u8;
51 typedef u_int16_t u16;
52 typedef u_int32_t u32;
53
54 #include <syslog.h>
55 #include <sys/types.h>
56 #include <string.h>
57 #include <errno.h>
58 #include <unistd.h>
59 #include <sys/wait.h>
60 #include <signal.h>
61 #include <setjmp.h>
62 #include <limits.h>
63
64 extern int h_errno;
65
66 #include <net/if.h>
67 #include <net/route.h>
68
69 #if LINUX_MAJOR == 1
70 # include <linux/if_arp.h>
71 # include <linux/time.h> /* also necessary */
72 #else
73 # include <net/if_arp.h>
74 #endif
75
76 #include <sys/time.h> /* gettimeofday()*/
77
78 /* Databases go in /var/state/dhcp. It would also be valid to put them
79 in /var/state/misc - indeed, given that there's only one lease file, it
80 would probably be better. However, I have some ideas for optimizing
81 the lease database that may result in a _lot_ of smaller files being
82 created, so in that context it makes more sense to have a seperate
83 directory. */
84
85 #ifndef _PATH_DHCPD_DB
86 #define _PATH_DHCPD_DB "/var/state/dhcp/dhcpd.leases"
87 #endif
88
89 #ifndef _PATH_DHCLIENT_DB
90 #define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases"
91 #endif
92
93 /* Varargs stuff... */
94 #include <stdarg.h>
95 #define VA_DOTDOTDOT ...
96 #define VA_start(list, last) va_start (list, last)
97 #define va_dcl
98
99 #define VOIDPTR void *
100
101 #define EOL '\n'
102
103 /* Time stuff... */
104
105 #include <time.h>
106
107 #define TIME time_t
108 #define GET_TIME(x) time ((x))
109
110 #if (LINUX_MAJOR >= 2)
111 # if (LINUX_MINOR >= 1)
112 # if defined (USE_DEFAULT_NETWORK)
113 # define USE_LPF
114 # endif
115 # if !defined (__sparc__) /* XXX hopefully this will be fixed someday */
116 # define SIOCGIFCONF_ZERO_PROBE
117 # endif
118 # define LINUX_SLASHPROC_DISCOVERY
119 # define PROCDEV_DEVICE "/proc/net/dev"
120 # define HAVE_ARPHRD_TUNNEL
121 # define HAVE_TR_SUPPORT
122 # endif
123 # define HAVE_ARPHRD_METRICOM
124 # define HAVE_ARPHRD_IEEE802
125 # define HAVE_ARPHRD_LOOPBACK
126 # define HAVE_SO_BINDTODEVICE
127 # define HAVE_SIOCGIFHWADDR
128 # define HAVE_SETFD
129 #endif
130
131 #if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR)
132 # define HAVE_SIOCGIFHWADDR
133 #endif
134
135 #if !defined (USE_LPF)
136 # if defined (USE_DEFAULT_NETWORK)
137 # define USE_SOCKETS
138 # define SOCKET_CAN_RECEIVE_UNICAST_UNCONFIGURED
139 # endif
140 # define IGNORE_HOSTUNREACH
141 #endif
142
143 #define ALIAS_NAMES_PERMUTED
144 #define SKIP_DUMMY_INTERFACES
145
146 #ifdef NEED_PRAND_CONF
147 #ifndef HAVE_DEV_RANDOM
148 # define HAVE_DEV_RANDOM 1
149 #endif /* HAVE_DEV_RANDOM */
150
151 const char *cmds[] = {
152 "/bin/ps -axlw 2>&1",
153 "/sbin/arp -an 2>&1",
154 "/bin/netstat -an 2>&1",
155 "/bin/df 2>&1",
156 "/usr/bin/dig com. soa +ti=1 +retry=0 2>&1",
157 "/usr/bin/uptime 2>&1",
158 "/bin/netstat -s 2>&1",
159 "/usr/bin/dig . soa +ti=1 +retry=0 2>&1",
160 "/usr/bin/vmstat 2>&1",
161 "/usr/bin/w 2>&1",
162 NULL
163 };
164
165 const char *dirs[] = {
166 "/tmp",
167 "/usr/tmp",
168 ".",
169 "/",
170 "/var/spool",
171 "/dev",
172 "/var/spool/mail",
173 "/home",
174 "/usr/home",
175 NULL
176 };
177
178 const char *files[] = {
179 "/proc/stat",
180 "/proc/rtc",
181 "/proc/meminfo",
182 "/proc/interrupts",
183 "/proc/self/status",
184 "/var/log/messages",
185 "/var/log/wtmp",
186 "/var/log/lastlog",
187 NULL
188 };
189 #endif /* NEED_PRAND_CONF */