philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-dhclient-preinit6s.patch

26a25c
diff -up dhcp-4.3.4/client/dhclient.c.preinit6s dhcp-4.3.4/client/dhclient.c
26a25c
--- dhcp-4.3.4/client/dhclient.c.preinit6s	2016-04-29 13:15:10.361379493 +0200
26a25c
+++ dhcp-4.3.4/client/dhclient.c	2016-04-29 13:17:43.622415423 +0200
26a25c
@@ -812,6 +812,12 @@ main(int argc, char **argv) {
26a25c
 
26a25c
 	inaddr_any.s_addr = INADDR_ANY;
26a25c
 
26a25c
+	/* Discover all the network interfaces. */
26a25c
+	discover_interfaces(DISCOVER_UNCONFIGURED);
26a25c
+
26a25c
+	/* Parse the dhclient.conf file. */
26a25c
+	read_client_conf();
26a25c
+
26a25c
 	/* Stateless special case. */
26a25c
 	if (stateless) {
26a25c
 		if (release_mode || (wanted_ia_na > 0) ||
26a25c
@@ -828,12 +834,6 @@ main(int argc, char **argv) {
26a25c
 		return 0;
26a25c
 	}
26a25c
 
26a25c
-	/* Discover all the network interfaces. */
26a25c
-	discover_interfaces(DISCOVER_UNCONFIGURED);
26a25c
-
26a25c
-	/* Parse the dhclient.conf file. */
26a25c
-	read_client_conf();
26a25c
-
26a25c
 	/* Parse any extra command line configuration arguments: */
26a25c
 	if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
26a25c
 		arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
26a25c
@@ -1288,20 +1288,30 @@ void run_stateless(int exit_mode, u_int1
26a25c
 	IGNORE_UNUSED(port);
26a25c
 #endif
26a25c
 
26a25c
-	/* Discover the network interface. */
26a25c
-	discover_interfaces(DISCOVER_REQUESTED);
26a25c
+	struct interface_info *ip;
26a25c
 
26a25c
 	if (!interfaces)
26a25c
 		usage("No interfaces available for stateless command: %s", "-S");
26a25c
 
26a25c
-	/* Parse the dhclient.conf file. */
26a25c
 #ifdef DHCP4o6
26a25c
 	if (dhcpv4_over_dhcpv6) {
26a25c
 		/* Mark we want to request IRT too! */
26a25c
 		dhcpv4_over_dhcpv6++;
26a25c
 	}
26a25c
 #endif
26a25c
-	read_client_conf();
26a25c
+
26a25c
+	for (ip = interfaces; ip; ip = ip->next) {
26a25c
+		if ((interfaces_requested > 0) &&
26a25c
+		    ((ip->flags & (INTERFACE_REQUESTED |
26a25c
+				   INTERFACE_AUTOMATIC)) !=
26a25c
+		     INTERFACE_REQUESTED))
26a25c
+			continue;
26a25c
+		script_init(ip->client, "PREINIT6", NULL);
26a25c
+		script_go(ip->client);
26a25c
+	}
26a25c
+
26a25c
+	/* Discover the network interface. */
26a25c
+	discover_interfaces(DISCOVER_REQUESTED);
26a25c
 
26a25c
 	/* Parse the lease database. */
26a25c
 	read_client_leases();