0adb5fb
diff -up dhcp-4.1.0/common/discover.c.noipv6 dhcp-4.1.0/common/discover.c
f81c3f9
--- dhcp-4.1.0/common/discover.c.noipv6	2009-02-18 10:44:20.000000000 -1000
f81c3f9
+++ dhcp-4.1.0/common/discover.c	2009-02-18 10:48:27.000000000 -1000
f81c3f9
@@ -443,15 +443,19 @@ begin_iface_scan(struct iface_conf_list 
f81c3f9
 	}
f81c3f9
 
f81c3f9
 #ifdef DHCPv6
f81c3f9
-	ifaces->fp6 = fopen("/proc/net/if_inet6", "re");
f81c3f9
-	if (ifaces->fp6 == NULL) {
f81c3f9
-		log_error("Error opening '/proc/net/if_inet6' to "
f81c3f9
-			  "list IPv6 interfaces; %m");
0adb5fb
-		close(ifaces->sock);
f81c3f9
-		ifaces->sock = -1;
0adb5fb
-		fclose(ifaces->fp);
f81c3f9
-		ifaces->fp = NULL;
f81c3f9
-		return 0;
f81c3f9
+	if (!access("/proc/net/if_inet6", R_OK)) {
f81c3f9
+		ifaces->fp6 = fopen("/proc/net/if_inet6", "re");
f81c3f9
+		if (ifaces->fp6 == NULL) {
f81c3f9
+			log_error("Error opening '/proc/net/if_inet6' to "
f81c3f9
+				  "list IPv6 interfaces; %m");
f81c3f9
+			close(ifaces->sock);
f81c3f9
+			ifaces->sock = -1;
0adb5fb
+			fclose(ifaces->fp);
f81c3f9
+			ifaces->fp = NULL;
f81c3f9
+			return 0;
f81c3f9
+		}
f81c3f9
+	} else {
f81c3f9
+		ifaces->fp6 = NULL;
0adb5fb
 	}
f81c3f9
 #endif
f81c3f9
 
f81c3f9
@@ -719,7 +723,7 @@ next_iface(struct iface_info *info, int 
0adb5fb
 		return 1;
0adb5fb
 	}
0adb5fb
 #ifdef DHCPv6
0adb5fb
-	if (!(*err)) {
0adb5fb
+	if (!(*err) && ifaces->fp6) {
0adb5fb
 		return next_iface6(info, err, ifaces);
0adb5fb
 	}
0adb5fb
 #endif
f81c3f9
@@ -736,7 +740,8 @@ end_iface_scan(struct iface_conf_list *i
0adb5fb
 	close(ifaces->sock);
0adb5fb
 	ifaces->sock = -1;
0adb5fb
 #ifdef DHCPv6
0adb5fb
-	fclose(ifaces->fp6);
0adb5fb
+	if (ifaces->fp6)
0adb5fb
+		fclose(ifaces->fp6);
0adb5fb
 	ifaces->fp6 = NULL;
0adb5fb
 #endif
0adb5fb
 }