]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add back -w, --waitip so that user has total control over behaviour.
authorRoy Marples <roy@marples.name>
Fri, 16 Oct 2009 19:59:30 +0000 (19:59 +0000)
committerRoy Marples <roy@marples.name>
Fri, 16 Oct 2009 19:59:30 +0000 (19:59 +0000)
dhcpcd.8.in
dhcpcd.c
dhcpcd.conf.5.in
if-options.c
if-options.h

index 2c772700ba03f27774dc59844cfc8a340c85f563..ee968d4c5c466fe87a27cacdb432d1f23e18f6df 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 15, 2009
+.Dd October 16, 2009
 .Dt DHCPCD 8 SMM
 .Os
 .Sh NAME
@@ -30,7 +30,7 @@
 .Nd an RFC 2131 compliant DHCP client
 .Sh SYNOPSIS
 .Nm
-.Op Fl bdgknpqABDEGKLTV
+.Op Fl bdgknpqwABDEGKLTV
 .Op Fl c , -script Ar script
 .Op Fl e , -env Ar value
 .Op Fl f , -config Ar file
@@ -336,6 +336,8 @@ Set the vendor option 03 with an IP address as a string.
 .D1 dhcpcd \-v 03,\e"192.168.0.2\e" eth0
 Set un-encapulated vendor option to hello world.
 .D1 dhcpcd \-v ,"hello world" eth0
+.It Fl w , -waitip
+Wait for an address to be assigned before forking to the background.
 .It Fl x , -exit
 This will signal an existing
 .Nm
index c41488d3b3623d19ca197efdc949f7dde1d24f3f..a89442640fe9fb3ce262bab9627696dd6daeb60e 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1800,7 +1800,10 @@ main(int argc, char **argv)
                if (iface->carrier != LINK_DOWN)
                        opt = 1;
        }
-       if (options & DHCPCD_LINK && opt == 0) {
+       if (opt == 0 &&
+           options & DHCPCD_LINK &&
+           !(options & DHCPCD_WAITIP))
+       {
                syslog(LOG_WARNING, "no interfaces have a carrier");
                daemonise();
        } else if (options & DHCPCD_DAEMONISE && ifo->timeout > 0) {
index 7fcc58cc5c4f151bbf1aa112362643a37f0f69b9..7becfa11f904bcc59096a761b0b2b162697b1c30 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 7, 2009
+.Dd October 16, 2009
 .Dt DHCPCD.CONF 5 SMM
 .Os
 .Sh NAME
@@ -272,6 +272,8 @@ Set un-encapulated vendor option to hello world.
 .It Ic vendorclassid Ar string
 Change the default vendorclassid sent from dhcpcd-version.
 If not set then none is sent.
+.It Ic waitip
+Wait for an address to be assigned before forking to the background.
 .El
 .Sh SEE ALSO
 .Xr dhcpcd-run-hooks 8 ,
index 53bb1a18261ffb8aef0db7b76ef636e806f09a51..c4d8d09680a436b059a978f4a2fb8e7728f70b18 100644 (file)
@@ -72,6 +72,7 @@ const struct option cf_options[] = {
        {"timeout",         required_argument, NULL, 't'},
        {"userclass",       required_argument, NULL, 'u'},
        {"vendor",          required_argument, NULL, 'v'},
+       {"waitip",          no_argument,       NULL, 'w'},
        {"exit",            no_argument,       NULL, 'x'},
        {"allowinterfaces", required_argument, NULL, 'z'},
        {"reboot",          required_argument, NULL, 'y'},
@@ -507,6 +508,9 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
                        ifo->vendor[0] += s + 2;
                }
                break;
+       case 'w':
+               ifo->options |= DHCPCD_WAITIP;
+               break;
        case 'y':
                ifo->reboot = atoint(arg);
                if (ifo->reboot < 0) {
index 532bcd4842fcb0e8b4cadcf697328bfc50492a2f..9f49021aaffc6f8beb29d8670c168cbacd5d6e0b 100644 (file)
@@ -37,7 +37,7 @@
 
 /* Don't set any optional arguments here so we retain POSIX
  * compatibility with getopt */
-#define IF_OPTS "bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:xy:z:ABC:DEF:GI:KLN:O:Q:TVW:X:Z:"
+#define IF_OPTS "bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:ABC:DEF:GI:KLN:O:Q:TVW:X:Z:"
 
 #define DEFAULT_TIMEOUT                30
 #define DEFAULT_REBOOT         10
@@ -71,6 +71,7 @@
 #define DHCPCD_BACKGROUND      (1 << 22)
 #define DHCPCD_VENDORRAW       (1 << 23)
 #define DHCPCD_TIMEOUT_IPV4LL  (1 << 24)
+#define DHCPCD_WAITIP          (1 << 25)
 
 extern const struct option cf_options[];