]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't timeout if we're daemonised.
authorRoy Marples <roy@marples.name>
Wed, 25 Feb 2009 07:52:07 +0000 (07:52 +0000)
committerRoy Marples <roy@marples.name>
Wed, 25 Feb 2009 07:52:07 +0000 (07:52 +0000)
dhcp.c
dhcpcd.c

diff --git a/dhcp.c b/dhcp.c
index 2689b734cd6d55c2bada5629c81a645f92349a08..e836211a8bbc79d742751c658ae454393c46fbcd 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -816,7 +816,7 @@ make_message(struct dhcp_message **message,
        }
        dhcp->xid = iface->state->xid;
        dhcp->cookie = htonl(MAGIC_COOKIE);
-
+#if 0
        *p++ = DHO_MESSAGETYPE; 
        *p++ = 1;
        *p++ = type;
@@ -952,7 +952,7 @@ make_message(struct dhcp_message **message,
                *n_params = p - n_params - 1;
        }
        *p++ = DHO_END;
-
+#endif
 #ifdef BOOTP_MESSAGE_LENTH_MIN
        /* Some crappy DHCP servers think they have to obey the BOOTP minimum
         * message length.
index 64372c6b7f448ea88eb868b51f2fbb2c3abfb6fd..95d7b2cefcd15c41c3ae30515ddc6ee378b6a7c8 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1446,7 +1446,15 @@ main(int argc, char **argv)
                        add_event(linkfd, handle_link, NULL);
        }
 
-       if (options & DHCPCD_DAEMONISE && !(options & DHCPCD_BACKGROUND)) {
+       ifc = argc - optind;
+       ifv = argv + optind;
+       if (options & DHCPCD_BACKGROUND ||
+           (ifc == 0 &&
+               options & DHCPCD_LINK &&
+               options & DHCPCD_DAEMONISE))
+       {
+               daemonise();
+       } else if (options & DHCPCD_DAEMONISE) {
                oi = ifo->timeout;
                if (ifo->options & DHCPCD_IPV4LL)
                        oi += 10;
@@ -1454,11 +1462,6 @@ main(int argc, char **argv)
        }
        free_options(ifo);
 
-       ifc = argc - optind;
-       ifv = argv + optind;
-       if (ifc == 0 && options & (DHCPCD_LINK | DHCPCD_DAEMONISE))
-               daemonise();
-
        ifaces = discover_interfaces(ifc, ifv);
        for (i = 0; i < ifc; i++) {
                for (iface = ifaces; iface; iface = iface->next)
@@ -1471,17 +1474,13 @@ main(int argc, char **argv)
        if (!ifaces) {
                if (ifc == 0)
                        syslog(LOG_ERR, "no valid interfaces found");
-               if (!(options & DHCPCD_BACKGROUND) || 
-                   !(options & DHCPCD_LINK))
-               {
+               if (!(options & DHCPCD_LINK)) {
                        syslog(LOG_ERR, "aborting as we're not backgrounding"
                            " with link detection");
                        exit(EXIT_FAILURE);
                }
        }
 
-       if (options & DHCPCD_BACKGROUND)
-               daemonise();
        for (iface = ifaces; iface; iface = iface->next)
                init_state(iface, argc, argv);
        sort_interfaces();