diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-05-05 10:51:24 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-05-05 10:51:24 +0000 |
commit | 1b870d7bf59aaa8a27c8825a5b3b7a40371a68d3 (patch) | |
tree | f8ba99fead27258ffa512b4fb425c17b6a560143 /sbin | |
parent | 94666e8111fe4cbbb6a165b5cd1bd7a186c4b21b (diff) |
open bpf and routefd a little later, after forking the priv child so it
doesn't get copies of those fds
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/dhclient.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 0e08866bf70..5f626992cba 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.41 2004/05/04 22:23:01 mickey Exp $ */ +/* $OpenBSD: dhclient.c,v 1.42 2004/05/05 10:51:23 henning Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -286,17 +286,6 @@ main(int argc, char *argv[]) fprintf(stderr, "got link\n"); } - priv_script_init("PREINIT", NULL); - if (ifi->client->alias) - priv_script_write_params("alias_", ifi->client->alias); - priv_script_go(); - - if ((routefd = socket(PF_ROUTE, SOCK_RAW, 0)) != -1) - add_protocol("AF_ROUTE", routefd, routehandler, ifi); - - /* set up the interface */ - discover_interfaces(ifi); - if ((pw = getpwnam("_dhcp")) == NULL) error("no such user: _dhcp"); @@ -308,6 +297,17 @@ main(int argc, char *argv[]) close(pipe_fd[0]); privfd = pipe_fd[1]; + if ((routefd = socket(PF_ROUTE, SOCK_RAW, 0)) != -1) + add_protocol("AF_ROUTE", routefd, routehandler, ifi); + + priv_script_init("PREINIT", NULL); + if (ifi->client->alias) + priv_script_write_params("alias_", ifi->client->alias); + priv_script_go(); + + /* set up the interface */ + discover_interfaces(ifi); + if (chroot(_PATH_VAREMPTY) == -1) error("chroot"); if (chdir("/") == -1) |