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