dhcp-4.3.3-missing_ipv6-1.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
  2. Date: 2011-11-23
  3. Initial Package Version: 4.2.2
  4. Upstream Status: unknown
  5. Origin: found at fedora
  6. Tanım: Allow dhcp4 to work even if the kernel doesn't support ipv6.
  7. Fixed up by hand to apply to 4.2.2 (to me, it looks identical to the 4.2.0
  8. version, but patch failed in one hunk when I tried to apply that one).
  9. --- dhcp-4.2.2/common/discover.c.orig 2011-07-19 23:22:48.000000000 +0100
  10. +++ dhcp-4.2.2/common/discover.c 2011-09-06 01:28:15.000000000 +0100
  11. @@ -455,7 +455,7 @@
  12. }
  13. #ifdef DHCPv6
  14. - if (local_family == AF_INET6) {
  15. + if ((local_family == AF_INET6) && !access("/proc/net/if_inet6", R_OK)) {
  16. ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
  17. if (ifaces->fp6 == NULL) {
  18. log_error("Error opening '/proc/net/if_inet6' to "
  19. @@ -466,6 +466,8 @@
  20. ifaces->fp = NULL;
  21. return 0;
  22. }
  23. + } else {
  24. + ifaces->fp6 = NULL;
  25. }
  26. #endif
  27. @@ -733,7 +735,7 @@
  28. return 1;
  29. }
  30. #ifdef DHCPv6
  31. - if (!(*err)) {
  32. + if (!(*err) && ifaces->fp6) {
  33. if (local_family == AF_INET6)
  34. return next_iface6(info, err, ifaces);
  35. }
  36. @@ -752,7 +754,8 @@
  37. ifaces->sock = -1;
  38. #ifdef DHCPv6
  39. if (local_family == AF_INET6) {
  40. - fclose(ifaces->fp6);
  41. + if (ifaces->fp6)
  42. + fclose(ifaces->fp6);
  43. ifaces->fp6 = NULL;
  44. }
  45. #endif