summaryrefslogtreecommitdiffstats
path: root/meta/packages/openswan/openswan-2.2.0/gcc4-fixes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/openswan/openswan-2.2.0/gcc4-fixes.patch')
-rw-r--r--meta/packages/openswan/openswan-2.2.0/gcc4-fixes.patch329
1 files changed, 329 insertions, 0 deletions
diff --git a/meta/packages/openswan/openswan-2.2.0/gcc4-fixes.patch b/meta/packages/openswan/openswan-2.2.0/gcc4-fixes.patch
new file mode 100644
index 0000000000..0e5f6ebe47
--- /dev/null
+++ b/meta/packages/openswan/openswan-2.2.0/gcc4-fixes.patch
@@ -0,0 +1,329 @@
1Index: openswan-2.2.0/linux/lib/libfreeswan/pfkey_v2_build.c
2===================================================================
3--- openswan-2.2.0.orig/linux/lib/libfreeswan/pfkey_v2_build.c 2004-04-12 02:59:06.000000000 +0000
4+++ openswan-2.2.0/linux/lib/libfreeswan/pfkey_v2_build.c 2005-11-14 13:49:01.000000000 +0000
5@@ -173,9 +173,9 @@
6 SENDERR(EINVAL);
7 }
8
9- if(!(*pfkey_ext = (struct sadb_ext*)
10- pfkey_msg = (struct sadb_msg*)
11- MALLOC(sizeof(struct sadb_msg)))) {
12+ pfkey_msg = (struct sadb_msg*)MALLOC(sizeof(struct sadb_msg));
13+ *pfkey_ext = (struct sadb_ext*)pfkey_msg;
14+ if(NULL == pfkey_msg) {
15 DEBUGGING(PF_KEY_DEBUG_BUILD,
16 "pfkey_msg_hdr_build: "
17 "memory allocation failed\n");
18@@ -297,9 +297,9 @@
19 SENDERR(EINVAL);
20 }
21
22- if(!(*pfkey_ext = (struct sadb_ext*)
23- pfkey_sa = (struct sadb_sa*)
24- MALLOC(sizeof(struct sadb_sa)))) {
25+ pfkey_sa = (struct sadb_sa*)MALLOC(sizeof(struct sadb_sa));
26+ *pfkey_ext = (struct sadb_ext*)pfkey_sa;
27+ if (NULL == pfkey_sa) {
28 DEBUGGING(PF_KEY_DEBUG_BUILD,
29 "pfkey_sa_build: "
30 "memory allocation failed\n");
31@@ -374,9 +374,9 @@
32 SENDERR(EINVAL);
33 }
34
35- if(!(*pfkey_ext = (struct sadb_ext*)
36- pfkey_lifetime = (struct sadb_lifetime*)
37- MALLOC(sizeof(struct sadb_lifetime)))) {
38+ pfkey_lifetime = (struct sadb_lifetime*)MALLOC(sizeof(struct sadb_lifetime));
39+ *pfkey_ext = (struct sadb_ext*)pfkey_lifetime;
40+ if (NULL == pfkey_lifetime) {
41 DEBUGGING(PF_KEY_DEBUG_BUILD,
42 "pfkey_lifetime_build: "
43 "memory allocation failed\n");
44@@ -563,10 +563,11 @@
45 SENDERR(EINVAL);
46 }
47
48- if(!(*pfkey_ext = (struct sadb_ext*)
49- pfkey_key = (struct sadb_key*)
50- MALLOC(sizeof(struct sadb_key) +
51- DIVUP(key_bits, 64) * IPSEC_PFKEYv2_ALIGN))) {
52+ pfkey_key = (struct sadb_key*)
53+ MALLOC(sizeof(struct sadb_key) +
54+ DIVUP(key_bits, 64) * IPSEC_PFKEYv2_ALIGN);
55+ *pfkey_ext = (struct sadb_ext*)pfkey_key;
56+ if (NULL == pfkey_key) {
57 ERROR("pfkey_key_build: "
58 "memory allocation failed\n");
59 SENDERR(ENOMEM);
60@@ -643,10 +644,11 @@
61 if((ident_type == SADB_IDENTTYPE_USERFQDN) ) {
62 }
63 #endif
64-
65- if(!(*pfkey_ext = (struct sadb_ext*)
66- pfkey_ident = (struct sadb_ident*)
67- MALLOC(ident_len * IPSEC_PFKEYv2_ALIGN))) {
68+
69+ pfkey_ident = (struct sadb_ident*)
70+ MALLOC(ident_len * IPSEC_PFKEYv2_ALIGN);
71+ *pfkey_ext = (struct sadb_ext*)pfkey_ident;
72+ if (NULL == pfkey_ident) {
73 ERROR("pfkey_ident_build: "
74 "memory allocation failed\n");
75 SENDERR(ENOMEM);
76@@ -696,10 +698,11 @@
77 (*pfkey_ext)->sadb_ext_type);
78 SENDERR(EINVAL); /* don't process these yet */
79
80- if(!(*pfkey_ext = (struct sadb_ext*)
81- pfkey_sens = (struct sadb_sens*)
82- MALLOC(sizeof(struct sadb_sens) +
83- (sens_len + integ_len) * sizeof(uint64_t)))) {
84+ pfkey_sens = (struct sadb_sens*)
85+ MALLOC(sizeof(struct sadb_sens) +
86+ (sens_len + integ_len) * sizeof(uint64_t));
87+ *pfkey_ext = (struct sadb_ext*)pfkey_sens;
88+ if (NULL == pfkey_sens) {
89 ERROR("pfkey_sens_build: "
90 "memory allocation failed\n");
91 SENDERR(ENOMEM);
92@@ -753,10 +756,11 @@
93 SENDERR(EINVAL);
94 }
95
96- if(!(*pfkey_ext = (struct sadb_ext*)
97- pfkey_prop = (struct sadb_prop*)
98- MALLOC(sizeof(struct sadb_prop) +
99- comb_num * sizeof(struct sadb_comb)))) {
100+ pfkey_prop = (struct sadb_prop*)
101+ MALLOC(sizeof(struct sadb_prop) +
102+ comb_num * sizeof(struct sadb_comb));
103+ *pfkey_ext = (struct sadb_ext*)pfkey_prop;
104+ if (NULL == pfkey_prop) {
105 ERROR("pfkey_prop_build: "
106 "memory allocation failed\n");
107 SENDERR(ENOMEM);
108@@ -833,11 +837,11 @@
109 SENDERR(EINVAL);
110 }
111
112- if(!(*pfkey_ext = (struct sadb_ext*)
113- pfkey_supported = (struct sadb_supported*)
114- MALLOC(sizeof(struct sadb_supported) +
115- alg_num *
116- sizeof(struct sadb_alg)))) {
117+ pfkey_supported = (struct sadb_supported*)
118+ MALLOC(sizeof(struct sadb_supported) +
119+ alg_num * sizeof(struct sadb_alg));
120+ *pfkey_ext = (struct sadb_ext*)pfkey_supported;
121+ if (NULL == pfkey_supported) {
122 DEBUGGING(PF_KEY_DEBUG_BUILD,
123 "pfkey_supported_build: "
124 "memory allocation failed\n");
125@@ -913,10 +917,11 @@
126 ntohl(min));
127 SENDERR(EEXIST);
128 }
129-
130- if(!(*pfkey_ext = (struct sadb_ext*)
131- pfkey_spirange = (struct sadb_spirange*)
132- MALLOC(sizeof(struct sadb_spirange)))) {
133+
134+ pfkey_spirange = (struct sadb_spirange*)
135+ MALLOC(sizeof(struct sadb_spirange));
136+ *pfkey_ext = (struct sadb_ext*)pfkey_spirange;
137+ if (NULL == pfkey_spirange) {
138 DEBUGGING(PF_KEY_DEBUG_BUILD,
139 "pfkey_spirange_build: "
140 "memory allocation failed\n");
141@@ -958,9 +963,10 @@
142 (*pfkey_ext)->sadb_ext_type);
143 SENDERR(EINVAL); /* don't process these yet */
144
145- if(!(*pfkey_ext = (struct sadb_ext*)
146- pfkey_x_kmprivate = (struct sadb_x_kmprivate*)
147- MALLOC(sizeof(struct sadb_x_kmprivate)))) {
148+ pfkey_x_kmprivate = (struct sadb_x_kmprivate*)
149+ MALLOC(sizeof(struct sadb_x_kmprivate));
150+ *pfkey_ext = (struct sadb_ext*)pfkey_x_kmprivate;
151+ if (NULL == pfkey_x_kmprivate) {
152 DEBUGGING(PF_KEY_DEBUG_BUILD,
153 "pfkey_x_kmprivate_build: "
154 "memory allocation failed\n");
155@@ -1009,8 +1015,10 @@
156 SENDERR(EINVAL);
157 }
158
159- if(!(*pfkey_ext = (struct sadb_ext*)pfkey_x_satype = (struct sadb_x_satype*)
160- MALLOC(sizeof(struct sadb_x_satype)))) {
161+ pfkey_x_satype = (struct sadb_x_satype*)
162+ MALLOC(sizeof(struct sadb_x_satype));
163+ *pfkey_ext = (struct sadb_ext*)pfkey_x_satype;
164+ if (NULL == pfkey_x_satype) {
165 ERROR("pfkey_x_satype_build: "
166 "memory allocation failed\n");
167 SENDERR(ENOMEM);
168@@ -1064,8 +1072,10 @@
169 "tunnel=%x netlink=%x xform=%x eroute=%x spi=%x radij=%x esp=%x ah=%x rcv=%x pfkey=%x ipcomp=%x verbose=%x?\n",
170 tunnel, netlink, xform, eroute, spi, radij, esp, ah, rcv, pfkey, ipcomp, verbose);
171
172- if(!(*pfkey_ext = (struct sadb_ext*)pfkey_x_debug = (struct sadb_x_debug*)
173- MALLOC(sizeof(struct sadb_x_debug)))) {
174+ pfkey_x_debug = (struct sadb_x_debug*)
175+ MALLOC(sizeof(struct sadb_x_debug));
176+ *pfkey_ext = (struct sadb_ext*)pfkey_x_debug;
177+ if (NULL == pfkey_x_debug) {
178 ERROR("pfkey_x_debug_build: "
179 "memory allocation failed\n");
180 SENDERR(ENOMEM);
181@@ -1122,8 +1132,10 @@
182 "pfkey_x_nat_t_type_build: "
183 "type=%d\n", type);
184
185- if(!(*pfkey_ext = (struct sadb_ext*)pfkey_x_nat_t_type = (struct sadb_x_nat_t_type*)
186- MALLOC(sizeof(struct sadb_x_nat_t_type)))) {
187+ pfkey_x_nat_t_type = (struct sadb_x_nat_t_type*)
188+ MALLOC(sizeof(struct sadb_x_nat_t_type));
189+ *pfkey_ext = (struct sadb_ext*)pfkey_x_nat_t_type;
190+ if (NULL == pfkey_x_nat_t_type) {
191 DEBUGGING(PF_KEY_DEBUG_BUILD,
192 "pfkey_x_nat_t_type_build: "
193 "memory allocation failed\n");
194@@ -1174,8 +1186,10 @@
195 "pfkey_x_nat_t_port_build: "
196 "ext=%d, port=%d\n", exttype, port);
197
198- if(!(*pfkey_ext = (struct sadb_ext*)pfkey_x_nat_t_port = (struct sadb_x_nat_t_port*)
199- MALLOC(sizeof(struct sadb_x_nat_t_port)))) {
200+ pfkey_x_nat_t_port = (struct sadb_x_nat_t_port*)
201+ MALLOC(sizeof(struct sadb_x_nat_t_port));
202+ *pfkey_ext = (struct sadb_ext*)pfkey_x_nat_t_port;
203+ if (NULL == pfkey_x_nat_t_port) {
204 DEBUGGING(PF_KEY_DEBUG_BUILD,
205 "pfkey_x_nat_t_port_build: "
206 "memory allocation failed\n");
207@@ -1328,7 +1342,12 @@
208 memcpy(pfkey_ext,
209 extensions[ext],
210 (extensions[ext])->sadb_ext_len * IPSEC_PFKEYv2_ALIGN);
211- ((char*)pfkey_ext) += (extensions[ext])->sadb_ext_len * IPSEC_PFKEYv2_ALIGN;
212+ {
213+ char *pfkey_ext_c = (char *)pfkey_ext;
214+
215+ pfkey_ext_c += (extensions[ext])->sadb_ext_len * IPSEC_PFKEYv2_ALIGN;
216+ pfkey_ext = (struct sadb_ext *)pfkey_ext_c;
217+ }
218 /* Mark that we have seen this extension and remember the header location */
219 extensions_seen |= ( 1 << ext );
220 }
221Index: openswan-2.2.0/programs/pluto/connections.c
222===================================================================
223--- openswan-2.2.0.orig/programs/pluto/connections.c 2004-06-27 20:46:15.000000000 +0000
224+++ openswan-2.2.0/programs/pluto/connections.c 2005-11-14 14:01:09.000000000 +0000
225@@ -30,6 +30,7 @@
226
227 #include <openswan.h>
228 #include <openswan/ipsec_policy.h>
229+#include "pfkeyv2.h"
230 #include "kameipsec.h"
231
232 #include "constants.h"
233Index: openswan-2.2.0/programs/pluto/ipsec_doi.c
234===================================================================
235--- openswan-2.2.0.orig/programs/pluto/ipsec_doi.c 2004-09-02 01:24:23.000000000 +0000
236+++ openswan-2.2.0/programs/pluto/ipsec_doi.c 2005-11-14 14:03:17.000000000 +0000
237@@ -31,6 +31,7 @@
238
239 #include <openswan.h>
240 #include <openswan/ipsec_policy.h>
241+#include "pfkeyv2.h"
242
243 #include "constants.h"
244 #include "defs.h"
245Index: openswan-2.2.0/programs/pluto/rcv_whack.c
246===================================================================
247--- openswan-2.2.0.orig/programs/pluto/rcv_whack.c 2004-06-14 02:01:32.000000000 +0000
248+++ openswan-2.2.0/programs/pluto/rcv_whack.c 2005-11-14 14:04:08.000000000 +0000
249@@ -31,6 +31,7 @@
250 #include <sys/queue.h>
251
252 #include <openswan.h>
253+#include "pfkeyv2.h"
254
255 #include "constants.h"
256 #include "defs.h"
257Index: openswan-2.2.0/programs/pluto/log.c
258===================================================================
259--- openswan-2.2.0.orig/programs/pluto/log.c 2004-06-14 01:46:03.000000000 +0000
260+++ openswan-2.2.0/programs/pluto/log.c 2005-11-14 14:02:33.000000000 +0000
261@@ -30,6 +30,7 @@
262 #include <sys/types.h>
263
264 #include <openswan.h>
265+#include "pfkeyv2.h"
266
267 #include "constants.h"
268 #include "oswlog.h"
269Index: openswan-2.2.0/programs/pluto/spdb.c
270===================================================================
271--- openswan-2.2.0.orig/programs/pluto/spdb.c 2004-05-25 22:25:02.000000000 +0000
272+++ openswan-2.2.0/programs/pluto/spdb.c 2005-11-14 14:02:55.000000000 +0000
273@@ -24,6 +24,7 @@
274
275 #include <openswan.h>
276 #include <openswan/ipsec_policy.h>
277+#include "pfkeyv2.h"
278
279 #include "constants.h"
280 #include "oswlog.h"
281Index: openswan-2.2.0/programs/pluto/db_ops.c
282===================================================================
283--- openswan-2.2.0.orig/programs/pluto/db_ops.c 2004-06-04 01:59:33.000000000 +0000
284+++ openswan-2.2.0/programs/pluto/db_ops.c 2005-11-14 13:54:10.000000000 +0000
285@@ -181,7 +181,13 @@
286 ctx->trans0 = ctx->prop.trans = new_trans;
287 /* update trans_cur (by offset) */
288 offset = (char *)(new_trans) - (char *)(old_trans);
289- (char *)(ctx->trans_cur) += offset;
290+
291+ {
292+ char *cctx = (char *)(ctx->trans_cur);
293+
294+ cctx += offset;
295+ ctx->trans_cur = (struct db_trans *)cctx;
296+ }
297 /* update elem count */
298 ctx->max_trans = max_trans;
299 PFREE_ST(old_trans, db_trans_st);
300@@ -213,12 +219,25 @@
301
302 /* update attrs0 and attrs_cur (obviously) */
303 offset = (char *)(new_attrs) - (char *)(old_attrs);
304- (char *)ctx->attrs0 += offset;
305- (char *)ctx->attrs_cur += offset;
306+ {
307+ char *actx = (char *)(ctx->attrs0);
308+
309+ actx += offset;
310+ ctx->attrs0 = (struct db_attr *)actx;
311+
312+ actx = (char *)ctx->attrs_cur;
313+ actx += offset;
314+ ctx->attrs_cur = (struct db_attr *)actx;
315+ }
316+
317 /* for each transform, rewrite attrs pointer by offsetting it */
318- for (t=ctx->prop.trans, ti=0; ti < ctx->prop.trans_cnt; t++, ti++) {
319- (char *)(t->attrs) += offset;
320+ for (t=ctx->prop.trans, ti=0; ti < ctx->prop.trans_cnt; t++, ti++) {
321+ char *actx = (char *)(t->attrs);
322+
323+ actx += offset;
324+ t->attrs = (struct db_attr *)actx;
325 }
326+
327 /* update elem count */
328 ctx->max_attrs = max_attrs;
329 PFREE_ST(old_attrs, db_attrs_st);