From: Roy Marples Date: Tue, 8 Jul 2008 16:02:51 +0000 (+0000) Subject: Move the --nodaemonize option from K to Z so we don't conflict with SuSE custom dhcpc... X-Git-Tag: v4.0.2~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4486a4f8a0019f9fe9bb669393d83c0ac0f811e3;p=thirdparty%2Fdhcpcd.git Move the --nodaemonize option from K to Z so we don't conflict with SuSE custom dhcpcd patch, and allow removal of option requests in the configuration file. --- diff --git a/dhcpcd.8.in b/dhcpcd.8.in index b8a8c256..c008a5ac 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 Jul 04, 2008 +.Dd Jul 08, 2008 .Dt DHCPCD 8 SMM .Sh NAME .Nm dhcpcd .Nd an RFC 2131 compliant DHCP client .Sh SYNOPSIS .Nm -.Op Fl dknpqADEGKLSTV +.Op Fl dknpqADEGLSTXV .Op Fl c , -script Ar script .Op Fl f , -config Ar file .Op Fl h , -hostname Ar hostname @@ -324,7 +324,7 @@ 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 +.It Fl X , -nodaemonise Don't daemonise when we acquire a lease. This disables the .Fl t, -timeout diff --git a/dhcpcd.c b/dhcpcd.c index 26aa2501..6d030291 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -52,7 +52,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:pqr:s:t:u:v:xAC:DEF:GI:KLO:TV" +#define OPTS "c:df:h:i:kl:m:no:pqr:s:t:u:v:xAC:DEF:GI:LO:TVX" static int doversion = 0; static int dohelp = 0; @@ -82,15 +82,15 @@ 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'}, {"variables", no_argument, NULL, 'V'}, + {"nodaemonise", no_argument, NULL, 'X'}, {"help", no_argument, &dohelp, 1}, {"version", no_argument, &doversion, 1}, #ifdef THERE_IS_NO_FORK - {"daemonised", no_argument, NULL, 'X'}, + {"daemonised", no_argument, NULL, 'z'}, {"skiproutes", required_argument, NULL, 'Z'}, #endif #ifdef CMDLINE_COMPAT @@ -109,7 +109,7 @@ char dhcpcd[PATH_MAX]; char **dhcpcd_argv = NULL; int dhcpcd_argc = 0; char *dhcpcd_skiproutes = NULL; -#define EXTRA_OPTS "XZ:" +#define EXTRA_OPTS "zZ:" #endif #ifdef CMDLINE_COMPAT @@ -539,12 +539,20 @@ parse_option(int opt, char *oarg, struct options *options) } #endif break; - case 'K': - options->options &= ~DHCPCD_DAEMONISE; - break; case 'L': options->options &= ~DHCPCD_IPV4LL; break; + case 'O': + if (make_reqmask(options->reqmask, &optarg, -1) != 0 || + make_reqmask(options->nomask, &optarg, 1) != 0) + { + logger(LOG_ERR, "unknown option `%s'", optarg); + return -1; + } + break; + case 'Z': + options->options &= ~DHCPCD_DAEMONISE; + break; default: return 0; } @@ -783,7 +791,7 @@ main(int argc, char **argv) case 'f': break; #ifdef THERE_IS_NO_FORK - case 'X': + case 'z': options->options |= DHCPCD_DAEMONISED; close_fds(); break; @@ -800,16 +808,6 @@ main(int argc, char **argv) case 'x': sig = SIGTERM; break; - case 'O': - if (make_reqmask(options->reqmask, &optarg, -1) != 0) { - logger(LOG_ERR, "unknown option `%s'", optarg); - return -1; - } - if (make_reqmask(options->nomask, &optarg, 1) != 0) { - logger(LOG_ERR, "unknown option `%s'", optarg); - return -1; - } - break; case 'T': options->options |= DHCPCD_TEST | DHCPCD_PERSISTENT; break;