| 1 |
diff -up dhcp-4.1.0/common/discover.c.noipv6 dhcp-4.1.0/common/discover.c
|
| 2 |
--- dhcp-4.1.0/common/discover.c.noipv6 2009-02-18 10:44:20.000000000 -1000
|
| 3 |
+++ dhcp-4.1.0/common/discover.c 2009-02-18 10:48:27.000000000 -1000
|
| 4 |
@@ -443,15 +443,19 @@ begin_iface_scan(struct iface_conf_list
|
| 5 |
}
|
| 6 |
|
| 7 |
#ifdef DHCPv6
|
| 8 |
- ifaces->fp6 = fopen("/proc/net/if_inet6", "re");
|
| 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", "re");
|
| 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 |
#endif
|
| 32 |
|
| 33 |
@@ -719,7 +723,7 @@ next_iface(struct iface_info *info, int
|
| 34 |
return 1;
|
| 35 |
}
|
| 36 |
#ifdef DHCPv6
|
| 37 |
- if (!(*err)) {
|
| 38 |
+ if (!(*err) && ifaces->fp6) {
|
| 39 |
return next_iface6(info, err, ifaces);
|
| 40 |
}
|
| 41 |
#endif
|
| 42 |
@@ -736,7 +740,8 @@ end_iface_scan(struct iface_conf_list *i
|
| 43 |
close(ifaces->sock);
|
| 44 |
ifaces->sock = -1;
|
| 45 |
#ifdef DHCPv6
|
| 46 |
- fclose(ifaces->fp6);
|
| 47 |
+ if (ifaces->fp6)
|
| 48 |
+ fclose(ifaces->fp6);
|
| 49 |
ifaces->fp6 = NULL;
|
| 50 |
#endif
|
| 51 |
}
|