PKGBUILDs/extra/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch
2009-10-09 21:23:22 -05:00

54 lines
1.3 KiB
Diff

Based on patch from redhat: http://cvs.fedoraproject.org/viewvc/devel/dhcp/dhcp-4.1.0-missing-ipv6-not-fatal.patch?revision=1.2
--- common/discover.c.orig 2008-08-29 13:48:57.000000000 -0400
+++ common/discover.c 2009-09-08 23:32:45.000000000 -0400
@@ -443,16 +443,20 @@
}
#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 (!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 "
+ "list IPv6 interfaces; %m");
+ close(ifaces->sock);
+ ifaces->sock = -1;
+ fclose(ifaces->fp);
+ ifaces->fp = NULL;
+ return 0;
+ }
+ } else {
+ ifaces->fp6 = NULL;
+ }
#endif
return 1;
@@ -719,7 +723,7 @@
return 1;
}
#ifdef DHCPv6
- if (!(*err)) {
+ if (!(*err) && ifaces->fp6) {
return next_iface6(info, err, ifaces);
}
#endif
@@ -736,7 +740,8 @@
close(ifaces->sock);
ifaces->sock = -1;
#ifdef DHCPv6
- fclose(ifaces->fp6);
+ if (ifaces->fp6)
+ fclose(ifaces->fp6);
ifaces->fp6 = NULL;
#endif
}