diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-22 14:04:27 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-22 14:04:27 +0000 |
commit | 35d4da0fb5884236fa7a131a13416268239c9e69 (patch) | |
tree | 1598327194a13be915980de0cb8be6a84e5c362c | |
parent | 85629f08bcea5d4a44b6d511422fd608bbc3fc45 (diff) | |
download | busybox-w32-35d4da0fb5884236fa7a131a13416268239c9e69.tar.gz busybox-w32-35d4da0fb5884236fa7a131a13416268239c9e69.tar.bz2 busybox-w32-35d4da0fb5884236fa7a131a13416268239c9e69.zip |
exterminate u_intXXX.
fix ping6 buglet (memset is too short), minor sync between ping and ping6
-rw-r--r-- | libbb/lineedit.c | 4 | ||||
-rw-r--r-- | networking/inetd.c | 8 | ||||
-rw-r--r-- | networking/ping.c | 47 | ||||
-rw-r--r-- | networking/ping6.c | 45 | ||||
-rw-r--r-- | networking/traceroute.c | 28 | ||||
-rw-r--r-- | networking/udhcp/dhcprelay.c | 8 |
6 files changed, 73 insertions, 67 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index e62975db3..2c849eb74 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -171,7 +171,7 @@ static void input_backward(unsigned num) | |||
171 | if (cmdedit_x >= num) { | 171 | if (cmdedit_x >= num) { |
172 | cmdedit_x -= num; | 172 | cmdedit_x -= num; |
173 | if (num <= 4) { | 173 | if (num <= 4) { |
174 | do putchar('\b'); while (--num); | 174 | printf("\b\b\b\b" + (4-num)); |
175 | return; | 175 | return; |
176 | } | 176 | } |
177 | printf("\033[%uD", num); | 177 | printf("\033[%uD", num); |
@@ -183,7 +183,7 @@ static void input_backward(unsigned num) | |||
183 | count_y = 1 + (num / cmdedit_termw); | 183 | count_y = 1 + (num / cmdedit_termw); |
184 | cmdedit_y -= count_y; | 184 | cmdedit_y -= count_y; |
185 | cmdedit_x = cmdedit_termw * count_y - num; | 185 | cmdedit_x = cmdedit_termw * count_y - num; |
186 | /* go to 1st col; go up; go to correct column */ | 186 | /* go to 1st column; go up; go to correct column */ |
187 | printf("\r" "\033[%dA" "\033[%dC", count_y, cmdedit_x); | 187 | printf("\r" "\033[%dA" "\033[%dC", count_y, cmdedit_x); |
188 | } | 188 | } |
189 | 189 | ||
diff --git a/networking/inetd.c b/networking/inetd.c index 218f85e53..c1f9918f0 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1707,7 +1707,7 @@ chargen_dg(int s, servtab_t *sep ATTRIBUTE_UNUSED) | |||
1707 | * some seventy years Bell Labs was asleep. | 1707 | * some seventy years Bell Labs was asleep. |
1708 | */ | 1708 | */ |
1709 | 1709 | ||
1710 | static u_int machtime(void) | 1710 | static unsigned machtime(void) |
1711 | { | 1711 | { |
1712 | struct timeval tv; | 1712 | struct timeval tv; |
1713 | 1713 | ||
@@ -1715,14 +1715,14 @@ static u_int machtime(void) | |||
1715 | fprintf(stderr, "Unable to get time of day\n"); | 1715 | fprintf(stderr, "Unable to get time of day\n"); |
1716 | return 0L; | 1716 | return 0L; |
1717 | } | 1717 | } |
1718 | return htonl((u_int) tv.tv_sec + 2208988800UL); | 1718 | return htonl((unsigned) tv.tv_sec + 2208988800UL); |
1719 | } | 1719 | } |
1720 | 1720 | ||
1721 | /* ARGSUSED */ | 1721 | /* ARGSUSED */ |
1722 | static void | 1722 | static void |
1723 | machtime_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED) | 1723 | machtime_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED) |
1724 | { | 1724 | { |
1725 | u_int result; | 1725 | unsigned result; |
1726 | 1726 | ||
1727 | result = machtime(); | 1727 | result = machtime(); |
1728 | (void) write(s, (char *) &result, sizeof(result)); | 1728 | (void) write(s, (char *) &result, sizeof(result)); |
@@ -1732,7 +1732,7 @@ machtime_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED) | |||
1732 | static void | 1732 | static void |
1733 | machtime_dg(int s, servtab_t *sep ATTRIBUTE_UNUSED) | 1733 | machtime_dg(int s, servtab_t *sep ATTRIBUTE_UNUSED) |
1734 | { | 1734 | { |
1735 | u_int result; | 1735 | unsigned result; |
1736 | /* struct sockaddr_storage ss; */ | 1736 | /* struct sockaddr_storage ss; */ |
1737 | struct sockaddr sa; | 1737 | struct sockaddr sa; |
1738 | struct sockaddr_in *dg_sin; | 1738 | struct sockaddr_in *dg_sin; |
diff --git a/networking/ping.c b/networking/ping.c index 12730bec5..d8a70334d 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -1,13 +1,15 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.56 2004/03/15 08:28:48 andersen Exp $ | ||
4 | * Mini ping implementation for busybox | 3 | * Mini ping implementation for busybox |
5 | * | 4 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 5 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
7 | * | 6 | * |
8 | * Adapted from the ping in netkit-base 0.10: | 7 | * Adapted from the ping in netkit-base 0.10: |
9 | * Copyright (c) 1989 The Regents of the University of California. | 8 | * Copyright (c) 1989 The Regents of the University of California. |
10 | * Derived from software contributed to Berkeley by Mike Muuss. | 9 | * All rights reserved. |
10 | * | ||
11 | * This code is derived from software contributed to Berkeley by | ||
12 | * Mike Muuss. | ||
11 | * | 13 | * |
12 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 14 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
13 | */ | 15 | */ |
@@ -74,7 +76,7 @@ static void ping(const char *host) | |||
74 | 76 | ||
75 | pingsock = create_icmp_socket(); | 77 | pingsock = create_icmp_socket(); |
76 | 78 | ||
77 | memset(&pingaddr, 0, sizeof(struct sockaddr_in)); | 79 | memset(&pingaddr, 0, sizeof(pingaddr)); |
78 | 80 | ||
79 | pingaddr.sin_family = AF_INET; | 81 | pingaddr.sin_family = AF_INET; |
80 | h = xgethostbyname(host); | 82 | h = xgethostbyname(host); |
@@ -202,7 +204,7 @@ static void sendping(int junk) | |||
202 | pkt->icmp_cksum = 0; | 204 | pkt->icmp_cksum = 0; |
203 | pkt->icmp_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ | 205 | pkt->icmp_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ |
204 | pkt->icmp_id = myid; | 206 | pkt->icmp_id = myid; |
205 | CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK); | 207 | CLR((uint16_t)ntransmitted % MAX_DUP_CHK); |
206 | ntransmitted++; | 208 | ntransmitted++; |
207 | 209 | ||
208 | gettimeofday((struct timeval *) &pkt->icmp_dun, NULL); | 210 | gettimeofday((struct timeval *) &pkt->icmp_dun, NULL); |
@@ -230,20 +232,20 @@ static void sendping(int junk) | |||
230 | static char *icmp_type_name(int id) | 232 | static char *icmp_type_name(int id) |
231 | { | 233 | { |
232 | switch (id) { | 234 | switch (id) { |
233 | case ICMP_ECHOREPLY: return "Echo Reply"; | 235 | case ICMP_ECHOREPLY: return "Echo Reply"; |
234 | case ICMP_DEST_UNREACH: return "Destination Unreachable"; | 236 | case ICMP_DEST_UNREACH: return "Destination Unreachable"; |
235 | case ICMP_SOURCE_QUENCH: return "Source Quench"; | 237 | case ICMP_SOURCE_QUENCH: return "Source Quench"; |
236 | case ICMP_REDIRECT: return "Redirect (change route)"; | 238 | case ICMP_REDIRECT: return "Redirect (change route)"; |
237 | case ICMP_ECHO: return "Echo Request"; | 239 | case ICMP_ECHO: return "Echo Request"; |
238 | case ICMP_TIME_EXCEEDED: return "Time Exceeded"; | 240 | case ICMP_TIME_EXCEEDED: return "Time Exceeded"; |
239 | case ICMP_PARAMETERPROB: return "Parameter Problem"; | 241 | case ICMP_PARAMETERPROB: return "Parameter Problem"; |
240 | case ICMP_TIMESTAMP: return "Timestamp Request"; | 242 | case ICMP_TIMESTAMP: return "Timestamp Request"; |
241 | case ICMP_TIMESTAMPREPLY: return "Timestamp Reply"; | 243 | case ICMP_TIMESTAMPREPLY: return "Timestamp Reply"; |
242 | case ICMP_INFO_REQUEST: return "Information Request"; | 244 | case ICMP_INFO_REQUEST: return "Information Request"; |
243 | case ICMP_INFO_REPLY: return "Information Reply"; | 245 | case ICMP_INFO_REPLY: return "Information Reply"; |
244 | case ICMP_ADDRESS: return "Address Mask Request"; | 246 | case ICMP_ADDRESS: return "Address Mask Request"; |
245 | case ICMP_ADDRESSREPLY: return "Address Mask Reply"; | 247 | case ICMP_ADDRESSREPLY: return "Address Mask Reply"; |
246 | default: return "unknown ICMP type"; | 248 | default: return "unknown ICMP type"; |
247 | } | 249 | } |
248 | } | 250 | } |
249 | 251 | ||
@@ -270,7 +272,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
270 | return; /* not our ping */ | 272 | return; /* not our ping */ |
271 | 273 | ||
272 | if (icmppkt->icmp_type == ICMP_ECHOREPLY) { | 274 | if (icmppkt->icmp_type == ICMP_ECHOREPLY) { |
273 | u_int16_t recv_seq = ntohs(icmppkt->icmp_seq); | 275 | uint16_t recv_seq = ntohs(icmppkt->icmp_seq); |
274 | ++nreceived; | 276 | ++nreceived; |
275 | tp = (struct timeval *) icmppkt->icmp_data; | 277 | tp = (struct timeval *) icmppkt->icmp_data; |
276 | 278 | ||
@@ -307,11 +309,12 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
307 | if (dupflag) | 309 | if (dupflag) |
308 | printf(" (DUP!)"); | 310 | printf(" (DUP!)"); |
309 | puts(""); | 311 | puts(""); |
310 | } else | 312 | } else { |
311 | if (icmppkt->icmp_type != ICMP_ECHO) | 313 | if (icmppkt->icmp_type != ICMP_ECHO) |
312 | bb_error_msg("warning: got ICMP %d (%s)", | 314 | bb_error_msg("warning: got ICMP %d (%s)", |
313 | icmppkt->icmp_type, | 315 | icmppkt->icmp_type, |
314 | icmp_type_name(icmppkt->icmp_type)); | 316 | icmp_type_name(icmppkt->icmp_type)); |
317 | } | ||
315 | fflush(stdout); | 318 | fflush(stdout); |
316 | } | 319 | } |
317 | 320 | ||
@@ -326,7 +329,7 @@ static void ping(const char *host) | |||
326 | xbind(pingsock, (struct sockaddr*)&sourceaddr, sizeof(sourceaddr)); | 329 | xbind(pingsock, (struct sockaddr*)&sourceaddr, sizeof(sourceaddr)); |
327 | } | 330 | } |
328 | 331 | ||
329 | memset(&pingaddr, 0, sizeof(struct sockaddr_in)); | 332 | memset(&pingaddr, 0, sizeof(pingaddr)); |
330 | 333 | ||
331 | pingaddr.sin_family = AF_INET; | 334 | pingaddr.sin_family = AF_INET; |
332 | hostent = xgethostbyname(host); | 335 | hostent = xgethostbyname(host); |
@@ -339,7 +342,7 @@ static void ping(const char *host) | |||
339 | setsockopt_broadcast(pingsock); | 342 | setsockopt_broadcast(pingsock); |
340 | 343 | ||
341 | /* set recv buf for broadcast pings */ | 344 | /* set recv buf for broadcast pings */ |
342 | sockopt = 48 * 1024; | 345 | sockopt = 48 * 1024; /* explain why 48k? */ |
343 | setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, (char *) &sockopt, | 346 | setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, (char *) &sockopt, |
344 | sizeof(sockopt)); | 347 | sizeof(sockopt)); |
345 | 348 | ||
diff --git a/networking/ping6.c b/networking/ping6.c index 5cb02f51a..dec3b426a 100644 --- a/networking/ping6.c +++ b/networking/ping6.c | |||
@@ -1,6 +1,5 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping6.c,v 1.6 2004/03/15 08:28:48 andersen Exp $ | ||
4 | * Mini ping implementation for busybox | 3 | * Mini ping implementation for busybox |
5 | * | 4 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 5 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -67,7 +66,7 @@ static void ping(const char *host) | |||
67 | 66 | ||
68 | pingsock = create_icmp6_socket(); | 67 | pingsock = create_icmp6_socket(); |
69 | 68 | ||
70 | memset(&pingaddr, 0, sizeof(struct sockaddr_in)); | 69 | memset(&pingaddr, 0, sizeof(pingaddr)); |
71 | 70 | ||
72 | pingaddr.sin6_family = AF_INET6; | 71 | pingaddr.sin6_family = AF_INET6; |
73 | h = xgethostbyname2(host, AF_INET6); | 72 | h = xgethostbyname2(host, AF_INET6); |
@@ -196,7 +195,7 @@ static void sendping(int junk) | |||
196 | pkt->icmp6_cksum = 0; | 195 | pkt->icmp6_cksum = 0; |
197 | pkt->icmp6_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ | 196 | pkt->icmp6_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ |
198 | pkt->icmp6_id = myid; | 197 | pkt->icmp6_id = myid; |
199 | CLR(pkt->icmp6_seq % MAX_DUP_CHK); | 198 | CLR((uint16_t)ntransmitted % MAX_DUP_CHK); |
200 | ntransmitted++; | 199 | ntransmitted++; |
201 | 200 | ||
202 | gettimeofday((struct timeval *) &pkt->icmp6_data8[4], NULL); | 201 | gettimeofday((struct timeval *) &pkt->icmp6_data8[4], NULL); |
@@ -220,7 +219,7 @@ static void sendping(int junk) | |||
220 | } | 219 | } |
221 | } | 220 | } |
222 | 221 | ||
223 | /* RFC3542 changed some definitions from RFC2292 for no good reason, whee ! | 222 | /* RFC3542 changed some definitions from RFC2292 for no good reason, whee! |
224 | * the newer 3542 uses a MLD_ prefix where as 2292 uses ICMP6_ prefix */ | 223 | * the newer 3542 uses a MLD_ prefix where as 2292 uses ICMP6_ prefix */ |
225 | #ifndef MLD_LISTENER_QUERY | 224 | #ifndef MLD_LISTENER_QUERY |
226 | # define MLD_LISTENER_QUERY ICMP6_MEMBERSHIP_QUERY | 225 | # define MLD_LISTENER_QUERY ICMP6_MEMBERSHIP_QUERY |
@@ -234,16 +233,16 @@ static void sendping(int junk) | |||
234 | static char *icmp6_type_name(int id) | 233 | static char *icmp6_type_name(int id) |
235 | { | 234 | { |
236 | switch (id) { | 235 | switch (id) { |
237 | case ICMP6_DST_UNREACH: return "Destination Unreachable"; | 236 | case ICMP6_DST_UNREACH: return "Destination Unreachable"; |
238 | case ICMP6_PACKET_TOO_BIG: return "Packet too big"; | 237 | case ICMP6_PACKET_TOO_BIG: return "Packet too big"; |
239 | case ICMP6_TIME_EXCEEDED: return "Time Exceeded"; | 238 | case ICMP6_TIME_EXCEEDED: return "Time Exceeded"; |
240 | case ICMP6_PARAM_PROB: return "Parameter Problem"; | 239 | case ICMP6_PARAM_PROB: return "Parameter Problem"; |
241 | case ICMP6_ECHO_REPLY: return "Echo Reply"; | 240 | case ICMP6_ECHO_REPLY: return "Echo Reply"; |
242 | case ICMP6_ECHO_REQUEST: return "Echo Request"; | 241 | case ICMP6_ECHO_REQUEST: return "Echo Request"; |
243 | case MLD_LISTENER_QUERY: return "Listener Query"; | 242 | case MLD_LISTENER_QUERY: return "Listener Query"; |
244 | case MLD_LISTENER_REPORT: return "Listener Report"; | 243 | case MLD_LISTENER_REPORT: return "Listener Report"; |
245 | case MLD_LISTENER_REDUCTION: return "Listener Reduction"; | 244 | case MLD_LISTENER_REDUCTION: return "Listener Reduction"; |
246 | default: return "unknown ICMP type"; | 245 | default: return "unknown ICMP type"; |
247 | } | 246 | } |
248 | } | 247 | } |
249 | 248 | ||
@@ -266,6 +265,7 @@ static void unpack(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit | |||
266 | return; /* not our ping */ | 265 | return; /* not our ping */ |
267 | 266 | ||
268 | if (icmppkt->icmp6_type == ICMP6_ECHO_REPLY) { | 267 | if (icmppkt->icmp6_type == ICMP6_ECHO_REPLY) { |
268 | uint16_t recv_seq = ntohs(icmppkt->icmp6_seq); | ||
269 | ++nreceived; | 269 | ++nreceived; |
270 | tp = (struct timeval *) &icmppkt->icmp6_data8[4]; | 270 | tp = (struct timeval *) &icmppkt->icmp6_data8[4]; |
271 | 271 | ||
@@ -282,12 +282,12 @@ static void unpack(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit | |||
282 | if (triptime > tmax) | 282 | if (triptime > tmax) |
283 | tmax = triptime; | 283 | tmax = triptime; |
284 | 284 | ||
285 | if (TST(icmppkt->icmp6_seq % MAX_DUP_CHK)) { | 285 | if (TST(recv_seq % MAX_DUP_CHK)) { |
286 | ++nrepeats; | 286 | ++nrepeats; |
287 | --nreceived; | 287 | --nreceived; |
288 | dupflag = 1; | 288 | dupflag = 1; |
289 | } else { | 289 | } else { |
290 | SET(icmppkt->icmp6_seq % MAX_DUP_CHK); | 290 | SET(recv_seq % MAX_DUP_CHK); |
291 | dupflag = 0; | 291 | dupflag = 0; |
292 | } | 292 | } |
293 | 293 | ||
@@ -297,16 +297,19 @@ static void unpack(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit | |||
297 | printf("%d bytes from %s: icmp6_seq=%u", sz, | 297 | printf("%d bytes from %s: icmp6_seq=%u", sz, |
298 | inet_ntop(AF_INET6, &pingaddr.sin6_addr, | 298 | inet_ntop(AF_INET6, &pingaddr.sin6_addr, |
299 | buf, sizeof(buf)), | 299 | buf, sizeof(buf)), |
300 | ntohs(icmppkt->icmp6_seq)); | 300 | recv_seq); |
301 | printf(" ttl=%d time=%lu.%lu ms", hoplimit, | 301 | printf(" ttl=%d time=%lu.%lu ms", hoplimit, |
302 | triptime / 10, triptime % 10); | 302 | triptime / 10, triptime % 10); |
303 | if (dupflag) | 303 | if (dupflag) |
304 | printf(" (DUP!)"); | 304 | printf(" (DUP!)"); |
305 | puts(""); | 305 | puts(""); |
306 | } else | 306 | } else { |
307 | if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST) | 307 | if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST) |
308 | bb_error_msg("warning: got ICMP %d (%s)", | 308 | bb_error_msg("warning: got ICMP %d (%s)", |
309 | icmppkt->icmp6_type, icmp6_type_name(icmppkt->icmp6_type)); | 309 | icmppkt->icmp6_type, |
310 | icmp6_type_name(icmppkt->icmp6_type)); | ||
311 | } | ||
312 | fflush(stdout); | ||
310 | } | 313 | } |
311 | 314 | ||
312 | static void ping(const char *host) | 315 | static void ping(const char *host) |
@@ -321,7 +324,7 @@ static void ping(const char *host) | |||
321 | 324 | ||
322 | pingsock = create_icmp6_socket(); | 325 | pingsock = create_icmp6_socket(); |
323 | 326 | ||
324 | memset(&pingaddr, 0, sizeof(struct sockaddr_in)); | 327 | memset(&pingaddr, 0, sizeof(pingaddr)); |
325 | 328 | ||
326 | pingaddr.sin6_family = AF_INET6; | 329 | pingaddr.sin6_family = AF_INET6; |
327 | hostent = xgethostbyname2(host, AF_INET6); | 330 | hostent = xgethostbyname2(host, AF_INET6); |
@@ -431,7 +434,7 @@ int ping6_main(int argc, char **argv) | |||
431 | "%s: invalid interface name", opt_I); | 434 | "%s: invalid interface name", opt_I); |
432 | } | 435 | } |
433 | 436 | ||
434 | myid = (int16_t)getpid(); | 437 | myid = (int16_t) getpid(); |
435 | ping(argv[optind]); | 438 | ping(argv[optind]); |
436 | return EXIT_SUCCESS; | 439 | return EXIT_SUCCESS; |
437 | } | 440 | } |
diff --git a/networking/traceroute.c b/networking/traceroute.c index 0f3da90d6..5eac6cd1e 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c | |||
@@ -268,7 +268,7 @@ struct udpiphdr { | |||
268 | struct hostinfo { | 268 | struct hostinfo { |
269 | char *name; | 269 | char *name; |
270 | int n; | 270 | int n; |
271 | u_int32_t *addrs; | 271 | uint32_t *addrs; |
272 | }; | 272 | }; |
273 | 273 | ||
274 | /* Data section of the probe packet */ | 274 | /* Data section of the probe packet */ |
@@ -279,7 +279,7 @@ struct outdata { | |||
279 | }; | 279 | }; |
280 | 280 | ||
281 | struct IFADDRLIST { | 281 | struct IFADDRLIST { |
282 | u_int32_t addr; | 282 | uint32_t addr; |
283 | char device[sizeof(struct ifreq)]; | 283 | char device[sizeof(struct ifreq)]; |
284 | }; | 284 | }; |
285 | 285 | ||
@@ -299,9 +299,9 @@ static struct icmp *outicmp; /* last output (icmp) packet */ | |||
299 | 299 | ||
300 | #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE | 300 | #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE |
301 | /* Maximum number of gateways (include room for one noop) */ | 301 | /* Maximum number of gateways (include room for one noop) */ |
302 | #define NGATEWAYS ((int)((MAX_IPOPTLEN - IPOPT_MINOFF - 1) / sizeof(u_int32_t))) | 302 | #define NGATEWAYS ((int)((MAX_IPOPTLEN - IPOPT_MINOFF - 1) / sizeof(uint32_t))) |
303 | /* loose source route gateway list (including room for final destination) */ | 303 | /* loose source route gateway list (including room for final destination) */ |
304 | static u_int32_t gwlist[NGATEWAYS + 1]; | 304 | static uint32_t gwlist[NGATEWAYS + 1]; |
305 | #endif | 305 | #endif |
306 | 306 | ||
307 | static int s; /* receive (icmp) socket file descriptor */ | 307 | static int s; /* receive (icmp) socket file descriptor */ |
@@ -429,7 +429,7 @@ ifaddrlist(struct IFADDRLIST **ipaddrp) | |||
429 | 429 | ||
430 | 430 | ||
431 | static void | 431 | static void |
432 | setsin(struct sockaddr_in *addr_sin, u_int32_t addr) | 432 | setsin(struct sockaddr_in *addr_sin, uint32_t addr) |
433 | { | 433 | { |
434 | memset(addr_sin, 0, sizeof(*addr_sin)); | 434 | memset(addr_sin, 0, sizeof(*addr_sin)); |
435 | #ifdef HAVE_SOCKADDR_SA_LEN | 435 | #ifdef HAVE_SOCKADDR_SA_LEN |
@@ -448,8 +448,8 @@ findsaddr(const struct sockaddr_in *to, struct sockaddr_in *from) | |||
448 | { | 448 | { |
449 | int i, n; | 449 | int i, n; |
450 | FILE *f; | 450 | FILE *f; |
451 | u_int32_t mask; | 451 | uint32_t mask; |
452 | u_int32_t dest, tmask; | 452 | uint32_t dest, tmask; |
453 | struct IFADDRLIST *al; | 453 | struct IFADDRLIST *al; |
454 | char buf[256], tdevice[256], device[256]; | 454 | char buf[256], tdevice[256], device[256]; |
455 | 455 | ||
@@ -641,7 +641,7 @@ send_probe(int seq, int ttl, struct timeval *tp) | |||
641 | int nshorts, i; | 641 | int nshorts, i; |
642 | 642 | ||
643 | sp = (uint16_t *)outip; | 643 | sp = (uint16_t *)outip; |
644 | nshorts = (u_int)packlen / sizeof(uint16_t); | 644 | nshorts = (unsigned)packlen / sizeof(uint16_t); |
645 | i = 0; | 645 | i = 0; |
646 | printf("[ %d bytes", packlen); | 646 | printf("[ %d bytes", packlen); |
647 | while (--nshorts >= 0) { | 647 | while (--nshorts >= 0) { |
@@ -776,7 +776,7 @@ packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq) | |||
776 | #if ENABLE_FEATURE_TRACEROUTE_VERBOSE | 776 | #if ENABLE_FEATURE_TRACEROUTE_VERBOSE |
777 | if (verbose) { | 777 | if (verbose) { |
778 | int i; | 778 | int i; |
779 | u_int32_t *lp = (u_int32_t *)&icp->icmp_ip; | 779 | uint32_t *lp = (uint32_t *)&icp->icmp_ip; |
780 | 780 | ||
781 | printf("\n%d bytes from %s to " | 781 | printf("\n%d bytes from %s to " |
782 | "%s: icmp type %d (%s) code %d\n", | 782 | "%s: icmp type %d (%s) code %d\n", |
@@ -838,7 +838,7 @@ gethostinfo(const char *host) | |||
838 | struct hostent *hp; | 838 | struct hostent *hp; |
839 | struct hostinfo *hi; | 839 | struct hostinfo *hi; |
840 | char **p; | 840 | char **p; |
841 | u_int32_t addr, *ap; | 841 | uint32_t addr, *ap; |
842 | 842 | ||
843 | hi = xzalloc(sizeof(*hi)); | 843 | hi = xzalloc(sizeof(*hi)); |
844 | addr = inet_addr(host); | 844 | addr = inet_addr(host); |
@@ -874,7 +874,7 @@ freehostinfo(struct hostinfo *hi) | |||
874 | 874 | ||
875 | #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE | 875 | #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE |
876 | static void | 876 | static void |
877 | getaddr(u_int32_t *ap, const char *host) | 877 | getaddr(uint32_t *ap, const char *host) |
878 | { | 878 | { |
879 | struct hostinfo *hi; | 879 | struct hostinfo *hi; |
880 | 880 | ||
@@ -892,7 +892,7 @@ traceroute_main(int argc, char *argv[]) | |||
892 | 892 | ||
893 | int code, n; | 893 | int code, n; |
894 | unsigned char *outp; | 894 | unsigned char *outp; |
895 | u_int32_t *ap; | 895 | uint32_t *ap; |
896 | struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom; | 896 | struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom; |
897 | struct sockaddr_in *to = (struct sockaddr_in *)&whereto; | 897 | struct sockaddr_in *to = (struct sockaddr_in *)&whereto; |
898 | struct hostinfo *hi; | 898 | struct hostinfo *hi; |
@@ -915,7 +915,7 @@ traceroute_main(int argc, char *argv[]) | |||
915 | int nprobes = 3; | 915 | int nprobes = 3; |
916 | char *nprobes_str = NULL; | 916 | char *nprobes_str = NULL; |
917 | char *waittime_str = NULL; | 917 | char *waittime_str = NULL; |
918 | u_int pausemsecs = 0; | 918 | unsigned pausemsecs = 0; |
919 | char *pausemsecs_str = NULL; | 919 | char *pausemsecs_str = NULL; |
920 | int first_ttl = 1; | 920 | int first_ttl = 1; |
921 | char *first_ttl_str = NULL; | 921 | char *first_ttl_str = NULL; |
@@ -1211,7 +1211,7 @@ traceroute_main(int argc, char *argv[]) | |||
1211 | (void)fflush(stderr); | 1211 | (void)fflush(stderr); |
1212 | 1212 | ||
1213 | for (ttl = first_ttl; ttl <= max_ttl; ++ttl) { | 1213 | for (ttl = first_ttl; ttl <= max_ttl; ++ttl) { |
1214 | u_int32_t lastaddr = 0; | 1214 | uint32_t lastaddr = 0; |
1215 | int gotlastaddr = 0; | 1215 | int gotlastaddr = 0; |
1216 | int got_there = 0; | 1216 | int got_there = 0; |
1217 | int unreachable = 0; | 1217 | int unreachable = 0; |
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c index 78a1b5e62..418aa7cbb 100644 --- a/networking/udhcp/dhcprelay.c +++ b/networking/udhcp/dhcprelay.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | /* This list holds information about clients. The xid_* functions manipulate this list. */ | 23 | /* This list holds information about clients. The xid_* functions manipulate this list. */ |
24 | static struct xid_item { | 24 | static struct xid_item { |
25 | u_int32_t xid; | 25 | uint32_t xid; |
26 | struct sockaddr_in ip; | 26 | struct sockaddr_in ip; |
27 | int client; | 27 | int client; |
28 | time_t timestamp; | 28 | time_t timestamp; |
@@ -30,7 +30,7 @@ static struct xid_item { | |||
30 | } dhcprelay_xid_list = {0, {0}, 0, 0, NULL}; | 30 | } dhcprelay_xid_list = {0, {0}, 0, 0, NULL}; |
31 | 31 | ||
32 | 32 | ||
33 | static struct xid_item * xid_add(u_int32_t xid, struct sockaddr_in *ip, int client) | 33 | static struct xid_item * xid_add(uint32_t xid, struct sockaddr_in *ip, int client) |
34 | { | 34 | { |
35 | struct xid_item *item; | 35 | struct xid_item *item; |
36 | 36 | ||
@@ -67,7 +67,7 @@ static void xid_expire(void) | |||
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | static struct xid_item * xid_find(u_int32_t xid) | 70 | static struct xid_item * xid_find(uint32_t xid) |
71 | { | 71 | { |
72 | struct xid_item *item = dhcprelay_xid_list.next; | 72 | struct xid_item *item = dhcprelay_xid_list.next; |
73 | while (item != NULL) { | 73 | while (item != NULL) { |
@@ -79,7 +79,7 @@ static struct xid_item * xid_find(u_int32_t xid) | |||
79 | return NULL; | 79 | return NULL; |
80 | } | 80 | } |
81 | 81 | ||
82 | static void xid_del(u_int32_t xid) | 82 | static void xid_del(uint32_t xid) |
83 | { | 83 | { |
84 | struct xid_item *item = dhcprelay_xid_list.next; | 84 | struct xid_item *item = dhcprelay_xid_list.next; |
85 | struct xid_item *last = &dhcprelay_xid_list; | 85 | struct xid_item *last = &dhcprelay_xid_list; |