From: Roy Marples Date: Mon, 30 Jun 2008 15:08:19 +0000 (+0000) Subject: Add -K, --nodaeomise option so dhcpcd can run in the foreground without debugging... X-Git-Tag: v4.0.2~261 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a72cb83891d74115890ee40761d4cd6e87cbf689;p=thirdparty%2Fdhcpcd.git Add -K, --nodaeomise option so dhcpcd can run in the foreground without debugging. This is useful for running under a debugger or network manager. --- diff --git a/dhcpcd.8.in b/dhcpcd.8.in index d4d2f562..053b9806 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -22,14 +22,14 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Jun 18, 2008 +.Dd Jun 30, 2008 .Dt DHCPCD 8 SMM .Sh NAME .Nm dhcpcd .Nd an RFC 2131 compliant DHCP client .Sh SYNOPSIS .Nm -.Op Fl dknpADEGLSTV +.Op Fl dknpADEGKLSTV .Op Fl c , -script Ar script .Op Fl f , -config Ar file .Op Fl h , -hostname Ar hostname @@ -306,6 +306,13 @@ Matches full name, or prefixed with 2 numbers optionally ending with .Pp So to stop dhcpcd from touching your DNS or MTU settings you would do:- .D1 dhcpcd -C resolv.conf -C mtu eth0 +.It Fl K , -nodaemonise +Don't daemonise when we acquire a lease. +This disables the +.Fl t, -timeout +option. +This is mainly useful for running under the control of another process, such +as a debugger or a network manager. .It Fl L , -noipv4ll Don't use IPv4LL at all. .It Fl O , -nooption Ar option diff --git a/dhcpcd.c b/dhcpcd.c index f844ad36..585b3d33 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -51,7 +51,7 @@ const char copyright[] = "Copyright (c) 2006-2008 Roy Marples"; /* Don't set any optional arguments here so we retain POSIX * compatibility with getopt */ -#define OPTS "c:df:h:i:kl:m:no:pr:s:t:u:xAC:DEF:GI:LO:TV" +#define OPTS "c:df:h:i:kl:m:no:pr:s:t:u:xAC:DEF:GI:KLO:TV" static int doversion = 0; static int dohelp = 0; @@ -79,6 +79,7 @@ static const struct option longopts[] = { {"fqdn", optional_argument, NULL, 'F'}, {"nogateway", no_argument, NULL, 'G'}, {"clientid", optional_argument, NULL, 'I'}, + {"nodaemonise", no_argument, NULL, 'K'}, {"noipv4ll", no_argument, NULL, 'L'}, {"nooption", optional_argument, NULL, 'O'}, {"test", no_argument, NULL, 'T'}, @@ -154,7 +155,7 @@ read_pid(const char *pidfile) static void usage(void) { - printf("usage: "PACKAGE" [-dknpxADEGHLOSTV] [-c script] [-f file ] [-h hostname]\n" + printf("usage: "PACKAGE" [-dknpxADEGHKLOTV] [-c script] [-f file ] [-h hostname]\n" " [-i classID ] [-l leasetime] [-m metric] [-o option] [-r ipaddr]\n" " [-s ipaddr] [-t timeout] [-u userclass] [-F none|ptr|both]\n" " [-I clientID] [-C hookscript] \n"); @@ -388,6 +389,9 @@ parse_option(int opt, char *oarg, struct options *options) options->options &= ~DHCPCD_CLIENTID; } break; + case 'K': + options->options &= ~DHCPCD_DAEMONISE; + break; case 'L': options->options &= ~DHCPCD_IPV4LL; break; @@ -739,6 +743,9 @@ main(int argc, char **argv) } } + if (!(options->options & DHCPCD_DAEMONISE)) + options->timeout = 0; + if (IN_LINKLOCAL(ntohl(options->request_address.s_addr))) { logger(LOG_ERR, "you are not allowed to request a link local address");