0001-WIP-Resolve-ISC-DHCP-does-not-build-with-gcc10.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. From 129b7e402bd6e7278854e5a8935fce460552b5f4 Mon Sep 17 00:00:00 2001
  2. From: Thomas Markwalder <tmark@isc.org>
  3. Date: Thu, 30 Jul 2020 10:01:36 -0400
  4. Subject: [PATCH] [#117] Fixed gcc 10 compilation issues
  5. client/dhclient.c
  6. relay/dhcrelay.c
  7. extern'ed local_port,remote_port
  8. common/discover.c
  9. init local_port,remote_port to 0
  10. server/mdb.c
  11. extern'ed dhcp_type_host
  12. server/mdb6.c
  13. create_prefix6() - eliminated memcpy string overflow error
  14. [Retrieved from:
  15. https://gitlab.isc.org/isc-projects/dhcp/-/merge_requests/60/diffs?commit_id=129b7e402bd6e7278854e5a8935fce460552b5f4]
  16. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  17. ---
  18. RELNOTES | 5 +++++
  19. client/dhclient.c | 5 +++--
  20. common/discover.c | 4 ++--
  21. relay/dhcrelay.c | 4 ++--
  22. server/mdb.c | 2 +-
  23. server/mdb6.c | 2 +-
  24. 6 files changed, 14 insertions(+), 8 deletions(-)
  25. diff --git a/RELNOTES b/RELNOTES
  26. index 9d0a0414..6919dba7 100644
  27. --- a/RELNOTES
  28. +++ b/RELNOTES
  29. @@ -103,6 +103,11 @@ ISC DHCP is open source software maintained by Internet Systems
  30. Consortium. This product includes cryptographic software written
  31. by Eric Young (eay@cryptsoft.com).
  32. + Changes since 4.4.2 (Bug Fixes)
  33. +
  34. +- Minor corrections to allow compilation under gcc 10.
  35. + [Gitlab #117]
  36. +
  37. Changes since 4.4.2b1 (Bug Fixes)
  38. - Added a clarification on DHCPINFORMs and server authority to
  39. diff --git a/client/dhclient.c b/client/dhclient.c
  40. index 189e5270..7a7837cb 100644
  41. --- a/client/dhclient.c
  42. +++ b/client/dhclient.c
  43. @@ -83,8 +83,9 @@ static const char message [] = "Internet Systems Consortium DHCP Client";
  44. static const char url [] = "For info, please visit https://www.isc.org/software/dhcp/";
  45. #endif /* UNIT_TEST */
  46. -u_int16_t local_port = 0;
  47. -u_int16_t remote_port = 0;
  48. +extern u_int16_t local_port;
  49. +extern u_int16_t remote_port;
  50. +
  51. #if defined(DHCPv6) && defined(DHCP4o6)
  52. int dhcp4o6_state = -1; /* -1 = stopped, 0 = polling, 1 = started */
  53. #endif
  54. diff --git a/common/discover.c b/common/discover.c
  55. index ca4f4d55..22f09767 100644
  56. --- a/common/discover.c
  57. +++ b/common/discover.c
  58. @@ -45,8 +45,8 @@ struct interface_info *fallback_interface = 0;
  59. int interfaces_invalidated;
  60. int quiet_interface_discovery;
  61. -u_int16_t local_port;
  62. -u_int16_t remote_port;
  63. +u_int16_t local_port = 0;
  64. +u_int16_t remote_port = 0;
  65. u_int16_t relay_port = 0;
  66. int dhcpv4_over_dhcpv6 = 0;
  67. int (*dhcp_interface_setup_hook) (struct interface_info *, struct iaddr *);
  68. diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
  69. index 883d5058..7211e3bb 100644
  70. --- a/relay/dhcrelay.c
  71. +++ b/relay/dhcrelay.c
  72. @@ -95,8 +95,8 @@ enum { forward_and_append, /* Forward and append our own relay option. */
  73. forward_untouched, /* Forward without changes. */
  74. discard } agent_relay_mode = forward_and_replace;
  75. -u_int16_t local_port;
  76. -u_int16_t remote_port;
  77. +extern u_int16_t local_port;
  78. +extern u_int16_t remote_port;
  79. /* Relay agent server list. */
  80. struct server_list {
  81. diff --git a/server/mdb.c b/server/mdb.c
  82. index ff8a707f..8266d764 100644
  83. --- a/server/mdb.c
  84. +++ b/server/mdb.c
  85. @@ -67,7 +67,7 @@ static host_id_info_t *host_id_info = NULL;
  86. int numclasseswritten;
  87. -omapi_object_type_t *dhcp_type_host;
  88. +extern omapi_object_type_t *dhcp_type_host;
  89. isc_result_t enter_class(cd, dynamicp, commit)
  90. struct class *cd;
  91. diff --git a/server/mdb6.c b/server/mdb6.c
  92. index da7baf6e..ebe01e56 100644
  93. --- a/server/mdb6.c
  94. +++ b/server/mdb6.c
  95. @@ -1945,7 +1945,7 @@ create_prefix6(struct ipv6_pool *pool, struct iasubopt **pref,
  96. }
  97. new_ds.data = new_ds.buffer->data;
  98. memcpy(new_ds.buffer->data, ds.data, ds.len);
  99. - memcpy(new_ds.buffer->data + ds.len, &tmp, sizeof(tmp));
  100. + memcpy(&new_ds.buffer->data[0] + ds.len, &tmp, sizeof(tmp));
  101. data_string_forget(&ds, MDL);
  102. data_string_copy(&ds, &new_ds, MDL);
  103. data_string_forget(&new_ds, MDL);
  104. --
  105. GitLab