summaryrefslogtreecommitdiff
path: root/networking/traceroute.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-19 22:59:12 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-19 22:59:12 +0000
commit294254ce6bd03047fb2ccf0549387cd1e2c3f0c5 (patch)
tree2f1353c65e19834a43d3b78cff26801a971cf2b6 /networking/traceroute.c
parentda2a7d6b20e34472997429bea4dde1a3121b20cc (diff)
downloadbusybox-w32-294254ce6bd03047fb2ccf0549387cd1e2c3f0c5.tar.gz
busybox-w32-294254ce6bd03047fb2ccf0549387cd1e2c3f0c5.tar.bz2
busybox-w32-294254ce6bd03047fb2ccf0549387cd1e2c3f0c5.zip
rfelker writes in Bug 740: s/u_char/unsigned char/
Diffstat (limited to 'networking/traceroute.c')
-rw-r--r--networking/traceroute.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c
index a9292a284..e6011cc47 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -243,8 +243,8 @@
243 * Overlay for ip header used by other protocols (tcp, udp). 243 * Overlay for ip header used by other protocols (tcp, udp).
244 */ 244 */
245struct ipovly { 245struct ipovly {
246 u_char ih_x1[9]; /* (unused) */ 246 unsigned char ih_x1[9]; /* (unused) */
247 u_char ih_pr; /* protocol */ 247 unsigned char ih_pr; /* protocol */
248 short ih_len; /* protocol length */ 248 short ih_len; /* protocol length */
249 struct in_addr ih_src; /* source internet address */ 249 struct in_addr ih_src; /* source internet address */
250 struct in_addr ih_dst; /* destination internet address */ 250 struct in_addr ih_dst; /* destination internet address */
@@ -279,8 +279,8 @@ struct hostinfo {
279 279
280/* Data section of the probe packet */ 280/* Data section of the probe packet */
281struct outdata { 281struct outdata {
282 u_char seq; /* sequence number of this packet */ 282 unsigned char seq; /* sequence number of this packet */
283 u_char ttl; /* ttl packet left with */ 283 unsigned char ttl; /* ttl packet left with */
284 struct timeval tv ATTRIBUTE_PACKED; /* time packet left */ 284 struct timeval tv ATTRIBUTE_PACKED; /* time packet left */
285}; 285};
286 286
@@ -293,7 +293,7 @@ struct IFADDRLIST {
293static const char route[] = "/proc/net/route"; 293static const char route[] = "/proc/net/route";
294 294
295/* last inbound (icmp) packet */ 295/* last inbound (icmp) packet */
296static u_char packet[512] ATTRIBUTE_ALIGNED(32); 296static unsigned char packet[512] ATTRIBUTE_ALIGNED(32);
297 297
298static struct ip *outip; /* last output (udp) packet */ 298static struct ip *outip; /* last output (udp) packet */
299static struct udphdr *outudp; /* last output (udp) packet */ 299static struct udphdr *outudp; /* last output (udp) packet */
@@ -596,7 +596,7 @@ in_cksum(u_short *addr, int len)
596 596
597 /* mop up an odd byte, if necessary */ 597 /* mop up an odd byte, if necessary */
598 if (nleft == 1) 598 if (nleft == 1)
599 sum += *(u_char *)w; 599 sum += *(unsigned char *)w;
600 600
601 /* 601 /*
602 * add back carry outs from top 16 bits to low 16 bits 602 * add back carry outs from top 16 bits to low 16 bits
@@ -689,7 +689,7 @@ send_probe(int seq, int ttl, struct timeval *tp)
689 if (packlen & 1) { 689 if (packlen & 1) {
690 if ((i % 8) == 0) 690 if ((i % 8) == 0)
691 printf("\n\t"); 691 printf("\n\t");
692 printf(" %02x", *(u_char *)sp); 692 printf(" %02x", *(unsigned char *)sp);
693 } 693 }
694 printf("]\n"); 694 printf("]\n");
695 } 695 }
@@ -728,7 +728,7 @@ deltaT(struct timeval *t1p, struct timeval *t2p)
728 * Convert an ICMP "type" field to a printable string. 728 * Convert an ICMP "type" field to a printable string.
729 */ 729 */
730static inline const char * 730static inline const char *
731pr_type(u_char t) 731pr_type(unsigned char t)
732{ 732{
733 static const char * const ttab[] = { 733 static const char * const ttab[] = {
734 "Echo Reply", "ICMP 1", "ICMP 2", "Dest Unreachable", 734 "Echo Reply", "ICMP 1", "ICMP 2", "Dest Unreachable",
@@ -746,10 +746,10 @@ pr_type(u_char t)
746#endif 746#endif
747 747
748static int 748static int
749packet_ok(u_char *buf, int cc, struct sockaddr_in *from, int seq) 749packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq)
750{ 750{
751 struct icmp *icp; 751 struct icmp *icp;
752 u_char type, code; 752 unsigned char type, code;
753 int hlen; 753 int hlen;
754 struct ip *ip; 754 struct ip *ip;
755 755
@@ -790,7 +790,7 @@ packet_ok(u_char *buf, int cc, struct sockaddr_in *from, int seq)
790 icp->icmp_seq == htons(seq)) 790 icp->icmp_seq == htons(seq))
791 return -2; 791 return -2;
792 792
793 hicmp = (struct icmp *)((u_char *)hip + hlen); 793 hicmp = (struct icmp *)((unsigned char *)hip + hlen);
794 /* XXX 8 is a magic number */ 794 /* XXX 8 is a magic number */
795 if (hlen + 8 <= cc && 795 if (hlen + 8 <= cc &&
796 hip->ip_p == IPPROTO_ICMP && 796 hip->ip_p == IPPROTO_ICMP &&
@@ -800,7 +800,7 @@ packet_ok(u_char *buf, int cc, struct sockaddr_in *from, int seq)
800 } else 800 } else
801#endif 801#endif
802 { 802 {
803 up = (struct udphdr *)((u_char *)hip + hlen); 803 up = (struct udphdr *)((unsigned char *)hip + hlen);
804 /* XXX 8 is a magic number */ 804 /* XXX 8 is a magic number */
805 if (hlen + 12 <= cc && 805 if (hlen + 12 <= cc &&
806 hip->ip_p == IPPROTO_UDP && 806 hip->ip_p == IPPROTO_UDP &&
@@ -850,7 +850,7 @@ inetname(struct sockaddr_in *from)
850} 850}
851 851
852static inline void 852static inline void
853print(u_char *buf, int cc, struct sockaddr_in *from) 853print(unsigned char *buf, int cc, struct sockaddr_in *from)
854{ 854{
855 struct ip *ip; 855 struct ip *ip;
856 int hlen; 856 int hlen;
@@ -928,7 +928,7 @@ traceroute_main(int argc, char *argv[])
928{ 928{
929 int code, n; 929 int code, n;
930 char *cp; 930 char *cp;
931 u_char *outp; 931 unsigned char *outp;
932 u_int32_t *ap; 932 u_int32_t *ap;
933 struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom; 933 struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom;
934 struct sockaddr_in *to = (struct sockaddr_in *)&whereto; 934 struct sockaddr_in *to = (struct sockaddr_in *)&whereto;
@@ -1112,7 +1112,7 @@ traceroute_main(int argc, char *argv[])
1112#ifdef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE 1112#ifdef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE
1113#if defined(IP_OPTIONS) 1113#if defined(IP_OPTIONS)
1114 if (lsrr > 0) { 1114 if (lsrr > 0) {
1115 u_char optlist[MAX_IPOPTLEN]; 1115 unsigned char optlist[MAX_IPOPTLEN];
1116 1116
1117 cp = "ip"; 1117 cp = "ip";
1118 if ((pe = getprotobyname(cp)) == NULL) 1118 if ((pe = getprotobyname(cp)) == NULL)
@@ -1179,10 +1179,10 @@ traceroute_main(int argc, char *argv[])
1179 outip->ip_tos = tos; 1179 outip->ip_tos = tos;
1180 outip->ip_len = htons(packlen); 1180 outip->ip_len = htons(packlen);
1181 outip->ip_off = htons(off); 1181 outip->ip_off = htons(off);
1182 outp = (u_char *)(outip + 1); 1182 outp = (unsigned char *)(outip + 1);
1183 outip->ip_dst = to->sin_addr; 1183 outip->ip_dst = to->sin_addr;
1184 1184
1185 outip->ip_hl = (outp - (u_char *)outip) >> 2; 1185 outip->ip_hl = (outp - (unsigned char *)outip) >> 2;
1186 ident = (getpid() & 0xffff) | 0x8000; 1186 ident = (getpid() & 0xffff) | 0x8000;
1187#ifdef CONFIG_FEATURE_TRACEROUTE_USE_ICMP 1187#ifdef CONFIG_FEATURE_TRACEROUTE_USE_ICMP
1188 if (useicmp) { 1188 if (useicmp) {