summaryrefslogtreecommitdiffstats
path: root/abs/core/dhcp/dhcp-4.1.1-missing-ipv6-not-fatal.patch
blob: cc5ddb84329f8bd1ca718a93ee099142a0788c61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- common/discover.c	2009-09-29 21:44:49.000000000 +0200
+++ common/discover.c_new	2010-06-30 19:40:02.000000000 +0200
@@ -443,7 +443,7 @@
 	}
 
 #ifdef DHCPv6
-	if (local_family == AF_INET6) {
+	if ((local_family == AF_INET6) && !access("/proc/net/if_inet6", R_OK)) {
 		ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
 		if (ifaces->fp6 == NULL) {
 			log_error("Error opening '/proc/net/if_inet6' to "
@@ -454,6 +454,8 @@
 			ifaces->fp = NULL;
 			return 0;
 		}
+	} else {
+		ifaces->fp6 = NULL;
 	}
 #endif
 
@@ -721,7 +723,7 @@
 		return 1;
 	}
 #ifdef DHCPv6
-	if (!(*err)) {
+	if (!(*err) && ifaces->fp6) {
 		if (local_family == AF_INET6)
 			return next_iface6(info, err, ifaces);
 	}
@@ -740,7 +742,8 @@
 	ifaces->sock = -1;
 #ifdef DHCPv6
 	if (local_family == AF_INET6) {
-		fclose(ifaces->fp6);
+		if(ifaces->fp6)
+			fclose(ifaces->fp6);
 		ifaces->fp6 = NULL;
 	}
 #endif