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