# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../udhcp/udhcpd-foreground.patch # Copyright (C) 2004 - 2005 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- T2-COPYRIGHT-NOTE-END --- diff -Nudr udhcp.orig/dhcpd.c udhcp/dhcpd.c --- udhcp.orig/dhcpd.c 2000-01-01 00:00:00.000000000 -0300 +++ udhcp/dhcpd.c 2005-02-13 19:17:48.604424267 -0300 @@ -104,7 +104,9 @@ return 1; #ifndef UDHCP_DEBUG - background(server_config.pidfile); /* hold lock during fork. */ + if (!server_config.foreground) { + background(server_config.pidfile); /* hold lock during fork. */ + } #endif /* Setup the signal pipe */ diff -Nudr udhcp.orig/dhcpd.h udhcp/dhcpd.h --- udhcp.orig/dhcpd.h 2000-01-01 00:00:00.000000000 -0300 +++ udhcp/dhcpd.h 2005-02-13 19:15:02.164551365 -0300 @@ -128,6 +128,7 @@ char *lease_file; char *pidfile; char *notify_file; /* What to run whenever leases are written */ + char foreground; /* Run in foreground */ uint32_t siaddr; /* next server bootp option */ char *sname; /* bootp server name */ char *boot_file; /* bootp boot file option */ diff -Nudr udhcp.orig/files.c udhcp/files.c --- udhcp.orig/files.c 2000-01-01 00:00:00.000000000 -0300 +++ udhcp/files.c 2005-02-13 19:13:47.311303959 -0300 @@ -220,6 +220,7 @@ {"lease_file", read_str, &(server_config.lease_file), LEASES_FILE}, {"pidfile", read_str, &(server_config.pidfile), "/var/run/udhcpd.pid"}, {"notify_file", read_str, &(server_config.notify_file), ""}, + {"foreground", read_yn, &(server_config.foreground), "no"}, {"siaddr", read_ip, &(server_config.siaddr), "0.0.0.0"}, {"sname", read_str, &(server_config.sname), ""}, {"boot_file", read_str, &(server_config.boot_file), ""}, diff -Nudr udhcp.orig/samples/udhcpd.conf udhcp/samples/udhcpd.conf --- udhcp.orig/samples/udhcpd.conf 2000-01-01 00:00:00.000000000 -0300 +++ udhcp/samples/udhcpd.conf 2005-02-13 19:13:03.000000000 -0300 @@ -69,6 +69,13 @@ #notify_file dumpleases # <--- usefull for debugging +# Normally udhcpd forks into the background after reading its +# configuration. The foreground option prevents this, which can be +# useful in some circumstances, such as when running directly from +# init. + +#foreground yes #default: no + # The following are bootp specific options, setable by udhcpd. #siaddr 192.168.0.22 #default: 0.0.0.0 diff -Nudr udhcp.orig/udhcpd.conf.5 udhcp/udhcpd.conf.5 --- udhcp.orig/udhcpd.conf.5 2000-01-01 00:00:00.000000000 -0300 +++ udhcp/udhcpd.conf.5 2005-02-13 19:11:06.000000000 -0300 @@ -91,6 +91,17 @@ .I FILE after the lease information is written. By default, no file is executed. .TP +.BI foreground\ FOREGROUND +If +.I FOREGROUND +is +.BR no +(the default), fork into the background after reading the +configuration. If it is +.BR yes , +run in the foreground, which can be useful in some +circumstances, such as when running directly from init. +.TP .BI siaddr\ ADDRESS BOOTP specific option. The default is .BR 0.0.0.0 .