Blob Blame Raw
diff -up dhcp-4.3.3/client/dhclient.c.preinit6s dhcp-4.3.3/client/dhclient.c
--- dhcp-4.3.3/client/dhclient.c.preinit6s	2015-09-22 16:42:27.211145636 +0200
+++ dhcp-4.3.3/client/dhclient.c	2015-09-22 16:42:54.826112762 +0200
@@ -691,6 +691,12 @@ main(int argc, char **argv) {
 
 	inaddr_any.s_addr = INADDR_ANY;
 
+	/* Discover all the network interfaces. */
+	discover_interfaces(DISCOVER_UNCONFIGURED);
+
+	/* Parse the dhclient.conf file. */
+	read_client_conf();
+
 	/* Stateless special case. */
 	if (stateless) {
 		if (release_mode || (wanted_ia_na > 0) ||
@@ -702,12 +708,6 @@ main(int argc, char **argv) {
 		return 0;
 	}
 
-	/* Discover all the network interfaces. */
-	discover_interfaces(DISCOVER_UNCONFIGURED);
-
-	/* Parse the dhclient.conf file. */
-	read_client_conf();
-
 	/* Parse any extra command line configuration arguments: */
 	if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
 		arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
@@ -1169,15 +1169,23 @@ void run_stateless(int exit_mode)
 	struct client_state *client;
 	omapi_object_t *listener;
 	isc_result_t result;
-
-	/* Discover the network interface. */
-	discover_interfaces(DISCOVER_REQUESTED);
+	struct interface_info *ip;
 
 	if (!interfaces)
 		usage();
 
-	/* Parse the dhclient.conf file. */
-	read_client_conf();
+	for (ip = interfaces; ip; ip = ip->next) {
+		if ((interfaces_requested > 0) &&
+		    ((ip->flags & (INTERFACE_REQUESTED |
+				   INTERFACE_AUTOMATIC)) !=
+		     INTERFACE_REQUESTED))
+			continue;
+		script_init(ip->client, "PREINIT6S", NULL);
+		script_go(ip->client);
+	}
+
+	/* Discover the network interface. */
+	discover_interfaces(DISCOVER_REQUESTED);
 
 	/* Parse the lease database. */
 	read_client_leases();