]>
Commit | Line | Data |
---|---|---|
48695f7d TL |
1 | /* linux.h |
2 | ||
f57d2a51 | 3 | System dependencies for Linux. |
48695f7d | 4 | |
f57d2a51 | 5 | Based on a configuration originally supplied by Jonathan Stone. */ |
48695f7d TL |
6 | |
7 | /* | |
88cd8aca | 8 | * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") |
98311e4b | 9 | * Copyright (c) 1996-2003 by Internet Software Consortium |
48695f7d | 10 | * |
98311e4b DH |
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. | |
48695f7d | 14 | * |
98311e4b DH |
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. | |
48695f7d | 22 | * |
98311e4b DH |
23 | * Internet Systems Consortium, Inc. |
24 | * 950 Charter Street | |
25 | * Redwood City, CA 94063 | |
26 | * <info@isc.org> | |
27 | * http://www.isc.org/ | |
49733f31 | 28 | * |
98311e4b | 29 | * This software has been written for Internet Systems Consortium |
49733f31 | 30 | * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. |
98311e4b | 31 | * To learn more about Internet Systems Consortium, see |
49733f31 TL |
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''. | |
48695f7d TL |
35 | */ |
36 | ||
f57d2a51 | 37 | #include <features.h> |
78b31f4e TL |
38 | #ifndef __BIT_TYPES_DEFINED__ |
39 | #define __BIT_TYPES_DEFINED__ | |
f57d2a51 TL |
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; | |
78b31f4e | 48 | #endif /* __BIT_TYPES_DEFINED__ */ |
f57d2a51 | 49 | |
d2bc90bd TL |
50 | typedef u_int8_t u8; |
51 | typedef u_int16_t u16; | |
52 | typedef u_int32_t u32; | |
53 | ||
3060073a | 54 | #include <syslog.h> |
48695f7d TL |
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 | ||
48695f7d TL |
64 | extern int h_errno; |
65 | ||
66 | #include <net/if.h> | |
469cf3a4 | 67 | #include <net/route.h> |
af566287 | 68 | |
d2bc90bd | 69 | #if LINUX_MAJOR == 1 |
af566287 TL |
70 | # include <linux/if_arp.h> |
71 | # include <linux/time.h> /* also necessary */ | |
72 | #else | |
73 | # include <net/if_arp.h> | |
74 | #endif | |
5448eba3 | 75 | |
48695f7d | 76 | #include <sys/time.h> /* gettimeofday()*/ |
48695f7d | 77 | |
74f45f96 TL |
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" | |
d432c972 | 87 | #endif |
74f45f96 | 88 | |
d432c972 | 89 | #ifndef _PATH_DHCLIENT_DB |
74f45f96 | 90 | #define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases" |
d432c972 | 91 | #endif |
48695f7d | 92 | |
48695f7d TL |
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 | |
f57d2a51 | 98 | |
48695f7d TL |
99 | #define VOIDPTR void * |
100 | ||
88cd8aca DH |
101 | #if defined(__alpha__) || defined(__amd64__) || defined(__ia64__) || \ |
102 | defined(__sparc64__) | |
103 | # define PTRSIZE_64BIT | |
104 | #endif | |
105 | ||
48695f7d TL |
106 | #define EOL '\n' |
107 | ||
48695f7d TL |
108 | /* Time stuff... */ |
109 | ||
48695f7d TL |
110 | #include <time.h> |
111 | ||
112 | #define TIME time_t | |
113 | #define GET_TIME(x) time ((x)) | |
48695f7d | 114 | |
74f45f96 | 115 | #if (LINUX_MAJOR >= 2) |
88cd8aca | 116 | # if ((LINUX_MAJOR > 2) || (LINUX_MINOR >= 1)) |
74f45f96 TL |
117 | # if defined (USE_DEFAULT_NETWORK) |
118 | # define USE_LPF | |
119 | # endif | |
aa2b88c2 | 120 | # if !defined (__sparc__) /* XXX hopefully this will be fixed someday */ |
31bbee78 | 121 | # define SIOCGIFCONF_ZERO_PROBE |
aa2b88c2 | 122 | # endif |
d2bc90bd TL |
123 | # define LINUX_SLASHPROC_DISCOVERY |
124 | # define PROCDEV_DEVICE "/proc/net/dev" | |
74f45f96 | 125 | # define HAVE_ARPHRD_TUNNEL |
7d29d66d | 126 | # define HAVE_TR_SUPPORT |
74f45f96 TL |
127 | # endif |
128 | # define HAVE_ARPHRD_METRICOM | |
129 | # define HAVE_ARPHRD_IEEE802 | |
130 | # define HAVE_ARPHRD_LOOPBACK | |
131 | # define HAVE_SO_BINDTODEVICE | |
132 | # define HAVE_SIOCGIFHWADDR | |
9a83b1d9 | 133 | # define HAVE_SETFD |
74f45f96 TL |
134 | #endif |
135 | ||
1bddf26a TL |
136 | #if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR) |
137 | # define HAVE_SIOCGIFHWADDR | |
138 | #endif | |
139 | ||
74f45f96 TL |
140 | #if !defined (USE_LPF) |
141 | # if defined (USE_DEFAULT_NETWORK) | |
60b60a2b | 142 | # define USE_SOCKETS |
3fc9a0ef | 143 | # define SOCKET_CAN_RECEIVE_UNICAST_UNCONFIGURED |
d2bc90bd | 144 | # endif |
74f45f96 | 145 | # define IGNORE_HOSTUNREACH |
60b60a2b | 146 | #endif |
9bd1bbac TL |
147 | |
148 | #define ALIAS_NAMES_PERMUTED | |
b968c68a | 149 | #define SKIP_DUMMY_INTERFACES |
32e99078 TL |
150 | |
151 | #ifdef NEED_PRAND_CONF | |
152 | #ifndef HAVE_DEV_RANDOM | |
153 | # define HAVE_DEV_RANDOM 1 | |
154 | #endif /* HAVE_DEV_RANDOM */ | |
155 | ||
156 | const char *cmds[] = { | |
157 | "/bin/ps -axlw 2>&1", | |
158 | "/sbin/arp -an 2>&1", | |
159 | "/bin/netstat -an 2>&1", | |
160 | "/bin/df 2>&1", | |
161 | "/usr/bin/dig com. soa +ti=1 +retry=0 2>&1", | |
162 | "/usr/bin/uptime 2>&1", | |
163 | "/bin/netstat -s 2>&1", | |
164 | "/usr/bin/dig . soa +ti=1 +retry=0 2>&1", | |
165 | "/usr/bin/vmstat 2>&1", | |
166 | "/usr/bin/w 2>&1", | |
167 | NULL | |
168 | }; | |
169 | ||
170 | const char *dirs[] = { | |
171 | "/tmp", | |
172 | "/usr/tmp", | |
173 | ".", | |
174 | "/", | |
175 | "/var/spool", | |
176 | "/dev", | |
177 | "/var/spool/mail", | |
178 | "/home", | |
179 | "/usr/home", | |
180 | NULL | |
181 | }; | |
182 | ||
183 | const char *files[] = { | |
184 | "/proc/stat", | |
185 | "/proc/rtc", | |
186 | "/proc/meminfo", | |
187 | "/proc/interrupts", | |
188 | "/proc/self/status", | |
189 | "/var/log/messages", | |
190 | "/var/log/wtmp", | |
191 | "/var/log/lastlog", | |
192 | NULL | |
193 | }; | |
194 | #endif /* NEED_PRAND_CONF */ |