Gentoo Archives: gentoo-commits

From: "Tony Vroon (chainsaw)" <chainsaw@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-misc/dhcp/files: dhcp-4.0-no_isc_blurb.patch dhcp-4.0-dhclient-ntp.patch dhcp-4.0-dhclient-stdin-conf.patch dhcp-4.0-paranoia.patch dhcp-4.0-dhclient-metric.patch dhcp-4.0-dhclient-script-correct-operators.patch dhcp-4.0-linux-ipv6-header.patch dhcp-4.0-dhclient-resolvconf.patch
Date: Thu, 04 Sep 2008 12:39:51
Message-Id: E1KbE7m-0003vY-5k@stork.gentoo.org
1 chainsaw 08/09/04 12:39:46
2
3 Added: dhcp-4.0-no_isc_blurb.patch
4 dhcp-4.0-dhclient-ntp.patch
5 dhcp-4.0-dhclient-stdin-conf.patch
6 dhcp-4.0-paranoia.patch
7 dhcp-4.0-dhclient-metric.patch
8 dhcp-4.0-dhclient-script-correct-operators.patch
9 dhcp-4.0-linux-ipv6-header.patch
10 dhcp-4.0-dhclient-resolvconf.patch
11 Log:
12 Version bump, closes bug #205214. Thanks to Roy "UberLord" Marples <roy@×××××××.name> for patching and patch porting.
13 (Portage version: 2.2_rc8/cvs/Linux 2.6.27-rc5-00131-g5f17cfc-dirty x86_64)
14
15 Revision Changes Path
16 1.1 net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch
17
18 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch?rev=1.1&view=markup
19 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch?rev=1.1&content-type=text/plain
20
21 Index: dhcp-4.0-no_isc_blurb.patch
22 ===================================================================
23 diff -uNr dhcp-4.0.0.ORIG/client/dhclient.c dhcp-4.0.0/client/dhclient.c
24 --- dhcp-4.0.0.ORIG/client/dhclient.c 2008-09-01 13:38:38.000000000 +0100
25 +++ dhcp-4.0.0/client/dhclient.c 2008-09-01 13:41:32.000000000 +0100
26 @@ -80,6 +80,8 @@
27
28 static isc_result_t write_duid(struct data_string *duid);
29
30 +extern int log_isc_blurb;
31 +
32 int
33 main(int argc, char **argv) {
34 int fd;
35 @@ -323,6 +325,7 @@
36 log_info ("%s", "");
37 } else {
38 log_perror = 0;
39 + log_isc_blurb = 0;
40 quiet_interface_discovery = 1;
41 }
42
43 diff -uNr dhcp-4.0.0.ORIG/omapip/errwarn.c dhcp-4.0.0/omapip/errwarn.c
44 --- dhcp-4.0.0.ORIG/omapip/errwarn.c 2008-09-01 13:38:38.000000000 +0100
45 +++ dhcp-4.0.0/omapip/errwarn.c 2008-09-01 13:39:17.000000000 +0100
46 @@ -43,6 +43,8 @@
47 int log_perror = 1;
48 #endif
49 int log_priority;
50 +int log_isc_blurb=1;
51 +
52 void (*log_cleanup) (void);
53
54 #define CVT_BUF_MAX 1023
55 @@ -74,7 +76,9 @@
56 write (STDERR_FILENO, "\n", 1);
57 }
58
59 -#if !defined (NOMINUM)
60 +#if !defined(NOMINUM)
61 + if ( log_isc_blurb )
62 + {
63 log_error ("%s", "");
64 log_error ("If you did not get this software from ftp.isc.org, please");
65 log_error ("get the latest from ftp.isc.org and install that before");
66 @@ -92,7 +96,12 @@
67 log_error ("the README file.");
68 log_error ("%s", "");
69 log_error ("exiting.");
70 + }else
71 + {
72 + log_error ("exiting.");
73 + }
74 #endif
75 +
76 if (log_cleanup)
77 (*log_cleanup) ();
78 exit (1);
79 diff -uNr dhcp-4.0.0.ORIG/relay/dhcrelay.c dhcp-4.0.0/relay/dhcrelay.c
80 --- dhcp-4.0.0.ORIG/relay/dhcrelay.c 2008-09-01 13:38:38.000000000 +0100
81 +++ dhcp-4.0.0/relay/dhcrelay.c 2008-09-01 13:43:15.000000000 +0100
82 @@ -97,6 +97,7 @@
83 static char arr [] = "All rights reserved.";
84 static char message [] = "Internet Systems Consortium DHCP Relay Agent";
85 static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/";
86 +extern int log_isc_blurb;
87
88 int
89 main(int argc, char **argv) {
90 @@ -163,6 +164,7 @@
91 } else if (!strcmp (argv [i], "-q")) {
92 quiet = 1;
93 quiet_interface_discovery = 1;
94 + log_isc_blurb = 0;
95 } else if (!strcmp (argv [i], "-a")) {
96 add_agent_options = 1;
97 } else if (!strcmp (argv [i], "-c")) {
98 diff -uNr dhcp-4.0.0.ORIG/server/dhcpd.c dhcp-4.0.0/server/dhcpd.c
99 --- dhcp-4.0.0.ORIG/server/dhcpd.c 2008-09-01 13:38:38.000000000 +0100
100 +++ dhcp-4.0.0/server/dhcpd.c 2008-09-01 13:42:37.000000000 +0100
101 @@ -61,6 +61,9 @@
102 struct iaddr server_identifier;
103 int server_identifier_matched;
104
105 +
106 +extern int log_isc_blurb;
107 +
108 #if defined (NSUPDATE)
109
110 /* This stuff is always executed to figure the default values for certain
111 @@ -359,6 +362,7 @@
112 lftest = 1;
113 log_perror = -1;
114 } else if (!strcmp (argv [i], "-q")) {
115 + log_isc_blurb = 0;
116 quiet = 1;
117 quiet_interface_discovery = 1;
118 #ifdef DHCPv6
119
120
121
122 1.1 net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch
123
124 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch?rev=1.1&view=markup
125 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch?rev=1.1&content-type=text/plain
126
127 Index: dhcp-4.0-dhclient-ntp.patch
128 ===================================================================
129 diff -uNr dhcp-4.0.0.ORIG/client/clparse.c dhcp-4.0.0/client/clparse.c
130 --- dhcp-4.0.0.ORIG/client/clparse.c 2008-09-01 11:38:51.000000000 +0100
131 +++ dhcp-4.0.0/client/clparse.c 2008-09-01 11:48:17.000000000 +0100
132 @@ -37,7 +37,7 @@
133
134 struct client_config top_level_config;
135
136 -#define NUM_DEFAULT_REQUESTED_OPTS 9
137 +#define NUM_DEFAULT_REQUESTED_OPTS 10
138 struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1];
139
140 static void parse_client_default_duid(struct parse *cfile);
141 @@ -98,15 +98,20 @@
142 dhcp_universe.code_hash, &code, 0, MDL);
143
144 /* 8 */
145 - code = D6O_NAME_SERVERS;
146 + code = DHO_NTP_SERVERS;
147 option_code_hash_lookup(&default_requested_options[7],
148 - dhcpv6_universe.code_hash, &code, 0, MDL);
149 + dhcp_universe.code_hash, &code, 0, MDL);
150
151 /* 9 */
152 - code = D6O_DOMAIN_SEARCH;
153 + code = D6O_NAME_SERVERS;
154 option_code_hash_lookup(&default_requested_options[8],
155 dhcpv6_universe.code_hash, &code, 0, MDL);
156
157 + /* 10 */
158 + code = D6O_DOMAIN_SEARCH;
159 + option_code_hash_lookup(&default_requested_options[9],
160 + dhcpv6_universe.code_hash, &code, 0, MDL);
161 +
162 for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) {
163 if (default_requested_options[code] == NULL)
164 log_fatal("Unable to find option definition for "
165 diff -uNr dhcp-4.0.0.ORIG/client/scripts/bsdos dhcp-4.0.0/client/scripts/bsdos
166 --- dhcp-4.0.0.ORIG/client/scripts/bsdos 2008-09-01 11:38:51.000000000 +0100
167 +++ dhcp-4.0.0/client/scripts/bsdos 2008-09-01 11:39:30.000000000 +0100
168 @@ -29,6 +29,26 @@
169
170 mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
171 fi
172 + # If we're making confs, may as well make an ntp.conf too
173 + make_ntp_conf
174 +}
175 +
176 +make_ntp_conf() {
177 + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
178 + if [ x$new_ntp_servers != x ]; then
179 + conf="# Generated by dhclient for interface $interface\n"
180 + conf="${conf}restrict default noquery notrust nomodify\n"
181 + conf="${conf}restrict 127.0.0.1\n"
182 + for ntpserver in $new_ntp_servers; do
183 + conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
184 + conf="${conf}server $ntpserver\n"
185 + done
186 + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
187 + conf="${conf}logfile /var/log/ntp.log\n"
188 + printf "${conf}" > /etc/ntp.conf
189 + chmod 644 /etc/ntp.conf
190 + fi
191 + fi
192 }
193
194 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
195 diff -uNr dhcp-4.0.0.ORIG/client/scripts/freebsd dhcp-4.0.0/client/scripts/freebsd
196 --- dhcp-4.0.0.ORIG/client/scripts/freebsd 2008-09-01 11:38:51.000000000 +0100
197 +++ dhcp-4.0.0/client/scripts/freebsd 2008-09-01 11:39:30.000000000 +0100
198 @@ -73,6 +73,26 @@
199 fi
200 fi
201 fi
202 + # If we're making confs, may as well make an ntp.conf too
203 + make_ntp_conf
204 +}
205 +
206 +make_ntp_conf() {
207 + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
208 + if [ "x$new_ntp_servers" != x ]; then
209 + conf="# Generated by dhclient for interface $interface\n"
210 + conf="${conf}restrict default noquery notrust nomodify\n"
211 + conf="${conf}restrict 127.0.0.1\n"
212 + for ntpserver in $new_ntp_servers; do
213 + conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
214 + conf="${conf}server $ntpserver\n"
215 + done
216 + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
217 + conf="${conf}logfile /var/log/ntp.log\n"
218 + printf "${conf}" > /etc/ntp.conf
219 + chmod 644 /etc/ntp.conf
220 + fi
221 + fi
222 }
223
224 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
225 diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux
226 --- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-01 11:38:51.000000000 +0100
227 +++ dhcp-4.0.0/client/scripts/linux 2008-09-01 11:39:30.000000000 +0100
228 @@ -55,6 +55,26 @@
229
230 mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
231 fi
232 + # If we're making confs, may as well make an ntp.conf too
233 + make_ntp_conf
234 +}
235 +
236 +make_ntp_conf() {
237 + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
238 + if [ "x$new_ntp_servers" != x ]; then
239 + conf="# Generated by dhclient for interface $interface\n"
240 + conf="${conf}restrict default noquery notrust nomodify\n"
241 + conf="${conf}restrict 127.0.0.1\n"
242 + for ntpserver in $new_ntp_servers; do
243 + conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
244 + conf="${conf}server $ntpserver\n"
245 + done
246 + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
247 + conf="${conf}logfile /var/log/ntp.log\n"
248 + printf "${conf}" > /etc/ntp.conf
249 + chmod 644 /etc/ntp.conf
250 + fi
251 + fi
252 }
253
254 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
255 diff -uNr dhcp-4.0.0.ORIG/client/scripts/netbsd dhcp-4.0.0/client/scripts/netbsd
256 --- dhcp-4.0.0.ORIG/client/scripts/netbsd 2008-09-01 11:38:51.000000000 +0100
257 +++ dhcp-4.0.0/client/scripts/netbsd 2008-09-01 11:39:30.000000000 +0100
258 @@ -29,6 +29,26 @@
259
260 mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
261 fi
262 + # If we're making confs, may as well make an ntp.conf too
263 + make_ntp_conf
264 +}
265 +
266 +make_ntp_conf() {
267 + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
268 + if [ "x$new_ntp_servers" != x ]; then
269 + conf="# Generated by dhclient for interface $interface\n"
270 + conf="${conf}restrict default noquery notrust nomodify\n"
271 + conf="${conf}restrict 127.0.0.1\n"
272 + for ntpserver in $new_ntp_servers; do
273 + conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
274 + conf="${conf}server $ntpserver\n"
275 + done
276 + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
277 + conf="${conf}logfile /var/log/ntp.log\n"
278 + printf "${conf}" > /etc/ntp.conf
279 + chmod 644 /etc/ntp.conf
280 + fi
281 + fi
282 }
283
284 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
285 diff -uNr dhcp-4.0.0.ORIG/client/scripts/openbsd dhcp-4.0.0/client/scripts/openbsd
286 --- dhcp-4.0.0.ORIG/client/scripts/openbsd 2008-09-01 11:38:51.000000000 +0100
287 +++ dhcp-4.0.0/client/scripts/openbsd 2008-09-01 11:39:30.000000000 +0100
288 @@ -29,6 +29,26 @@
289
290 mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
291 fi
292 + # If we're making confs, may as well make an ntp.conf too
293 + make_ntp_conf
294 +}
295 +
296 +make_ntp_conf() {
297 + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
298 + if [ "x$new_ntp_servers" != x ]; then
299 + conf="# Generated by dhclient for interface $interface\n"
300 + conf="${conf}restrict default noquery notrust nomodify\n"
301 + conf="${conf}restrict 127.0.0.1\n"
302 + for ntpserver in $new_ntp_servers; do
303 + conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
304 + conf="${conf}server $ntpserver\n"
305 + done
306 + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
307 + conf="${conf}logfile /var/log/ntp.log\n"
308 + printf "${conf}" > /etc/ntp.conf
309 + chmod 644 /etc/ntp.conf
310 + fi
311 + fi
312 }
313
314 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
315 diff -uNr dhcp-4.0.0.ORIG/client/scripts/solaris dhcp-4.0.0/client/scripts/solaris
316 --- dhcp-4.0.0.ORIG/client/scripts/solaris 2008-09-01 11:38:51.000000000 +0100
317 +++ dhcp-4.0.0/client/scripts/solaris 2008-09-01 11:39:30.000000000 +0100
318 @@ -17,6 +17,26 @@
319
320 mv /etc/resolv.conf.dhclient /etc/resolv.conf
321 fi
322 + # If we're making confs, may as well make an ntp.conf too
323 + make_ntp_conf
324 +}
325 +
326 +make_ntp_conf() {
327 + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
328 + if [ "x$new_ntp_servers" != x ]; then
329 + conf="# Generated by dhclient for interface $interface\n"
330 + conf="${conf}restrict default noquery notrust nomodify\n"
331 + conf="${conf}restrict 127.0.0.1\n"
332 + for ntpserver in $new_ntp_servers; do
333 + conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
334 + conf="${conf}server $ntpserver\n"
335 + done
336 + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
337 + conf="${conf}logfile /var/log/ntp.log\n"
338 + printf "${conf}" > /etc/ntp.conf
339 + chmod 644 /etc/ntp.conf
340 + fi
341 + fi
342 }
343
344 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
345
346
347
348 1.1 net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch
349
350 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch?rev=1.1&view=markup
351 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch?rev=1.1&content-type=text/plain
352
353 Index: dhcp-4.0-dhclient-stdin-conf.patch
354 ===================================================================
355 diff -ur a/client/clparse.c b/client/clparse.c
356 --- a/client/clparse.c 2008-09-03 21:39:30.000000000 +0100
357 +++ b/client/clparse.c 2008-09-03 23:10:48.000000000 +0100
358 @@ -172,6 +172,10 @@
359 #endif
360 }
361
362 + /* Read any extra configuration from stdin */
363 + read_client_conf_stdin ((struct interface_info *)0,
364 + &top_level_config);
365 +
366 /* Set up state and config structures for clients that don't
367 have per-interface configuration statements. */
368 config = (struct client_config *)0;
369 @@ -201,21 +205,13 @@
370 return status;
371 }
372
373 -int read_client_conf_file (const char *name, struct interface_info *ip,
374 - struct client_config *client)
375 +int read_client_conf_actual (struct parse *cfile, struct interface_info *ip,
376 + struct client_config *client)
377 {
378 - int file;
379 - struct parse *cfile;
380 const char *val;
381 int token;
382 isc_result_t status;
383
384 - if ((file = open (name, O_RDONLY)) < 0)
385 - return uerr2isc (errno);
386 -
387 - cfile = (struct parse *)0;
388 - new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
389 -
390 do {
391 token = peek_token (&val, (unsigned *)0, cfile);
392 if (token == END_OF_FILE)
393 @@ -226,10 +222,74 @@
394 status = (cfile -> warnings_occurred
395 ? ISC_R_BADPARSE
396 : ISC_R_SUCCESS);
397 + return status;
398 +}
399 +
400 +int read_client_conf_file (const char *name, struct interface_info *ip,
401 + struct client_config *client)
402 +{
403 + int file;
404 + struct parse *cfile;
405 + isc_result_t status;
406 +
407 + if ((file = open (name, O_RDONLY)) < 0)
408 + return uerr2isc (errno);
409 +
410 + cfile = (struct parse *)0;
411 + new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
412 + status = read_client_conf_actual(cfile, ip, client);
413 end_parse (&cfile);
414 return status;
415 }
416
417 +int read_client_conf_stdin (struct interface_info *ip,
418 + struct client_config *client)
419 +{
420 + int file;
421 + char *buffer = NULL, *p;
422 + unsigned buflen, len = 0;
423 + struct parse *cfile;
424 + size_t bytes;
425 + isc_result_t status;
426 +
427 + file = fileno(stdin);
428 + if (isatty (file))
429 + return ISC_R_NOTFOUND;
430 + if (fcntl (file, F_SETFL, O_NONBLOCK) < 0)
431 + log_fatal ("could not set stdin to non blocking!");
432 +
433 + buflen = BUFSIZ;
434 + buffer = malloc (BUFSIZ + 1);
435 + p = buffer;
436 + do {
437 + bytes = read (file, p, BUFSIZ);
438 + if (bytes == 0)
439 + break;
440 + if (bytes == -1)
441 + log_fatal ("failed to read stdin!");
442 + if (bytes >= BUFSIZ) {
443 + buflen += BUFSIZ;
444 + len += BUFSIZ;
445 + buffer = realloc (buffer, buflen + 1);
446 + if (!buffer)
447 + log_fatal ("not enough buffer to read stdin!");
448 + p = buffer + len;
449 + } else {
450 + len += bytes;
451 + break;
452 + }
453 + } while(1);
454 + buffer[len] = '\0';
455 +
456 + cfile = (struct parse *)0;
457 + status = new_parse (&cfile, -1, buffer, len, "stdin", 0);
458 + if (status == ISC_R_SUCCESS) {
459 + status = read_client_conf_actual (cfile, ip, client);
460 + end_parse (&cfile);
461 + }
462 + free(buffer);
463 + return status;
464 +}
465
466 /* lease-file :== client-lease-statements END_OF_FILE
467 client-lease-statements :== <nil>
468 Files a/client/clparse.o and b/client/clparse.o differ
469 Files a/client/dhclient and b/client/dhclient differ
470
471
472
473 1.1 net-misc/dhcp/files/dhcp-4.0-paranoia.patch
474
475 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-paranoia.patch?rev=1.1&view=markup
476 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-paranoia.patch?rev=1.1&content-type=text/plain
477
478 Index: dhcp-4.0-paranoia.patch
479 ===================================================================
480 diff -uNr dhcp-4.0.0.ORIG/configure.ac dhcp-4.0.0/configure.ac
481 --- dhcp-4.0.0.ORIG/configure.ac 2008-09-02 10:57:37.000000000 +0100
482 +++ dhcp-4.0.0/configure.ac 2008-09-02 11:00:27.000000000 +0100
483 @@ -30,6 +30,17 @@
484 [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
485 or LITTLE_ENDIAN for LSB (Intel CPUs).])
486
487 +# Paranoia/early chrooting is off by default
488 +AC_ARG_ENABLE(paranoia,
489 + AC_HELP_STRING([--enable-paranoia],
490 + [enable support for early chroot (default is no)]))
491 +if test "$enable_paranoia" != "no"; then
492 + AC_DEFINE([PARANOIA], [1],
493 + [Define to enable paranoia.])
494 + AC_DEFINE([EARLY_CHROOT], [1],
495 + [Define to 1 to chroot early.])
496 +fi
497 +
498 # DHCPv6 is off by default
499 AC_ARG_ENABLE(dhcpv6,
500 AC_HELP_STRING([--enable-dhcpv6],
501 diff -uNr dhcp-4.0.0.ORIG/server/dhcpd.c dhcp-4.0.0/server/dhcpd.c
502 --- dhcp-4.0.0.ORIG/server/dhcpd.c 2008-09-02 10:57:37.000000000 +0100
503 +++ dhcp-4.0.0/server/dhcpd.c 2008-09-02 10:57:54.000000000 +0100
504 @@ -46,6 +46,16 @@
505 #include <sys/types.h>
506 #include <signal.h>
507
508 +#if defined (PARANOIA)
509 +# include <sys/types.h>
510 +# include <unistd.h>
511 +# include <pwd.h>
512 +/* get around the ISC declaration of group */
513 +# define group real_group
514 +# include <grp.h>
515 +# undef group
516 +#endif /* PARANOIA */
517 +
518 static void usage(void);
519
520 struct iaddr server_identifier;
521 @@ -195,6 +205,21 @@
522 omapi_object_dereference (&listener, MDL);
523 }
524
525 +#if defined (PARANOIA)
526 +/* to be used in one of two possible scenarios */
527 +static void setup_chroot (char *chroot_dir) {
528 + if (geteuid())
529 + log_fatal ("you must be root to use chroot");
530 + if (chroot(chroot_dir)) {
531 + log_fatal ("chroot(\"%s\"): %m", chroot_dir);
532 + }
533 + if (chdir ("/")) {
534 + /* probably permission denied */
535 + log_fatal ("chdir(\"/\"): %m");
536 + }
537 +}
538 +#endif /* PARANOIA */
539 +
540 #ifndef UNIT_TEST
541 int
542 main(int argc, char **argv) {
543 @@ -224,6 +249,14 @@
544 char *traceinfile = (char *)0;
545 char *traceoutfile = (char *)0;
546 #endif
547 +#if defined (PARANOIA)
548 + char *set_user = 0;
549 + char *set_group = 0;
550 + char *set_chroot = 0;
551 +
552 + uid_t set_uid = 0;
553 + gid_t set_gid = 0;
554 +#endif /* PARANOIA */
555
556 /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
557 2 (stderr) are open. To do this, we assume that when we
558 @@ -284,6 +317,20 @@
559 if (++i == argc)
560 usage ();
561 server = argv [i];
562 +#if defined (PARANOIA)
563 + } else if (!strcmp (argv [i], "-user")) {
564 + if (++i == argc)
565 + usage ();
566 + set_user = argv [i];
567 + } else if (!strcmp (argv [i], "-group")) {
568 + if (++i == argc)
569 + usage ();
570 + set_group = argv [i];
571 + } else if (!strcmp (argv [i], "-chroot")) {
572 + if (++i == argc)
573 + usage ();
574 + set_chroot = argv [i];
575 +#endif /* PARANOIA */
576 } else if (!strcmp (argv [i], "-cf")) {
577 if (++i == argc)
578 usage ();
579 @@ -438,6 +485,44 @@
580 trace_seed_stop, MDL);
581 #endif
582
583 +#if defined (PARANOIA)
584 + /* get user and group info if those options were given */
585 + if (set_user) {
586 + struct passwd *tmp_pwd;
587 +
588 + if (geteuid())
589 + log_fatal ("you must be root to set user");
590 +
591 + if (!(tmp_pwd = getpwnam(set_user)))
592 + log_fatal ("no such user: %s", set_user);
593 +
594 + set_uid = tmp_pwd->pw_uid;
595 +
596 + /* use the user's group as the default gid */
597 + if (!set_group)
598 + set_gid = tmp_pwd->pw_gid;
599 + }
600 +
601 + if (set_group) {
602 +/* get around the ISC declaration of group */
603 +#define group real_group
604 + struct group *tmp_grp;
605 +
606 + if (geteuid())
607 + log_fatal ("you must be root to set group");
608 +
609 + if (!(tmp_grp = getgrnam(set_group)))
610 + log_fatal ("no such group: %s", set_group);
611 +
612 + set_gid = tmp_grp->gr_gid;
613 +#undef group
614 + }
615 +
616 +# if defined (EARLY_CHROOT)
617 + if (set_chroot) setup_chroot (set_chroot);
618 +# endif /* EARLY_CHROOT */
619 +#endif /* PARANOIA */
620 +
621 /* Default to the DHCP/BOOTP port. */
622 if (!local_port)
623 {
624 @@ -576,6 +661,10 @@
625
626 postconf_initialization (quiet);
627
628 +#if defined (PARANOIA) && !defined (EARLY_CHROOT)
629 + if (set_chroot) setup_chroot (set_chroot);
630 +#endif /* PARANOIA && !EARLY_CHROOT */
631 +
632 /* test option should cause an early exit */
633 if (cftest && !lftest)
634 exit(0);
635 @@ -659,6 +748,22 @@
636 exit (0);
637 }
638
639 +#if defined (PARANOIA)
640 + /* change uid to the specified one */
641 +
642 + if (set_gid) {
643 + if (setgroups (0, (void *)0))
644 + log_fatal ("setgroups: %m");
645 + if (setgid (set_gid))
646 + log_fatal ("setgid(%d): %m", (int) set_gid);
647 + }
648 +
649 + if (set_uid) {
650 + if (setuid (set_uid))
651 + log_fatal ("setuid(%d): %m", (int) set_uid);
652 + }
653 +#endif /* PARANOIA */
654 +
655 /* Read previous pid file. */
656 if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
657 status = read(i, pbuf, (sizeof pbuf) - 1);
658 @@ -1039,6 +1144,10 @@
659 #else /* !DHCPv6 */
660 " [-cf config-file] [-lf lease-file]\n"
661 #endif /* DHCPv6 */
662 +#if defined (PARANOIA)
663 + /* meld into the following string */
664 + "\n [-user user] [-group group] [-chroot dir]"
665 +#endif /* PARANOIA */
666 #if defined (TRACING)
667 " [-tf trace-output-file]\n"
668 " [-play trace-input-file]\n"
669
670
671
672 1.1 net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch
673
674 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch?rev=1.1&view=markup
675 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch?rev=1.1&content-type=text/plain
676
677 Index: dhcp-4.0-dhclient-metric.patch
678 ===================================================================
679 diff -uNr dhcp-4.0.0.ORIG/client/scripts/bsdos dhcp-4.0.0/client/scripts/bsdos
680 --- dhcp-4.0.0.ORIG/client/scripts/bsdos 2008-09-01 13:22:40.000000000 +0100
681 +++ dhcp-4.0.0/client/scripts/bsdos 2008-09-01 13:23:24.000000000 +0100
682 @@ -95,6 +95,9 @@
683 if [ x$new_interface_mtu != x ]; then
684 mtu_arg="mtu $new_interface_mtu"
685 fi
686 +if [ x$IF_METRIC != x ]; then
687 + metric_arg="metric $IF_METRIC"
688 +fi
689
690 if [ x$reason = xMEDIUM ]; then
691 eval "ifconfig $interface $medium"
692 @@ -156,7 +159,7 @@
693 if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
694 [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
695 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
696 - $new_broadcast_arg $mtu_arg $medium"
697 + $new_broadcast_arg $mtu_arg $metric_arg $medium"
698 route add $new_ip_address 127.1 >/dev/null 2>&1
699 for router in $new_routers; do
700 route add default $router >/dev/null 2>&1
701 @@ -213,7 +216,7 @@
702 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
703 fi
704 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
705 - $new_broadcast_arg $mtu_arg $medium"
706 + $new_broadcast_arg $mtu_arg $metric_arg $medium"
707 sleep 1
708 if [ "$new_routers" != "" ]; then
709 set $new_routers
710 diff -uNr dhcp-4.0.0.ORIG/client/scripts/freebsd dhcp-4.0.0/client/scripts/freebsd
711 --- dhcp-4.0.0.ORIG/client/scripts/freebsd 2008-09-01 13:22:40.000000000 +0100
712 +++ dhcp-4.0.0/client/scripts/freebsd 2008-09-01 13:23:24.000000000 +0100
713 @@ -139,6 +139,9 @@
714 if [ x$new_interface_mtu != x ]; then
715 mtu_arg="mtu $new_interface_mtu"
716 fi
717 +if [ x$IF_METRIC != x ]; then
718 + metric_arg="metric $IF_METRIC"
719 +fi
720
721 if [ x$reason = xMEDIUM ]; then
722 eval "ifconfig $interface $medium"
723 @@ -200,7 +203,7 @@
724 if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
725 [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
726 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
727 - $new_broadcast_arg $mtu_arg $medium"
728 + $new_broadcast_arg $mtu_arg $metric_arg $medium"
729 $LOGGER "New IP Address ($interface): $new_ip_address"
730 $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
731 $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
732 @@ -264,7 +267,7 @@
733 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
734 fi
735 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
736 - $new_broadcast_arg $mtu_arg $medium"
737 + $new_broadcast_arg $mtu_arg $metric_arg $medium"
738 $LOGGER "New IP Address ($interface): $new_ip_address"
739 $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
740 $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
741 diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux
742 --- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-01 13:22:40.000000000 +0100
743 +++ dhcp-4.0.0/client/scripts/linux 2008-09-01 13:26:19.000000000 +0100
744 @@ -98,11 +98,6 @@
745 fi
746 fi
747
748 -release=`uname -r`
749 -release=`expr $release : '\(.*\)\..*'`
750 -relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
751 -relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
752 -
753 ###
754 ### DHCPv4 Handlers
755 ###
756 @@ -125,6 +120,9 @@
757 if [ x$new_interface_mtu != x ]; then
758 mtu_arg="mtu $new_interface_mtu"
759 fi
760 +if [ x$IF_METRIC != x ]; then
761 + metric_arg="metric $IF_METRIC"
762 +fi
763
764 if [ x$reason = xMEDIUM ]; then
765 # Linux doesn't do mediums (ok, ok, media).
766 @@ -136,15 +134,7 @@
767 # Bring down alias interface. Its routes will disappear too.
768 ifconfig $interface:0- inet 0
769 fi
770 - if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] )
771 - then
772 - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
773 - broadcast 255.255.255.255 up
774 - # Add route to make broadcast work. Do not omit netmask.
775 - route add default dev $interface netmask 0.0.0.0
776 - else
777 - ifconfig $interface 0 up
778 - fi
779 + ifconfig $interface 0 up
780
781 # We need to give the kernel some time to get the interface up.
782 sleep 1
783 @@ -186,12 +176,14 @@
784 ifconfig $interface inet $new_ip_address $new_subnet_arg \
785 $new_broadcast_arg $mtu_arg
786 # Add a network route to the computed network address.
787 - if [ $relmajor -lt 2 ] || \
788 - ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
789 - route add -net $new_network_number $new_subnet_arg dev $interface
790 + if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then
791 + route del -net $new_network_number $new_subnet_arg \
792 + dev $interface
793 + route add -net $new_network_number $new_subnet_arg $metric_arg \
794 + dev $interface
795 fi
796 for router in $new_routers; do
797 - route add default gw $router
798 + route add default gw $router $metric_arg dev $interface
799 done
800 fi
801 if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
802 @@ -234,12 +226,15 @@
803 ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
804 route add -host $alias_ip_address dev $interface:0
805 fi
806 - if [ $relmajor -lt 2 ] || \
807 - ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
808 - route add -net $new_network_number
809 + # Add a network route to the computed network address.
810 + if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then
811 + route del -net $new_network_number $new_subnet_arg \
812 + dev $interface
813 + route add -net $new_network_number $new_subnet_arg $metric_arg \
814 + dev $interface
815 fi
816 for router in $new_routers; do
817 - route add default gw $router
818 + route add default gw $router $metric_arg dev $interface
819 done
820 make_resolv_conf
821 exit_with_hooks 0
822 diff -uNr dhcp-4.0.0.ORIG/client/scripts/netbsd dhcp-4.0.0/client/scripts/netbsd
823 --- dhcp-4.0.0.ORIG/client/scripts/netbsd 2008-09-01 13:22:40.000000000 +0100
824 +++ dhcp-4.0.0/client/scripts/netbsd 2008-09-01 13:23:33.000000000 +0100
825 @@ -95,6 +95,9 @@
826 if [ x$new_interface_mtu != x ]; then
827 mtu_arg="mtu $new_interface_mtu"
828 fi
829 +if [ x$IF_METRIC != x ]; then
830 + metric_arg="metric $IF_METRIC"
831 +fi
832
833 if [ x$reason = xMEDIUM ]; then
834 eval "ifconfig $interface $medium"
835 @@ -156,7 +159,7 @@
836 if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
837 [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
838 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
839 - $new_broadcast_arg $mtu_arg $medium"
840 + $new_broadcast_arg $mtu_arg $metric_arg $medium"
841 route add $new_ip_address 127.1 >/dev/null 2>&1
842 for router in $new_routers; do
843 route add default $router >/dev/null 2>&1
844 @@ -213,7 +216,7 @@
845 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
846 fi
847 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
848 - $new_broadcast_arg $mtu_arg $medium"
849 + $new_broadcast_arg $mtu_arg $metric_arg $medium"
850 sleep 1
851 if [ "$new_routers" != "" ]; then
852 set $new_routers
853 diff -uNr dhcp-4.0.0.ORIG/client/scripts/solaris dhcp-4.0.0/client/scripts/solaris
854 --- dhcp-4.0.0.ORIG/client/scripts/solaris 2008-09-01 13:22:40.000000000 +0100
855 +++ dhcp-4.0.0/client/scripts/solaris 2008-09-01 13:23:33.000000000 +0100
856 @@ -78,6 +78,9 @@
857 if [ x$new_interface_mtu != x ]; then
858 mtu_arg="mtu $new_interface_mtu"
859 fi
860 +if [ x$IF_METRIC != x ]; then
861 + metric_arg="metric $IF_METRIC"
862 +fi
863
864 ifconfig=/sbin/ifconfig
865
866 @@ -140,7 +143,7 @@
867 if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
868 [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
869 eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
870 - $new_broadcast_arg $mtu_arg $medium"
871 + $new_broadcast_arg $mtu_arg $metric_arg $medium"
872 route add $new_ip_address 127.1 1 >/dev/null 2>&1
873 for router in $new_routers; do
874 route add default $router 1 >/dev/null 2>&1
875 @@ -181,7 +184,7 @@
876 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
877 fi
878 eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
879 - $new_broadcast_arg $mtu_arg $medium"
880 + $new_broadcast_arg $mtu_arg $metric_arg $medium"
881 sleep 1
882 set $new_routers
883 if ping -s -n -I 1 $1 64 1; then
884
885
886
887 1.1 net-misc/dhcp/files/dhcp-4.0-dhclient-script-correct-operators.patch
888
889 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-script-correct-operators.patch?rev=1.1&view=markup
890 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-script-correct-operators.patch?rev=1.1&content-type=text/plain
891
892 Index: dhcp-4.0-dhclient-script-correct-operators.patch
893 ===================================================================
894 diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux
895 --- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-03 00:52:41.000000000 +0100
896 +++ dhcp-4.0.0/client/scripts/linux 2008-09-03 00:53:16.000000000 +0100
897 @@ -258,7 +232,7 @@
898 ### DHCPv6 Handlers
899 ###
900
901 -if [ ${reason} = PREINIT6 ] ; then
902 +if [ x$reason = xPREINIT6 ] ; then
903 # Ensure interface is up.
904 ${ip} link set ${interface} up
905
906 @@ -268,7 +242,7 @@
907 exit_with_hooks 0
908 fi
909
910 -if [ ${reason} = BOUND6 ] ; then
911 +if [ x$reason = xBOUND6 ] ; then
912 if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then
913 exit_with_hooks 2;
914 fi
915 @@ -282,7 +256,7 @@
916 exit_with_hooks 0
917 fi
918
919 -if [ ${reason} = RENEW6 ] || [ ${reason} = REBIND6 ] ; then
920 +if [ x$reason = xRENEW6 ] || [ x$reason} = xREBIND6 ] ; then
921 # Make sure nothing has moved around on us.
922
923 # Nameservers/domains/etc.
924 @@ -294,7 +268,7 @@
925 exit_with_hooks 0
926 fi
927
928 -if [ ${reason} = DEPREF6 ] ; then
929 +if [ x$reason = xDEPREF6 ] ; then
930 if [ x${new_ip6_prefixlen} = x ] ; then
931 exit_with_hooks 2;
932 fi
933 @@ -307,7 +281,7 @@
934 exit_with_hooks 0
935 fi
936
937 -if [ ${reason} = EXPIRE6 -o ${reason} = RELEASE6 -o ${reason} = STOP6 ] ; then
938 +if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ] ; then
939 if [ x${old_ip6_address} = x ] || [ x${old_ip6_prefixlen} = x ] ; then
940 exit_with_hooks 2;
941 fi
942
943
944
945 1.1 net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch
946
947 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch?rev=1.1&view=markup
948 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch?rev=1.1&content-type=text/plain
949
950 Index: dhcp-4.0-linux-ipv6-header.patch
951 ===================================================================
952 diff -uNr dhcp-4.0.0.ORIG/common/socket.c dhcp-4.0.0/common/socket.c
953 --- dhcp-4.0.0.ORIG/common/socket.c 2008-09-02 10:25:21.000000000 +0100
954 +++ dhcp-4.0.0/common/socket.c 2008-09-02 10:27:29.000000000 +0100
955 @@ -46,6 +46,10 @@
956 #include <sys/uio.h>
957 #include <sys/uio.h>
958
959 +#ifdef HAVE_LINUX_IPV6_H
960 +#include <linux/ipv6.h>
961 +#endif
962 +
963 #ifdef USE_SOCKET_FALLBACK
964 # if !defined (USE_SOCKET_SEND)
965 # define if_register_send if_register_fallback
966 diff -uNr dhcp-4.0.0.ORIG/configure.ac dhcp-4.0.0/configure.ac
967 --- dhcp-4.0.0.ORIG/configure.ac 2008-09-02 10:25:21.000000000 +0100
968 +++ dhcp-4.0.0/configure.ac 2008-09-02 10:26:29.000000000 +0100
969 @@ -37,6 +37,7 @@
970 if test "$enable_dhcpv6" != "no"; then
971 AC_DEFINE([DHCPv6], [1],
972 [Define to 1 to include DHCPv6 support.])
973 + AC_CHECK_HEADERS(linux/ipv6.h)
974 fi
975
976 ###
977
978
979
980 1.1 net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch
981
982 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch?rev=1.1&view=markup
983 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch?rev=1.1&content-type=text/plain
984
985 Index: dhcp-4.0-dhclient-resolvconf.patch
986 ===================================================================
987 diff -ur a/client/scripts/bsdos b/client/scripts/bsdos
988 --- a/client/scripts/bsdos 2008-09-01 14:41:00.000000000 +0100
989 +++ b/client/scripts/bsdos 2008-09-01 14:57:33.000000000 +0100
990 @@ -1,34 +1,41 @@
991 #!/bin/sh
992
993 make_resolv_conf() {
994 + if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
995 + return 0
996 + fi
997 + local conf=
998 if [ x"$new_domain_name_servers" != x ]; then
999 - cat /dev/null > /etc/resolv.conf.dhclient
1000 if [ "x$new_domain_search" != x ]; then
1001 - echo search $new_domain_search >> /etc/resolv.conf.dhclient
1002 + conf="${conf}search ${new_domain_search}\n"
1003 elif [ "x$new_domain_name" != x ]; then
1004 # Note that the DHCP 'Domain Name Option' is really just a domain
1005 # name, and that this practice of using the domain name option as
1006 # a search path is both nonstandard and deprecated.
1007 - echo search $new_domain_name >> /etc/resolv.conf.dhclient
1008 + conf="${conf}search ${new_domain_name}\n"
1009 fi
1010 for nameserver in $new_domain_name_servers; do
1011 - echo nameserver $nameserver >> /etc/resolv.conf.dhclient
1012 + conf="${conf}nameserver ${nameserver}\n"
1013 done
1014 -
1015 - mv /etc/resolv.conf.dhclient /etc/resolv.conf
1016 elif [ "x${new_dhcp6_name_servers}" != x ] ; then
1017 - cat /dev/null > /etc/resolv.conf.dhclient6
1018 - chmod 644 /etc/resolv.conf.dhclient6
1019 -
1020 if [ "x${new_dhcp6_domain_search}" != x ] ; then
1021 - echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
1022 + conf="${conf}search ${new_dhcp6_domain_search}\n"
1023 fi
1024 for nameserver in ${new_dhcp6_name_servers} ; do
1025 - echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
1026 + conf="${conf}nameserver ${nameserver}\n"
1027 done
1028 + fi
1029
1030 - mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
1031 + if [ x"$conf" != x ]; then
1032 + conf="# Generated by dhclient or interface $interface\n${conf}"
1033 + if type resolvconf >/dev/null 2>&1; then
1034 + printf "${conf}" | resolvconf -a $interface
1035 + else
1036 + printf "${conf}" > /etc/resolv.conf
1037 + chmod 644 /etc/resolv.conf
1038 + fi
1039 fi
1040 +
1041 # If we're making confs, may as well make an ntp.conf too
1042 make_ntp_conf
1043 }
1044 diff -ur a/client/scripts/freebsd b/client/scripts/freebsd
1045 --- a/client/scripts/freebsd 2008-09-01 14:41:00.000000000 +0100
1046 +++ b/client/scripts/freebsd 2008-09-01 15:00:18.000000000 +0100
1047 @@ -11,68 +11,41 @@
1048 fi
1049
1050 make_resolv_conf() {
1051 + if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
1052 + return 0
1053 + fi
1054 + local conf=
1055 if [ x"$new_domain_name_servers" != x ]; then
1056 - ( cat /dev/null > /etc/resolv.conf.dhclient )
1057 - exit_status=$?
1058 - if [ $exit_status -ne 0 ]; then
1059 - $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
1060 - else
1061 - if [ "x$new_domain_search" != x ]; then
1062 - ( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
1063 - exit_status=$?
1064 - elif [ "x$new_domain_name" != x ]; then
1065 - # Note that the DHCP 'Domain Name Option' is really just a domain
1066 - # name, and that this practice of using the domain name option as
1067 - # a search path is both nonstandard and deprecated.
1068 - ( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
1069 - exit_status=$?
1070 - fi
1071 - for nameserver in $new_domain_name_servers; do
1072 - if [ $exit_status -ne 0 ]; then
1073 - break
1074 - fi
1075 - ( echo nameserver $nameserver >>/etc/resolv.conf.dhclient )
1076 - exit_status=$?
1077 - done
1078 -
1079 - # If there were no errors, attempt to mv the new file into place.
1080 - if [ $exit_status -eq 0 ]; then
1081 - ( mv /etc/resolv.conf.dhclient /etc/resolv.conf )
1082 - exit_status=$?
1083 - fi
1084 -
1085 - if [ $exit_status -ne 0 ]; then
1086 - $LOGGER "Error while writing new /etc/resolv.conf."
1087 - fi
1088 + if [ "x$new_domain_search" != x ]; then
1089 + conf="${conf}search ${new_domain_search}\n"
1090 + elif [ "x$new_domain_name" != x ]; then
1091 + # Note that the DHCP 'Domain Name Option' is really just a domain
1092 + # name, and that this practice of using the domain name option as
1093 + # a search path is both nonstandard and deprecated.
1094 + conf="${conf}search ${new_domain_name}\n"
1095 fi
1096 + for nameserver in $new_domain_name_servers; do
1097 + conf="${conf}nameserver ${nameserver}\n"
1098 + done
1099 elif [ "x${new_dhcp6_name_servers}" != x ] ; then
1100 - ( cat /dev/null > /etc/resolv.conf.dhclient6 )
1101 - exit_status=$?
1102 - if [ $exit_status -ne 0 ] ; then
1103 - $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit_status"
1104 - else
1105 - if [ "x${new_dhcp6_domain_search}" != x ] ; then
1106 - ( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6 )
1107 - exit_status=$?
1108 - fi
1109 - for nameserver in ${new_dhcp6_name_servers} ; do
1110 - if [ $exit_status -ne 0 ] ; then
1111 - break
1112 - fi
1113 - ( echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 )
1114 - exit_status=$?
1115 - done
1116 -
1117 - if [ $exit_status -eq 0 ] ; then
1118 - ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf )
1119 - exit_status=$?
1120 - fi
1121 + if [ "x${new_dhcp6_domain_search}" != x ] ; then
1122 + conf="${conf}search ${new_dhcp6_domain_search}\n"
1123 + fi
1124 + for nameserver in ${new_dhcp6_name_servers} ; do
1125 + conf="${conf}nameserver ${nameserver}\n"
1126 + done
1127 + fi
1128
1129 - if [ $exit_status -ne 0 ] ; then
1130 - $LOGGER "Error while writing new /etc/resolv.conf."
1131 - fi
1132 + if [ x"$conf" != x ]; then
1133 + conf="# Generated by dhclient or interface $interface\n${conf}"
1134 + if type resolvconf >/dev/null 2>&1; then
1135 + printf "${conf}" | resolvconf -a $interface
1136 + else
1137 + printf "${conf}" > /etc/resolv.conf
1138 + chmod 644 /etc/resolv.conf
1139 fi
1140 fi
1141 +
1142 # If we're making confs, may as well make an ntp.conf too
1143 make_ntp_conf
1144 }
1145 diff -ur a/client/scripts/linux b/client/scripts/linux
1146 --- a/client/scripts/linux 2008-09-01 14:41:00.000000000 +0100
1147 +++ b/client/scripts/linux 2008-09-01 14:58:09.000000000 +0100
1148 @@ -26,35 +26,41 @@
1149 ip=/sbin/ip
1150
1151 make_resolv_conf() {
1152 + if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
1153 + return 0
1154 + fi
1155 + local conf=
1156 if [ x"$new_domain_name_servers" != x ]; then
1157 - cat /dev/null > /etc/resolv.conf.dhclient
1158 - chmod 644 /etc/resolv.conf.dhclient
1159 - if [ x"$new_domain_search" != x ]; then
1160 - echo search $new_domain_search >> /etc/resolv.conf.dhclient
1161 - elif [ x"$new_domain_name" != x ]; then
1162 + if [ "x$new_domain_search" != x ]; then
1163 + conf="${conf}search ${new_domain_search}\n"
1164 + elif [ "x$new_domain_name" != x ]; then
1165 # Note that the DHCP 'Domain Name Option' is really just a domain
1166 # name, and that this practice of using the domain name option as
1167 # a search path is both nonstandard and deprecated.
1168 - echo search $new_domain_name >> /etc/resolv.conf.dhclient
1169 + conf="${conf}search ${new_domain_name}\n"
1170 fi
1171 for nameserver in $new_domain_name_servers; do
1172 - echo nameserver $nameserver >>/etc/resolv.conf.dhclient
1173 + conf="${conf}nameserver ${nameserver}\n"
1174 done
1175 -
1176 - mv /etc/resolv.conf.dhclient /etc/resolv.conf
1177 elif [ "x${new_dhcp6_name_servers}" != x ] ; then
1178 - cat /dev/null > /etc/resolv.conf.dhclient6
1179 - chmod 644 /etc/resolv.conf.dhclient6
1180 -
1181 if [ "x${new_dhcp6_domain_search}" != x ] ; then
1182 - echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
1183 + conf="${conf}search ${new_dhcp6_domain_search}\n"
1184 fi
1185 for nameserver in ${new_dhcp6_name_servers} ; do
1186 - echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
1187 + conf="${conf}nameserver ${nameserver}\n"
1188 done
1189 + fi
1190
1191 - mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
1192 + if [ x"$conf" != x ]; then
1193 + conf="# Generated by dhclient or interface $interface\n${conf}"
1194 + if type resolvconf >/dev/null 2>&1; then
1195 + printf "${conf}" | resolvconf -a $interface
1196 + else
1197 + printf "${conf}" > /etc/resolv.conf
1198 + chmod 644 /etc/resolv.conf
1199 + fi
1200 fi
1201 +
1202 # If we're making confs, may as well make an ntp.conf too
1203 make_ntp_conf
1204 }
1205 diff -ur a/client/scripts/netbsd b/client/scripts/netbsd
1206 --- a/client/scripts/netbsd 2008-09-01 14:41:00.000000000 +0100
1207 +++ b/client/scripts/netbsd 2008-09-01 14:58:40.000000000 +0100
1208 @@ -1,34 +1,41 @@
1209 #!/bin/sh
1210
1211 make_resolv_conf() {
1212 - if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
1213 - cat /dev/null > /etc/resolv.conf.dhclient
1214 - if [ "x$new_domain_search != x ]; then
1215 - echo search $new_domain_search >> /etc/resolv.conf.dhclient
1216 - elif [ "x$new_domain_name != x ]; then
1217 + if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
1218 + return 0
1219 + fi
1220 + local conf=
1221 + if [ x"$new_domain_name_servers" != x ]; then
1222 + if [ "x$new_domain_search" != x ]; then
1223 + conf="${conf}search ${new_domain_search}\n"
1224 + elif [ "x$new_domain_name" != x ]; then
1225 # Note that the DHCP 'Domain Name Option' is really just a domain
1226 # name, and that this practice of using the domain name option as
1227 # a search path is both nonstandard and deprecated.
1228 - echo search $new_domain_name >> /etc/resolv.conf.dhclient
1229 + conf="${conf}search ${new_domain_name}\n"
1230 fi
1231 for nameserver in $new_domain_name_servers; do
1232 - echo nameserver $nameserver >>/etc/resolv.conf.dhclient
1233 + conf="${conf}nameserver ${nameserver}\n"
1234 done
1235 -
1236 - mv /etc/resolv.conf.dhclient /etc/resolv.conf
1237 elif [ "x${new_dhcp6_name_servers}" != x ] ; then
1238 - cat /dev/null > /etc/resolv.conf.dhclient6
1239 - chmod 644 /etc/resolv.conf.dhclient6
1240 -
1241 if [ "x${new_dhcp6_domain_search}" != x ] ; then
1242 - echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
1243 + conf="${conf}search ${new_dhcp6_domain_search}\n"
1244 fi
1245 for nameserver in ${new_dhcp6_name_servers} ; do
1246 - echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
1247 + conf="${conf}nameserver ${nameserver}\n"
1248 done
1249 + fi
1250
1251 - mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
1252 + if [ x"$conf" != x ]; then
1253 + conf="# Generated by dhclient or interface $interface\n${conf}"
1254 + if type resolvconf >/dev/null 2>&1; then
1255 + printf "${conf}" | resolvconf -a $interface
1256 + else
1257 + printf "${conf}" > /etc/resolv.conf
1258 + chmod 644 /etc/resolv.conf
1259 + fi
1260 fi
1261 +
1262 # If we're making confs, may as well make an ntp.conf too
1263 make_ntp_conf
1264 }
1265 diff -ur a/client/scripts/openbsd b/client/scripts/openbsd
1266 --- a/client/scripts/openbsd 2008-09-01 14:41:00.000000000 +0100
1267 +++ b/client/scripts/openbsd 2008-09-01 14:59:12.000000000 +0100
1268 @@ -1,34 +1,41 @@
1269 #!/bin/sh
1270
1271 make_resolv_conf() {
1272 - if x"$new_domain_name_servers" != x ]; then
1273 - cat /dev/null > /etc/resolv.conf.dhclient
1274 - if [ x"$new_domain_search" != x ]; then
1275 - echo search $new_domain_search >> /etc/resolv.conf.dhclient
1276 - elif [ x"$new_domain_name" != x ]; then
1277 + if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
1278 + return 0
1279 + fi
1280 + local conf=
1281 + if [ x"$new_domain_name_servers" != x ]; then
1282 + if [ "x$new_domain_search" != x ]; then
1283 + conf="${conf}search ${new_domain_search}\n"
1284 + elif [ "x$new_domain_name" != x ]; then
1285 # Note that the DHCP 'Domain Name Option' is really just a domain
1286 # name, and that this practice of using the domain name option as
1287 # a search path is both nonstandard and deprecated.
1288 - echo search $new_domain_name >> /etc/resolv.conf.dhclient
1289 + conf="${conf}search ${new_domain_name}\n"
1290 fi
1291 for nameserver in $new_domain_name_servers; do
1292 - echo nameserver $nameserver >>/etc/resolv.conf.dhclient
1293 + conf="${conf}nameserver ${nameserver}\n"
1294 done
1295 -
1296 - mv /etc/ersolv.conf.dhclient /etc/resolv.conf
1297 elif [ "x${new_dhcp6_name_servers}" != x ] ; then
1298 - cat /dev/null > /etc/resolv.conf.dhclient6
1299 - chmod 644 /etc/resolv.conf.dhclient6
1300 -
1301 if [ "x${new_dhcp6_domain_search}" != x ] ; then
1302 - echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
1303 + conf="${conf}search ${new_dhcp6_domain_search}\n"
1304 fi
1305 for nameserver in ${new_dhcp6_name_servers} ; do
1306 - echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
1307 + conf="${conf}nameserver ${nameserver}\n"
1308 done
1309 + fi
1310
1311 - mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
1312 + if [ x"$conf" != x ]; then
1313 + conf="# Generated by dhclient or interface $interface\n${conf}"
1314 + if type resolvconf >/dev/null 2>&1; then
1315 + printf "${conf}" | resolvconf -a $interface
1316 + else
1317 + printf "${conf}" > /etc/resolv.conf
1318 + chmod 644 /etc/resolv.conf
1319 + fi
1320 fi
1321 +
1322 # If we're making confs, may as well make an ntp.conf too
1323 make_ntp_conf
1324 }
1325 diff -ur a/client/scripts/solaris b/client/scripts/solaris
1326 --- a/client/scripts/solaris 2008-09-01 14:41:00.000000000 +0100
1327 +++ b/client/scripts/solaris 2008-09-01 14:59:27.000000000 +0100
1328 @@ -1,22 +1,41 @@
1329 #!/bin/sh
1330
1331 make_resolv_conf() {
1332 + if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
1333 + return 0
1334 + fi
1335 + local conf=
1336 if [ x"$new_domain_name_servers" != x ]; then
1337 - cat /dev/null > /etc/resolv.conf.dhclient
1338 - if [ x"$new_domain_search" != x ]; then
1339 - echo search $new_domain_search >> /etc/resolv.conf.dhclient
1340 - elif [ x"$new_domain_name" != x ]; then
1341 + if [ "x$new_domain_search" != x ]; then
1342 + conf="${conf}search ${new_domain_search}\n"
1343 + elif [ "x$new_domain_name" != x ]; then
1344 # Note that the DHCP 'Domain Name Option' is really just a domain
1345 # name, and that this practice of using the domain name option as
1346 # a search path is both nonstandard and deprecated.
1347 - echo search $new_domain_name >> /etc/resolv.conf.dhclient
1348 + conf="${conf}search ${new_domain_name}\n"
1349 fi
1350 for nameserver in $new_domain_name_servers; do
1351 - echo nameserver $nameserver >>/etc/resolv.conf.dhclient
1352 + conf="${conf}nameserver ${nameserver}\n"
1353 + done
1354 + elif [ "x${new_dhcp6_name_servers}" != x ] ; then
1355 + if [ "x${new_dhcp6_domain_search}" != x ] ; then
1356 + conf="${conf}search ${new_dhcp6_domain_search}\n"
1357 + fi
1358 + for nameserver in ${new_dhcp6_name_servers} ; do
1359 + conf="${conf}nameserver ${nameserver}\n"
1360 done
1361 + fi
1362
1363 - mv /etc/resolv.conf.dhclient /etc/resolv.conf
1364 + if [ x"$conf" != x ]; then
1365 + conf="# Generated by dhclient or interface $interface\n${conf}"
1366 + if type resolvconf >/dev/null 2>&1; then
1367 + printf "${conf}" | resolvconf -a $interface
1368 + else
1369 + printf "${conf}" > /etc/resolv.conf
1370 + chmod 644 /etc/resolv.conf
1371 + fi
1372 fi
1373 +
1374 # If we're making confs, may as well make an ntp.conf too
1375 make_ntp_conf
1376 }