Dash:
[t2.git] / package / network / udhcp / udhcpd-foreground.patch
blobd11fc5b3a96f6eced47f50c8d4c7a60f5f368bcd
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../udhcp/udhcpd-foreground.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
16 diff -Nudr udhcp.orig/dhcpd.c udhcp/dhcpd.c
17 --- udhcp.orig/dhcpd.c 2000-01-01 00:00:00.000000000 -0300
18 +++ udhcp/dhcpd.c 2005-02-13 19:17:48.604424267 -0300
19 @@ -104,7 +104,9 @@
20 return 1;
22 #ifndef UDHCP_DEBUG
23 - background(server_config.pidfile); /* hold lock during fork. */
24 + if (!server_config.foreground) {
25 + background(server_config.pidfile); /* hold lock during fork. */
26 + }
27 #endif
29 /* Setup the signal pipe */
30 diff -Nudr udhcp.orig/dhcpd.h udhcp/dhcpd.h
31 --- udhcp.orig/dhcpd.h 2000-01-01 00:00:00.000000000 -0300
32 +++ udhcp/dhcpd.h 2005-02-13 19:15:02.164551365 -0300
33 @@ -128,6 +128,7 @@
34 char *lease_file;
35 char *pidfile;
36 char *notify_file; /* What to run whenever leases are written */
37 + char foreground; /* Run in foreground */
38 uint32_t siaddr; /* next server bootp option */
39 char *sname; /* bootp server name */
40 char *boot_file; /* bootp boot file option */
41 diff -Nudr udhcp.orig/files.c udhcp/files.c
42 --- udhcp.orig/files.c 2000-01-01 00:00:00.000000000 -0300
43 +++ udhcp/files.c 2005-02-13 19:13:47.311303959 -0300
44 @@ -220,6 +220,7 @@
45 {"lease_file", read_str, &(server_config.lease_file), LEASES_FILE},
46 {"pidfile", read_str, &(server_config.pidfile), "/var/run/udhcpd.pid"},
47 {"notify_file", read_str, &(server_config.notify_file), ""},
48 + {"foreground", read_yn, &(server_config.foreground), "no"},
49 {"siaddr", read_ip, &(server_config.siaddr), "0.0.0.0"},
50 {"sname", read_str, &(server_config.sname), ""},
51 {"boot_file", read_str, &(server_config.boot_file), ""},
52 diff -Nudr udhcp.orig/samples/udhcpd.conf udhcp/samples/udhcpd.conf
53 --- udhcp.orig/samples/udhcpd.conf 2000-01-01 00:00:00.000000000 -0300
54 +++ udhcp/samples/udhcpd.conf 2005-02-13 19:13:03.000000000 -0300
55 @@ -69,6 +69,13 @@
57 #notify_file dumpleases # <--- usefull for debugging
59 +# Normally udhcpd forks into the background after reading its
60 +# configuration. The foreground option prevents this, which can be
61 +# useful in some circumstances, such as when running directly from
62 +# init.
64 +#foreground yes #default: no
66 # The following are bootp specific options, setable by udhcpd.
68 #siaddr 192.168.0.22 #default: 0.0.0.0
69 diff -Nudr udhcp.orig/udhcpd.conf.5 udhcp/udhcpd.conf.5
70 --- udhcp.orig/udhcpd.conf.5 2000-01-01 00:00:00.000000000 -0300
71 +++ udhcp/udhcpd.conf.5 2005-02-13 19:11:06.000000000 -0300
72 @@ -91,6 +91,17 @@
73 .I FILE
74 after the lease information is written. By default, no file is executed.
75 .TP
76 +.BI foreground\ FOREGROUND
77 +If
78 +.I FOREGROUND
79 +is
80 +.BR no
81 +(the default), fork into the background after reading the
82 +configuration. If it is
83 +.BR yes ,
84 +run in the foreground, which can be useful in some
85 +circumstances, such as when running directly from init.
86 +.TP
87 .BI siaddr\ ADDRESS
88 BOOTP specific option. The default is
89 .BR 0.0.0.0 .