aboutsummaryrefslogtreecommitdiffstats
path: root/main/dhcp/linux_ipv6_discover.patch
blob: ebf3865e6a05e7da565b5a6387bc1119c802aec1 (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
50
diff -Naur dhcp-4.1.0a2/common/discover.c dhcp-4.1.0a2-mcn/common/discover.c
--- dhcp-4.1.0a2/common/discover.c	2008-08-29 18:48:57.000000000 +0100
+++ dhcp-4.1.0a2-mcn/common/discover.c	2008-10-02 13:02:06.000000000 +0100
@@ -443,15 +443,17 @@
 	}
 
 #ifdef DHCPv6
-	ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
-	if (ifaces->fp6 == NULL) {
-		log_error("Error opening '/proc/net/if_inet6' to "
-			  "list IPv6 interfaces; %m");
-		close(ifaces->sock);
-		ifaces->sock = -1;
-		fclose(ifaces->fp);
-		ifaces->fp = NULL;
-		return 0;
+	if (local_family == AF_INET6) {
+		ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
+		if (ifaces->fp6 == NULL) {
+			log_error("Error opening '/proc/net/if_inet6' to "
+				  "list IPv6 interfaces; %m");
+			close(ifaces->sock);
+			ifaces->sock = -1;
+			fclose(ifaces->fp);
+			ifaces->fp = NULL;
+			return 0;
+		}
 	}
 #endif
 
@@ -720,7 +722,8 @@
 	}
 #ifdef DHCPv6
 	if (!(*err)) {
-		return next_iface6(info, err, ifaces);
+		if (local_family == AF_INET6)
+			return next_iface6(info, err, ifaces);
 	}
 #endif
 	return 0;
@@ -736,7 +739,8 @@
 	close(ifaces->sock);
 	ifaces->sock = -1;
 #ifdef DHCPv6
-	fclose(ifaces->fp6);
+	if (local_family == AF_INET6)
+		fclose(ifaces->fp6);
 	ifaces->fp6 = NULL;
 #endif
 }