1 |
diff -p -up dhcp-4.1.1/common/discover.c.ipv6_not_fatal dhcp-4.1.1/common/discover.c |
2 |
--- dhcp-4.1.1/common/discover.c.ipv6_not_fatal 2009-09-29 16:44:49.000000000 -0300 |
3 |
+++ dhcp-4.1.1/common/discover.c 2010-02-25 11:35:34.000000000 -0300 |
4 |
@@ -444,15 +444,19 @@ begin_iface_scan(struct iface_conf_list |
5 |
|
6 |
#ifdef DHCPv6 |
7 |
if (local_family == AF_INET6) { |
8 |
- ifaces->fp6 = fopen("/proc/net/if_inet6", "r"); |
9 |
- if (ifaces->fp6 == NULL) { |
10 |
- log_error("Error opening '/proc/net/if_inet6' to " |
11 |
- "list IPv6 interfaces; %m"); |
12 |
- close(ifaces->sock); |
13 |
- ifaces->sock = -1; |
14 |
- fclose(ifaces->fp); |
15 |
- ifaces->fp = NULL; |
16 |
- return 0; |
17 |
+ if (!access("/proc/net/if_inet6", R_OK)) { |
18 |
+ ifaces->fp6 = fopen("/proc/net/if_inet6", "r"); |
19 |
+ if (ifaces->fp6 == NULL) { |
20 |
+ log_error("Error opening '/proc/net/if_inet6' to " |
21 |
+ "list IPv6 interfaces; %m"); |
22 |
+ close(ifaces->sock); |
23 |
+ ifaces->sock = -1; |
24 |
+ fclose(ifaces->fp); |
25 |
+ ifaces->fp = NULL; |
26 |
+ return 0; |
27 |
+ } |
28 |
+ } else { |
29 |
+ ifaces->fp6 = NULL; |
30 |
} |
31 |
} |
32 |
#endif |
33 |
@@ -721,7 +725,7 @@ next_iface(struct iface_info *info, int |
34 |
return 1; |
35 |
} |
36 |
#ifdef DHCPv6 |
37 |
- if (!(*err)) { |
38 |
+ if (!(*err) && ifaces->fp6) { |
39 |
if (local_family == AF_INET6) |
40 |
return next_iface6(info, err, ifaces); |
41 |
} |
42 |
@@ -740,7 +744,8 @@ end_iface_scan(struct iface_conf_list *i |
43 |
ifaces->sock = -1; |
44 |
#ifdef DHCPv6 |
45 |
if (local_family == AF_INET6) { |
46 |
- fclose(ifaces->fp6); |
47 |
+ if (ifaces->fp6) |
48 |
+ fclose(ifaces->fp6); |
49 |
ifaces->fp6 = NULL; |
50 |
} |
51 |
#endif |