summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-02-17 23:02:09 +0000
committerRoy Marples <roy@marples.name>2009-02-17 23:02:09 +0000
commitc9fc4ec4b90fb8a029a16ccc934368b68c2a51c3 (patch)
tree14b99ebbfe317c0735dcb94ee907ffa08e28bf30
parent3c3f38c09021f2b82a3823f35edd2d4cb2d1fb7e (diff)
downloaddhcpcd-c9fc4ec4b90fb8a029a16ccc934368b68c2a51c3.tar.xz
If running as a controlling daemon with link management, background earlier.
-rw-r--r--dhcpcd.8.in10
-rw-r--r--dhcpcd.c5
2 files changed, 11 insertions, 4 deletions
diff --git a/dhcpcd.8.in b/dhcpcd.8.in
index 61df5e90..c2494fa7 100644
--- a/dhcpcd.8.in
+++ b/dhcpcd.8.in
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 28, 2009
+.Dd February 17, 2009
.Dt DHCPCD 8 SMM
.Sh NAME
.Nm dhcpcd
@@ -111,10 +111,12 @@ option.
can be run per interface or as a single instance to manage all interfaces.
If a list of interfaces are given on the command line, then
.Nm
-only works with those interfaces.
-If no interfaces are given then
+only works with those interfaces, otherwise
.Nm
-discovers available interfaces and attempts to configure them.
+discovers available interfaces.
+If link management is enabled and none or more than one interfaces are given,
+.Nm
+forks to the background right away.
.Pp
Interfaces are preferred by carrier, DHCP lease/IPv4LL and then lowest metric.
For systems that support route metrics, each route will be tagged with the
diff --git a/dhcpcd.c b/dhcpcd.c
index 21612bdb..ec275266 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1460,6 +1460,11 @@ main(int argc, char **argv)
ifc = argc - optind;
ifv = argv + optind;
+ if (ifc != 1) {
+ if (options & (DHCPCD_LINK | DHCPCD_DAEMONISE))
+ daemonise();
+ }
+
ifaces = discover_interfaces(ifc, ifv);
for (i = 0; i < ifc; i++) {
for (iface = ifaces; iface; iface = iface->next)