Fix dhclient for interfaces that are down. The discover_interfaces() function

that looks for interface skips interfaces that are not UP. We need to call
dhclient-script PREINIT before we call discover_interfaces(), so the script has
a chance to bring the interface UP.

Reported by:	alfred
This commit is contained in:
Pawel Jakub Dawidek 2013-07-04 12:27:10 +00:00
parent 27f90bebef
commit 374a8a322b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252697

View File

@ -457,6 +457,11 @@ main(int argc, char *argv[])
if (gethostname(hostname, sizeof(hostname)) < 0)
hostname[0] = '\0';
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);
@ -483,11 +488,6 @@ main(int argc, char *argv[])
rewrite_client_leases();
close(fd);
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);
if (shutdown(routefd, SHUT_WR) < 0)