0001-susv3-legacy.patch
8.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
[PATCH] Replace susv3 legacy function with modern equivalents
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
nuttcp-6.1.2.c | 90 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 45 insertions(+), 45 deletions(-)
Index: nuttcp-6.1.2/nuttcp-6.1.2.c
===================================================================
--- nuttcp-6.1.2.orig/nuttcp-6.1.2.c
+++ nuttcp-6.1.2/nuttcp-6.1.2.c
@@ -1925,11 +1925,11 @@
if (udp && !haverateopt)
rate = DEFAULT_UDP_RATE;
- bzero((char *)&frominet, sizeof(frominet));
- bzero((char *)&clientaddr, sizeof(clientaddr));
+ memset((char *)&frominet, 0, sizeof(frominet));
+ memset((char *)&clientaddr, 0, sizeof(clientaddr));
#ifdef AF_INET6
- bzero((char *)&clientaddr6, sizeof(clientaddr6));
+ memset((char *)&clientaddr6, 0, sizeof(clientaddr6));
clientscope6 = 0;
#endif
@@ -1985,7 +1985,7 @@
}
while (stream_idx <= nstream) {
- bzero(&hints, sizeof(hints));
+ memset(&hints, 0, sizeof(hints));
res[stream_idx] = NULL;
if (explicitaf) hints.ai_family = af;
if ((cp2 = strchr(cp1, '/'))) {
@@ -3013,12 +3013,12 @@
if ((stream_idx > 0) && skip_data)
break;
- bzero((char *)&sinme[stream_idx], sizeof(sinme[stream_idx]));
- bzero((char *)&sinhim[stream_idx], sizeof(sinhim[stream_idx]));
+ memset((char *)&sinme[stream_idx], 0, sizeof(sinme[stream_idx]));
+ memset((char *)&sinhim[stream_idx], 0, sizeof(sinhim[stream_idx]));
#ifdef AF_INET6
- bzero((char *)&sinme6[stream_idx], sizeof(sinme6[stream_idx]));
- bzero((char *)&sinhim6[stream_idx], sizeof(sinhim6[stream_idx]));
+ memset((char *)&sinme6[stream_idx], 0, sizeof(sinme6[stream_idx]));
+ memset((char *)&sinhim6[stream_idx], 0, sizeof(sinhim6[stream_idx]));
#endif
if (((trans && !reverse) && (stream_idx > 0)) ||
@@ -3028,15 +3028,15 @@
if (client) {
if (af == AF_INET) {
sinhim[stream_idx].sin_family = af;
- bcopy((char *)&(((struct sockaddr_in *)res[stream_idx]->ai_addr)->sin_addr),
- (char *)&sinhim[stream_idx].sin_addr.s_addr,
+ memcpy((char *)&sinhim[stream_idx].sin_addr.s_addr,
+ (char *)&(((struct sockaddr_in *)res[stream_idx]->ai_addr)->sin_addr),
sizeof(sinhim[stream_idx].sin_addr.s_addr));
}
#ifdef AF_INET6
else if (af == AF_INET6) {
sinhim6[stream_idx].sin6_family = af;
- bcopy((char *)&(((struct sockaddr_in6 *)res[stream_idx]->ai_addr)->sin6_addr),
- (char *)&sinhim6[stream_idx].sin6_addr.s6_addr,
+ memcpy((char *)&sinhim6[stream_idx].sin6_addr.s6_addr,
+ (char *)&(((struct sockaddr_in6 *)res[stream_idx]->ai_addr)->sin6_addr),
sizeof(sinhim6[stream_idx].sin6_addr.s6_addr));
sinhim6[stream_idx].sin6_scope_id = ((struct sockaddr_in6 *)res[stream_idx]->ai_addr)->sin6_scope_id;
}
@@ -3113,8 +3113,8 @@
* to the multicast group
*/
if (af == AF_INET) {
- bcopy((char *)&sinhim[1].sin_addr.s_addr,
- (char *)&save_sinhim.sin_addr.s_addr,
+ memcpy((char *)&save_sinhim.sin_addr.s_addr,
+ (char *)&sinhim[1].sin_addr.s_addr,
sizeof(struct in_addr));
if (!client && (irvers >= 50505)) {
struct sockaddr_in peer;
@@ -3124,8 +3124,8 @@
&peerlen) < 0) {
err("getpeername");
}
- bcopy((char *)&peer.sin_addr.s_addr,
- (char *)&sinhim[1].sin_addr.s_addr,
+ memcpy((char *)&sinhim[1].sin_addr.s_addr,
+ (char *)&peer.sin_addr.s_addr,
sizeof(struct in_addr));
}
else {
@@ -3136,8 +3136,8 @@
&melen) < 0) {
err("getsockname");
}
- bcopy((char *)&me.sin_addr.s_addr,
- (char *)&sinhim[1].sin_addr.s_addr,
+ memcpy((char *)&sinhim[1].sin_addr.s_addr,
+ (char *)&me.sin_addr.s_addr,
sizeof(struct in_addr));
}
sinhim[1].sin_addr.s_addr &=
@@ -4197,13 +4197,13 @@
&melen) < 0) {
err("getsockname");
}
- bcopy((char *)&me.sin_addr.s_addr,
- (char *)&mc_group.imr_multiaddr.s_addr,
+ memcpy((char *)&mc_group.imr_multiaddr.s_addr,
+ (char *)&me.sin_addr.s_addr,
sizeof(struct in_addr));
}
else {
- bcopy((char *)&peer.sin_addr.s_addr,
- (char *)&mc_group.imr_multiaddr.s_addr,
+ memcpy((char *)&mc_group.imr_multiaddr.s_addr,
+ (char *)&peer.sin_addr.s_addr,
sizeof(struct in_addr));
}
mc_group.imr_multiaddr.s_addr &= htonl(0xFFFFFF);
@@ -4330,12 +4330,12 @@
if(udp) {
strcpy(buf, "BOD0");
if (multicast) {
- bcopy((char *)&sinhim[1].sin_addr.s_addr,
- (char *)&save_mc.sin_addr.s_addr,
- sizeof(struct in_addr));
- bcopy((char *)&save_sinhim.sin_addr.s_addr,
+ memcpy((char *)&save_mc.sin_addr.s_addr,
(char *)&sinhim[1].sin_addr.s_addr,
sizeof(struct in_addr));
+ memcpy((char *)&sinhim[1].sin_addr.s_addr,
+ (char *)&save_sinhim.sin_addr.s_addr,
+ sizeof(struct in_addr));
}
(void)Nwrite( fd[stream_idx + 1], buf, 4 ); /* rcvr start */
if (two_bod) {
@@ -4344,8 +4344,8 @@
(void)Nwrite( fd[stream_idx + 1], buf, 4 ); /* rcvr start */
}
if (multicast) {
- bcopy((char *)&save_mc.sin_addr.s_addr,
- (char *)&sinhim[1].sin_addr.s_addr,
+ memcpy((char *)&sinhim[1].sin_addr.s_addr,
+ (char *)&save_mc.sin_addr.s_addr,
sizeof(struct in_addr));
}
if (timeout)
@@ -4361,7 +4361,7 @@
fflush(stdout);
}
if (udplossinfo)
- bcopy(&nbytes, buf + 24, 8);
+ memcpy(buf + 24, &nbytes, 8);
if (!udp && interval && !(format & NORETRANS) &&
((retransinfo == 1) ||
((retransinfo >= 2) &&
@@ -4372,13 +4372,13 @@
tmp = 0x5254524Eu; /* "RTRN" */
else
tmp = 0x48525452u; /* "HRTR" */
- bcopy(&nretrans, buf + 24, 4);
- bcopy(&tmp, buf + 28, 4);
+ memcpy(buf + 24, &nretrans, 4);
+ memcpy(buf + 28, &tmp, 4);
}
else {
send_retrans = 0;
if (!udp)
- bzero(buf + 24, 8);
+ memset(buf + 24, 0, 8);
}
if (nbuf == INT_MAX)
nbuf = ULLONG_MAX;
@@ -4423,12 +4423,12 @@
nbytes += buflen;
cnt = 0;
if (udplossinfo)
- bcopy(&nbytes, buf + 24, 8);
+ memcpy(buf + 24, &nbytes, 8);
if (send_retrans) {
nretrans = get_retrans(
fd[stream_idx + 1]);
nretrans -= iretrans;
- bcopy(&nretrans, buf + 24, 4);
+ memcpy(buf + 24, &nretrans, 4);
}
stream_idx++;
stream_idx = stream_idx % nstream;
@@ -4523,8 +4523,8 @@
nbytes += cnt;
if(udp) {
if (multicast)
- bcopy((char *)&save_sinhim.sin_addr.s_addr,
- (char *)&sinhim[1].sin_addr.s_addr,
+ memcpy((char *)&sinhim[1].sin_addr.s_addr,
+ (char *)&save_sinhim.sin_addr.s_addr,
sizeof(struct in_addr));
strcpy(buf, "EOD0");
(void)Nwrite( fd[stream_idx + 1], buf, 4 ); /* rcvr end */
@@ -4532,7 +4532,7 @@
} else {
first_read = 1;
need_swap = 0;
- bzero(buf + 24, 8);
+ memset(buf + 24, 0, 8);
if (udp) {
ntbytesc = 0;
got_eod0 = 0;
@@ -4584,7 +4584,7 @@
* goes off right here */
if (udplossinfo) {
if (first_read) {
- bcopy(buf + 24, &ntbytesc,
+ memcpy(&ntbytesc, buf + 24,
8);
first_read = 0;
if (ntbytesc > 0x100000000ull)
@@ -4598,7 +4598,7 @@
}
}
if (!need_swap)
- bcopy(buf + 24, &ntbytesc,
+ memcpy(&ntbytesc, buf + 24,
8);
else {
cp1 = (char *)&ntbytesc;
@@ -4627,8 +4627,8 @@
uint32_t tmp;
first_read = 0;
- bcopy(buf + 24, &nretrans, 4);
- bcopy(buf + 28, &tmp, 4);
+ memcpy(&nretrans, buf + 24, 4);
+ memcpy(&tmp, buf + 28, 4);
if (tmp == 0x5254524Eu) {
/* "RTRN" */
retransinfo = 1;
@@ -4661,7 +4661,7 @@
}
if (read_retrans) {
if (!need_swap)
- bcopy(buf + 24, &nretrans,
+ memcpy(&nretrans, buf + 24,
4);
else {
cp1 = (char *)&nretrans;
@@ -5327,10 +5327,10 @@
itimer.it_interval.tv_usec = 0;
setitimer(ITIMER_REAL, &itimer, 0);
signal(SIGALRM, SIG_DFL);
- bzero((char *)&frominet, sizeof(frominet));
- bzero((char *)&clientaddr, sizeof(clientaddr));
+ memset((char *)&frominet, 0, sizeof(frominet));
+ memset((char *)&clientaddr, 0, sizeof(clientaddr));
#ifdef AF_INET6
- bzero((char *)&clientaddr6, sizeof(clientaddr));
+ memset((char *)&clientaddr6, 0, sizeof(clientaddr));
clientscope6 = 0;
#endif
cput = 0.000001;